summaryrefslogtreecommitdiffstats
path: root/qtsharp/src/examples/samples/scribblewindow.cs
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-12-05 15:55:57 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-12-05 15:55:57 -0600
commit9ba04742771370f59740e32e11c5f3a1e6a1b70a (patch)
treec81c34dae2b3b1ea73801bf18a960265dc4207f7 /qtsharp/src/examples/samples/scribblewindow.cs
parent1a96c45b22d01378202d9dc7ed9c47acd30f966e (diff)
downloadtdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.tar.gz
tdebindings-9ba04742771370f59740e32e11c5f3a1e6a1b70a.zip
Initial TQt conversion
Diffstat (limited to 'qtsharp/src/examples/samples/scribblewindow.cs')
-rw-r--r--qtsharp/src/examples/samples/scribblewindow.cs112
1 files changed, 56 insertions, 56 deletions
diff --git a/qtsharp/src/examples/samples/scribblewindow.cs b/qtsharp/src/examples/samples/scribblewindow.cs
index fdd9fe46..70ed3c0f 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(TQColor)")]
- [DeclareQtSignal ("load(TQString)")]
- [DeclareQtSignal ("save(TQString)")]
- public class ScribbleWindow : TQMainWindow {
-
- private TQMenuBar menubar;
- private TQPopupMenu filemenu;
- private TQPopupMenu aboutmenu;
- private TQScrollView scrollview;
+ [DeclareQtSignal ("colorChanged(TTQColor)")]
+ [DeclareQtSignal ("load(TTQString)")]
+ [DeclareQtSignal ("save(TTQString)")]
+ public class ScribbleWindow : TTQMainWindow {
+
+ private TTQMenuBar menubar;
+ private TTQPopupMenu filemenu;
+ private TTQPopupMenu aboutmenu;
+ private TTQScrollView scrollview;
public ScribbleArea scribblearea;
enum Color {Black, Red, Blue, Green, Yellow};
public static int Main (String[] args)
{
- TQApplication app = new TQApplication (args);
+ TTQApplication app = new TTQApplication (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 TQPopupMenu (null, "filemenu");
+ filemenu = new TTQPopupMenu (null, "filemenu");
filemenu.InsertItem ("&Load", this, TQT_SLOT ("SlotLoad()") );
filemenu.InsertItem ("&Save", this, TQT_SLOT ("SlotSave()") );
filemenu.InsertSeparator ();
filemenu.InsertItem ("&Quit", qApp, TQT_SLOT ("quit()"));
- aboutmenu = new TQPopupMenu (null, "helpmenu");
+ aboutmenu = new TTQPopupMenu (null, "helpmenu");
aboutmenu.InsertItem ("&About Qt-Sharp", this, TQT_SLOT ("SlotAboutQtSharp()"));
aboutmenu.InsertItem ("&About Qt", this, TQT_SLOT ("SlotAboutQt()"));
- menubar = new TQMenuBar (this, "");
+ menubar = new TTQMenuBar (this, "");
menubar.InsertItem ("&File", filemenu);
menubar.InsertItem ("&Color", this, TQT_SLOT("SlotColorChooser()"));
menubar.InsertItem ("&About", aboutmenu);
- scrollview = new TQScrollView (this);
+ scrollview = new TTQScrollView (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 ());
- 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)") );
+ TTQObject.Connect (this, TQT_SIGNAL ("colorChanged(TTQColor)"),
+ scribblearea, TQT_SLOT ("SlotSetColor(TTQColor)") );
+ TTQObject.Connect (this, TQT_SIGNAL ("load(TTQString)"),
+ scribblearea, TQT_SLOT ("PerformLoad(TTQString)") );
+ TTQObject.Connect (this, TQT_SIGNAL ("save(TTQString)"),
+ scribblearea, TQT_SLOT ("PerformSave(TTQString)") );
}
public void SlotLoad ()
{
- string filename = TQFileDialog.GetOpenFileName (".", "*.bmp", this,
- null, "Load File", TQString.Null, true);
+ string filename = TTQFileDialog.GetOpenFileName (".", "*.bmp", this,
+ null, "Load File", TTQString.Null, true);
if ( filename != null )
- Emit ("load(TQString)", (TQString) filename);
+ Emit ("load(TTQString)", (TTQString) filename);
}
public void SlotSave ()
{
- string filename = TQFileDialog.GetSaveFileName (".", "*.bmp", this,
- null, "Save File", TQString.Null, true);
+ string filename = TTQFileDialog.GetSaveFileName (".", "*.bmp", this,
+ null, "Save File", TTQString.Null, true);
if ( filename != null )
{
if ( ! filename.ToLower().EndsWith(".bmp") )
filename += ".bmp";
- Emit ("save(TQString)", (TQString) filename);
+ Emit ("save(TTQString)", (TTQString) filename);
}
}
public void SlotAboutQtSharp ()
{
- TQMessageBox.Information (this, "About Qt# 0.7",
+ TTQMessageBox.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,29 +100,29 @@ namespace QtSamples {
public void SlotAboutQt ()
{
- TQMessageBox.AboutQt (this, "About Qt");
+ TTQMessageBox.AboutQt (this, "About Qt");
}
public void SlotColorChooser ()
{
- TQColor chosenColor = QColorDialog.GetColor();
+ TTQColor chosenColor = TQColorDialog.GetColor();
if (chosenColor.IsValid())
- Emit ("colorChanged(TQColor)", chosenColor);
+ Emit ("colorChanged(TTQColor)", chosenColor);
}
- public class ScribbleArea : TQFrame {
- private TQPoint last;
- private TQPixmap buffer;
- private TQColor currentcolor = new TQColor("Black");
- private TQPopupMenu popupmenu;
+ public class ScribbleArea : TTQFrame {
+ private TTQPoint last;
+ private TTQPixmap buffer;
+ private TTQColor currentcolor = new TTQColor("Black");
+ private TTQPopupMenu popupmenu;
- public ScribbleArea (TQWidget parent) : base (parent)
+ public ScribbleArea (TTQWidget parent) : base (parent)
{
- buffer = new TQPixmap ();
- last = new TQPoint ();
+ buffer = new TTQPixmap ();
+ last = new TTQPoint ();
SetBackgroundMode (Qt.BackgroundMode.NoBackground);
- popupmenu = new TQPopupMenu();
+ popupmenu = new TTQPopupMenu();
popupmenu.InsertItem ("&Clear", this, TQT_SLOT ("SlotClearArea()") );
mouseMoveEvent += new MouseMoveEvent (MouseMoved);
@@ -131,51 +131,51 @@ namespace QtSamples {
resizeEvent += new ResizeEvent (PerformResize);
}
- public void PerformLoad (TQString filename)
+ public void PerformLoad (TTQString filename)
{
if ( ! buffer.Load(filename) )
- TQMessageBox.Warning (null, "Load error", "Could not load file");
+ TTQMessageBox.Warning (null, "Load error", "Could not load file");
Repaint();
}
- public void PerformSave (TQString filename)
+ public void PerformSave (TTQString filename)
{
if ( ! buffer.Save (filename, "BMP") )
- TQMessageBox.Warning( null, "Save error", "Could not save file");
+ TTQMessageBox.Warning( null, "Save error", "Could not save file");
}
public void SlotClearArea ()
{
- buffer.Fill( new TQColor ("white") );
+ buffer.Fill( new TTQColor ("white") );
BitBlt (this, 0, 0, buffer, 0, 0, -1, -1, Qt.RasterOp.CopyROP, false);
}
- public void SlotSetColor (TQColor color)
+ public void SlotSetColor (TTQColor color)
{
currentcolor = color;
}
- // Note, Dispose() is called on QPoints here to increase performance
- // of the UI. Otherwise, the GC would let dead TQPoint instances pile
+ // Note, Dispose() is called on TQPoints here to increase performance
+ // of the UI. Otherwise, the GC would let dead TTQPoint 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 (TQMouseEvent e)
+ protected void MousePressed (TTQMouseEvent e)
{
if (e.Button() == ButtonState.RightButton )
- popupmenu.Exec (TQCursor.Pos ());
+ popupmenu.Exec (TTQCursor.Pos ());
else {
last.Dispose ();
last = e.Pos();
}
}
- protected void MouseMoved (TQMouseEvent e)
+ protected void MouseMoved (TTQMouseEvent e)
{
- TQPainter windowPainter = new TQPainter ();
- TQPainter bufferPainter = new TQPainter ();
+ TTQPainter windowPainter = new TTQPainter ();
+ TTQPainter bufferPainter = new TTQPainter ();
windowPainter.Begin (this);
bufferPainter.Begin (buffer);
@@ -193,17 +193,17 @@ namespace QtSamples {
last = e.Pos ();
}
- protected void PerformPaint (TQPaintEvent e)
+ protected void PerformPaint (TTQPaintEvent e)
{
BitBlt(this, 0, 0, buffer,
0, 0, -1, -1, RasterOp.CopyROP, false);
}
- protected void PerformResize (TQResizeEvent e)
+ protected void PerformResize (TTQResizeEvent e)
{
- TQPixmap save = new TQPixmap (buffer);
+ TTQPixmap save = new TTQPixmap (buffer);
buffer.Resize (e.Size());
- buffer.Fill (new TQColor("white"));
+ buffer.Fill (new TTQColor("white"));
BitBlt (buffer, 0, 0, save,
0, 0, -1, -1, RasterOp.CopyROP, false);
}