From 9ba04742771370f59740e32e11c5f3a1e6a1b70a Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 5 Dec 2011 15:55:57 -0600 Subject: Initial TQt conversion --- qtsharp/src/examples/samples/quantumfractals.cs | 130 ++++++++++++------------ 1 file changed, 65 insertions(+), 65 deletions(-) (limited to 'qtsharp/src/examples/samples/quantumfractals.cs') diff --git a/qtsharp/src/examples/samples/quantumfractals.cs b/qtsharp/src/examples/samples/quantumfractals.cs index fe6c914e..484b5640 100644 --- a/qtsharp/src/examples/samples/quantumfractals.cs +++ b/qtsharp/src/examples/samples/quantumfractals.cs @@ -9,18 +9,18 @@ namespace Qf { using System; using System.Threading; - public class FractalViewer : TQMainWindow { + public class FractalViewer : TTQMainWindow { //Menuing - private TQMenuBar menubar; - private TQPopupMenu filemenu; - private TQPopupMenu shapemenu; - private TQPopupMenu settingsmenu; + private TTQMenuBar menubar; + private TTQPopupMenu filemenu; + private TTQPopupMenu shapemenu; + private TTQPopupMenu settingsmenu; public static int Main (string[] args) { //Initialize and start the main event loop - TQApplication app = new TQApplication (args); + TTQApplication app = new TTQApplication (args); FractalViewer view = new FractalViewer (); app.SetMainWidget (view); view.Show (); @@ -36,13 +36,13 @@ namespace Qf { SetCentralWidget (display); //Setup the filemenu - filemenu = new TQPopupMenu (null, "filemenu"); + filemenu = new TTQPopupMenu (null, "filemenu"); filemenu.InsertItem ("&Screenshot", display, TQT_SLOT ("SlotScreenshot()")); filemenu.InsertSeparator (); filemenu.InsertItem ("&Quit", qApp, TQT_SLOT ("quit()")); //Setup the shapemenu - shapemenu = new TQPopupMenu (null, "typemenu"); + shapemenu = new TTQPopupMenu (null, "typemenu"); shapemenu.InsertItem( "&Tetrahedron", 0); shapemenu.InsertItem( "&Cube", 1); shapemenu.InsertItem( "&Octahedron", 2); @@ -52,42 +52,42 @@ namespace Qf { shapemenu.InsertItem( "&Icosidodecahedron", 6); //Connect the shapemenu - TQObject.Connect (shapemenu, TQT_SIGNAL ("activated(int)"), + TTQObject.Connect (shapemenu, TQT_SIGNAL ("activated(int)"), display, TQT_SLOT("SlotShapeMenu(int)")); //Setup the settingsmenu - settingsmenu = new TQPopupMenu (null, "settingsmenu"); + settingsmenu = new TTQPopupMenu (null, "settingsmenu"); settingsmenu.InsertItem ("&Alpha", display, TQT_SLOT ("SlotSetAlpha()")); //Setup the menubar - menubar = new TQMenuBar (this, ""); + menubar = new TTQMenuBar (this, ""); menubar.InsertItem ("&File", filemenu); menubar.InsertItem ("&Shape", shapemenu); menubar.InsertItem ("&Settings", settingsmenu); } } - public class Display: TQWidget, IQuantumFractal { + public class Display: TTQWidget, IQuantumFractal { //Labels - TQLabel count; - TQLabel shape; - TQLabel alpha; + TTQLabel count; + TTQLabel shape; + TTQLabel alpha; //Buttons - TQPushButton start; - TQPushButton stop; - TQPushButton reset; - TQPushButton gray; - TQPushButton intense; + TTQPushButton start; + TTQPushButton stop; + TTQPushButton reset; + TTQPushButton gray; + TTQPushButton intense; //Drawable region - QPaintBuffer buffer; + TQPaintBuffer buffer; //Layouts - TQVBoxLayout layout; - TQHBoxLayout buttons; - TQVBoxLayout labels; + TTQVBoxLayout layout; + TTQHBoxLayout buttons; + TTQVBoxLayout labels; //Engine controller variables int[] topDensity = new int[0]; @@ -106,35 +106,35 @@ namespace Qf { QuantumFractals qf; Thread engine; - public Display (TQWidget parent): base (parent) + public Display (TTQWidget parent): base (parent) { //Setup the sizes - TQSize size = new TQSize (resolution, resolution); + TTQSize size = new TTQSize (resolution, resolution); parent.SetBaseSize (size); //Some nice colors - SetPaletteBackgroundColor (new TQColor ("Black")); - SetPaletteForegroundColor (new TQColor ("LightBlue")); + SetPaletteBackgroundColor (new TTQColor ("Black")); + SetPaletteForegroundColor (new TTQColor ("LightBlue")); //Setup the buttons - start = new TQPushButton ("Start", this); - stop = new TQPushButton ("Stop", this); - reset = new TQPushButton ("Reset", this); - gray = new TQPushButton ("Color", this); - intense = new TQPushButton ("Intensity", this); + start = new TTQPushButton ("Start", this); + stop = new TTQPushButton ("Stop", this); + reset = new TTQPushButton ("Reset", this); + gray = new TTQPushButton ("Color", this); + intense = new TTQPushButton ("Intensity", this); //Setup the labels - count = new TQLabel (this); - alpha = new TQLabel (this); - shape = new TQLabel (this); + count = new TTQLabel (this); + alpha = new TTQLabel (this); + shape = new TTQLabel (this); //Setup the drawable - buffer = new QPaintBuffer (this); + buffer = new TQPaintBuffer (this); buffer.SetMinimumSize (size); //Create the layouts - layout = new TQVBoxLayout (this); - buttons = new TQHBoxLayout (layout); + layout = new TTQVBoxLayout (this); + buttons = new TTQHBoxLayout (layout); //Add some buttons buttons.AddWidget (start); @@ -144,23 +144,23 @@ namespace Qf { buttons.AddWidget (intense); //Connect the buttons and SlotQuit - TQObject.Connect (start, TQT_SIGNAL ("clicked()"), + TTQObject.Connect (start, TQT_SIGNAL ("clicked()"), this, TQT_SLOT ("SlotStart()")); - TQObject.Connect (stop, TQT_SIGNAL ("clicked()"), + TTQObject.Connect (stop, TQT_SIGNAL ("clicked()"), this, TQT_SLOT ("SlotStop()")); - TQObject.Connect (reset, TQT_SIGNAL ("clicked()"), + TTQObject.Connect (reset, TQT_SIGNAL ("clicked()"), this, TQT_SLOT ("SlotReset()")); - TQObject.Connect (gray, TQT_SIGNAL ("clicked()"), + TTQObject.Connect (gray, TQT_SIGNAL ("clicked()"), this, TQT_SLOT ("SlotGray()")); - TQObject.Connect (intense, TQT_SIGNAL ("clicked()"), + TTQObject.Connect (intense, TQT_SIGNAL ("clicked()"), this, TQT_SLOT ("SlotIntense()")); - TQObject.Connect (buffer, TQT_SIGNAL ("Painted()"), + TTQObject.Connect (buffer, TQT_SIGNAL ("Painted()"), this, TQT_SLOT ("SlotSetLabels()")); - TQObject.Connect (qApp, TQT_SIGNAL ("lastWindowClosed ()"), + TTQObject.Connect (qApp, TQT_SIGNAL ("lastWindowClosed ()"), this, TQT_SLOT ("SlotQuit ()")); //Layout labels - labels = new TQVBoxLayout (layout); + labels = new TTQVBoxLayout (layout); labels.AddWidget (count); labels.AddWidget (shape); labels.AddWidget (alpha); @@ -367,9 +367,9 @@ namespace Qf { WasRunning = Running ? true : false; SlotStop (); - string filename = TQFileDialog.GetSaveFileName ( + string filename = TTQFileDialog.GetSaveFileName ( - TQDir.HomeDirPath (), "*", this, "save", + TTQDir.HomeDirPath (), "*", this, "save", "Save Screenshot", "*.png", true ); @@ -386,7 +386,7 @@ namespace Qf { WasRunning = Running ? true : false; SlotStop (); - qf.Alpha = QInputDialog.GetDouble ( + qf.Alpha = TQInputDialog.GetDouble ( "Set Alpha", "Alpha: ", qf.Alpha, 0, 2, 32 ); @@ -405,7 +405,7 @@ namespace Qf { } //Need to reset the resolution upon resize - private void TouchResize (TQResizeEvent e) + private void TouchResize (TTQResizeEvent e) { int height = buffer.Size ().Height (); int width = buffer.Size ().Width (); @@ -415,23 +415,23 @@ namespace Qf { } [DeclareQtSignal ("Painted()")] - public class QPaintBuffer : TQFrame { + public class TQPaintBuffer : TTQFrame { //Drawables - private TQPixmap buffer; - private TQImage image; + private TTQPixmap buffer; + private TTQImage image; //Timer private TimerCallback call; private Timer timer; - public QPaintBuffer (TQWidget parent) : base (parent) + public TQPaintBuffer (TTQWidget parent) : base (parent) { SetBackgroundMode (Qt.BackgroundMode.NoBackground); //Create drawables - buffer = new TQPixmap (); - image = new TQImage (Size (), 32); + buffer = new TTQPixmap (); + image = new TTQImage (Size (), 32); //Setup the event handlers paintEvent += new PaintEvent (TouchPaint); @@ -448,8 +448,8 @@ namespace Qf { //Resets the drawables public void Reset () { - buffer = new TQPixmap (); - image = new TQImage (Size (), 32); + buffer = new TTQPixmap (); + image = new TTQImage (Size (), 32); PaintImage (null); } @@ -484,24 +484,24 @@ namespace Qf { } //Receive focus events - private void TouchFocus (TQFocusEvent e) + private void TouchFocus (TTQFocusEvent e) { PerformPaint (); } //Receive paint events - private void TouchPaint (TQPaintEvent e) + private void TouchPaint (TTQPaintEvent e) { PerformPaint (); } //Receive resize events - private void TouchResize (TQResizeEvent e) + private void TouchResize (TTQResizeEvent e) { - image = new TQImage (e.Size (), 32); + image = new TTQImage (e.Size (), 32); buffer.Resize (e.Size()); - buffer.Fill (new TQColor("black")); - BitBlt (buffer, 0, 0, new TQPixmap (buffer), + buffer.Fill (new TTQColor("black")); + BitBlt (buffer, 0, 0, new TTQPixmap (buffer), 0, 0, -1, -1, RasterOp.CopyROP, false); } -- cgit v1.2.1