diff options
Diffstat (limited to 'qtjava/javalib/examples/dragdrop')
-rw-r--r-- | qtjava/javalib/examples/dragdrop/DropSite.java | 60 | ||||
-rw-r--r-- | qtjava/javalib/examples/dragdrop/Main.java | 28 | ||||
-rw-r--r-- | qtjava/javalib/examples/dragdrop/SecretDrag.java | 10 | ||||
-rw-r--r-- | qtjava/javalib/examples/dragdrop/SecretSource.java | 10 | ||||
-rw-r--r-- | qtjava/javalib/examples/dragdrop/trolltech.bmp | bin | 30054 -> 30055 bytes | |||
-rw-r--r-- | qtjava/javalib/examples/dragdrop/trolltech.gif | bin | 42629 -> 42635 bytes |
6 files changed, 54 insertions, 54 deletions
diff --git a/qtjava/javalib/examples/dragdrop/DropSite.java b/qtjava/javalib/examples/dragdrop/DropSite.java index 3584f1e4..34f41f12 100644 --- a/qtjava/javalib/examples/dragdrop/DropSite.java +++ b/qtjava/javalib/examples/dragdrop/DropSite.java @@ -15,7 +15,7 @@ import org.kde.qt.*; import java.util.*; -class DropSite extends QLabel +class DropSite extends TQLabel { SecretSource s; @@ -24,12 +24,12 @@ void setSecretSource(SecretSource source) s = source; } -DropSite( QWidget parent ) +DropSite( TQWidget parent ) { this(parent, null); } -DropSite( QWidget parent, String name ) +DropSite( TQWidget parent, String name ) { super( parent, name ); setAcceptDrops(true); @@ -41,20 +41,20 @@ DropSite( QWidget parent, String name ) } -protected void dragMoveEvent( QDragMoveEvent e ) +protected void dragMoveEvent( TQDragMoveEvent e ) { // Check if you want the drag at e.pos()... // Give the user some feedback... } -protected void dragEnterEvent( QDragEnterEvent e ) +protected void dragEnterEvent( TQDragEnterEvent e ) { // Check if you want the drag... if ( SecretDrag.canDecode( e ) - || QTextDrag.canDecode( e ) - || QImageDrag.canDecode( e ) - || QUriDrag.canDecode( e ) ) { + || TQTextDrag.canDecode( e ) + || TQImageDrag.canDecode( e ) + || TQUriDrag.canDecode( e ) ) { e.accept(); } @@ -68,7 +68,7 @@ protected void dragEnterEvent( QDragEnterEvent e ) setBackgroundColor(white()); } -protected void dragLeaveEvent( QDragLeaveEvent e ) +protected void dragLeaveEvent( TQDragLeaveEvent e ) { // Give the user some feedback... emit("message", ""); @@ -76,34 +76,34 @@ protected void dragLeaveEvent( QDragLeaveEvent e ) } -protected void dropEvent( QDropEvent e ) +protected void dropEvent( TQDropEvent e ) { setBackgroundColor(lightGray()); // Try to decode to the data you understand... StringBuffer str = new StringBuffer(""); - if ( QTextDrag.decode( e, str ) ) { + if ( TQTextDrag.decode( e, str ) ) { setText( str.toString() ); setMinimumSize( minimumSize().expandedTo( sizeHint() ) ); return; } - QPixmap pm = new QPixmap(); - if ( QImageDrag.decode( e, pm ) ) { + TQPixmap pm = new TQPixmap(); + if ( TQImageDrag.decode( e, pm ) ) { setPixmap( pm ); setMinimumSize( minimumSize().expandedTo( sizeHint() ) ); return; } ArrayList strings = new ArrayList(); - if ( QUriDrag.decode( e, strings ) ) { + if ( TQUriDrag.decode( e, strings ) ) { String m = "Full URLs:\n"; Iterator it = strings.iterator(); while (it.hasNext()) m += " " + (String) it.next() + "\n"; ArrayList files = new ArrayList(); - if ( QUriDrag.decodeLocalFiles( e, files ) ) { + if ( TQUriDrag.decodeLocalFiles( e, files ) ) { m = m + "Files:\n"; Iterator i = strings.iterator(); while (i.hasNext()) @@ -121,36 +121,36 @@ protected void dropEvent( QDropEvent e ) } } -protected void mousePressEvent( QMouseEvent e ) +protected void mousePressEvent( TQMouseEvent e ) { - QDragObject drobj; + TQDragObject drobj; if ( pixmap() != null ) { - drobj = new QImageDrag( pixmap().convertToImage(), this ); - QPixmap pm = new QPixmap(); + drobj = new TQImageDrag( pixmap().convertToImage(), this ); + TQPixmap pm = new TQPixmap(); pm.convertFromImage(pixmap().convertToImage().smoothScale( pixmap().width()/3,pixmap().height()/3)); - drobj.setPixmap(pm,new QPoint(-5,-7)); + drobj.setPixmap(pm,new TQPoint(-5,-7)); // Try it. // new DragMoviePlayer(drobj); } else { - drobj = new QTextDrag( text(), this ); + drobj = new TQTextDrag( text(), this ); } drobj.dragCopy(); } -class DragMoviePlayer extends QObject { - QDragObject dobj; - QMovie movie; +class DragMoviePlayer extends TQObject { + TQDragObject dobj; + TQMovie movie; -DragMoviePlayer( QDragObject p ) +DragMoviePlayer( TQDragObject p ) { -// QObject(p), +// TQObject(p), dobj = p; - movie = new QMovie("trolltech.gif" ); - movie.connectUpdate(this,SLOT("updatePixmap(QRect)")); + movie = new TQMovie("trolltech.gif" ); + movie.connectUpdate(this,SLOT("updatePixmap(TQRect)")); } -void updatePixmap( QRect rect ) +void updatePixmap( TQRect rect ) { dobj.setPixmap(movie.framePixmap()); } @@ -158,7 +158,7 @@ void updatePixmap( QRect rect ) } -void backgroundColorChange( QColor color ) +void backgroundColorChange( TQColor color ) { // Reduce flicker by using repaint() rather than update() repaint(); diff --git a/qtjava/javalib/examples/dragdrop/Main.java b/qtjava/javalib/examples/dragdrop/Main.java index 3297aaec..7ce5ff19 100644 --- a/qtjava/javalib/examples/dragdrop/Main.java +++ b/qtjava/javalib/examples/dragdrop/Main.java @@ -15,40 +15,40 @@ import org.kde.qt.*; public class Main { -static DropSite addStuff( QWidget parent, boolean image ) +static DropSite addStuff( TQWidget parent, boolean image ) { return addStuff(parent, image, false); } -static DropSite addStuff( QWidget parent, boolean image, boolean secret ) +static DropSite addStuff( TQWidget parent, boolean image, boolean secret ) { - QVBoxLayout tll = new QVBoxLayout( parent, 10 ); + TQVBoxLayout tll = new TQVBoxLayout( parent, 10 ); DropSite d = new DropSite( parent ); - d.setFrameStyle( QFrame.Sunken + QFrame.WinPanel ); + d.setFrameStyle( TQFrame.Sunken + TQFrame.WinPanel ); tll.addWidget( d ); if ( image ) { - QPixmap stuff = new QPixmap(); + TQPixmap stuff = new TQPixmap(); if ( !stuff.load( "trolltech.bmp" ) ) { - stuff = new QPixmap(20,20); + stuff = new TQPixmap(20,20); stuff.fill(Qt.green()); } d.setPixmap( stuff ); } else { d.setText("Drag and Drop"); } - d.setFont(new QFont("Helvetica",18)); + d.setFont(new TQFont("Helvetica",18)); if ( secret ) { SecretSource s = new SecretSource( (byte) 42, parent ); tll.addWidget( s ); d.setSecretSource( s); } - QLabel format = new QLabel( "\n\n\n\nNone\n\n\n\n", parent ); + TQLabel format = new TQLabel( "\n\n\n\nNone\n\n\n\n", parent ); tll.addWidget( format ); tll.activate(); parent.resize( parent.sizeHint() ); - QObject.connect( d, Qt.SIGNAL("message(String)"), + TQObject.connect( d, Qt.SIGNAL("message(String)"), format, Qt.SLOT("setText(String)") ); return d; } @@ -58,24 +58,24 @@ static DropSite addStuff( QWidget parent, boolean image, boolean secret ) public static void main( String[] args ) { - QApplication a = new QApplication( args ); + TQApplication a = new TQApplication( args ); - QWidget mw = new QWidget(); + TQWidget mw = new TQWidget(); DropSite d1 = addStuff( mw, true ); mw.setCaption( "Qt Example - Drag and Drop" ); mw.show(); - QWidget mw2 = new QWidget(); + TQWidget mw2 = new TQWidget(); DropSite d2 = addStuff( mw2, false ); mw2.setCaption( "Qt Example - Drag and Drop" ); mw2.show(); - QWidget mw3 = new QWidget(); + TQWidget mw3 = new TQWidget(); DropSite d3 = addStuff( mw3, true, true ); mw3.setCaption( "Qt Example - Drag and Drop" ); mw3.show(); - QObject.connect(Qt.qApp(),Qt.SIGNAL("lastWindowClosed()"),Qt.qApp(),Qt.SLOT("quit()")); + TQObject.connect(Qt.qApp(),Qt.SIGNAL("lastWindowClosed()"),Qt.qApp(),Qt.SLOT("quit()")); a.exec(); return; } diff --git a/qtjava/javalib/examples/dragdrop/SecretDrag.java b/qtjava/javalib/examples/dragdrop/SecretDrag.java index fd12aed3..5220fd9f 100644 --- a/qtjava/javalib/examples/dragdrop/SecretDrag.java +++ b/qtjava/javalib/examples/dragdrop/SecretDrag.java @@ -14,10 +14,10 @@ import org.kde.qt.*; -class SecretDrag extends QStoredDrag { +class SecretDrag extends TQStoredDrag { //create the object withe the secret byte -public SecretDrag( byte secret, QWidget parent, String name ) +public SecretDrag( byte secret, TQWidget parent, String name ) { super( "secret/magic", parent, name ); byte[] data = { 0 }; @@ -25,19 +25,19 @@ public SecretDrag( byte secret, QWidget parent, String name ) setEncodedData( data ); } -public SecretDrag( byte secret, QWidget parent ) +public SecretDrag( byte secret, TQWidget parent ) { this(secret, parent, null); } -public static boolean canDecode( QDragMoveEvent e ) +public static boolean canDecode( TQDragMoveEvent e ) { return e.provides( "secret/magic" ); } //decode it into a string -public static boolean decode( QDropEvent e, StringBuffer str ) +public static boolean decode( TQDropEvent e, StringBuffer str ) { byte[] payload = e.data( "secret/magic" ); if ( payload.length > 0 ) { diff --git a/qtjava/javalib/examples/dragdrop/SecretSource.java b/qtjava/javalib/examples/dragdrop/SecretSource.java index 00824dee..9d26f73e 100644 --- a/qtjava/javalib/examples/dragdrop/SecretSource.java +++ b/qtjava/javalib/examples/dragdrop/SecretSource.java @@ -13,16 +13,16 @@ ****************************************************************************/ import org.kde.qt.*; -class SecretSource extends QLabel +class SecretSource extends TQLabel { private int mySecret; -SecretSource( byte secret, QWidget parent ) +SecretSource( byte secret, TQWidget parent ) { this(secret, parent, null); } -SecretSource( byte secret, QWidget parent, String name ) +SecretSource( byte secret, TQWidget parent, String name ) { super( "Secret", parent, name ); setBackgroundColor( blue().light() ); @@ -58,10 +58,10 @@ static String picture_xpm[] = { " ..... ", " "}; -protected void mousePressEvent( QMouseEvent e ) +protected void mousePressEvent( TQMouseEvent e ) { SecretDrag sd = new SecretDrag( (byte) mySecret, this ); - sd.setPixmap(new QPixmap(picture_xpm),new QPoint(8,8)); + sd.setPixmap(new TQPixmap(picture_xpm),new TQPoint(8,8)); sd.dragCopy(); mySecret++; } diff --git a/qtjava/javalib/examples/dragdrop/trolltech.bmp b/qtjava/javalib/examples/dragdrop/trolltech.bmp Binary files differindex 220861e2..9f399c70 100644 --- a/qtjava/javalib/examples/dragdrop/trolltech.bmp +++ b/qtjava/javalib/examples/dragdrop/trolltech.bmp diff --git a/qtjava/javalib/examples/dragdrop/trolltech.gif b/qtjava/javalib/examples/dragdrop/trolltech.gif Binary files differindex f674369e..02c13b14 100644 --- a/qtjava/javalib/examples/dragdrop/trolltech.gif +++ b/qtjava/javalib/examples/dragdrop/trolltech.gif |