diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:44:01 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:44:01 +0000 |
commit | 479f5f799523bffbcc83dff581a2299c047c6fff (patch) | |
tree | 186aae707ed02aac6c7cab2fb14e97f72aca5e36 /qtsharp/src/examples/samples/scribblewindow.cs | |
parent | f1dbff6145c98324ff82e34448b7483727e8ace4 (diff) | |
download | tdebindings-479f5f799523bffbcc83dff581a2299c047c6fff.tar.gz tdebindings-479f5f799523bffbcc83dff581a2299c047c6fff.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1157645 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'qtsharp/src/examples/samples/scribblewindow.cs')
-rw-r--r-- | qtsharp/src/examples/samples/scribblewindow.cs | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/qtsharp/src/examples/samples/scribblewindow.cs b/qtsharp/src/examples/samples/scribblewindow.cs index 6b594eb8..fdd9fe46 100644 --- a/qtsharp/src/examples/samples/scribblewindow.cs +++ b/qtsharp/src/examples/samples/scribblewindow.cs @@ -9,22 +9,22 @@ namespace QtSamples { using Qt; using System; - [DeclareQtSignal ("colorChanged(QColor)")] - [DeclareQtSignal ("load(QString)")] - [DeclareQtSignal ("save(QString)")] - public class ScribbleWindow : QMainWindow { - - private QMenuBar menubar; - private QPopupMenu filemenu; - private QPopupMenu aboutmenu; - private QScrollView scrollview; + [DeclareQtSignal ("colorChanged(TQColor)")] + [DeclareQtSignal ("load(TQString)")] + [DeclareQtSignal ("save(TQString)")] + public class ScribbleWindow : TQMainWindow { + + private TQMenuBar menubar; + private TQPopupMenu filemenu; + private TQPopupMenu aboutmenu; + private TQScrollView scrollview; public ScribbleArea scribblearea; enum Color {Black, Red, Blue, Green, Yellow}; public static int Main (String[] args) { - QApplication app = new QApplication (args); + TQApplication app = new TQApplication (args); ScribbleWindow demo = new ScribbleWindow (); demo.SetGeometry (50, 500, 400, 400); app.SetMainWidget (demo); @@ -35,22 +35,22 @@ namespace QtSamples { ScribbleWindow () : base (null, null) { - filemenu = new QPopupMenu (null, "filemenu"); - filemenu.InsertItem ("&Load", this, SLOT ("SlotLoad()") ); - filemenu.InsertItem ("&Save", this, SLOT ("SlotSave()") ); + filemenu = new TQPopupMenu (null, "filemenu"); + filemenu.InsertItem ("&Load", this, TQT_SLOT ("SlotLoad()") ); + filemenu.InsertItem ("&Save", this, TQT_SLOT ("SlotSave()") ); filemenu.InsertSeparator (); - filemenu.InsertItem ("&Quit", qApp, SLOT ("quit()")); + filemenu.InsertItem ("&Quit", qApp, TQT_SLOT ("quit()")); - aboutmenu = new QPopupMenu (null, "helpmenu"); - aboutmenu.InsertItem ("&About Qt-Sharp", this, SLOT ("SlotAboutQtSharp()")); - aboutmenu.InsertItem ("&About Qt", this, SLOT ("SlotAboutQt()")); + aboutmenu = new TQPopupMenu (null, "helpmenu"); + aboutmenu.InsertItem ("&About Qt-Sharp", this, TQT_SLOT ("SlotAboutQtSharp()")); + aboutmenu.InsertItem ("&About Qt", this, TQT_SLOT ("SlotAboutQt()")); - menubar = new QMenuBar (this, ""); + menubar = new TQMenuBar (this, ""); menubar.InsertItem ("&File", filemenu); - menubar.InsertItem ("&Color", this, SLOT("SlotColorChooser()")); + menubar.InsertItem ("&Color", this, TQT_SLOT("SlotColorChooser()")); menubar.InsertItem ("&About", aboutmenu); - scrollview = new QScrollView (this); + scrollview = new TQScrollView (this); scrollview.SetGeometry (0, menubar.Height (), Width (), Height () - menubar.Height ()); scribblearea = new ScribbleArea (this); scribblearea.SetGeometry (0, 0, 1000, 1000); @@ -58,39 +58,39 @@ namespace QtSamples { this.SetCentralWidget (scrollview); SetMaximumSize (Width (), Height () - menubar.Height ()); - QObject.Connect (this, SIGNAL ("colorChanged(QColor)"), - scribblearea, SLOT ("SlotSetColor(QColor)") ); - QObject.Connect (this, SIGNAL ("load(QString)"), - scribblearea, SLOT ("PerformLoad(QString)") ); - QObject.Connect (this, SIGNAL ("save(QString)"), - scribblearea, SLOT ("PerformSave(QString)") ); + TQObject.Connect (this, TQT_SIGNAL ("colorChanged(TQColor)"), + scribblearea, TQT_SLOT ("SlotSetColor(TQColor)") ); + TQObject.Connect (this, TQT_SIGNAL ("load(TQString)"), + scribblearea, TQT_SLOT ("PerformLoad(TQString)") ); + TQObject.Connect (this, TQT_SIGNAL ("save(TQString)"), + scribblearea, TQT_SLOT ("PerformSave(TQString)") ); } public void SlotLoad () { - string filename = QFileDialog.GetOpenFileName (".", "*.bmp", this, - null, "Load File", QString.Null, true); + string filename = TQFileDialog.GetOpenFileName (".", "*.bmp", this, + null, "Load File", TQString.Null, true); if ( filename != null ) - Emit ("load(QString)", (QString) filename); + Emit ("load(TQString)", (TQString) filename); } public void SlotSave () { - string filename = QFileDialog.GetSaveFileName (".", "*.bmp", this, - null, "Save File", QString.Null, true); + string filename = TQFileDialog.GetSaveFileName (".", "*.bmp", this, + null, "Save File", TQString.Null, true); if ( filename != null ) { if ( ! filename.ToLower().EndsWith(".bmp") ) filename += ".bmp"; - Emit ("save(QString)", (QString) filename); + Emit ("save(TQString)", (TQString) filename); } } public void SlotAboutQtSharp () { - QMessageBox.Information (this, "About Qt# 0.7", + TQMessageBox.Information (this, "About Qt# 0.7", "A Qt (http://www.trolltech.com) to C# language binding. \n" + "Qt# is compatible with Mono (http://go-mono.org) and\n" + "Portable.NET (http://www.southern-storm.com.au/portable_net.html)\n" + @@ -100,30 +100,30 @@ namespace QtSamples { public void SlotAboutQt () { - QMessageBox.AboutQt (this, "About Qt"); + TQMessageBox.AboutQt (this, "About Qt"); } public void SlotColorChooser () { - QColor chosenColor = QColorDialog.GetColor(); + TQColor chosenColor = QColorDialog.GetColor(); if (chosenColor.IsValid()) - Emit ("colorChanged(QColor)", chosenColor); + Emit ("colorChanged(TQColor)", chosenColor); } - public class ScribbleArea : QFrame { - private QPoint last; - private QPixmap buffer; - private QColor currentcolor = new QColor("Black"); - private QPopupMenu popupmenu; + public class ScribbleArea : TQFrame { + private TQPoint last; + private TQPixmap buffer; + private TQColor currentcolor = new TQColor("Black"); + private TQPopupMenu popupmenu; - public ScribbleArea (QWidget parent) : base (parent) + public ScribbleArea (TQWidget parent) : base (parent) { - buffer = new QPixmap (); - last = new QPoint (); + buffer = new TQPixmap (); + last = new TQPoint (); SetBackgroundMode (Qt.BackgroundMode.NoBackground); - popupmenu = new QPopupMenu(); - popupmenu.InsertItem ("&Clear", this, SLOT ("SlotClearArea()") ); + popupmenu = new TQPopupMenu(); + popupmenu.InsertItem ("&Clear", this, TQT_SLOT ("SlotClearArea()") ); mouseMoveEvent += new MouseMoveEvent (MouseMoved); mousePressEvent += new MousePressEvent (MousePressed); @@ -131,51 +131,51 @@ namespace QtSamples { resizeEvent += new ResizeEvent (PerformResize); } - public void PerformLoad (QString filename) + public void PerformLoad (TQString filename) { if ( ! buffer.Load(filename) ) - QMessageBox.Warning (null, "Load error", "Could not load file"); + TQMessageBox.Warning (null, "Load error", "Could not load file"); Repaint(); } - public void PerformSave (QString filename) + public void PerformSave (TQString filename) { if ( ! buffer.Save (filename, "BMP") ) - QMessageBox.Warning( null, "Save error", "Could not save file"); + TQMessageBox.Warning( null, "Save error", "Could not save file"); } public void SlotClearArea () { - buffer.Fill( new QColor ("white") ); + buffer.Fill( new TQColor ("white") ); BitBlt (this, 0, 0, buffer, 0, 0, -1, -1, Qt.RasterOp.CopyROP, false); } - public void SlotSetColor (QColor color) + public void SlotSetColor (TQColor color) { currentcolor = color; } // Note, Dispose() is called on QPoints here to increase performance - // of the UI. Otherwise, the GC would let dead QPoint instances pile + // of the UI. Otherwise, the GC would let dead TQPoint instances pile // up and delete them all at once, causing the UI to pause while it frees // memory. (This happens because the GC runs in the same thread as the // application.) - protected void MousePressed (QMouseEvent e) + protected void MousePressed (TQMouseEvent e) { if (e.Button() == ButtonState.RightButton ) - popupmenu.Exec (QCursor.Pos ()); + popupmenu.Exec (TQCursor.Pos ()); else { last.Dispose (); last = e.Pos(); } } - protected void MouseMoved (QMouseEvent e) + protected void MouseMoved (TQMouseEvent e) { - QPainter windowPainter = new QPainter (); - QPainter bufferPainter = new QPainter (); + TQPainter windowPainter = new TQPainter (); + TQPainter bufferPainter = new TQPainter (); windowPainter.Begin (this); bufferPainter.Begin (buffer); @@ -193,17 +193,17 @@ namespace QtSamples { last = e.Pos (); } - protected void PerformPaint (QPaintEvent e) + protected void PerformPaint (TQPaintEvent e) { BitBlt(this, 0, 0, buffer, 0, 0, -1, -1, RasterOp.CopyROP, false); } - protected void PerformResize (QResizeEvent e) + protected void PerformResize (TQResizeEvent e) { - QPixmap save = new QPixmap (buffer); + TQPixmap save = new TQPixmap (buffer); buffer.Resize (e.Size()); - buffer.Fill (new QColor("white")); + buffer.Fill (new TQColor("white")); BitBlt (buffer, 0, 0, save, 0, 0, -1, -1, RasterOp.CopyROP, false); } |