summaryrefslogtreecommitdiffstats
path: root/qtjava/javalib/examples/scribble/Scribble.java
diff options
context:
space:
mode:
Diffstat (limited to 'qtjava/javalib/examples/scribble/Scribble.java')
-rw-r--r--qtjava/javalib/examples/scribble/Scribble.java72
1 files changed, 36 insertions, 36 deletions
diff --git a/qtjava/javalib/examples/scribble/Scribble.java b/qtjava/javalib/examples/scribble/Scribble.java
index 2adf609c..e9ecda9e 100644
--- a/qtjava/javalib/examples/scribble/Scribble.java
+++ b/qtjava/javalib/examples/scribble/Scribble.java
@@ -11,55 +11,55 @@
import org.kde.qt.*;
import java.util.*;
-class Scribble extends QMainWindow
+class Scribble extends TQMainWindow
{
protected Canvas canvas;
-protected QSpinBox bPWidth;
-protected QToolButton bPColor, bSave, bClear;
+protected TQSpinBox bPWidth;
+protected TQToolButton bPColor, bSave, bClear;
-class Canvas extends QWidget
+class Canvas extends TQWidget
{
- void setPenColor( QColor c )
+ void setPenColor( TQColor c )
{ pen.setColor( c ); }
void setPenWidth( int w )
{ pen.setWidth( w ); }
- QColor penColor()
+ TQColor penColor()
{ return pen.color(); }
int penWidth()
{ return pen.width(); }
-protected QPen pen;
-protected QPointArray polyline;
+protected TQPen pen;
+protected TQPointArray polyline;
protected boolean mousePressed;
-protected QPixmap buffer = new QPixmap();
+protected TQPixmap buffer = new TQPixmap();
public boolean no_writing = false;
-Canvas( QWidget parent )
+Canvas( TQWidget parent )
{
this(parent, null);
}
-Canvas( QWidget parent, String name )
+Canvas( TQWidget parent, String name )
{
super( parent, name, WStaticContents );
- pen = new QPen( Qt.red(), 3 );
- polyline = new QPointArray(3);
+ pen = new TQPen( Qt.red(), 3 );
+ polyline = new TQPointArray(3);
if ((qApp().args().length > 0) && !buffer.load(qApp().args()[0]))
buffer.fill( colorGroup().base() );
- setBackgroundMode( QWidget.PaletteBase );
+ setBackgroundMode( TQWidget.PaletteBase );
setCursor( Qt.crossCursor() );
}
@@ -75,7 +75,7 @@ void clearScreen()
repaint( false );
}
-protected void mousePressEvent( QMouseEvent e )
+protected void mousePressEvent( TQMouseEvent e )
{
mousePressed = true;
polyline.setPoint(0, e.pos());
@@ -83,15 +83,15 @@ protected void mousePressEvent( QMouseEvent e )
polyline.setPoint(2, e.pos());
}
-protected void mouseReleaseEvent( QMouseEvent e )
+protected void mouseReleaseEvent( TQMouseEvent e )
{
mousePressed = false;
}
-protected void mouseMoveEvent( QMouseEvent e )
+protected void mouseMoveEvent( TQMouseEvent e )
{
if ( mousePressed ) {
- QPainter painter = new QPainter();
+ TQPainter painter = new TQPainter();
painter.begin( buffer );
painter.setPen( pen );
polyline.setPoint(2, polyline.at(1));
@@ -100,7 +100,7 @@ protected void mouseMoveEvent( QMouseEvent e )
painter.drawPolyline( polyline );
painter.end();
- QRect r = polyline.boundingRect();
+ TQRect r = polyline.boundingRect();
r = r.normalize();
r.setLeft( r.left() - penWidth() );
r.setTop( r.top() - penWidth() );
@@ -111,7 +111,7 @@ protected void mouseMoveEvent( QMouseEvent e )
}
}
-protected void resizeEvent( QResizeEvent e )
+protected void resizeEvent( TQResizeEvent e )
{
super.resizeEvent( e );
@@ -120,18 +120,18 @@ protected void resizeEvent( QResizeEvent e )
int h = height() > buffer.height() ?
height() : buffer.height();
- QPixmap tmp = new QPixmap( buffer );
+ TQPixmap tmp = new TQPixmap( buffer );
buffer.resize( w, h );
buffer.fill( colorGroup().base() );
bitBlt( buffer, 0, 0, tmp, 0, 0, tmp.width(), tmp.height() );
}
-protected void paintEvent( QPaintEvent e )
+protected void paintEvent( TQPaintEvent e )
{
super.paintEvent( e );
ArrayList rects = e.region().rects();
for ( int i = 0; i < rects.size(); i++ ) {
- QRect r = (QRect) rects.get(i);
+ TQRect r = (TQRect) rects.get(i);
bitBlt( this, r.x(), r.y(), buffer, r.x(), r.y(), r.width(), r.height() );
}
}
@@ -145,52 +145,52 @@ Scribble( )
this(null, null);
}
-Scribble( QWidget parent, String name )
+Scribble( TQWidget parent, String name )
{
super( parent, name );
canvas = new Canvas( this );
setCentralWidget( canvas );
- QToolBar tools = new QToolBar( this );
+ TQToolBar tools = new TQToolBar( this );
- bSave = new QToolButton( new QIconSet(), "Save", "Save as PNG image", this, SLOT(" slotSave()"), tools );
+ bSave = new TQToolButton( new TQIconSet(), "Save", "Save as PNG image", this, SLOT(" slotSave()"), tools );
bSave.setText( "Save as..." );
tools.addSeparator();
- bPColor = new QToolButton( new QIconSet(), "Choose Pen Color", "Choose Pen Color", this, SLOT(" slotColor()"), tools );
+ bPColor = new TQToolButton( new TQIconSet(), "Choose Pen Color", "Choose Pen Color", this, SLOT(" slotColor()"), tools );
bPColor.setText( "Choose Pen Color..." );
tools.addSeparator();
- bPWidth = new QSpinBox( 1, 20, 1, tools );
- QToolTip.add( bPWidth, "Choose Pen Width" );
+ bPWidth = new TQSpinBox( 1, 20, 1, tools );
+ TQToolTip.add( bPWidth, "Choose Pen Width" );
connect( bPWidth, SIGNAL(" valueChanged( int )"), this, SLOT(" slotWidth( int )") );
bPWidth.setValue( 3 );
tools.addSeparator();
- bClear = new QToolButton( new QIconSet(), "Clear Screen", "Clear Screen", this, SLOT(" slotClear()"), tools );
+ bClear = new TQToolButton( new TQIconSet(), "Clear Screen", "Clear Screen", this, SLOT(" slotClear()"), tools );
bClear.setText( "Clear Screen" );
}
void slotSave()
{
- QPopupMenu menu = new QPopupMenu( null );
+ TQPopupMenu menu = new TQPopupMenu( null );
HashMap formats = new HashMap();
- for ( int i = 0; i < QImageIO.outputFormats().size(); i++ ) {
- String str = (String) QImageIO.outputFormats().get( i );
+ for ( int i = 0; i < TQImageIO.outputFormats().size(); i++ ) {
+ String str = (String) TQImageIO.outputFormats().get( i );
formats.put( new Integer(menu.insertItem( str + "..." )), str );
}
menu.setMouseTracking( true );
- int id = menu.exec( bSave.mapToGlobal( new QPoint( 0, bSave.height() + 1 ) ) );
+ int id = menu.exec( bSave.mapToGlobal( new TQPoint( 0, bSave.height() + 1 ) ) );
if ( id != -1 ) {
String format = (String) formats.get( new Integer(id) );
- String filename = QFileDialog.getSaveFileName( "", "*." + format.toLowerCase(), this );
+ String filename = TQFileDialog.getSaveFileName( "", "*." + format.toLowerCase(), this );
if ( !filename.equals("") )
canvas.save( filename, format );
}
@@ -199,7 +199,7 @@ void slotSave()
void slotColor()
{
- QColor c = QColorDialog.getColor( canvas.penColor(), this );
+ TQColor c = TQColorDialog.getColor( canvas.penColor(), this );
if ( c.isValid() )
canvas.setPenColor( c );
}