summaryrefslogtreecommitdiffstats
path: root/kdejava/koala/examples/kscribble/KScribbleView.java
diff options
context:
space:
mode:
Diffstat (limited to 'kdejava/koala/examples/kscribble/KScribbleView.java')
-rw-r--r--kdejava/koala/examples/kscribble/KScribbleView.java110
1 files changed, 55 insertions, 55 deletions
diff --git a/kdejava/koala/examples/kscribble/KScribbleView.java b/kdejava/koala/examples/kscribble/KScribbleView.java
index 464227ec..05bc0d47 100644
--- a/kdejava/koala/examples/kscribble/KScribbleView.java
+++ b/kdejava/koala/examples/kscribble/KScribbleView.java
@@ -2,16 +2,16 @@ import org.kde.qt.*;
import org.kde.koala.*;
/** The KScribbleView class provides the view widget for the KScribble instance.
- * The View instance inherits QWidget as a base class and represents the view object of a KMainWindow. As KScribbleView is part of the
+ * The View instance inherits TQWidget as a base class and represents the view object of a KMainWindow. As KScribbleView is part of the
* docuement-view model, it needs a reference to the document object connected with it by the KScribble class to manipulate and display
* the document structure provided by the KScribbleDoc class.
*
* @author Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team.
* @version KDevelop version 0.4 code generation
*/
-public class KScribbleView extends QScrollView {
+public class KScribbleView extends TQScrollView {
- private QClipboard cb;
+ private TQClipboard cb;
private KScribbleDoc doc;
private static final int IDLE = 0;
private static final int DRAW = 1;
@@ -19,25 +19,25 @@ public class KScribbleView extends QScrollView {
private static final int PASTE = 3;
private static final int DRAG = 4;
- private QPixmap tmp = new QPixmap();
+ private TQPixmap tmp = new TQPixmap();
private int action = IDLE;
- private QRect select = new QRect();
+ private TQRect select = new TQRect();
private KIconLoader k = new KIconLoader();
- private QImageDrag qid;
+ private TQImageDrag qid;
- public KScribbleView(KScribbleDoc pDoc, QWidget parent, String name, int wflags) {
+ public KScribbleView(KScribbleDoc pDoc, TQWidget parent, String name, int wflags) {
super(parent, name,wflags | WPaintClever | WNorthWestGravity | WRepaintNoErase);
setBackgroundMode(PaletteBase);
- cb = QApplication.clipboard();
+ cb = TQApplication.clipboard();
viewport().setAcceptDrops(true);
setDragAutoScroll(true);
doc=pDoc;
action=IDLE;
viewport().setCursor( Qt.crossCursor() );
- QSize size=doc.docSize();
+ TQSize size=doc.docSize();
resizeContents(size.width(), size.height());
resize(size);
@@ -52,7 +52,7 @@ public class KScribbleView extends QScrollView {
return doc;
}
- protected void keyPressEvent( QKeyEvent e ) {
+ protected void keyPressEvent( TQKeyEvent e ) {
switch (e.key()) {
case Key_Right:
scrollBy( 10, 0 );
@@ -85,7 +85,7 @@ public class KScribbleView extends QScrollView {
/** cuts out a selection */
void cutSelection() {
select=select.normalize();
- QPixmap cb_pix = new QPixmap();
+ TQPixmap cb_pix = new TQPixmap();
cb_pix.resize(select.size());
// copy selection to cb_pix and copy to clipboard
bitBlt(cb_pix,0, 0, doc.buffer, select.x()+contentsX(), select.y()+contentsY(), cb_pix.width(),cb_pix.height());
@@ -109,7 +109,7 @@ public class KScribbleView extends QScrollView {
/** copies a selection to the clipboard */
void copySelection(){
select=select.normalize();
- QPixmap cb_pix = new QPixmap();
+ TQPixmap cb_pix = new TQPixmap();
cb_pix.resize(select.size());
// copy selection to cb_pix and copy to clipboard
bitBlt(cb_pix, 0, 0,doc.buffer, select.x()+contentsX(), select.y()+contentsY(), cb_pix.width(),cb_pix.height());
@@ -118,9 +118,9 @@ public class KScribbleView extends QScrollView {
viewport().repaint(0,0,visibleWidth(), visibleHeight(), false);
}
- public void print(QPrinter pPrinter) {
+ public void print(TQPrinter pPrinter) {
if (pPrinter.setup(this)) {
- QPainter p = new QPainter();
+ TQPainter p = new TQPainter();
p.begin(pPrinter);
///////////////////////////////
@@ -131,7 +131,7 @@ public class KScribbleView extends QScrollView {
}
}
- protected void viewportMousePressEvent( QMouseEvent e ) {
+ protected void viewportMousePressEvent( TQMouseEvent e ) {
if ( e.button() == LeftButton && action == IDLE) {
action=DRAW;
doc.polyline.setPoint(0,viewportToContents(e.pos()));
@@ -141,7 +141,7 @@ public class KScribbleView extends QScrollView {
}
else if ( e.button() == RightButton && action == IDLE) {
action = SELECT;
- QPoint pt=e.pos();
+ TQPoint pt=e.pos();
int x = pt.x() > contentsWidth() ? contentsWidth() : pt.x();
int y = pt.y() > contentsHeight() ? contentsHeight() : pt.y();
select.setLeft(x-1);
@@ -157,8 +157,8 @@ public class KScribbleView extends QScrollView {
if(select.contains(e.pos(), true)) { // point inside the selection
tmp.resize(select.size());
bitBlt(tmp, 0, 0, doc.buffer, select.x()+contentsX(), select.y()+contentsY(), tmp.width(),tmp.height());
- QImage img =tmp.convertToImage();
- QDragObject d = new QImageDrag( img, viewport(), "" );
+ TQImage img =tmp.convertToImage();
+ TQDragObject d = new TQImageDrag( img, viewport(), "" );
d.setPixmap(KDE.BarIcon("filenew"));
d.drag();
}
@@ -171,8 +171,8 @@ public class KScribbleView extends QScrollView {
action = IDLE;
viewport().setCursor( Qt.crossCursor() );
}
- QPoint mv_pt = new QPoint(viewport().height(), viewport().width());
- if(new QRect(0,0,mv_pt.x(),mv_pt.y()).contains(e.pos()))
+ TQPoint mv_pt = new TQPoint(viewport().height(), viewport().width());
+ if(new TQRect(0,0,mv_pt.x(),mv_pt.y()).contains(e.pos()))
select.moveCenter(e.pos());
else {
select.moveBottomRight(mv_pt);
@@ -181,30 +181,30 @@ public class KScribbleView extends QScrollView {
}
}
- protected void viewportMouseReleaseEvent( QMouseEvent e ) {
+ protected void viewportMouseReleaseEvent( TQMouseEvent e ) {
if ( action == DRAW ) {
action = IDLE;
doc.updateAllViews(this);
}
if ( action == SELECT) {
- QPoint pt=e.pos();
+ TQPoint pt=e.pos();
int x = pt.x() > 0 ? pt.x() : 0;
int y = pt.y() > 0 ? pt.y() : 0;
select.setRight(x);
select.setBottom(y);
- QSize size=doc.docSize();
- select = select.intersect(new QRect(0,0,size.width(), size.height()));
+ TQSize size=doc.docSize();
+ select = select.intersect(new TQRect(0,0,size.width(), size.height()));
}
}
/** On paste actions inserts the pasted clipboard contents
*/
- protected void viewportMouseDoubleClickEvent(QMouseEvent e) {
+ protected void viewportMouseDoubleClickEvent(TQMouseEvent e) {
if( action == PASTE ) {
action = IDLE;
select.moveCenter(e.pos());
viewport().setCursor( Qt.crossCursor() );
- QPixmap cb_pix = new QPixmap();
+ TQPixmap cb_pix = new TQPixmap();
cb_pix.resize(cb.pixmap().size());
cb_pix=cb.pixmap();
bitBlt( doc.buffer,contentsX()+select.x(), contentsY()+select.y(),cb_pix, 0, 0, select.width(), select.height());
@@ -215,9 +215,9 @@ public class KScribbleView extends QScrollView {
}
- protected void viewportMouseMoveEvent( QMouseEvent e ) {
+ protected void viewportMouseMoveEvent( TQMouseEvent e ) {
if ( action == DRAW ) {
- QPainter painter = new QPainter();
+ TQPainter painter = new TQPainter();
painter.begin( doc.buffer );
painter.setPen( doc.currentPen() );
doc.polyline.setPoint(2, doc.polyline.at(1));
@@ -226,7 +226,7 @@ public class KScribbleView extends QScrollView {
painter.drawPolyline( doc.polyline );
painter.end();
- QRect r = doc.polyline.boundingRect();
+ TQRect r = doc.polyline.boundingRect();
r = r.normalize();
r.setLeft( r.left() - doc.penWidth() );
r.setTop( r.top() - doc.penWidth() );
@@ -238,38 +238,38 @@ public class KScribbleView extends QScrollView {
doc.updateAllViews(this);
}
if ( action == SELECT ) {
- QPoint pt=e.pos();
+ TQPoint pt=e.pos();
select.setWidth(select.x()+pt.x());
select.setHeight(select.y()+pt.y());
select.setRight(pt.x());
select.setBottom(pt.y());
- QSize size=doc.docSize();
- select = select.intersect(new QRect(0,0,size.width(), size.height()));
+ TQSize size=doc.docSize();
+ select = select.intersect(new TQRect(0,0,size.width(), size.height()));
viewport().repaint(0,0,visibleWidth(), visibleHeight(), false);
}
if( action == PASTE ) {
- QPoint mv_pt = new QPoint(viewport().height(), viewport().width());
- if(new QRect(0,0,mv_pt.x(),mv_pt.y()).contains(e.pos()))
+ TQPoint mv_pt = new TQPoint(viewport().height(), viewport().width());
+ if(new TQRect(0,0,mv_pt.x(),mv_pt.y()).contains(e.pos()))
select.moveCenter(e.pos());
else {
select.moveBottomRight(mv_pt);
}
- QRect pm_rect=cb.pixmap().rect();
+ TQRect pm_rect=cb.pixmap().rect();
select.setWidth(pm_rect.width());
select.setHeight(pm_rect.height());
- QSize size=doc.docSize();
- select = select.intersect(new QRect(0,0,size.width(), size.height()));
+ TQSize size=doc.docSize();
+ select = select.intersect(new TQRect(0,0,size.width(), size.height()));
viewport().repaint(0,0,visibleWidth(), visibleHeight(), false);
doc.setModified();
doc.updateAllViews(this);
}
}
- //void KScribbleView::viewportResizeEvent( QResizeEvent *e )
+ //void KScribbleView::viewportResizeEvent( TQResizeEvent *e )
//{
//}
- protected void viewportPaintEvent( QPaintEvent e ) {
+ protected void viewportPaintEvent( TQPaintEvent e ) {
bitBlt( viewport(),0, 0, doc.buffer, contentsX(), contentsY(), doc.buffer.width(),doc.buffer.width());
if( action == PASTE )
@@ -279,35 +279,35 @@ public class KScribbleView extends QScrollView {
}
if( action == PASTE || action == DRAG )
{
- QSize size=doc.docSize();
- select = select.intersect(new QRect(0,0,size.width(), size.height()));
+ TQSize size=doc.docSize();
+ select = select.intersect(new TQRect(0,0,size.width(), size.height()));
if(select.intersects(e.rect()))
bitBlt(viewport(), select.x(), select.y(), tmp, 0, 0, select.width(), select.height());
}
if( action == PASTE || action == DRAG || action == SELECT ) {
if(select.intersects(e.rect())) {
- QPainter paint_area = new QPainter();
+ TQPainter paint_area = new TQPainter();
paint_area.begin(viewport());
- paint_area.setPen(new QPen(Qt.black(), 0, DashLine));
+ paint_area.setPen(new TQPen(Qt.black(), 0, DashLine));
paint_area.drawRect( select );
paint_area.end();
}
}
- // not implemented for QScrollView yet
+ // not implemented for TQScrollView yet
// super.viewportPaintEvent(e);
}
- protected void viewportDragEnterEvent ( QDragEnterEvent e) {
- e.accept(QImageDrag.canDecode(e));
+ protected void viewportDragEnterEvent ( TQDragEnterEvent e) {
+ e.accept(TQImageDrag.canDecode(e));
action = DRAG;
}
- protected void viewportDragMoveEvent ( QDragMoveEvent e) {
- QImage img = new QImage();
+ protected void viewportDragMoveEvent ( TQDragMoveEvent e) {
+ TQImage img = new TQImage();
- if ( QImageDrag.canDecode(e) ){
- QImageDrag.decode(e, img);
+ if ( TQImageDrag.canDecode(e) ){
+ TQImageDrag.decode(e, img);
tmp.resize(img.size());
tmp.convertFromImage(img);
select.setWidth(tmp.width());
@@ -317,15 +317,15 @@ public class KScribbleView extends QScrollView {
}
}
- protected void viewportDragLeaveEvent ( QDragLeaveEvent e ) {
+ protected void viewportDragLeaveEvent ( TQDragLeaveEvent e ) {
action = IDLE;
viewport().repaint(0,0,visibleWidth(), visibleHeight(), false);
}
- protected void viewportDropEvent ( QDropEvent e) {
- QImage img = new QImage();
- if ( QImageDrag.canDecode(e) ) {
- QImageDrag.decode(e, img);
+ protected void viewportDropEvent ( TQDropEvent e) {
+ TQImage img = new TQImage();
+ if ( TQImageDrag.canDecode(e) ) {
+ TQImageDrag.decode(e, img);
tmp.resize(img.size());
tmp.convertFromImage(img);
select.setWidth(tmp.width());