summaryrefslogtreecommitdiffstats
path: root/qtsharp/src/examples/samples/display.cs
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit90825e2392b2d70e43c7a25b8a3752299a933894 (patch)
treee33aa27f02b74604afbfd0ea4f1cfca8833d882a /qtsharp/src/examples/samples/display.cs
downloadtdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.tar.gz
tdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'qtsharp/src/examples/samples/display.cs')
-rw-r--r--qtsharp/src/examples/samples/display.cs65
1 files changed, 65 insertions, 0 deletions
diff --git a/qtsharp/src/examples/samples/display.cs b/qtsharp/src/examples/samples/display.cs
new file mode 100644
index 00000000..b1c7ca10
--- /dev/null
+++ b/qtsharp/src/examples/samples/display.cs
@@ -0,0 +1,65 @@
+namespace QtSamples {
+
+ using Qt;
+ using System;
+
+ public class Display : QMainWindow {
+
+ private TextArea textarea;
+ private QScrollView scrollview;
+ private QMenuBar menubar;
+ private QPopupMenu filemenu, aboutmenu;
+
+ private class TextArea : QTextEdit {
+
+ public TextArea (QWidget parent) : base (parent)
+ {
+ QFile file = new QFile ("display.cs");
+ if ( file.Open(1) ) {
+ QTextStream ts = new QTextStream (file);
+ this.SetText (ts.Read ());
+ this.SetTabStopWidth (30);
+ }
+ }
+ }
+
+ public Display ()
+ {
+ filemenu = new QPopupMenu (null, "filemenu");
+ filemenu.InsertItem ("&Quit", qApp, SLOT ("quit()"));
+
+ aboutmenu = new QPopupMenu(null, "aboutmenu");
+ aboutmenu.InsertItem("&About Qt-Sharp", this, SLOT("slotAbout()"));
+
+ menubar = new QMenuBar(this, "");
+ menubar.InsertItem("&File", filemenu);
+ menubar.InsertItem("&About", aboutmenu);
+
+ textarea = new TextArea (this);
+ textarea.SetGeometry(0, menubar.Height(), Width(), Height() - menubar.Height());
+ this.SetCentralWidget (textarea);
+ }
+
+ public void slotAbout ()
+ {
+ QMessageBox.Information (
+ this, "About Qt-Sharp-0.7",
+ "A Qt (http://www.trolltech.com) to C# language binding.\n" +
+ "Qt-Sharp is compatible with Mono (http://go-mono.org) and\n" +
+ "Portable.NET (http://www.southern-storm.com.au/portable_net.html)\n" +
+ "(c) 2002 Adam Treat. Licensed under the terms of the GNU GPL.\n"
+ );
+ }
+
+ public static void Main (String[] args)
+ {
+ QApplication app = new QApplication (args);
+ Display demo = new Display ();
+ demo.SetCaption ("Qt-Sharp-0.7!");
+ app.SetMainWidget (demo);
+ demo.Show ();
+ app.Exec ();
+ return;
+ }
+ }
+}