summaryrefslogtreecommitdiffstats
path: root/qtjava/javalib/test/ScribbleWindow.java
diff options
context:
space:
mode:
Diffstat (limited to 'qtjava/javalib/test/ScribbleWindow.java')
-rw-r--r--qtjava/javalib/test/ScribbleWindow.java96
1 files changed, 48 insertions, 48 deletions
diff --git a/qtjava/javalib/test/ScribbleWindow.java b/qtjava/javalib/test/ScribbleWindow.java
index 731b136f..c8e98166 100644
--- a/qtjava/javalib/test/ScribbleWindow.java
+++ b/qtjava/javalib/test/ScribbleWindow.java
@@ -5,7 +5,7 @@
import org.kde.qt.*;
-public class ScribbleWindow extends QWidget {
+public class ScribbleWindow extends TQWidget {
public static final int COLOR_MENU_ID_BLACK = 0;
public static final int COLOR_MENU_ID_RED = 1;
@@ -13,19 +13,19 @@ public class ScribbleWindow extends QWidget {
public static final int COLOR_MENU_ID_GREEN = 3;
public static final int COLOR_MENU_ID_YELLOW = 4;
- private QMenuBar _menubar;
- private QPopupMenu _filemenu;
- private QPopupMenu _colormenu;
- private QPopupMenu _helpmenu;
- private QScrollView _scrollview;
+ private TQMenuBar _menubar;
+ private TQPopupMenu _filemenu;
+ private TQPopupMenu _colormenu;
+ private TQPopupMenu _helpmenu;
+ private TQScrollView _scrollview;
private ScribbleArea _scribblearea;
- public class ScribbleArea extends QWidget {
- private QPoint _last;
- private QColor _currentcolor;
+ public class ScribbleArea extends TQWidget {
+ private TQPoint _last;
+ private TQColor _currentcolor;
- private QPixmap _buffer;
- private QPopupMenu _popupmenu;
+ private TQPixmap _buffer;
+ private TQPopupMenu _popupmenu;
/**
* The constructor. Initializes the member variables.
@@ -33,24 +33,24 @@ public class ScribbleWindow extends QWidget {
ScribbleArea()
{
// initialize member variables
- _buffer = new QPixmap();
- _last = new QPoint();
+ _buffer = new TQPixmap();
+ _last = new TQPoint();
_currentcolor = black();
// don't blank the window before repainting
setBackgroundMode( NoBackground );
// create a pop-up menu
- _popupmenu = new QPopupMenu();
+ _popupmenu = new TQPopupMenu();
_popupmenu.insertItem( "&Clear", this, SLOT( "slotClearArea()" ) );
}
/**
* This slot sets the curren color for the scribble area. It will be
- * connected with the colorChanged( QColor ) signal from the
+ * connected with the colorChanged( TQColor ) signal from the
* ScribbleWindow.
*/
- public void setColor( QColor new_color )
+ public void setColor( TQColor new_color )
{
_currentcolor = new_color;
}
@@ -70,13 +70,13 @@ public class ScribbleWindow extends QWidget {
/**
- * This method does the actual loading. It relies on QPixmap (and the
+ * This method does the actual loading. It relies on TQPixmap (and the
* underlying I/O machinery) to determine the filetype.
*/
public void slotLoad( String filename )
{
if ( !_buffer.load( filename ) )
- QMessageBox.warning( null, "Load error", "Could not load file" );
+ TQMessageBox.warning( null, "Load error", "Could not load file" );
repaint(); // refresh the window
}
@@ -89,7 +89,7 @@ public class ScribbleWindow extends QWidget {
public void slotSave( String filename )
{
if( !_buffer.save( filename, "BMP" ) )
- QMessageBox.warning( null, "Save error", "Could not save file" );
+ TQMessageBox.warning( null, "Save error", "Could not save file" );
}
@@ -98,10 +98,10 @@ public class ScribbleWindow extends QWidget {
* mouse over the window. It just records the position of the mouse
* at the time of the click.
*/
- protected void mousePressEvent(QMouseEvent event)
+ protected void mousePressEvent(TQMouseEvent event)
{
if ( event.button() == RightButton )
- _popupmenu.exec( QCursor.pos() );
+ _popupmenu.exec( TQCursor.pos() );
else
{
_last = event.pos(); // retrieve the coordinates from the event
@@ -117,11 +117,11 @@ public class ScribbleWindow extends QWidget {
* we haven't, and thus don't have to check whether any buttons are
* pressed.
*/
- protected void mouseMoveEvent(QMouseEvent event) {
- // create a QPainter object for drawing onto the window
- QPainter windowpainter = new QPainter();
- // and another QPainter object for drawing int an off-screen pixmap
- QPainter bufferpainter = new QPainter();
+ protected void mouseMoveEvent(TQMouseEvent event) {
+ // create a TQPainter object for drawing onto the window
+ TQPainter windowpainter = new TQPainter();
+ // and another TQPainter object for drawing int an off-screen pixmap
+ TQPainter bufferpainter = new TQPainter();
// start painting
windowpainter.begin( this ); // this painter paints onto the window
@@ -146,7 +146,7 @@ public class ScribbleWindow extends QWidget {
* This method is called whenever the widget needs
* painting, for example when it has been obscured and then revealed again.
*/
- protected void paintEvent(QPaintEvent event) {
+ protected void paintEvent(TQPaintEvent event) {
bitBlt(this, 0, 0, _buffer);
}
@@ -154,8 +154,8 @@ public class ScribbleWindow extends QWidget {
* This method get called whenever the widget needs
* painting, for example, when it has been obscured and then revealed again.
*/
- protected void resizeEvent(QResizeEvent event) {
- QPixmap save = new QPixmap( _buffer );
+ protected void resizeEvent(TQResizeEvent event) {
+ TQPixmap save = new TQPixmap( _buffer );
_buffer.resize( event.size() );
_buffer.fill( white() );
bitBlt( _buffer, 0, 0, save );
@@ -166,47 +166,47 @@ public class ScribbleWindow extends QWidget {
{
/* The next lines build the menu bar. We first create the menus
* one by one, then add them to the menu bar. */
- _filemenu = new QPopupMenu(); // create a file menu
+ _filemenu = new TQPopupMenu(); // create a file menu
_filemenu.insertItem( "&Load", this, SLOT( "slotLoad()" ) );
_filemenu.insertItem( "&Save", this, SLOT( "slotSave()" ) );
_filemenu.insertSeparator();
_filemenu.insertItem( "&Quit", qApp(), SLOT( "quit()" ) );
- _colormenu = new QPopupMenu(); // create a color menu
+ _colormenu = new TQPopupMenu(); // create a color menu
_colormenu.insertItem( "B&lack", COLOR_MENU_ID_BLACK);
_colormenu.insertItem( "&Red", COLOR_MENU_ID_RED);
_colormenu.insertItem( "&Blue", COLOR_MENU_ID_BLUE);
_colormenu.insertItem( "&Green", COLOR_MENU_ID_GREEN);
_colormenu.insertItem( "&Yellow", COLOR_MENU_ID_YELLOW);
- QObject.connect( _colormenu, SIGNAL( "activated( int )" ),
+ TQObject.connect( _colormenu, SIGNAL( "activated( int )" ),
this, SLOT( "slotColorMenu( int )" ) );
- _helpmenu = new QPopupMenu(); // create a help menu
+ _helpmenu = new TQPopupMenu(); // create a help menu
_helpmenu.insertItem( "&About QtScribble", this, SLOT( "slotAbout()" ) );
_helpmenu.insertItem( "&About Qt", this, SLOT( "slotAboutQt()" ) );
- _menubar = new QMenuBar( this, "" ); // create a menu bar
+ _menubar = new TQMenuBar( this, "" ); // create a menu bar
_menubar.insertItem( "&File", _filemenu );
_menubar.insertItem( "&Color", _colormenu );
_menubar.insertItem( "&Help", _helpmenu );
- /* We create a QScrollView and a ScribbleArea. The ScribbleArea will
+ /* We create a TQScrollView and a ScribbleArea. The ScribbleArea will
* be managed by the scroll view.*/
- _scrollview = new QScrollView( this );
+ _scrollview = new TQScrollView( this );
_scrollview.setGeometry( 0, _menubar.height(),
width(), height() - _menubar.height() );
_scribblearea = new ScribbleArea();
_scribblearea.setGeometry( 0, 0, 1000, 1000 );
_scrollview.addChild( _scribblearea );
- QObject.connect( this, SIGNAL( "colorChanged( QColor )" ),
- _scribblearea, SLOT( "setColor( QColor )" ) );
- QObject.connect( this, SIGNAL( "save( String )" ),
+ TQObject.connect( this, SIGNAL( "colorChanged( TQColor )" ),
+ _scribblearea, SLOT( "setColor( TQColor )" ) );
+ TQObject.connect( this, SIGNAL( "save( String )" ),
_scribblearea, SLOT( "slotSave( String )" ) );
- QObject.connect( this, SIGNAL( "load(String)" ),
+ TQObject.connect( this, SIGNAL( "load(String)" ),
_scribblearea, SLOT( "slotLoad( String )" ) );
}
- protected void resizeEvent( QResizeEvent event )
+ protected void resizeEvent( TQResizeEvent event )
{
/* When the whole window is resized, we have to rearrange the geometry
* in the ScribbleWindow as well. Note that the ScribbleArea does not need
@@ -219,7 +219,7 @@ public class ScribbleWindow extends QWidget {
private void slotAbout()
{
- QMessageBox.information( this, "About QtScribble 5",
+ TQMessageBox.information( this, "About QtScribble 5",
"This is the Scribble 5 application\n" +
"Copyright 1998 by Mathias Kalle Dalheimer\n"
);
@@ -227,7 +227,7 @@ public class ScribbleWindow extends QWidget {
private void slotAboutQt()
{
- QMessageBox.aboutQt( this, "About Qt" );
+ TQMessageBox.aboutQt( this, "About Qt" );
}
private void slotColorMenu( int item )
@@ -255,7 +255,7 @@ public class ScribbleWindow extends QWidget {
/**
* This is the slot for the menu item File/Load. It opens a
- * QFileDialog to ask the user for a filename, then emits a save()
+ * TQFileDialog to ask the user for a filename, then emits a save()
* signal with the filename as parameter.
*/
private void slotLoad()
@@ -263,14 +263,14 @@ public class ScribbleWindow extends QWidget {
/* Open a file dialog for loading. The default directory is the
* current directory, the filter *.bmp.
*/
- String filename = QFileDialog.getOpenFileName( ".", "*.bmp", this );
+ String filename = TQFileDialog.getOpenFileName( ".", "*.bmp", this );
if ( !filename.equals("") )
emit("load", filename);
}
/**
* This is the slot for the menu item File/Load. It opens a
- * QFileDialog to ask the user for a filename, then emits a save()
+ * TQFileDialog to ask the user for a filename, then emits a save()
* signal with the filename as parameter.
*/
private void slotSave()
@@ -278,7 +278,7 @@ public class ScribbleWindow extends QWidget {
/* Open a file dialog for saving. The default directory is the
* current directory, the filter *.bmp.
*/
- String filename = QFileDialog.getSaveFileName( ".", "*.bmp", this );
+ String filename = TQFileDialog.getSaveFileName( ".", "*.bmp", this );
if ( !filename.equals("") )
emit("save", filename);
}
@@ -286,7 +286,7 @@ public class ScribbleWindow extends QWidget {
public static void main(String[] args)
{
- QApplication myapp = new QApplication(args);
+ TQApplication myapp = new TQApplication(args);
ScribbleWindow mywidget = new ScribbleWindow();
mywidget.setGeometry(50, 500, 400, 400);