From 90825e2392b2d70e43c7a25b8a3752299a933894 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: 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 --- qtsharp/src/Makefile.am | 2 + qtsharp/src/api/qt.xml | 23157 +++++++++++++++++++ qtsharp/src/bindings/Makefile.am | 23 + qtsharp/src/bindings/qt.build | 493 + qtsharp/src/bindings/static/AlignmentFlags.cs | 40 + qtsharp/src/bindings/static/ArrowType.cs | 33 + qtsharp/src/bindings/static/BGMode.cs | 31 + qtsharp/src/bindings/static/BackgroundMode.cs | 49 + qtsharp/src/bindings/static/BrushStyle.cs | 45 + qtsharp/src/bindings/static/ButtonState.cs | 40 + qtsharp/src/bindings/static/CursorShape.cs | 47 + qtsharp/src/bindings/static/DateFormat.cs | 32 + .../bindings/static/DeclareQtSignalAttribute.cs | 16 + qtsharp/src/bindings/static/Dock.cs | 43 + qtsharp/src/bindings/static/GUIStyle.cs | 34 + qtsharp/src/bindings/static/IQMenuData.cs | 115 + .../src/bindings/static/ImageConversionFlags.cs | 46 + qtsharp/src/bindings/static/Key.cs | 269 + qtsharp/src/bindings/static/Modifier.cs | 35 + qtsharp/src/bindings/static/Orientation.cs | 31 + qtsharp/src/bindings/static/PaintUnit.cs | 35 + qtsharp/src/bindings/static/PenCapStyle.cs | 33 + qtsharp/src/bindings/static/PenJoinStyle.cs | 33 + qtsharp/src/bindings/static/PenStyle.cs | 36 + qtsharp/src/bindings/static/QApplication.cs | 1031 + qtsharp/src/bindings/static/QByteArray.cs | 84 + qtsharp/src/bindings/static/QCallBack.cs | 37 + qtsharp/src/bindings/static/QEventArgs.cs | 42 + qtsharp/src/bindings/static/QEventList.cs | 55 + qtsharp/src/bindings/static/QGL.cs | 49 + qtsharp/src/bindings/static/QMenuBar.cs | 815 + qtsharp/src/bindings/static/QMenuData.cs | 719 + qtsharp/src/bindings/static/QNull.cs | 35 + qtsharp/src/bindings/static/QObject.cs | 609 + qtsharp/src/bindings/static/QPopupMenu.cs | 830 + qtsharp/src/bindings/static/QString.cs | 1340 ++ qtsharp/src/bindings/static/QStyle.cs | 595 + qtsharp/src/bindings/static/QToolButton.cs | 290 + qtsharp/src/bindings/static/QWidgetStack.cs | 173 + qtsharp/src/bindings/static/QtSignal.cs | 848 + qtsharp/src/bindings/static/QtSignalMap.cs | 99 + qtsharp/src/bindings/static/QtSlot.cs | 284 + qtsharp/src/bindings/static/QtSupport.cs | 750 + qtsharp/src/bindings/static/RasterOp.cs | 48 + .../src/bindings/static/StringComparisonMode.cs | 34 + qtsharp/src/bindings/static/TextFlags.cs | 37 + qtsharp/src/bindings/static/TextFormat.cs | 32 + qtsharp/src/bindings/static/UIEffect.cs | 35 + qtsharp/src/bindings/static/WidgetFlags.cs | 66 + qtsharp/src/bindings/static/WidgetState.cs | 53 + qtsharp/src/bindings/static/WindowsVersion.cs | 38 + qtsharp/src/examples/Makefile.am | 1 + qtsharp/src/examples/samples/Makefile.am | 24 + qtsharp/src/examples/samples/display.cs | 65 + qtsharp/src/examples/samples/emit.cs | 41 + qtsharp/src/examples/samples/eventhandling.cs | 52 + qtsharp/src/examples/samples/hello.cs | 36 + qtsharp/src/examples/samples/mandelbrot.cs | 264 + qtsharp/src/examples/samples/mandelbrot2.cs | 309 + qtsharp/src/examples/samples/qstring-slot.cs | 38 + qtsharp/src/examples/samples/quantumfractals.cs | 828 + qtsharp/src/examples/samples/samples.build | 86 + qtsharp/src/examples/samples/scribblewindow.cs | 212 + qtsharp/src/examples/test-results.html | 203 + qtsharp/src/examples/test-results.sxc | Bin 0 -> 6109 bytes qtsharp/src/examples/tutorials/Makefile.am | 24 + qtsharp/src/examples/tutorials/README | 14 + qtsharp/src/examples/tutorials/t1.cs | 23 + qtsharp/src/examples/tutorials/t2.cs | 28 + qtsharp/src/examples/tutorials/t3.cs | 29 + qtsharp/src/examples/tutorials/t4.cs | 44 + qtsharp/src/examples/tutorials/t5.cs | 45 + qtsharp/src/examples/tutorials/t6.cs | 58 + qtsharp/src/examples/tutorials/t7.cs | 78 + qtsharp/src/examples/tutorials/tutorials.build | 75 + qtsharp/src/generator/Converter.cs | 464 + qtsharp/src/generator/Generator.cs | 97 + qtsharp/src/generator/Makefile.am | 16 + qtsharp/src/generator/ParseAPI.cs | 90 + qtsharp/src/generator/Parser.cs | 323 + qtsharp/src/generator/Printer.cs | 526 + qtsharp/src/generator/QAncestor.cs | 26 + qtsharp/src/generator/QCtor.cs | 47 + qtsharp/src/generator/QDCtor.cs | 57 + qtsharp/src/generator/QEnum.cs | 63 + qtsharp/src/generator/QItem.cs | 44 + qtsharp/src/generator/QMember.cs | 116 + qtsharp/src/generator/QMethod.cs | 54 + qtsharp/src/generator/QParam.cs | 54 + qtsharp/src/generator/QType.cs | 126 + qtsharp/src/generator/QTypeMap.cs | 477 + qtsharp/src/generator/generator.build | 15 + qtsharp/src/libqtsharp/Makefile.am | 12 + qtsharp/src/libqtsharp/customslot.cpp | 254 + qtsharp/src/libqtsharp/customslot.h | 120 + qtsharp/src/libqtsharp/qtsharp.cpp | 291 + qtsharp/src/libqtsharp/qtsharp.h | 67 + qtsharp/src/tests/Makefile.am | 11 + qtsharp/src/tests/lookuptest.cs | 50 + qtsharp/src/uicsharp/Makefile.am | 21 + qtsharp/src/uicsharp/tests/form1.ui | 43 + qtsharp/src/uicsharp/tests/form10.ui | 131 + qtsharp/src/uicsharp/tests/form2.ui | 138 + qtsharp/src/uicsharp/tests/form3.ui | 206 + qtsharp/src/uicsharp/tests/form4.ui | 224 + qtsharp/src/uicsharp/tests/form5.ui | 450 + qtsharp/src/uicsharp/tests/form6.ui | 167 + qtsharp/src/uicsharp/tests/form7.ui | 339 + qtsharp/src/uicsharp/tests/form8.ui | 75 + qtsharp/src/uicsharp/tests/form9.ui | 211 + qtsharp/src/uicsharp/uicsharp.build | 15 + qtsharp/src/uicsharp/uicsharp.cs | 934 + 112 files changed, 42677 insertions(+) create mode 100644 qtsharp/src/Makefile.am create mode 100644 qtsharp/src/api/qt.xml create mode 100644 qtsharp/src/bindings/Makefile.am create mode 100644 qtsharp/src/bindings/qt.build create mode 100644 qtsharp/src/bindings/static/AlignmentFlags.cs create mode 100644 qtsharp/src/bindings/static/ArrowType.cs create mode 100644 qtsharp/src/bindings/static/BGMode.cs create mode 100644 qtsharp/src/bindings/static/BackgroundMode.cs create mode 100644 qtsharp/src/bindings/static/BrushStyle.cs create mode 100644 qtsharp/src/bindings/static/ButtonState.cs create mode 100644 qtsharp/src/bindings/static/CursorShape.cs create mode 100644 qtsharp/src/bindings/static/DateFormat.cs create mode 100644 qtsharp/src/bindings/static/DeclareQtSignalAttribute.cs create mode 100644 qtsharp/src/bindings/static/Dock.cs create mode 100644 qtsharp/src/bindings/static/GUIStyle.cs create mode 100644 qtsharp/src/bindings/static/IQMenuData.cs create mode 100644 qtsharp/src/bindings/static/ImageConversionFlags.cs create mode 100644 qtsharp/src/bindings/static/Key.cs create mode 100644 qtsharp/src/bindings/static/Modifier.cs create mode 100644 qtsharp/src/bindings/static/Orientation.cs create mode 100644 qtsharp/src/bindings/static/PaintUnit.cs create mode 100644 qtsharp/src/bindings/static/PenCapStyle.cs create mode 100644 qtsharp/src/bindings/static/PenJoinStyle.cs create mode 100644 qtsharp/src/bindings/static/PenStyle.cs create mode 100644 qtsharp/src/bindings/static/QApplication.cs create mode 100644 qtsharp/src/bindings/static/QByteArray.cs create mode 100644 qtsharp/src/bindings/static/QCallBack.cs create mode 100644 qtsharp/src/bindings/static/QEventArgs.cs create mode 100644 qtsharp/src/bindings/static/QEventList.cs create mode 100644 qtsharp/src/bindings/static/QGL.cs create mode 100644 qtsharp/src/bindings/static/QMenuBar.cs create mode 100644 qtsharp/src/bindings/static/QMenuData.cs create mode 100644 qtsharp/src/bindings/static/QNull.cs create mode 100644 qtsharp/src/bindings/static/QObject.cs create mode 100644 qtsharp/src/bindings/static/QPopupMenu.cs create mode 100644 qtsharp/src/bindings/static/QString.cs create mode 100644 qtsharp/src/bindings/static/QStyle.cs create mode 100644 qtsharp/src/bindings/static/QToolButton.cs create mode 100644 qtsharp/src/bindings/static/QWidgetStack.cs create mode 100644 qtsharp/src/bindings/static/QtSignal.cs create mode 100644 qtsharp/src/bindings/static/QtSignalMap.cs create mode 100644 qtsharp/src/bindings/static/QtSlot.cs create mode 100644 qtsharp/src/bindings/static/QtSupport.cs create mode 100644 qtsharp/src/bindings/static/RasterOp.cs create mode 100644 qtsharp/src/bindings/static/StringComparisonMode.cs create mode 100644 qtsharp/src/bindings/static/TextFlags.cs create mode 100644 qtsharp/src/bindings/static/TextFormat.cs create mode 100644 qtsharp/src/bindings/static/UIEffect.cs create mode 100644 qtsharp/src/bindings/static/WidgetFlags.cs create mode 100644 qtsharp/src/bindings/static/WidgetState.cs create mode 100644 qtsharp/src/bindings/static/WindowsVersion.cs create mode 100644 qtsharp/src/examples/Makefile.am create mode 100644 qtsharp/src/examples/samples/Makefile.am create mode 100644 qtsharp/src/examples/samples/display.cs create mode 100644 qtsharp/src/examples/samples/emit.cs create mode 100644 qtsharp/src/examples/samples/eventhandling.cs create mode 100644 qtsharp/src/examples/samples/hello.cs create mode 100644 qtsharp/src/examples/samples/mandelbrot.cs create mode 100644 qtsharp/src/examples/samples/mandelbrot2.cs create mode 100644 qtsharp/src/examples/samples/qstring-slot.cs create mode 100644 qtsharp/src/examples/samples/quantumfractals.cs create mode 100644 qtsharp/src/examples/samples/samples.build create mode 100644 qtsharp/src/examples/samples/scribblewindow.cs create mode 100644 qtsharp/src/examples/test-results.html create mode 100644 qtsharp/src/examples/test-results.sxc create mode 100644 qtsharp/src/examples/tutorials/Makefile.am create mode 100644 qtsharp/src/examples/tutorials/README create mode 100644 qtsharp/src/examples/tutorials/t1.cs create mode 100644 qtsharp/src/examples/tutorials/t2.cs create mode 100644 qtsharp/src/examples/tutorials/t3.cs create mode 100644 qtsharp/src/examples/tutorials/t4.cs create mode 100644 qtsharp/src/examples/tutorials/t5.cs create mode 100644 qtsharp/src/examples/tutorials/t6.cs create mode 100644 qtsharp/src/examples/tutorials/t7.cs create mode 100644 qtsharp/src/examples/tutorials/tutorials.build create mode 100644 qtsharp/src/generator/Converter.cs create mode 100644 qtsharp/src/generator/Generator.cs create mode 100644 qtsharp/src/generator/Makefile.am create mode 100644 qtsharp/src/generator/ParseAPI.cs create mode 100644 qtsharp/src/generator/Parser.cs create mode 100644 qtsharp/src/generator/Printer.cs create mode 100644 qtsharp/src/generator/QAncestor.cs create mode 100644 qtsharp/src/generator/QCtor.cs create mode 100644 qtsharp/src/generator/QDCtor.cs create mode 100644 qtsharp/src/generator/QEnum.cs create mode 100644 qtsharp/src/generator/QItem.cs create mode 100644 qtsharp/src/generator/QMember.cs create mode 100644 qtsharp/src/generator/QMethod.cs create mode 100644 qtsharp/src/generator/QParam.cs create mode 100644 qtsharp/src/generator/QType.cs create mode 100644 qtsharp/src/generator/QTypeMap.cs create mode 100644 qtsharp/src/generator/generator.build create mode 100644 qtsharp/src/libqtsharp/Makefile.am create mode 100644 qtsharp/src/libqtsharp/customslot.cpp create mode 100644 qtsharp/src/libqtsharp/customslot.h create mode 100644 qtsharp/src/libqtsharp/qtsharp.cpp create mode 100644 qtsharp/src/libqtsharp/qtsharp.h create mode 100644 qtsharp/src/tests/Makefile.am create mode 100644 qtsharp/src/tests/lookuptest.cs create mode 100644 qtsharp/src/uicsharp/Makefile.am create mode 100644 qtsharp/src/uicsharp/tests/form1.ui create mode 100644 qtsharp/src/uicsharp/tests/form10.ui create mode 100644 qtsharp/src/uicsharp/tests/form2.ui create mode 100644 qtsharp/src/uicsharp/tests/form3.ui create mode 100644 qtsharp/src/uicsharp/tests/form4.ui create mode 100644 qtsharp/src/uicsharp/tests/form5.ui create mode 100644 qtsharp/src/uicsharp/tests/form6.ui create mode 100644 qtsharp/src/uicsharp/tests/form7.ui create mode 100644 qtsharp/src/uicsharp/tests/form8.ui create mode 100644 qtsharp/src/uicsharp/tests/form9.ui create mode 100644 qtsharp/src/uicsharp/uicsharp.build create mode 100644 qtsharp/src/uicsharp/uicsharp.cs (limited to 'qtsharp/src') diff --git a/qtsharp/src/Makefile.am b/qtsharp/src/Makefile.am new file mode 100644 index 00000000..b7388c8e --- /dev/null +++ b/qtsharp/src/Makefile.am @@ -0,0 +1,2 @@ +SUBDIRS = generator libqtsharp bindings examples + diff --git a/qtsharp/src/api/qt.xml b/qtsharp/src/api/qt.xml new file mode 100644 index 00000000..29fc39ea --- /dev/null +++ b/qtsharp/src/api/qt.xml @@ -0,0 +1,23157 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/** + Shortcut to avoid dealing with QDomNodeList + all the time. + +*/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/** + API + +*/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/** + Helpers + +*/ + + + +/** + Functions + +*/ + + + + + +/** + Functions + +*/ + + + + + + + + + + + + + + + + + + + + + + + + +/** + Functions + +*/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/** + Helpers + +*/ + + + + + + + + + + +/** + Implementations of basic tree algorithms + +*/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/** + API + +*/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +/** + Helpers + +*/ + + + +/** + Functions + +*/ + + + + + + +/** + Functions + +*/ + + + + + + + + + + + + + +/** + Functions + +*/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qtsharp/src/bindings/Makefile.am b/qtsharp/src/bindings/Makefile.am new file mode 100644 index 00000000..9732e2ec --- /dev/null +++ b/qtsharp/src/bindings/Makefile.am @@ -0,0 +1,23 @@ +all: Qt.dll + +QWidget.cs: + $(CLI) ../generator/generator.exe -f ../api/qt.xml -d . + +Qt.dll: QWidget.cs $(wildcard *.cs) $(wildcard static/*.cs) + cp static/*.cs . + csant -D$(CSC_NAME)=$(CSC) -C $(CSC_NAME) + +clean: + -rm Qt.dll + +distclean: clean + -rm *.cs + +install: + if ! test -d $(DESTDIR)$(libdir); then $(INSTALL) -d -m 0755 $(DESTDIR)$(libdir); fi + $(INSTALL) -m 0644 Qt.dll $(DESTDIR)$(libdir) + +uninstall: + rm -rf $(libdir)/Qt.dll + +.PHONY: all clean distclean install uninstall diff --git a/qtsharp/src/bindings/qt.build b/qtsharp/src/bindings/qt.build new file mode 100644 index 00000000..46ca68ae --- /dev/null +++ b/qtsharp/src/bindings/qt.build @@ -0,0 +1,493 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qtsharp/src/bindings/static/AlignmentFlags.cs b/qtsharp/src/bindings/static/AlignmentFlags.cs new file mode 100644 index 00000000..4b6ca5c8 --- /dev/null +++ b/qtsharp/src/bindings/static/AlignmentFlags.cs @@ -0,0 +1,40 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum AlignmentFlags { + AlignAuto = 0, + AlignLeft = 1, + AlignRight = 2, + AlignHCenter = 4, + AlignJustify = 8, + AlignHorizontal_Mask = AlignLeft|AlignRight|AlignHCenter|AlignJustify, + AlignTop = 16, + AlignBottom = 32, + AlignVCenter = 64, + AlignVertical_Mask = AlignTop|AlignBottom|AlignVCenter, + AlignCenter = AlignVCenter|AlignHCenter + } +} \ No newline at end of file diff --git a/qtsharp/src/bindings/static/ArrowType.cs b/qtsharp/src/bindings/static/ArrowType.cs new file mode 100644 index 00000000..0abb3468 --- /dev/null +++ b/qtsharp/src/bindings/static/ArrowType.cs @@ -0,0 +1,33 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum ArrowType { + UpArrow = 0, + DownArrow = 1, + LeftArrow = 2, + RightArrow = 3 + } +} \ No newline at end of file diff --git a/qtsharp/src/bindings/static/BGMode.cs b/qtsharp/src/bindings/static/BGMode.cs new file mode 100644 index 00000000..5ee8abdb --- /dev/null +++ b/qtsharp/src/bindings/static/BGMode.cs @@ -0,0 +1,31 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum BGMode { + TransparentMode = 0, + OpaqueMode = 1 + } +} \ No newline at end of file diff --git a/qtsharp/src/bindings/static/BackgroundMode.cs b/qtsharp/src/bindings/static/BackgroundMode.cs new file mode 100644 index 00000000..83100dc1 --- /dev/null +++ b/qtsharp/src/bindings/static/BackgroundMode.cs @@ -0,0 +1,49 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum BackgroundMode { + FixedColor = 0, + FixedPixmap = 1, + NoBackground = 2, + PaletteForeground = 3, + PaletteButton = 4, + PaletteLight = 5, + PaletteMidlight = 6, + PaletteDark = 7, + PaletteMid = 8, + PaletteText = 9, + PaletteBrightText = 10, + PaletteBase = 11, + PaletteBackground = 12, + PaletteShadow = 13, + PaletteHighlight = 14, + PaletteHighlightedText = 15, + PaletteButtonText = 16, + PaletteLink = 17, + PaletteLinkVisited = 18, + X11ParentRelative = 19 + } +} \ No newline at end of file diff --git a/qtsharp/src/bindings/static/BrushStyle.cs b/qtsharp/src/bindings/static/BrushStyle.cs new file mode 100644 index 00000000..4605dbed --- /dev/null +++ b/qtsharp/src/bindings/static/BrushStyle.cs @@ -0,0 +1,45 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum BrushStyle { + NoBrush = 0, + SolidPattern = 1, + Dense1Pattern = 2, + Dense2Pattern = 3, + Dense3Pattern = 4, + Dense4Pattern = 5, + Dense5Pattern = 6, + Dense6Pattern = 7, + Dense7Pattern = 8, + HorPattern = 9, + VerPattern = 10, + CrossPattern = 11, + BDiagPattern = 12, + FDiagPattern = 13, + DiagCrossPattern = 14, + CustomPattern = 24 + } +} diff --git a/qtsharp/src/bindings/static/ButtonState.cs b/qtsharp/src/bindings/static/ButtonState.cs new file mode 100644 index 00000000..9b058bd0 --- /dev/null +++ b/qtsharp/src/bindings/static/ButtonState.cs @@ -0,0 +1,40 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum ButtonState { + NoButton = 0, + LeftButton = 1, + RightButton = 2, + MidButton = 4, + MouseButtonMask = 255, + ShiftButton = 256, + ControlButton = 512, + AltButton = 1024, + MetaButton = 2048, + KeyButtonMask = 4095, + Keypad = 16384 + } +} \ No newline at end of file diff --git a/qtsharp/src/bindings/static/CursorShape.cs b/qtsharp/src/bindings/static/CursorShape.cs new file mode 100644 index 00000000..33f277e3 --- /dev/null +++ b/qtsharp/src/bindings/static/CursorShape.cs @@ -0,0 +1,47 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum CursorShape { + ArrowCursor = 0, + UpArrowCursor = 1, + CrossCursor = 2, + WaitCursor = 3, + IbeamCursor = 4, + SizeVerCursor = 5, + SizeHorCursor = 6, + SizeBDiagCursor = 7, + SizeFDiagCursor = 8, + SizeAllCursor = 9, + BlankCursor = 10, + SplitVCursor = 11, + SplitHCursor = 12, + PointingHandCursor = 13, + ForbiddenCursor = 14, + WhatsThisCursor = 15, + LastCursor = WhatsThisCursor, + BitmapCursor = 24 + } +} \ No newline at end of file diff --git a/qtsharp/src/bindings/static/DateFormat.cs b/qtsharp/src/bindings/static/DateFormat.cs new file mode 100644 index 00000000..6572b43b --- /dev/null +++ b/qtsharp/src/bindings/static/DateFormat.cs @@ -0,0 +1,32 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum DateFormat { + TextDate = 0, + ISODate = 1, + LocalDate = 2 + } +} \ No newline at end of file diff --git a/qtsharp/src/bindings/static/DeclareQtSignalAttribute.cs b/qtsharp/src/bindings/static/DeclareQtSignalAttribute.cs new file mode 100644 index 00000000..9d9dceed --- /dev/null +++ b/qtsharp/src/bindings/static/DeclareQtSignalAttribute.cs @@ -0,0 +1,16 @@ +namespace Qt { + using System; + + [AttributeUsage(AttributeTargets.Class, Inherited=true, AllowMultiple=true)] + public class DeclareQtSignalAttribute: Attribute { + private string signalName; + + internal string SignalName { + get { return signalName; } + } + + public DeclareQtSignalAttribute(string signalname) { + signalName = signalname.Replace(" ", ""); + } + } +} diff --git a/qtsharp/src/bindings/static/Dock.cs b/qtsharp/src/bindings/static/Dock.cs new file mode 100644 index 00000000..09f11da6 --- /dev/null +++ b/qtsharp/src/bindings/static/Dock.cs @@ -0,0 +1,43 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum Dock { + DockUnmanaged = 0, + DockTornOff = 1, + DockTop = 2, + DockBottom = 3, + DockRight = 4, + DockLeft = 5, + DockMinimized = 6, + Unmanaged = DockUnmanaged, + TornOff = DockTornOff, + Top = DockTop, + Bottom = DockBottom, + Right = DockRight, + Left = DockLeft, + Minimized = DockMinimized + } +} \ No newline at end of file diff --git a/qtsharp/src/bindings/static/GUIStyle.cs b/qtsharp/src/bindings/static/GUIStyle.cs new file mode 100644 index 00000000..d9e264b3 --- /dev/null +++ b/qtsharp/src/bindings/static/GUIStyle.cs @@ -0,0 +1,34 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum GUIStyle { + MacStyle = 0, + WindowsStyle = 1, + Win3Style = 2, + PMStyle = 3, + MotifStyle = 4 + } +} \ No newline at end of file diff --git a/qtsharp/src/bindings/static/IQMenuData.cs b/qtsharp/src/bindings/static/IQMenuData.cs new file mode 100644 index 00000000..2e1a5614 --- /dev/null +++ b/qtsharp/src/bindings/static/IQMenuData.cs @@ -0,0 +1,115 @@ +// QMenuData.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Collections; + + public interface IQMenuData { + Hashtable MenuConnections { get; } + uint Count (); + int InsertItem (string text, QObject receiver, string member, QKeySequence accel, int identifier, int index); + int InsertItem (QIconSet icon, string text, QObject receiver, string member, QKeySequence accel, int identifier, int index); + int InsertItem (QPixmap pixmap, QObject receiver, string member, QKeySequence accel, int identifier, int index); + int InsertItem (QIconSet icon, QPixmap pixmap, QObject receiver, string member, QKeySequence accel, int identifier, int index); + int InsertItem (string text, int identifier, int index); + int InsertItem (QIconSet icon, string text, int identifier, int index); + int InsertItem (string text, QPopupMenu popup, int identifier, int index); + int InsertItem (QIconSet icon, string text, QPopupMenu popup, int identifier, int index); + int InsertItem (QPixmap pixmap, int identifier, int index); + int InsertItem (QIconSet icon, QPixmap pixmap, int identifier, int index); + int InsertItem (QPixmap pixmap, QPopupMenu popup, int identifier, int index); + int InsertItem (QIconSet icon, QPixmap pixmap, QPopupMenu popup, int identifier, int index); + int InsertItem (QWidget widget, int identifier, int index); + int InsertItem (QIconSet icon, QCustomMenuItem custom, int identifier, int index); + int InsertItem (QCustomMenuItem custom, int identifier, int index); + int InsertSeparator (int index); + void RemoveItem (int identifier); + void RemoveItemAt (int index); + void Clear (); + QKeySequence Accel (int identifier); + void SetAccel (QKeySequence key, int identifier); + QIconSet IconSet (int identifier); + string Text (int identifier); + QPixmap Pixmap (int identifier); + void SetWhatsThis (int identifier, string arg1); + string WhatsThis (int identifier); + void ChangeItem (int identifier, string text); + void ChangeItem (int identifier, QPixmap pixmap); + void ChangeItem (int identifier, QIconSet icon, string text); + void ChangeItem (int identifier, QIconSet icon, QPixmap pixmap); + void ChangeItem (string text, int identifier); + void ChangeItem (QPixmap pixmap, int identifier); + void ChangeItem (QIconSet icon, string text, int identifier); + bool IsItemActive (int identifier); + bool IsItemEnabled (int identifier); + void SetItemEnabled (int identifier, bool enable); + bool IsItemChecked (int identifier); + void SetItemChecked (int identifier, bool check); + int IndexOf (int identifier); + void SetId (int index, int identifier); + bool ConnectItem (int identifier, QObject receiver, string member); + bool DisconnectItem (int identifier, QObject receiver, string member); + bool SetItemParameter (int identifier, int param); + int ItemParameter (int identifier); + QMenuItem FindItem (int identifier); + QMenuItem FindItem (int identifier, QMenuData parent); + QMenuItem FindPopup (QPopupMenu arg1, int[] index); + int InsertItem (string text, QObject receiver, string member); + int InsertItem (string text, QObject receiver, string member, QKeySequence accel); + int InsertItem (string text, QObject receiver, string member, QKeySequence accel, int identifier); + int InsertItem (QIconSet icon, string text, QObject receiver, string member); + int InsertItem (QIconSet icon, string text, QObject receiver, string member, QKeySequence accel); + int InsertItem (QIconSet icon, string text, QObject receiver, string member, QKeySequence accel, int identifier); + int InsertItem (QPixmap pixmap, QObject receiver, string member); + int InsertItem (QPixmap pixmap, QObject receiver, string member, QKeySequence accel); + int InsertItem (QPixmap pixmap, QObject receiver, string member, QKeySequence accel, int identifier); + int InsertItem (QIconSet icon, QPixmap pixmap, QObject receiver, string member); + int InsertItem (QIconSet icon, QPixmap pixmap, QObject receiver, string member, QKeySequence accel); + int InsertItem (QIconSet icon, QPixmap pixmap, QObject receiver, string member, QKeySequence accel, int identifier); + int InsertItem (string text); + int InsertItem (string text, int identifier); + int InsertItem (QIconSet icon, string text); + int InsertItem (QIconSet icon, string text, int identifier); + int InsertItem (string text, QPopupMenu popup); + int InsertItem (string text, QPopupMenu popup, int identifier); + int InsertItem (QIconSet icon, string text, QPopupMenu popup); + int InsertItem (QIconSet icon, string text, QPopupMenu popup, int identifier); + int InsertItem (QPixmap pixmap); + int InsertItem (QPixmap pixmap, int identifier); + int InsertItem (QIconSet icon, QPixmap pixmap); + int InsertItem (QIconSet icon, QPixmap pixmap, int identifier); + int InsertItem (QPixmap pixmap, QPopupMenu popup); + int InsertItem (QPixmap pixmap, QPopupMenu popup, int identifier); + int InsertItem (QIconSet icon, QPixmap pixmap, QPopupMenu popup); + int InsertItem (QIconSet icon, QPixmap pixmap, QPopupMenu popup, int identifier); + int InsertItem (QWidget widget); + int InsertItem (QWidget widget, int identifier); + int InsertItem (QIconSet icon, QCustomMenuItem custom); + int InsertItem (QIconSet icon, QCustomMenuItem custom, int identifier); + int InsertItem (QCustomMenuItem custom); + int InsertItem (QCustomMenuItem custom, int identifier); + int InsertSeparator (); + QMenuItem FindPopup (QPopupMenu arg1); + //IntPtr QMenuData (); + } +} diff --git a/qtsharp/src/bindings/static/ImageConversionFlags.cs b/qtsharp/src/bindings/static/ImageConversionFlags.cs new file mode 100644 index 00000000..010199bf --- /dev/null +++ b/qtsharp/src/bindings/static/ImageConversionFlags.cs @@ -0,0 +1,46 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum ImageConversionFlags { + ColorMode_Mask = 3, + AutoColor = 0, + ColorOnly = 3, + MonoOnly = 2, + AlphaDither_Mask = 12, + ThresholdAlphaDither = 0, + OrderedAlphaDither = 4, + DiffuseAlphaDither = 8, + NoAlpha = 12, + Dither_Mask = 48, + DiffuseDither = 0, + OrderedDither = 16, + ThresholdDither = 32, + DitherMode_Mask = 192, + AutoDither = 0, + PreferDither = 64, + AvoidDither = 128 + } +} diff --git a/qtsharp/src/bindings/static/Key.cs b/qtsharp/src/bindings/static/Key.cs new file mode 100644 index 00000000..1e02dd37 --- /dev/null +++ b/qtsharp/src/bindings/static/Key.cs @@ -0,0 +1,269 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum Key { + Key_Escape = 4096, + Key_Tab = 4097, + Key_Backtab = 4098, + Key_BackTab = Key_Backtab, + Key_Backspace = 4099, + Key_BackSpace = Key_Backspace, + Key_Return = 4100, + Key_Enter = 4101, + Key_Insert = 4102, + Key_Delete = 4103, + Key_Pause = 4104, + Key_Print = 4105, + Key_SysReq = 4106, + Key_Home = 4112, + Key_End = 4113, + Key_Left = 4114, + Key_Up = 4115, + Key_Right = 4116, + Key_Down = 4117, + Key_Prior = 4118, + Key_PageUp = Key_Prior, + Key_Next = 4119, + Key_PageDown = Key_Next, + Key_Shift = 4128, + Key_Control = 4129, + Key_Meta = 4130, + Key_Alt = 4131, + Key_CapsLock = 4132, + Key_NumLock = 4133, + Key_ScrollLock = 4134, + Key_F1 = 4144, + Key_F2 = 4145, + Key_F3 = 4146, + Key_F4 = 4147, + Key_F5 = 4148, + Key_F6 = 4149, + Key_F7 = 4150, + Key_F8 = 4151, + Key_F9 = 4152, + Key_F10 = 4153, + Key_F11 = 4154, + Key_F12 = 4155, + Key_F13 = 4156, + Key_F14 = 4157, + Key_F15 = 4158, + Key_F16 = 4159, + Key_F17 = 4160, + Key_F18 = 4161, + Key_F19 = 4162, + Key_F20 = 4163, + Key_F21 = 4164, + Key_F22 = 4165, + Key_F23 = 4166, + Key_F24 = 4167, + Key_F25 = 4168, + Key_F26 = 4169, + Key_F27 = 4170, + Key_F28 = 4171, + Key_F29 = 4172, + Key_F30 = 4173, + Key_F31 = 4174, + Key_F32 = 4175, + Key_F33 = 4176, + Key_F34 = 4177, + Key_F35 = 4178, + Key_Super_L = 4179, + Key_Super_R = 4180, + Key_Menu = 4181, + Key_Hyper_L = 4182, + Key_Hyper_R = 4183, + Key_Help = 4184, + Key_Direction_L = 4185, + Key_Direction_R = 4192, + Key_Space = 32, + Key_Any = Key_Space, + Key_Exclam = 33, + Key_QuoteDbl = 34, + Key_NumberSign = 35, + Key_Dollar = 36, + Key_Percent = 37, + Key_Ampersand = 38, + Key_Apostrophe = 39, + Key_ParenLeft = 40, + Key_ParenRight = 41, + Key_Asterisk = 42, + Key_Plus = 43, + Key_Comma = 44, + Key_Minus = 45, + Key_Period = 46, + Key_Slash = 47, + Key_0 = 48, + Key_1 = 49, + Key_2 = 50, + Key_3 = 51, + Key_4 = 52, + Key_5 = 53, + Key_6 = 54, + Key_7 = 55, + Key_8 = 56, + Key_9 = 57, + Key_Colon = 58, + Key_Semicolon = 59, + Key_Less = 60, + Key_Equal = 61, + Key_Greater = 62, + Key_Question = 63, + Key_At = 64, + Key_A = 65, + Key_B = 66, + Key_C = 67, + Key_D = 68, + Key_E = 69, + Key_F = 70, + Key_G = 71, + Key_H = 72, + Key_I = 73, + Key_J = 74, + Key_K = 75, + Key_L = 76, + Key_M = 77, + Key_N = 78, + Key_O = 79, + Key_P = 80, + Key_Q = 81, + Key_R = 82, + Key_S = 83, + Key_T = 84, + Key_U = 85, + Key_V = 86, + Key_W = 87, + Key_X = 88, + Key_Y = 89, + Key_Z = 90, + Key_BracketLeft = 91, + Key_Backslash = 92, + Key_BracketRight = 93, + Key_AsciiCircum = 94, + Key_Underscore = 95, + Key_QuoteLeft = 96, + Key_BraceLeft = 123, + Key_Bar = 124, + Key_BraceRight = 125, + Key_AsciiTilde = 126, + Key_nobreakspace = 160, + Key_exclamdown = 161, + Key_cent = 162, + Key_sterling = 163, + Key_currency = 164, + Key_yen = 165, + Key_brokenbar = 166, + Key_section = 167, + Key_diaeresis = 168, + Key_copyright = 169, + Key_ordfeminine = 170, + Key_guillemotleft = 171, + Key_notsign = 172, + Key_hyphen = 173, + Key_registered = 174, + Key_macron = 175, + Key_degree = 176, + Key_plusminus = 177, + Key_twosuperior = 178, + Key_threesuperior = 179, + Key_acute = 180, + Key_mu = 181, + Key_paragraph = 182, + Key_periodcentered = 183, + Key_cedilla = 184, + Key_onesuperior = 185, + Key_masculine = 186, + Key_guillemotright = 187, + Key_onequarter = 188, + Key_onehalf = 189, + Key_threequarters = 190, + Key_questiondown = 191, + Key_Agrave = 192, + Key_Aacute = 193, + Key_Acircumflex = 194, + Key_Atilde = 195, + Key_Adiaeresis = 196, + Key_Aring = 197, + Key_AE = 198, + Key_Ccedilla = 199, + Key_Egrave = 200, + Key_Eacute = 201, + Key_Ecircumflex = 202, + Key_Ediaeresis = 203, + Key_Igrave = 204, + Key_Iacute = 205, + Key_Icircumflex = 206, + Key_Idiaeresis = 207, + Key_ETH = 208, + Key_Ntilde = 209, + Key_Ograve = 210, + Key_Oacute = 211, + Key_Ocircumflex = 212, + Key_Otilde = 213, + Key_Odiaeresis = 214, + Key_multiply = 215, + Key_Ooblique = 216, + Key_Ugrave = 217, + Key_Uacute = 218, + Key_Ucircumflex = 219, + Key_Udiaeresis = 220, + Key_Yacute = 221, + Key_THORN = 222, + Key_ssharp = 223, + Key_agrave = 224, + Key_aacute = 225, + Key_acircumflex = 226, + Key_atilde = 227, + Key_adiaeresis = 228, + Key_aring = 229, + Key_ae = 230, + Key_ccedilla = 231, + Key_egrave = 232, + Key_eacute = 233, + Key_ecircumflex = 234, + Key_ediaeresis = 235, + Key_igrave = 236, + Key_iacute = 237, + Key_icircumflex = 238, + Key_idiaeresis = 239, + Key_eth = 240, + Key_ntilde = 241, + Key_ograve = 242, + Key_oacute = 243, + Key_ocircumflex = 244, + Key_otilde = 245, + Key_odiaeresis = 246, + Key_division = 247, + Key_oslash = 248, + Key_ugrave = 249, + Key_uacute = 250, + Key_ucircumflex = 251, + Key_udiaeresis = 252, + Key_yacute = 253, + Key_thorn = 254, + Key_ydiaeresis = 255, + Key_unknown = 65535 + } +} \ No newline at end of file diff --git a/qtsharp/src/bindings/static/Modifier.cs b/qtsharp/src/bindings/static/Modifier.cs new file mode 100644 index 00000000..74f1b376 --- /dev/null +++ b/qtsharp/src/bindings/static/Modifier.cs @@ -0,0 +1,35 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum Modifier { + SHIFT = 2097152, + CTRL = 4194304, + ALT = 8388608, + MODIFIER_MASK = 14680064, + UNICODE_ACCEL = 268435456, + ASCII_ACCEL = UNICODE_ACCEL + } +} \ No newline at end of file diff --git a/qtsharp/src/bindings/static/Orientation.cs b/qtsharp/src/bindings/static/Orientation.cs new file mode 100644 index 00000000..ab04bc29 --- /dev/null +++ b/qtsharp/src/bindings/static/Orientation.cs @@ -0,0 +1,31 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum Orientation { + Horizontal = 0, + Vertical = 1 + } +} diff --git a/qtsharp/src/bindings/static/PaintUnit.cs b/qtsharp/src/bindings/static/PaintUnit.cs new file mode 100644 index 00000000..44463912 --- /dev/null +++ b/qtsharp/src/bindings/static/PaintUnit.cs @@ -0,0 +1,35 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum PaintUnit { + PixelUnit = 0, + LoMetricUnit = 1, + HiMetricUnit = 2, + LoEnglishUnit = 3, + HiEnglishUnit = 4, + TwipsUnit = 5 + } +} \ No newline at end of file diff --git a/qtsharp/src/bindings/static/PenCapStyle.cs b/qtsharp/src/bindings/static/PenCapStyle.cs new file mode 100644 index 00000000..dc8cc5d9 --- /dev/null +++ b/qtsharp/src/bindings/static/PenCapStyle.cs @@ -0,0 +1,33 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum PenCapStyle { + FlatCap = 0, + SquareCap = 16, + RoundCap = 32, + MPenCapStyle = 48 + } +} \ No newline at end of file diff --git a/qtsharp/src/bindings/static/PenJoinStyle.cs b/qtsharp/src/bindings/static/PenJoinStyle.cs new file mode 100644 index 00000000..3d2d1fd6 --- /dev/null +++ b/qtsharp/src/bindings/static/PenJoinStyle.cs @@ -0,0 +1,33 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum PenJoinStyle { + MiterJoin = 0, + BevelJoin = 64, + RoundJoin = 128, + MPenJoinStyle = 192 + } +} \ No newline at end of file diff --git a/qtsharp/src/bindings/static/PenStyle.cs b/qtsharp/src/bindings/static/PenStyle.cs new file mode 100644 index 00000000..ce6ac476 --- /dev/null +++ b/qtsharp/src/bindings/static/PenStyle.cs @@ -0,0 +1,36 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum PenStyle { + NoPen = 0, + SolidLine = 1, + DashLine = 2, + DotLine = 3, + DashDotLine = 4, + DashDotDotLine = 5, + MPenStyle = 15 + } +} \ No newline at end of file diff --git a/qtsharp/src/bindings/static/QApplication.cs b/qtsharp/src/bindings/static/QApplication.cs new file mode 100644 index 00000000..ee7e443a --- /dev/null +++ b/qtsharp/src/bindings/static/QApplication.cs @@ -0,0 +1,1031 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Collections; + using System.Runtime.InteropServices; + + public class QApplication : QObject, IDisposable { + + public enum Type { + Tty = 0, + GuiClient = 1, + GuiServer = 2 + } + + public enum ColorMode { + NormalColors = 0, + CustomColors = 1 + } + + public enum ColorSpec { + NormalColor = 0, + CustomColor = 1, + ManyColor = 2 + } + + public enum Encoding { + DefaultCodec = 0, + UnicodeUTF8 = 1 + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_new_QApplication (int argc, string[] argv); + public QApplication (string[] argv) : this (QNull.Instance) + { + QObject.qApp = this; + qparent = null; + argv = ParseArguments (argv); + rawObject = qt_new_QApplication (argv.Length, argv); + RegisterObject (this); + RegisterEventDelegate (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_new_QApplication1 (int argc, string[] argv, bool GUIenabled); + public QApplication (string[] argv, bool GUIenabled) : this (QNull.Instance) + { + QObject.qApp = this; + qparent = null; + argv = ParseArguments (argv); + rawObject = qt_new_QApplication1 (argv.Length, argv, GUIenabled); + RegisterObject (this); + RegisterEventDelegate (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_new_QApplication2 (int argc, string[] argv, Type arg1); + public QApplication (string[] argv, Type arg1) : this (QNull.Instance) + { + QObject.qApp = this; + qparent = null; + argv = ParseArguments (argv); + rawObject = qt_new_QApplication2 (argv.Length, argv, arg1); + RegisterObject (this); + RegisterEventDelegate (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_new_QApplication3 (IntPtr dpy, uint visual, uint cmap); + public QApplication (IntPtr dpy, uint visual, uint cmap) : this (QNull.Instance) + { + QObject.qApp = this; + qparent = null; + rawObject = qt_new_QApplication3 (dpy, visual, cmap); + RegisterObject (this); + RegisterEventDelegate (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_new_QApplication4 (IntPtr dpy, int argc, string[] argv, uint visual, uint cmap); + public QApplication (IntPtr dpy, string[] argv, uint visual, uint cmap) : this (QNull.Instance) + { + QObject.qApp = this; + qparent = null; + argv = ParseArguments (argv); + rawObject = qt_new_QApplication4 (dpy, argv.Length, argv, visual, cmap); + RegisterObject (this); + RegisterEventDelegate (); + } + + public QApplication (IntPtr dpy) : this (dpy, (uint) 0) {} + + public QApplication (IntPtr dpy, uint visual) : this (dpy, visual, (uint) 0) {} + + public QApplication (IntPtr dpy, string[] argv) : this (dpy, argv, (uint) 0) {} + + public QApplication (IntPtr dpy, string[] argv, uint visual) : this (dpy, argv, visual, (uint) 0) {} + + internal QApplication () : this (QNull.Instance) {} + + internal QApplication (QNull dummy) : base (QNull.Instance) {} + + ~QApplication () + { + Dispose (false); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_del_QApplication (IntPtr obj); + internal override void Delete () + { + if (deleted) return; + + qt_del_QApplication (rawObject); + deleted = true; + } + + private string[] ParseArguments (string[] args) + { + ArrayList newargs = new ArrayList(); + + foreach (string arg in args) { + switch (arg) { + case "--qts-help": + PrintHelp (); + Environment.Exit(0); + break; + case "--qts-debug": + QtSupport.enableDebug = true; + break; + case "--qts-notracking": + QtSupport.disableTracking = true; + break; + case "--qts-trace-objects": + QtSupport.traceObjects = true; + break; + case "--qts-trace-connects": + QtSignal.traceConnects = true; + break; + case "--qts-trace-children": + QtSupport.traceChildren = true; + break; + default: + newargs.Add (arg); + break; + } + } + + return newargs.ToArray (typeof (string)) as string[]; + } + + private void PrintHelp () + { + Msg ("Qt# Options:"); + Msg (""); + Msg ("--qts-help\t\tDisplay help."); + Msg ("--qts-debug\t\tEnable debug mode."); + Msg ("--qts-notracking\tDisable object tracking."); + Msg ("--qts-trace-objects\tTrace object tracking."); + Msg ("--qts-trace-connects\tTrace signal connections."); + Msg ("--qts-trace-children\tTrace parent/child relationships."); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QApplication_argc (IntPtr raw); + public int Argc () + { + return qt_QApplication_argc (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern string[] qt_QApplication_argv (IntPtr raw); + public string[] Argv () + { + return qt_QApplication_argv (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern Type qt_QApplication_type (IntPtr raw); + public Type TheType () + { + return qt_QApplication_type (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_mainWidget (IntPtr raw); + public QWidget MainWidget () + { + return (QWidget)LookupObject (qt_QApplication_mainWidget (rawObject), typeof(QWidget)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_setMainWidget (IntPtr raw, IntPtr arg1); + public void SetMainWidget (QWidget arg1) + { + qt_QApplication_setMainWidget (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_polish (IntPtr raw, IntPtr arg1); + public void Polish (QWidget arg1) + { + qt_QApplication_polish (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_focusWidget (IntPtr raw); + public QWidget FocusWidget () + { + return (QWidget)LookupObject (qt_QApplication_focusWidget (rawObject), typeof(QWidget)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_activeWindow (IntPtr raw); + public QWidget ActiveWindow () + { + return (QWidget)LookupObject (qt_QApplication_activeWindow (rawObject), typeof(QWidget)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QApplication_exec (IntPtr raw); + public int Exec () + { + return qt_QApplication_exec (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_processEvents (IntPtr raw); + public void ProcessEvents () + { + qt_QApplication_processEvents (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_processEvents1 (IntPtr raw, int maxtime); + public void ProcessEvents (int maxtime) + { + qt_QApplication_processEvents1 (rawObject, maxtime); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QApplication_hasPendingEvents (IntPtr raw); + public bool HasPendingEvents () + { + return qt_QApplication_hasPendingEvents (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QApplication_enter_loop (IntPtr raw); + public int Enter_loop () + { + return qt_QApplication_enter_loop (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_exit_loop (IntPtr raw); + public void Exit_loop () + { + qt_QApplication_exit_loop (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QApplication_loopLevel (IntPtr raw); + public int LoopLevel () + { + return qt_QApplication_loopLevel (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QApplication_notify (IntPtr raw, IntPtr arg1, IntPtr arg2); + public bool Notify (QObject arg1, QEvent arg2) + { + return qt_QApplication_notify (rawObject, arg1.RawObject, arg2.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_setDefaultCodec (IntPtr raw, IntPtr arg1); + public void SetDefaultCodec (QTextCodec arg1) + { + qt_QApplication_setDefaultCodec (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_defaultCodec (IntPtr raw); + public QTextCodec DefaultCodec () + { + return (QTextCodec)LookupObject (qt_QApplication_defaultCodec (rawObject), typeof(QTextCodec)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_installTranslator (IntPtr raw, IntPtr arg1); + public void InstallTranslator (QTranslator arg1) + { + qt_QApplication_installTranslator (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_removeTranslator (IntPtr raw, IntPtr arg1); + public void RemoveTranslator (QTranslator arg1) + { + qt_QApplication_removeTranslator (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_translate (IntPtr raw, string context, string key, string comment, Encoding encoding); + public string Translate (string context, string key, string comment, Encoding encoding) + { + QString qstr = new QString (qt_QApplication_translate (rawObject, context, key, comment, encoding)); + string str = qstr.Latin1 (); + qstr.Dispose (); + return str; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QApplication_macEventFilter (IntPtr raw, IntPtr arg1); + public bool MacEventFilter (IntPtr arg1) + { + return qt_QApplication_macEventFilter (rawObject, arg1); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QApplication_winEventFilter (IntPtr raw, IntPtr arg1); + public bool WinEventFilter (IntPtr arg1) + { + return qt_QApplication_winEventFilter (rawObject, arg1); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QApplication_x11EventFilter (IntPtr raw, IntPtr arg1); + public bool X11EventFilter (IntPtr arg1) + { + return qt_QApplication_x11EventFilter (rawObject, arg1); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QApplication_x11ClientMessage (IntPtr raw, IntPtr arg1, IntPtr arg2, bool passive_only); + public int X11ClientMessage (QWidget arg1, IntPtr arg2, bool passive_only) + { + return qt_QApplication_x11ClientMessage (rawObject, arg1.RawObject, arg2, passive_only); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QApplication_qwsEventFilter (IntPtr raw, IntPtr arg1); + public bool QwsEventFilter (IntPtr arg1) + { + return qt_QApplication_qwsEventFilter (rawObject, arg1); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_qwsSetCustomColors (IntPtr raw, int colortable, int start, int numColors); + public void QwsSetCustomColors (int colortable, int start, int numColors) + { + qt_QApplication_qwsSetCustomColors (rawObject, colortable, start, numColors); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_winFocus (IntPtr raw, IntPtr arg1, bool arg2); + public void WinFocus (QWidget arg1, bool arg2) + { + qt_QApplication_winFocus (rawObject, arg1.RawObject, arg2); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QApplication_isSessionRestored (IntPtr raw); + public bool IsSessionRestored () + { + return qt_QApplication_isSessionRestored (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_sessionId (IntPtr raw); + public string SessionId () + { + QString qstr = new QString (qt_QApplication_sessionId (rawObject)); + string str = qstr.Latin1 (); + qstr.Dispose (); + return str; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_commitData (IntPtr raw, IntPtr sm); + public void CommitData (QSessionManager sm) + { + qt_QApplication_commitData (rawObject, sm.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_saveState (IntPtr raw, IntPtr sm); + public void SaveState (QSessionManager sm) + { + qt_QApplication_saveState (rawObject, sm.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_wakeUpGuiThread (IntPtr raw); + public void WakeUpGuiThread () + { + qt_QApplication_wakeUpGuiThread (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_lock (IntPtr raw); + public void Q_lock () + { + qt_QApplication_lock (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_unlock (IntPtr raw, bool wakeUpGui); + public void Unlock (bool wakeUpGui) + { + qt_QApplication_unlock (rawObject, wakeUpGui); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QApplication_locked (IntPtr raw); + public bool Locked () + { + return qt_QApplication_locked (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QApplication_tryLock (IntPtr raw); + public bool TryLock () + { + return qt_QApplication_tryLock (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_setEnableRemoteControl (IntPtr raw, bool enable, IntPtr appId); + public void SetEnableRemoteControl (bool enable, QUuid appId) + { + qt_QApplication_setEnableRemoteControl (rawObject, enable, appId.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QApplication_remoteControlEnabled (IntPtr raw); + public bool RemoteControlEnabled () + { + return qt_QApplication_remoteControlEnabled (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_applicationId (IntPtr raw); + public QUuid ApplicationId () + { + return (QUuid)LookupObject (qt_QApplication_applicationId (rawObject), typeof(QUuid)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_quit (IntPtr raw); + public void Quit () + { + qt_QApplication_quit (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_closeAllWindows (IntPtr raw); + public void CloseAllWindows () + { + qt_QApplication_closeAllWindows (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_style (); + public static QStyle Style () + { + return (QStyle)LookupObject (qt_QApplication_style (), typeof(QStyle)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_setStyle (IntPtr arg1); + public static void SetStyle (QStyle arg1) + { + qt_QApplication_setStyle (arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_setStyle1 (IntPtr arg1); + public static QStyle SetStyle (string arg1) + { + return (QStyle)LookupObject (qt_QApplication_setStyle1 (new QString (arg1).RawObject), typeof(QStyle)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern ColorMode qt_QApplication_colorMode (); + public static ColorMode TheColorMode () + { + return qt_QApplication_colorMode (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_setColorMode (QApplication.ColorMode arg1); + public static void SetColorMode (QApplication.ColorMode arg1) + { + qt_QApplication_setColorMode (arg1); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QApplication_colorSpec (); + public static int TheColorSpec () + { + return qt_QApplication_colorSpec (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_setColorSpec (int arg1); + public static void SetColorSpec (int arg1) + { + qt_QApplication_setColorSpec (arg1); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_overrideCursor (); + public static QCursor OverrideCursor () + { + return (QCursor)LookupObject (qt_QApplication_overrideCursor (), typeof(QCursor)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_setOverrideCursor (IntPtr arg1, bool replace); + public static void SetOverrideCursor (QCursor arg1, bool replace) + { + qt_QApplication_setOverrideCursor (arg1.RawObject, replace); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_restoreOverrideCursor (); + public static void RestoreOverrideCursor () + { + qt_QApplication_restoreOverrideCursor (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QApplication_hasGlobalMouseTracking (); + public static bool HasGlobalMouseTracking () + { + return qt_QApplication_hasGlobalMouseTracking (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_setGlobalMouseTracking (bool enable); + public static void SetGlobalMouseTracking (bool enable) + { + qt_QApplication_setGlobalMouseTracking (enable); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_palette (IntPtr arg1); + public static QPalette Palette (QWidget arg1) + { + return (QPalette)LookupObject (qt_QApplication_palette (arg1.RawObject), typeof(QPalette)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_setPalette (IntPtr arg1, bool informWidgets, string className); + public static void SetPalette (QPalette arg1, bool informWidgets, string className) + { + qt_QApplication_setPalette (arg1.RawObject, informWidgets, className); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_font (IntPtr arg1); + public static QFont Font (QWidget arg1) + { + return (QFont)LookupObject (qt_QApplication_font (arg1.RawObject), typeof(QFont)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_setFont (IntPtr arg1, bool informWidgets, string className); + public static void SetFont (QFont arg1, bool informWidgets, string className) + { + qt_QApplication_setFont (arg1.RawObject, informWidgets, className); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_fontMetrics (); + public static QFontMetrics FontMetrics () + { + return (QFontMetrics)LookupObject (qt_QApplication_fontMetrics (), typeof(QFontMetrics)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_allWidgets (); + public static QWidgetList AllWidgets () + { + return (QWidgetList)LookupObject (qt_QApplication_allWidgets (), typeof(QWidgetList)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_topLevelWidgets (); + public static QWidgetList TopLevelWidgets () + { + return (QWidgetList)LookupObject (qt_QApplication_topLevelWidgets (), typeof(QWidgetList)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_desktop (); + public static QDesktopWidget Desktop () + { + return (QDesktopWidget)LookupObject (qt_QApplication_desktop (), typeof(QDesktopWidget)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_activePopupWidget (); + public static QWidget ActivePopupWidget () + { + return (QWidget)LookupObject (qt_QApplication_activePopupWidget (), typeof(QWidget)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_activeModalWidget (); + public static QWidget ActiveModalWidget () + { + return (QWidget)LookupObject (qt_QApplication_activeModalWidget (), typeof(QWidget)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_clipboard (); + public static QClipboard Clipboard () + { + return (QClipboard)LookupObject (qt_QApplication_clipboard (), typeof(QClipboard)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_widgetAt (int x, int y, bool child); + public static QWidget WidgetAt (int x, int y, bool child) + { + return (QWidget)LookupObject (qt_QApplication_widgetAt (x, y, child), typeof(QWidget)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_widgetAt1 (IntPtr arg1, bool child); + public static QWidget WidgetAt (QPoint arg1, bool child) + { + return (QWidget)LookupObject (qt_QApplication_widgetAt1 (arg1.RawObject, child), typeof(QWidget)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_exit (int retcode); + public static void Exit (int retcode) + { + qt_QApplication_exit (retcode); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_sendPostedEvents (IntPtr receiver, int event_type); + public static void SendPostedEvents (QObject receiver, int event_type) + { + qt_QApplication_sendPostedEvents (receiver.RawObject, event_type); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_sendPostedEvents1 (); + public static void SendPostedEvents () + { + qt_QApplication_sendPostedEvents1 (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_removePostedEvents (IntPtr receiver); + public static void RemovePostedEvents (QObject receiver) + { + qt_QApplication_removePostedEvents (receiver.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QApplication_startingUp (); + public static bool StartingUp () + { + return qt_QApplication_startingUp (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QApplication_closingDown (); + public static bool ClosingDown () + { + return qt_QApplication_closingDown (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_flushX (); + public static void FlushX () + { + qt_QApplication_flushX (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_flush (); + public static void Flush () + { + qt_QApplication_flush (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_syncX (); + public static void SyncX () + { + qt_QApplication_syncX (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_beep (); + public static void Beep () + { + qt_QApplication_beep (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_setWinStyleHighlightColor (IntPtr c); + public static void SetWinStyleHighlightColor (QColor c) + { + qt_QApplication_setWinStyleHighlightColor (c.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_winStyleHighlightColor (); + public static QColor WinStyleHighlightColor () + { + return (QColor)LookupObject (qt_QApplication_winStyleHighlightColor (), typeof(QColor)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_setDesktopSettingsAware (bool arg1); + public static void SetDesktopSettingsAware (bool arg1) + { + qt_QApplication_setDesktopSettingsAware (arg1); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QApplication_desktopSettingsAware (); + public static bool DesktopSettingsAware () + { + return qt_QApplication_desktopSettingsAware (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_setCursorFlashTime (int arg1); + public static void SetCursorFlashTime (int arg1) + { + qt_QApplication_setCursorFlashTime (arg1); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QApplication_cursorFlashTime (); + public static int CursorFlashTime () + { + return qt_QApplication_cursorFlashTime (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_setDoubleClickInterval (int arg1); + public static void SetDoubleClickInterval (int arg1) + { + qt_QApplication_setDoubleClickInterval (arg1); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QApplication_doubleClickInterval (); + public static int DoubleClickInterval () + { + return qt_QApplication_doubleClickInterval (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_setWheelScrollLines (int arg1); + public static void SetWheelScrollLines (int arg1) + { + qt_QApplication_setWheelScrollLines (arg1); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QApplication_wheelScrollLines (); + public static int WheelScrollLines () + { + return qt_QApplication_wheelScrollLines (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_setGlobalStrut (IntPtr arg1); + public static void SetGlobalStrut (QSize arg1) + { + qt_QApplication_setGlobalStrut (arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_globalStrut (); + public static QSize GlobalStrut () + { + return (QSize)LookupObject (qt_QApplication_globalStrut (), typeof(QSize)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_setLibraryPaths (IntPtr arg1); + public static void SetLibraryPaths (QStringList arg1) + { + qt_QApplication_setLibraryPaths (arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_libraryPaths (); + public static QStringList LibraryPaths () + { + return (QStringList)LookupObject (qt_QApplication_libraryPaths (), typeof(QStringList)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_addLibraryPath (IntPtr arg1); + public static void AddLibraryPath (string arg1) + { + qt_QApplication_addLibraryPath (new QString (arg1).RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_removeLibraryPath (IntPtr arg1); + public static void RemoveLibraryPath (string arg1) + { + qt_QApplication_removeLibraryPath (new QString (arg1).RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_setStartDragTime (int ms); + public static void SetStartDragTime (int ms) + { + qt_QApplication_setStartDragTime (ms); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QApplication_startDragTime (); + public static int StartDragTime () + { + return qt_QApplication_startDragTime (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_setStartDragDistance (int l); + public static void SetStartDragDistance (int l) + { + qt_QApplication_setStartDragDistance (l); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QApplication_startDragDistance (); + public static int StartDragDistance () + { + return qt_QApplication_startDragDistance (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_setReverseLayout (bool b); + public static void SetReverseLayout (bool b) + { + qt_QApplication_setReverseLayout (b); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QApplication_reverseLayout (); + public static bool ReverseLayout () + { + return qt_QApplication_reverseLayout (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QApplication_horizontalAlignment (int align); + public static int HorizontalAlignment (int align) + { + return qt_QApplication_horizontalAlignment (align); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QApplication_isEffectEnabled (Qt.UIEffect arg1); + public static bool IsEffectEnabled (Qt.UIEffect arg1) + { + return qt_QApplication_isEffectEnabled (arg1); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_setEffectEnabled (Qt.UIEffect arg1, bool enable); + public static void SetEffectEnabled (Qt.UIEffect arg1, bool enable) + { + qt_QApplication_setEffectEnabled (arg1, enable); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QApplication_qwsDecoration (); + public static IntPtr QwsDecoration () + { + return qt_QApplication_qwsDecoration (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_qwsSetDecoration (IntPtr arg1); + public static void QwsSetDecoration (IntPtr arg1) + { + qt_QApplication_qwsSetDecoration (arg1); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern Qt.WindowsVersion qt_QApplication_winVersion (); + public static Qt.WindowsVersion WinVersion () + { + return qt_QApplication_winVersion (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_winMouseButtonUp (); + public static void WinMouseButtonUp () + { + qt_QApplication_winMouseButtonUp (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_create_xim (); + public static void Create_xim () + { + qt_QApplication_create_xim (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QApplication_close_xim (); + public static void Close_xim () + { + qt_QApplication_close_xim (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QApplication_x11_apply_settings (); + public static bool X11_apply_settings () + { + return qt_QApplication_x11_apply_settings (); + } + + public string Translate (string context, string key) + { + return Translate(context, key, ""); + } + + public string Translate (string context, string key, string comment) + { + return Translate(context, key, comment, Encoding.DefaultCodec); + } + + public void Unlock () + { + Unlock(true); + } + + public void SetEnableRemoteControl (bool enable) + { + SetEnableRemoteControl(enable, new QUuid ()); + } + + public static void SetOverrideCursor (QCursor arg1) + { + SetOverrideCursor(arg1, false); + } + + public static QPalette Palette () + { + return Palette(new QWidget ()); + } + + public static void SetPalette (QPalette arg1) + { + SetPalette(arg1, false); + } + + public static void SetPalette (QPalette arg1, bool informWidgets) + { + SetPalette(arg1, informWidgets, ""); + } + + public static QFont Font () + { + return Font(new QWidget ()); + } + + public static void SetFont (QFont arg1) + { + SetFont(arg1, false); + } + + public static void SetFont (QFont arg1, bool informWidgets) + { + SetFont(arg1, informWidgets, ""); + } + + public static QWidget WidgetAt (int x, int y) + { + return WidgetAt(x, y, false); + } + + public static QWidget WidgetAt (QPoint arg1) + { + return WidgetAt(arg1, false); + } + + public static void Exit () + { + Exit((int) 0); + } + + public static void SetEffectEnabled (Qt.UIEffect arg1) + { + SetEffectEnabled(arg1, true); + } + + // Begin interface methods. + + } +} diff --git a/qtsharp/src/bindings/static/QByteArray.cs b/qtsharp/src/bindings/static/QByteArray.cs new file mode 100644 index 00000000..5bb37574 --- /dev/null +++ b/qtsharp/src/bindings/static/QByteArray.cs @@ -0,0 +1,84 @@ +// QByteArray.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public class QByteArray : QMemArray, IDisposable { + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_new_QByteArray (); + public QByteArray () : this (QNull.Instance) + { + rawObject = qt_new_QByteArray (); + RegisterObject (this); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_new_QByteArray1 (int size); + public QByteArray (int size) : this (QNull.Instance) + { + rawObject = qt_new_QByteArray1 (size); + RegisterObject (this); + } + + internal QByteArray (IntPtr ptr) : this (QNull.Instance) + { + rawObject = ptr; + RegisterObject(this); + } + + internal QByteArray (QNull dummy) : base (QNull.Instance) {} + + ~QByteArray () + { + Dispose (false); + } + + internal override void Delete () + { + if (deleted) return; + + // libqtc lacks a qt_del_QByteArray function + deleted = true; + } + + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QByteArray_assign1 + (IntPtr rawObject, [MarshalAs(UnmanagedType.LPArray)] byte[] b, + uint length ); + + public static implicit operator QByteArray (byte[] bArray) + { + QByteArray qbArray = new QByteArray (bArray.Length); + qbArray.rawObject = + qt_QByteArray_assign1 (qbArray.rawObject, bArray, (uint) bArray.Length); + GC.KeepAlive (bArray); + return qbArray; + } + + // Begin interface methods. + + } +} diff --git a/qtsharp/src/bindings/static/QCallBack.cs b/qtsharp/src/bindings/static/QCallBack.cs new file mode 100644 index 00000000..e3ae5c94 --- /dev/null +++ b/qtsharp/src/bindings/static/QCallBack.cs @@ -0,0 +1,37 @@ +// QCallBack.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// + +namespace Qt { + + using Qt; + using System; + using System.Reflection; + + public class QCallBack { + + public Object receiver; + public MethodInfo info; + + public QCallBack (Object receiver, MethodInfo info) + { + this.receiver = receiver; + this.info = info; + } + } +} diff --git a/qtsharp/src/bindings/static/QEventArgs.cs b/qtsharp/src/bindings/static/QEventArgs.cs new file mode 100644 index 00000000..f4264911 --- /dev/null +++ b/qtsharp/src/bindings/static/QEventArgs.cs @@ -0,0 +1,42 @@ +// QEventArgs.cs - QEventArgs c-sharp support file +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// + +namespace Qt { + + using Qt; + using System; + + public class QEventArgs : EventArgs { + private QEvent qevent; + private string name; + + public QEvent Event { + get { return qevent; } + } + + public string Name { + get { return name; } + } + + public QEventArgs(string n, QEvent e) { + qevent = e; + name = n; + } + } +} \ No newline at end of file diff --git a/qtsharp/src/bindings/static/QEventList.cs b/qtsharp/src/bindings/static/QEventList.cs new file mode 100644 index 00000000..d10afb71 --- /dev/null +++ b/qtsharp/src/bindings/static/QEventList.cs @@ -0,0 +1,55 @@ +// QtSupport.cs - QtSupport c-sharp support file +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// + +namespace Qt { + + using System; + using System.Collections; + + internal class QEventList + { + private Hashtable events; + + internal QEventList () + { + events = new Hashtable (); + } + + internal void Add (String name, System.Delegate handler) + { + if (events [name] == null) + events.Add (name, new ArrayList ()); + + ((ArrayList)events [name]).Add (handler); + } + + internal void Remove (String name, System.Delegate handler) + { + if (events [name] == null) + return; + + ((ArrayList)events [name]).Remove (handler); + } + + internal ArrayList QEventHandlers (String name) + { + return (ArrayList)events [name]; + } + } +} diff --git a/qtsharp/src/bindings/static/QGL.cs b/qtsharp/src/bindings/static/QGL.cs new file mode 100644 index 00000000..f95a645f --- /dev/null +++ b/qtsharp/src/bindings/static/QGL.cs @@ -0,0 +1,49 @@ +// QGL.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + + public class QGL { + + public enum FormatOption { + DoubleBuffer = 1, + DepthBuffer = 2, + Rgba = 4, + AlphaChannel = 8, + AccumBuffer = 16, + StencilBuffer = 32, + StereoBuffers = 64, + DirectRendering = 128, + HasOverlay = 256, + SingleBuffer = DoubleBuffer << 16, + NoDepthBuffer = DepthBuffer << 16, + ColorIndex = Rgba << 16, + NoAlphaChannel = AlphaChannel << 16, + NoAccumBuffer = AccumBuffer << 16, + NoStencilBuffer = StencilBuffer << 16, + NoStereoBuffers = StereoBuffers << 16, + IndirectRendering = DirectRendering << 16, + NoOverlay = HasOverlay << 16 + } + + } +} diff --git a/qtsharp/src/bindings/static/QMenuBar.cs b/qtsharp/src/bindings/static/QMenuBar.cs new file mode 100644 index 00000000..405d7dd0 --- /dev/null +++ b/qtsharp/src/bindings/static/QMenuBar.cs @@ -0,0 +1,815 @@ +// QMenuBar.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Regenerated by Adam Treat on August 03 2002 +// +// TODO +// o Override Dispose method, make sure slots are disconnected. + +namespace Qt { + + using Qt; + using System; + using System.Collections; + using System.Runtime.InteropServices; + + public class QMenuBar : QFrame, IQMenuData, IDisposable { + + private Hashtable menuConnections; + + public Hashtable MenuConnections { + get { return menuConnections; } + } + + public enum Separator { + Never = 0, + InWindowsStyle = 1 + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_new_QMenuBar (IntPtr parent, string name); + public QMenuBar (QWidget parent, string name) : this (QNull.Instance) + { + qparent = parent; + if (qparent == null) parent = new QWidget (IntPtr.Zero); + rawObject = qt_new_QMenuBar (parent.RawObject, name); + if (qparent == null) RegisterObject (this); + else qparent.AddChild (this); + } + + public QMenuBar () : this (new QWidget ()) {} + + public QMenuBar (QWidget parent) : this (parent, "") {} + + internal QMenuBar (IntPtr ptr) : this (QNull.Instance) + { + rawObject = ptr; + RegisterObject(this); + } + + internal QMenuBar (QNull dummy) : base (QNull.Instance) + { + menuConnections = new Hashtable(); + } + + ~QMenuBar () + { + Dispose (false); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_del_QMenuBar (IntPtr obj); + internal override void Delete () + { + if (deleted) return; + + qt_del_QMenuBar (rawObject); + deleted = true; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuBar_updateItem (IntPtr raw, int identifier); + public void UpdateItem (int identifier) + { + qt_QMenuBar_updateItem (rawObject, identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuBar_show (IntPtr raw); + public void Show () + { + qt_QMenuBar_show (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuBar_hide (IntPtr raw); + public void Hide () + { + qt_QMenuBar_hide (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QMenuBar_eventFilter (IntPtr raw, IntPtr arg1, IntPtr arg2); + public bool EventFilter (QObject arg1, QEvent arg2) + { + return qt_QMenuBar_eventFilter (rawObject, arg1.RawObject, arg2.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuBar_heightForWidth (IntPtr raw, int arg1); + public int HeightForWidth (int arg1) + { + return qt_QMenuBar_heightForWidth (rawObject, arg1); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern QMenuBar.Separator qt_QMenuBar_separator (IntPtr raw); + public QMenuBar.Separator TheSeparator () + { + return qt_QMenuBar_separator (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuBar_setSeparator (IntPtr raw, QMenuBar.Separator when); + public void SetSeparator (QMenuBar.Separator when) + { + qt_QMenuBar_setSeparator (rawObject, when); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuBar_setDefaultUp (IntPtr raw, bool arg1); + public void SetDefaultUp (bool arg1) + { + qt_QMenuBar_setDefaultUp (rawObject, arg1); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QMenuBar_isDefaultUp (IntPtr raw); + public bool IsDefaultUp () + { + return qt_QMenuBar_isDefaultUp (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QMenuBar_customWhatsThis (IntPtr raw); + public bool CustomWhatsThis () + { + return qt_QMenuBar_customWhatsThis (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuBar_sizeHint (IntPtr raw); + public QSize SizeHint () + { + return (QSize)LookupObject (qt_QMenuBar_sizeHint (rawObject), typeof(QSize)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuBar_minimumSize (IntPtr raw); + public QSize MinimumSize () + { + return (QSize)LookupObject (qt_QMenuBar_minimumSize (rawObject), typeof(QSize)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuBar_minimumSizeHint (IntPtr raw); + public QSize MinimumSizeHint () + { + return (QSize)LookupObject (qt_QMenuBar_minimumSizeHint (rawObject), typeof(QSize)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuBar_activateItemAt (IntPtr raw, int index); + public void ActivateItemAt (int index) + { + qt_QMenuBar_activateItemAt (rawObject, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuBar_initialize (); + public static void Initialize () + { + qt_QMenuBar_initialize (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuBar_cleanup (); + public static void Cleanup () + { + qt_QMenuBar_cleanup (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuBar_drawContents (IntPtr raw, IntPtr arg1); + protected void DrawContents (QPainter arg1) + { + qt_QMenuBar_drawContents (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuBar_fontChange (IntPtr raw, IntPtr arg1); + protected void FontChange (QFont arg1) + { + qt_QMenuBar_fontChange (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuBar_menuContentsChanged (IntPtr raw); + protected void MenuContentsChanged () + { + qt_QMenuBar_menuContentsChanged (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuBar_menuStateChanged (IntPtr raw); + protected void MenuStateChanged () + { + qt_QMenuBar_menuStateChanged (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuBar_styleChange (IntPtr raw, IntPtr arg1); + protected void StyleChange (QStyle arg1) + { + qt_QMenuBar_styleChange (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuBar_itemAtPos (IntPtr raw, IntPtr arg1); + protected int ItemAtPos (QPoint arg1) + { + return qt_QMenuBar_itemAtPos (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuBar_hidePopups (IntPtr raw); + protected void HidePopups () + { + qt_QMenuBar_hidePopups (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuBar_itemRect (IntPtr raw, int item); + protected QRect ItemRect (int item) + { + return (QRect)LookupObject (qt_QMenuBar_itemRect (rawObject, item), typeof(QRect)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuBar_QMenuData (IntPtr raw); + public IntPtr QMenuData () + { + return qt_QMenuBar_QMenuData (rawObject); + } + + // Begin interface methods. + + + //********************* A temporary hack to divert connections to CSharpConnect *****************// + + // This makes my brain hurt! + // :-) Mine too! + + public int InsertItem (string text, QObject receiver, string member, QKeySequence accel, int identifier, int index) + { + int id = InsertItem (text, identifier, index); + SetAccel (accel, id); + ConnectItem (id, receiver, member); + return id; + } + + public int InsertItem (QIconSet icon, string text, QObject receiver, string member, QKeySequence accel, int identifier, int index) + { + int id = InsertItem (icon, text, identifier, index); + SetAccel (accel, id); + ConnectItem (id, receiver, member); + return id; + } + + public int InsertItem (QPixmap pixmap, QObject receiver, string member, QKeySequence accel, int identifier, int index) + { + int id = InsertItem (pixmap, identifier, index); + SetAccel (accel, id); + ConnectItem (id, receiver, member); + return id; + } + + public int InsertItem (QIconSet icon, QPixmap pixmap, QObject receiver, string member, QKeySequence accel, int identifier, int index) + { + int id = InsertItem (icon, pixmap, identifier, index); + SetAccel (accel, id); + ConnectItem (id, receiver, member); + return id; + } + + public bool ConnectItem (int identifier, QObject receiver, string member) + { + return Qt.QMenuData.ConnectItem (this, QMenuData (), identifier, receiver, member); + + } + + public bool DisconnectItem (int identifier, QObject receiver, string member) + { + return Qt.QMenuData.DisconnectItem (this, QMenuData (), identifier, receiver, member); + } + + //********************* A temporary hack to divert connections to CSharpConnect *****************// + + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern uint qt_QMenuData_count (IntPtr raw); + public uint Count () + { + return qt_QMenuData_count (QMenuData ()); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem4 (IntPtr raw, IntPtr text, int identifier, int index); + public int InsertItem (string text, int identifier, int index) + { + return qt_QMenuData_insertItem4 (QMenuData (), new QString (text).RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem5 (IntPtr raw, IntPtr icon, IntPtr text, int identifier, int index); + public int InsertItem (QIconSet icon, string text, int identifier, int index) + { + return qt_QMenuData_insertItem5 (QMenuData (), icon.RawObject, new QString (text).RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem6 (IntPtr raw, IntPtr text, IntPtr popup, int identifier, int index); + public int InsertItem (string text, QPopupMenu popup, int identifier, int index) + { + return qt_QMenuData_insertItem6 (QMenuData (), new QString (text).RawObject, popup.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem7 (IntPtr raw, IntPtr icon, IntPtr text, IntPtr popup, int identifier, int index); + public int InsertItem (QIconSet icon, string text, QPopupMenu popup, int identifier, int index) + { + return qt_QMenuData_insertItem7 (QMenuData (), icon.RawObject, new QString (text).RawObject, popup.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem8 (IntPtr raw, IntPtr pixmap, int identifier, int index); + public int InsertItem (QPixmap pixmap, int identifier, int index) + { + return qt_QMenuData_insertItem8 (QMenuData (), pixmap.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem9 (IntPtr raw, IntPtr icon, IntPtr pixmap, int identifier, int index); + public int InsertItem (QIconSet icon, QPixmap pixmap, int identifier, int index) + { + return qt_QMenuData_insertItem9 (QMenuData (), icon.RawObject, pixmap.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem10 (IntPtr raw, IntPtr pixmap, IntPtr popup, int identifier, int index); + public int InsertItem (QPixmap pixmap, QPopupMenu popup, int identifier, int index) + { + return qt_QMenuData_insertItem10 (QMenuData (), pixmap.RawObject, popup.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem11 (IntPtr raw, IntPtr icon, IntPtr pixmap, IntPtr popup, int identifier, int index); + public int InsertItem (QIconSet icon, QPixmap pixmap, QPopupMenu popup, int identifier, int index) + { + return qt_QMenuData_insertItem11 (QMenuData (), icon.RawObject, pixmap.RawObject, popup.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem12 (IntPtr raw, IntPtr widget, int identifier, int index); + public int InsertItem (QWidget widget, int identifier, int index) + { + return qt_QMenuData_insertItem12 (QMenuData (), widget.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem13 (IntPtr raw, IntPtr icon, IntPtr custom, int identifier, int index); + public int InsertItem (QIconSet icon, QCustomMenuItem custom, int identifier, int index) + { + return qt_QMenuData_insertItem13 (QMenuData (), icon.RawObject, custom.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem14 (IntPtr raw, IntPtr custom, int identifier, int index); + public int InsertItem (QCustomMenuItem custom, int identifier, int index) + { + return qt_QMenuData_insertItem14 (QMenuData (), custom.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertSeparator (IntPtr raw, int index); + public int InsertSeparator (int index) + { + return qt_QMenuData_insertSeparator (QMenuData (), index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_removeItem (IntPtr raw, int identifier); + public void RemoveItem (int identifier) + { + qt_QMenuData_removeItem (QMenuData (), identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_removeItemAt (IntPtr raw, int index); + public void RemoveItemAt (int index) + { + qt_QMenuData_removeItemAt (QMenuData (), index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_clear (IntPtr raw); + public void Clear () + { + qt_QMenuData_clear (QMenuData ()); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_accel (IntPtr raw, int identifier); + public QKeySequence Accel (int identifier) + { + return (QKeySequence)LookupObject (qt_QMenuData_accel (QMenuData (), identifier), typeof(QKeySequence)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_setAccel (IntPtr raw, IntPtr key, int identifier); + public void SetAccel (QKeySequence key, int identifier) + { + qt_QMenuData_setAccel (QMenuData (), key.RawObject, identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_iconSet (IntPtr raw, int identifier); + public QIconSet IconSet (int identifier) + { + return (QIconSet)LookupObject (qt_QMenuData_iconSet (QMenuData (), identifier), typeof(QIconSet)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_text (IntPtr raw, int identifier); + public string Text (int identifier) + { + QString qstr = new QString (qt_QMenuData_text (QMenuData (), identifier)); + string str = qstr.Latin1 (); + qstr.Dispose (); + return str; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_pixmap (IntPtr raw, int identifier); + public QPixmap Pixmap (int identifier) + { + return (QPixmap)LookupObject (qt_QMenuData_pixmap (QMenuData (), identifier), typeof(QPixmap)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_setWhatsThis (IntPtr raw, int identifier, IntPtr arg1); + public void SetWhatsThis (int identifier, string arg1) + { + qt_QMenuData_setWhatsThis (QMenuData (), identifier, new QString (arg1).RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_whatsThis (IntPtr raw, int identifier); + public string WhatsThis (int identifier) + { + QString qstr = new QString (qt_QMenuData_whatsThis (QMenuData (), identifier)); + string str = qstr.Latin1 (); + qstr.Dispose (); + return str; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_changeItem (IntPtr raw, int identifier, IntPtr text); + public void ChangeItem (int identifier, string text) + { + qt_QMenuData_changeItem (QMenuData (), identifier, new QString (text).RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_changeItem1 (IntPtr raw, int identifier, IntPtr pixmap); + public void ChangeItem (int identifier, QPixmap pixmap) + { + qt_QMenuData_changeItem1 (QMenuData (), identifier, pixmap.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_changeItem2 (IntPtr raw, int identifier, IntPtr icon, IntPtr text); + public void ChangeItem (int identifier, QIconSet icon, string text) + { + qt_QMenuData_changeItem2 (QMenuData (), identifier, icon.RawObject, new QString (text).RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_changeItem3 (IntPtr raw, int identifier, IntPtr icon, IntPtr pixmap); + public void ChangeItem (int identifier, QIconSet icon, QPixmap pixmap) + { + qt_QMenuData_changeItem3 (QMenuData (), identifier, icon.RawObject, pixmap.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_changeItem4 (IntPtr raw, IntPtr text, int identifier); + public void ChangeItem (string text, int identifier) + { + qt_QMenuData_changeItem4 (QMenuData (), new QString (text).RawObject, identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_changeItem5 (IntPtr raw, IntPtr pixmap, int identifier); + public void ChangeItem (QPixmap pixmap, int identifier) + { + qt_QMenuData_changeItem5 (QMenuData (), pixmap.RawObject, identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_changeItem6 (IntPtr raw, IntPtr icon, IntPtr text, int identifier); + public void ChangeItem (QIconSet icon, string text, int identifier) + { + qt_QMenuData_changeItem6 (QMenuData (), icon.RawObject, new QString (text).RawObject, identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QMenuData_isItemActive (IntPtr raw, int identifier); + public bool IsItemActive (int identifier) + { + return qt_QMenuData_isItemActive (QMenuData (), identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QMenuData_isItemEnabled (IntPtr raw, int identifier); + public bool IsItemEnabled (int identifier) + { + return qt_QMenuData_isItemEnabled (QMenuData (), identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_setItemEnabled (IntPtr raw, int identifier, bool enable); + public void SetItemEnabled (int identifier, bool enable) + { + qt_QMenuData_setItemEnabled (QMenuData (), identifier, enable); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QMenuData_isItemChecked (IntPtr raw, int identifier); + public bool IsItemChecked (int identifier) + { + return qt_QMenuData_isItemChecked (QMenuData (), identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_setItemChecked (IntPtr raw, int identifier, bool check); + public void SetItemChecked (int identifier, bool check) + { + qt_QMenuData_setItemChecked (QMenuData (), identifier, check); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_indexOf (IntPtr raw, int identifier); + public int IndexOf (int identifier) + { + return qt_QMenuData_indexOf (QMenuData (), identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_idAt (IntPtr raw, int index); + public int IdAt (int index) + { + return qt_QMenuData_idAt (QMenuData (), index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_setId (IntPtr raw, int index, int identifier); + public void SetId (int index, int identifier) + { + qt_QMenuData_setId (QMenuData (), index, identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QMenuData_setItemParameter (IntPtr raw, int identifier, int param); + public bool SetItemParameter (int identifier, int param) + { + return qt_QMenuData_setItemParameter (QMenuData (), identifier, param); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_itemParameter (IntPtr raw, int identifier); + public int ItemParameter (int identifier) + { + return qt_QMenuData_itemParameter (QMenuData (), identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_findItem (IntPtr raw, int identifier); + public QMenuItem FindItem (int identifier) + { + return (QMenuItem)LookupObject (qt_QMenuData_findItem (QMenuData (), identifier), typeof(QMenuItem)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_findItem1 (IntPtr raw, int identifier, IntPtr parent); + public QMenuItem FindItem (int identifier, QMenuData parent) + { + return (QMenuItem)LookupObject (qt_QMenuData_findItem1 (QMenuData (), identifier, parent.RawObject), typeof(QMenuItem)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_findPopup (IntPtr raw, IntPtr arg1, int[] index); + public QMenuItem FindPopup (QPopupMenu arg1, int[] index) + { + return (QMenuItem)LookupObject (qt_QMenuData_findPopup (QMenuData (), arg1.RawObject, index), typeof(QMenuItem)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_menuInsPopup (IntPtr raw, IntPtr arg1); + protected void MenuInsPopup (QPopupMenu arg1) + { + qt_QMenuData_menuInsPopup (QMenuData (), arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_menuDelPopup (IntPtr raw, IntPtr arg1); + protected void MenuDelPopup (QPopupMenu arg1) + { + qt_QMenuData_menuDelPopup (QMenuData (), arg1.RawObject); + } + + public int InsertItem (string text, QObject receiver, string member) + { + return InsertItem(text, receiver, member, new QKeySequence ()); + } + + public int InsertItem (string text, QObject receiver, string member, QKeySequence accel) + { + return InsertItem(text, receiver, member, accel, (int) -1); + } + + public int InsertItem (string text, QObject receiver, string member, QKeySequence accel, int identifier) + { + return InsertItem(text, receiver, member, accel, identifier, (int) -1); + } + + public int InsertItem (QIconSet icon, string text, QObject receiver, string member) + { + return InsertItem(icon, text, receiver, member, new QKeySequence ()); + } + + public int InsertItem (QIconSet icon, string text, QObject receiver, string member, QKeySequence accel) + { + return InsertItem(icon, text, receiver, member, accel, (int) -1); + } + + public int InsertItem (QIconSet icon, string text, QObject receiver, string member, QKeySequence accel, int identifier) + { + return InsertItem(icon, text, receiver, member, accel, identifier, (int) -1); + } + + public int InsertItem (QPixmap pixmap, QObject receiver, string member) + { + return InsertItem(pixmap, receiver, member, new QKeySequence ()); + } + + public int InsertItem (QPixmap pixmap, QObject receiver, string member, QKeySequence accel) + { + return InsertItem(pixmap, receiver, member, accel, (int) -1); + } + + public int InsertItem (QPixmap pixmap, QObject receiver, string member, QKeySequence accel, int identifier) + { + return InsertItem(pixmap, receiver, member, accel, identifier, (int) -1); + } + + public int InsertItem (QIconSet icon, QPixmap pixmap, QObject receiver, string member) + { + return InsertItem(icon, pixmap, receiver, member, new QKeySequence ()); + } + + public int InsertItem (QIconSet icon, QPixmap pixmap, QObject receiver, string member, QKeySequence accel) + { + return InsertItem(icon, pixmap, receiver, member, accel, (int) -1); + } + + public int InsertItem (QIconSet icon, QPixmap pixmap, QObject receiver, string member, QKeySequence accel, int identifier) + { + return InsertItem(icon, pixmap, receiver, member, accel, identifier, (int) -1); + } + + public int InsertItem (string text) + { + return InsertItem(text, (int) -1); + } + + public int InsertItem (string text, int identifier) + { + return InsertItem(text, identifier, (int) -1); + } + + public int InsertItem (QIconSet icon, string text) + { + return InsertItem(icon, text, (int) -1); + } + + public int InsertItem (QIconSet icon, string text, int identifier) + { + return InsertItem(icon, text, identifier, (int) -1); + } + + public int InsertItem (string text, QPopupMenu popup) + { + return InsertItem(text, popup, (int) -1); + } + + public int InsertItem (string text, QPopupMenu popup, int identifier) + { + return InsertItem(text, popup, identifier, (int) -1); + } + + public int InsertItem (QIconSet icon, string text, QPopupMenu popup) + { + return InsertItem(icon, text, popup, (int) -1); + } + + public int InsertItem (QIconSet icon, string text, QPopupMenu popup, int identifier) + { + return InsertItem(icon, text, popup, identifier, (int) -1); + } + + public int InsertItem (QPixmap pixmap) + { + return InsertItem(pixmap, (int) -1); + } + + public int InsertItem (QPixmap pixmap, int identifier) + { + return InsertItem(pixmap, identifier, (int) -1); + } + + public int InsertItem (QIconSet icon, QPixmap pixmap) + { + return InsertItem(icon, pixmap, (int) -1); + } + + public int InsertItem (QIconSet icon, QPixmap pixmap, int identifier) + { + return InsertItem(icon, pixmap, identifier, (int) -1); + } + + public int InsertItem (QPixmap pixmap, QPopupMenu popup) + { + return InsertItem(pixmap, popup, (int) -1); + } + + public int InsertItem (QPixmap pixmap, QPopupMenu popup, int identifier) + { + return InsertItem(pixmap, popup, identifier, (int) -1); + } + + public int InsertItem (QIconSet icon, QPixmap pixmap, QPopupMenu popup) + { + return InsertItem(icon, pixmap, popup, (int) -1); + } + + public int InsertItem (QIconSet icon, QPixmap pixmap, QPopupMenu popup, int identifier) + { + return InsertItem(icon, pixmap, popup, identifier, (int) -1); + } + + public int InsertItem (QWidget widget) + { + return InsertItem(widget, (int) -1); + } + + public int InsertItem (QWidget widget, int identifier) + { + return InsertItem(widget, identifier, (int) -1); + } + + public int InsertItem (QIconSet icon, QCustomMenuItem custom) + { + return InsertItem(icon, custom, (int) -1); + } + + public int InsertItem (QIconSet icon, QCustomMenuItem custom, int identifier) + { + return InsertItem(icon, custom, identifier, (int) -1); + } + + public int InsertItem (QCustomMenuItem custom) + { + return InsertItem(custom, (int) -1); + } + + public int InsertItem (QCustomMenuItem custom, int identifier) + { + return InsertItem(custom, identifier, (int) -1); + } + + public int InsertSeparator () + { + return InsertSeparator((int) -1); + } + + public QMenuItem FindPopup (QPopupMenu arg1) + { + return FindPopup(arg1, new int[]{0}); + } + } +} diff --git a/qtsharp/src/bindings/static/QMenuData.cs b/qtsharp/src/bindings/static/QMenuData.cs new file mode 100644 index 00000000..dc2813a0 --- /dev/null +++ b/qtsharp/src/bindings/static/QMenuData.cs @@ -0,0 +1,719 @@ +// QMenuData.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Regenerated by Adam Treat on August 03 2002 +// +// TODO +// o The QMenu* and QPopupMenu classes need serious analysis. I've only added +// functionality for C# slot support - I've not made sure its all working. :-) + +namespace Qt { + + using Qt; + using System; + using System.Collections; + using System.Runtime.InteropServices; + + public class QMenuData : QtSupport, IQMenuData, IDisposable { + + private Hashtable menuConnections; + + public Hashtable MenuConnections { + get { return menuConnections; } + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_new_QMenuData (); + public QMenuData () : this (QNull.Instance) + { + rawObject = qt_new_QMenuData (); + RegisterObject (this); + } + + internal QMenuData (IntPtr ptr) : this (QNull.Instance) + { + rawObject = ptr; + RegisterObject(this); + } + + internal QMenuData (QNull dummy) : base (QNull.Instance) + { + menuConnections = new Hashtable(); + } + + ~QMenuData () + { + Dispose(false); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_del_QMenuData (IntPtr obj); + internal override void Delete () + { + if (deleted) return; + + qt_del_QMenuData (rawObject); + deleted = true; + } + + // The next two static methods are here to service all IQMenuData implementors. + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QMenuData_connectItem (IntPtr raw, int identifier, IntPtr receiver, string member); + + internal static bool ConnectItem (IQMenuData menu, IntPtr menudata, int id, QObject receiver, string slot) + { + if (QtSignal.traceConnects) + ErrMsg ("ConnectItem: ({0}) {1}, {2}, ({3}) {4}, {5}", menudata, menu, id, receiver.RawObject, receiver, slot); + + QtSlot slotobj = new QtSlot(receiver, QtSignal.NormalizeParam(slot)); + + if (slotobj.IsCSharpSlot) { + ArrayList cxlist; + + if ((cxlist = (ArrayList)menu.MenuConnections[id]) == null) + menu.MenuConnections[id] = cxlist = new ArrayList(); + else if (cxlist.Contains(slotobj)) + return false; + + Delegate del; + + switch (slotobj.Args) { + case "()": + del = Delegate.CreateDelegate (typeof (QtSignal.del_void), receiver, slotobj.Name); + slotobj.WrapperPtr = csharp_connect_item_void (menudata, id, receiver.RawObject, del); + break; + case "(int)": + del = Delegate.CreateDelegate (typeof (QtSignal.del_int), receiver, slotobj.Name); + slotobj.WrapperPtr = csharp_connect_item_int (((QtSupport)menu).RawObject, id, receiver.RawObject, del); + break; + default: + throw new ArgumentException("Unsupported slot arguments: " + slotobj.Args); + } + + if (slotobj.WrapperPtr == IntPtr.Zero) { + return false; + } + + slotobj.Callback = del; + cxlist.Add(slotobj); + return true; + } + else { + return qt_QMenuData_connectItem(menudata, id, receiver.RawObject, slot); + } + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QMenuData_disconnectItem (IntPtr raw, int identifier, IntPtr receiver, string member); + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_del_QObject (IntPtr raw); + + internal static bool DisconnectItem (IQMenuData menu, IntPtr menudata, int id, QObject receiver, string slot) + { + if (QtSignal.traceConnects) + ErrMsg ("DisconnectItem: ({0}) {1}, {2}, ({3}) {4}, {5}", menudata, menu, id, receiver.RawObject, receiver, slot); + + QtSlot slotobj = new QtSlot(receiver, QtSignal.NormalizeParam(slot)); + + if (slotobj.IsCSharpSlot) { + ArrayList cxlist; + + if ((cxlist = (ArrayList)menu.MenuConnections[id]) == null) + return false; + else if (!cxlist.Contains(slotobj)) + return false; + + // FIXME Make sure LastIndexOf tests equality with Equals. MS docs are unclear... + slotobj = (QtSlot)cxlist[cxlist.LastIndexOf(slotobj)]; + cxlist.Remove(slotobj); + if (cxlist.Count == 0) + menu.MenuConnections.Remove (cxlist); + + // FIXME Make sure QObject's dtor auto-disconnects menu items. + qt_del_QObject (slotobj.WrapperPtr); + return true; + } + else { + return qt_QMenuData_disconnectItem (menudata, id, receiver.RawObject, slot); + } + } + + // Hack so QMenuData implements IQMenuData... + + public bool setItemParameter (int identifier, int param) + { + return false; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern uint qt_QMenuData_count (IntPtr raw); + public uint Count () + { + return qt_QMenuData_count (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem4 (IntPtr raw, IntPtr text, int identifier, int index); + public int InsertItem (string text, int identifier, int index) + { + return qt_QMenuData_insertItem4 (rawObject, new QString (text).RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem5 (IntPtr raw, IntPtr icon, IntPtr text, int identifier, int index); + public int InsertItem (QIconSet icon, string text, int identifier, int index) + { + return qt_QMenuData_insertItem5 (rawObject, icon.RawObject, new QString (text).RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem6 (IntPtr raw, IntPtr text, IntPtr popup, int identifier, int index); + public int InsertItem (string text, QPopupMenu popup, int identifier, int index) + { + return qt_QMenuData_insertItem6 (rawObject, new QString (text).RawObject, popup.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem7 (IntPtr raw, IntPtr icon, IntPtr text, IntPtr popup, int identifier, int index); + public int InsertItem (QIconSet icon, string text, QPopupMenu popup, int identifier, int index) + { + return qt_QMenuData_insertItem7 (rawObject, icon.RawObject, new QString (text).RawObject, popup.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem8 (IntPtr raw, IntPtr pixmap, int identifier, int index); + public int InsertItem (QPixmap pixmap, int identifier, int index) + { + return qt_QMenuData_insertItem8 (rawObject, pixmap.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem9 (IntPtr raw, IntPtr icon, IntPtr pixmap, int identifier, int index); + public int InsertItem (QIconSet icon, QPixmap pixmap, int identifier, int index) + { + return qt_QMenuData_insertItem9 (rawObject, icon.RawObject, pixmap.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem10 (IntPtr raw, IntPtr pixmap, IntPtr popup, int identifier, int index); + public int InsertItem (QPixmap pixmap, QPopupMenu popup, int identifier, int index) + { + return qt_QMenuData_insertItem10 (rawObject, pixmap.RawObject, popup.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem11 (IntPtr raw, IntPtr icon, IntPtr pixmap, IntPtr popup, int identifier, int index); + public int InsertItem (QIconSet icon, QPixmap pixmap, QPopupMenu popup, int identifier, int index) + { + return qt_QMenuData_insertItem11 (rawObject, icon.RawObject, pixmap.RawObject, popup.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem12 (IntPtr raw, IntPtr widget, int identifier, int index); + public int InsertItem (QWidget widget, int identifier, int index) + { + return qt_QMenuData_insertItem12 (rawObject, widget.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem13 (IntPtr raw, IntPtr icon, IntPtr custom, int identifier, int index); + public int InsertItem (QIconSet icon, QCustomMenuItem custom, int identifier, int index) + { + return qt_QMenuData_insertItem13 (rawObject, icon.RawObject, custom.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem14 (IntPtr raw, IntPtr custom, int identifier, int index); + public int InsertItem (QCustomMenuItem custom, int identifier, int index) + { + return qt_QMenuData_insertItem14 (rawObject, custom.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertSeparator (IntPtr raw, int index); + public int InsertSeparator (int index) + { + return qt_QMenuData_insertSeparator (rawObject, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_removeItem (IntPtr raw, int identifier); + public void RemoveItem (int identifier) + { + qt_QMenuData_removeItem (rawObject, identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_removeItemAt (IntPtr raw, int index); + public void RemoveItemAt (int index) + { + qt_QMenuData_removeItemAt (rawObject, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_clear (IntPtr raw); + public void Clear () + { + qt_QMenuData_clear (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_accel (IntPtr raw, int identifier); + public QKeySequence Accel (int identifier) + { + return (QKeySequence)LookupObject (qt_QMenuData_accel (rawObject, identifier), typeof(QKeySequence)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_setAccel (IntPtr raw, IntPtr key, int identifier); + public void SetAccel (QKeySequence key, int identifier) + { + qt_QMenuData_setAccel (rawObject, key.RawObject, identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_iconSet (IntPtr raw, int identifier); + public QIconSet IconSet (int identifier) + { + return (QIconSet)LookupObject (qt_QMenuData_iconSet (rawObject, identifier), typeof(QIconSet)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_text (IntPtr raw, int identifier); + public string Text (int identifier) + { + QString qstr = new QString (qt_QMenuData_text (rawObject, identifier)); + string str = qstr.Latin1 (); + qstr.Dispose (); + return str; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_pixmap (IntPtr raw, int identifier); + public QPixmap Pixmap (int identifier) + { + return (QPixmap)LookupObject (qt_QMenuData_pixmap (rawObject, identifier), typeof(QPixmap)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_setWhatsThis (IntPtr raw, int identifier, IntPtr arg1); + public void SetWhatsThis (int identifier, string arg1) + { + qt_QMenuData_setWhatsThis (rawObject, identifier, new QString (arg1).RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_whatsThis (IntPtr raw, int identifier); + public string WhatsThis (int identifier) + { + QString qstr = new QString (qt_QMenuData_whatsThis (rawObject, identifier)); + string str = qstr.Latin1 (); + qstr.Dispose (); + return str; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_changeItem (IntPtr raw, int identifier, IntPtr text); + public void ChangeItem (int identifier, string text) + { + qt_QMenuData_changeItem (rawObject, identifier, new QString (text).RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_changeItem1 (IntPtr raw, int identifier, IntPtr pixmap); + public void ChangeItem (int identifier, QPixmap pixmap) + { + qt_QMenuData_changeItem1 (rawObject, identifier, pixmap.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_changeItem2 (IntPtr raw, int identifier, IntPtr icon, IntPtr text); + public void ChangeItem (int identifier, QIconSet icon, string text) + { + qt_QMenuData_changeItem2 (rawObject, identifier, icon.RawObject, new QString (text).RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_changeItem3 (IntPtr raw, int identifier, IntPtr icon, IntPtr pixmap); + public void ChangeItem (int identifier, QIconSet icon, QPixmap pixmap) + { + qt_QMenuData_changeItem3 (rawObject, identifier, icon.RawObject, pixmap.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_changeItem4 (IntPtr raw, IntPtr text, int identifier); + public void ChangeItem (string text, int identifier) + { + qt_QMenuData_changeItem4 (rawObject, new QString (text).RawObject, identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_changeItem5 (IntPtr raw, IntPtr pixmap, int identifier); + public void ChangeItem (QPixmap pixmap, int identifier) + { + qt_QMenuData_changeItem5 (rawObject, pixmap.RawObject, identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_changeItem6 (IntPtr raw, IntPtr icon, IntPtr text, int identifier); + public void ChangeItem (QIconSet icon, string text, int identifier) + { + qt_QMenuData_changeItem6 (rawObject, icon.RawObject, new QString (text).RawObject, identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QMenuData_isItemActive (IntPtr raw, int identifier); + public bool IsItemActive (int identifier) + { + return qt_QMenuData_isItemActive (rawObject, identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QMenuData_isItemEnabled (IntPtr raw, int identifier); + public bool IsItemEnabled (int identifier) + { + return qt_QMenuData_isItemEnabled (rawObject, identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_setItemEnabled (IntPtr raw, int identifier, bool enable); + public void SetItemEnabled (int identifier, bool enable) + { + qt_QMenuData_setItemEnabled (rawObject, identifier, enable); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QMenuData_isItemChecked (IntPtr raw, int identifier); + public bool IsItemChecked (int identifier) + { + return qt_QMenuData_isItemChecked (rawObject, identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_setItemChecked (IntPtr raw, int identifier, bool check); + public void SetItemChecked (int identifier, bool check) + { + qt_QMenuData_setItemChecked (rawObject, identifier, check); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_indexOf (IntPtr raw, int identifier); + public int IndexOf (int identifier) + { + return qt_QMenuData_indexOf (rawObject, identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_idAt (IntPtr raw, int index); + public int IdAt (int index) + { + return qt_QMenuData_idAt (rawObject, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_setId (IntPtr raw, int index, int identifier); + public void SetId (int index, int identifier) + { + qt_QMenuData_setId (rawObject, index, identifier); + } + + //********************* A temporary hack to divert connections to CSharpConnect *****************// + + public bool ConnectItem (int identifier, QObject receiver, string slot) + { + return ConnectItem (this, this.RawObject, identifier, receiver, slot); + } + + public bool DisconnectItem (int identifier, QObject receiver, string slot) + { + return DisconnectItem (this, this.RawObject, identifier, receiver, slot); + } + + public int InsertItem (string text, QObject receiver, string member, QKeySequence accel, int identifier, int index) + { + int id = InsertItem (text, identifier, index); + SetAccel (accel, id); + ConnectItem (id, receiver, member); + return id; + } + + public int InsertItem (QIconSet icon, string text, QObject receiver, string member, QKeySequence accel, int identifier, int index) + { + int id = InsertItem (icon, text, identifier, index); + SetAccel (accel, id); + ConnectItem (id, receiver, member); + return id; + } + + public int InsertItem (QPixmap pixmap, QObject receiver, string member, QKeySequence accel, int identifier, int index) + { + int id = InsertItem (pixmap, identifier, index); + SetAccel (accel, id); + ConnectItem (id, receiver, member); + return id; + } + + public int InsertItem (QIconSet icon, QPixmap pixmap, QObject receiver, string member, QKeySequence accel, int identifier, int index) + { + int id = InsertItem (icon, pixmap, identifier, index); + SetAccel (accel, id); + ConnectItem (id, receiver, member); + return id; + } + + //********************* A temporary hack to divert connections to CSharpConnect *****************// + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QMenuData_setItemParameter (IntPtr raw, int identifier, int param); + public bool SetItemParameter (int identifier, int param) + { + return qt_QMenuData_setItemParameter (rawObject, identifier, param); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_itemParameter (IntPtr raw, int identifier); + public int ItemParameter (int identifier) + { + return qt_QMenuData_itemParameter (rawObject, identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_findItem (IntPtr raw, int identifier); + public QMenuItem FindItem (int identifier) + { + return (QMenuItem)LookupObject (qt_QMenuData_findItem (rawObject, identifier), typeof(QMenuItem)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_findItem1 (IntPtr raw, int identifier, IntPtr parent); + public QMenuItem FindItem (int identifier, QMenuData parent) + { + return (QMenuItem)LookupObject (qt_QMenuData_findItem1 (rawObject, identifier, parent.RawObject), typeof(QMenuItem)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_findPopup (IntPtr raw, IntPtr arg1, int[] index); + public QMenuItem FindPopup (QPopupMenu arg1, int[] index) + { + return (QMenuItem)LookupObject (qt_QMenuData_findPopup (rawObject, arg1.RawObject, index), typeof(QMenuItem)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_menuInsPopup (IntPtr raw, IntPtr arg1); + protected void MenuInsPopup (QPopupMenu arg1) + { + qt_QMenuData_menuInsPopup (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_menuDelPopup (IntPtr raw, IntPtr arg1); + protected void MenuDelPopup (QPopupMenu arg1) + { + qt_QMenuData_menuDelPopup (rawObject, arg1.RawObject); + } + + public int InsertItem (string text, QObject receiver, string member) + { + return InsertItem(text, receiver, member, new QKeySequence ()); + } + + public int InsertItem (string text, QObject receiver, string member, QKeySequence accel) + { + return InsertItem(text, receiver, member, accel, (int) -1); + } + + public int InsertItem (string text, QObject receiver, string member, QKeySequence accel, int identifier) + { + return InsertItem(text, receiver, member, accel, identifier, (int) -1); + } + + public int InsertItem (QIconSet icon, string text, QObject receiver, string member) + { + return InsertItem(icon, text, receiver, member, new QKeySequence ()); + } + + public int InsertItem (QIconSet icon, string text, QObject receiver, string member, QKeySequence accel) + { + return InsertItem(icon, text, receiver, member, accel, (int) -1); + } + + public int InsertItem (QIconSet icon, string text, QObject receiver, string member, QKeySequence accel, int identifier) + { + return InsertItem(icon, text, receiver, member, accel, identifier, (int) -1); + } + + public int InsertItem (QPixmap pixmap, QObject receiver, string member) + { + return InsertItem(pixmap, receiver, member, new QKeySequence ()); + } + + public int InsertItem (QPixmap pixmap, QObject receiver, string member, QKeySequence accel) + { + return InsertItem(pixmap, receiver, member, accel, (int) -1); + } + + public int InsertItem (QPixmap pixmap, QObject receiver, string member, QKeySequence accel, int identifier) + { + return InsertItem(pixmap, receiver, member, accel, identifier, (int) -1); + } + + public int InsertItem (QIconSet icon, QPixmap pixmap, QObject receiver, string member) + { + return InsertItem(icon, pixmap, receiver, member, new QKeySequence ()); + } + + public int InsertItem (QIconSet icon, QPixmap pixmap, QObject receiver, string member, QKeySequence accel) + { + return InsertItem(icon, pixmap, receiver, member, accel, (int) -1); + } + + public int InsertItem (QIconSet icon, QPixmap pixmap, QObject receiver, string member, QKeySequence accel, int identifier) + { + return InsertItem(icon, pixmap, receiver, member, accel, identifier, (int) -1); + } + + public int InsertItem (string text) + { + return InsertItem(text, (int) -1); + } + + public int InsertItem (string text, int identifier) + { + return InsertItem(text, identifier, (int) -1); + } + + public int InsertItem (QIconSet icon, string text) + { + return InsertItem(icon, text, (int) -1); + } + + public int InsertItem (QIconSet icon, string text, int identifier) + { + return InsertItem(icon, text, identifier, (int) -1); + } + + public int InsertItem (string text, QPopupMenu popup) + { + return InsertItem(text, popup, (int) -1); + } + + public int InsertItem (string text, QPopupMenu popup, int identifier) + { + return InsertItem(text, popup, identifier, (int) -1); + } + + public int InsertItem (QIconSet icon, string text, QPopupMenu popup) + { + return InsertItem(icon, text, popup, (int) -1); + } + + public int InsertItem (QIconSet icon, string text, QPopupMenu popup, int identifier) + { + return InsertItem(icon, text, popup, identifier, (int) -1); + } + + public int InsertItem (QPixmap pixmap) + { + return InsertItem(pixmap, (int) -1); + } + + public int InsertItem (QPixmap pixmap, int identifier) + { + return InsertItem(pixmap, identifier, (int) -1); + } + + public int InsertItem (QIconSet icon, QPixmap pixmap) + { + return InsertItem(icon, pixmap, (int) -1); + } + + public int InsertItem (QIconSet icon, QPixmap pixmap, int identifier) + { + return InsertItem(icon, pixmap, identifier, (int) -1); + } + + public int InsertItem (QPixmap pixmap, QPopupMenu popup) + { + return InsertItem(pixmap, popup, (int) -1); + } + + public int InsertItem (QPixmap pixmap, QPopupMenu popup, int identifier) + { + return InsertItem(pixmap, popup, identifier, (int) -1); + } + + public int InsertItem (QIconSet icon, QPixmap pixmap, QPopupMenu popup) + { + return InsertItem(icon, pixmap, popup, (int) -1); + } + + public int InsertItem (QIconSet icon, QPixmap pixmap, QPopupMenu popup, int identifier) + { + return InsertItem(icon, pixmap, popup, identifier, (int) -1); + } + + public int InsertItem (QWidget widget) + { + return InsertItem(widget, (int) -1); + } + + public int InsertItem (QWidget widget, int identifier) + { + return InsertItem(widget, identifier, (int) -1); + } + + public int InsertItem (QIconSet icon, QCustomMenuItem custom) + { + return InsertItem(icon, custom, (int) -1); + } + + public int InsertItem (QIconSet icon, QCustomMenuItem custom, int identifier) + { + return InsertItem(icon, custom, identifier, (int) -1); + } + + public int InsertItem (QCustomMenuItem custom) + { + return InsertItem(custom, (int) -1); + } + + public int InsertItem (QCustomMenuItem custom, int identifier) + { + return InsertItem(custom, identifier, (int) -1); + } + + public int InsertSeparator () + { + return InsertSeparator((int) -1); + } + + public QMenuItem FindPopup (QPopupMenu arg1) + { + return FindPopup(arg1, new int[]{0}); + } + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_item_void (IntPtr instance, int id, IntPtr receiver, Delegate method); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_item_int (IntPtr instance, int id, IntPtr receiver, Delegate method); + + } +} diff --git a/qtsharp/src/bindings/static/QNull.cs b/qtsharp/src/bindings/static/QNull.cs new file mode 100644 index 00000000..d017da1c --- /dev/null +++ b/qtsharp/src/bindings/static/QNull.cs @@ -0,0 +1,35 @@ +// QNull.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// + +namespace Qt { + + using Qt; + using System; + + internal struct QNull { + + private static readonly QNull instance = new QNull (null); + + private QNull (Object dummy) {} + + internal static QNull Instance { + get {return instance;} + } + } +} diff --git a/qtsharp/src/bindings/static/QObject.cs b/qtsharp/src/bindings/static/QObject.cs new file mode 100644 index 00000000..d016fa62 --- /dev/null +++ b/qtsharp/src/bindings/static/QObject.cs @@ -0,0 +1,609 @@ +// QObject.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Regenerated by Adam Treat on August 30 2002 +// +// NOTES +// o Methods related to Qt reflection have been marked internal. Most of them +// should eventually be throttled, and this file regenerated +// o Some event-related methods are also marked internal. I don't think we use +// any of them, they can likely be throttled. +// +// TODO +// o Should use children() in object tree tracking for constructing +// complete tree representations. + +namespace Qt { + + using Qt; + using System; + using System.Collections; + using System.Runtime.InteropServices; + + //[DeclareQtSignal ("ChildDestroyed(QObject)")] + public class QObject : QtSupport, IDisposable { + + // Hold an instance of the QApplication object + private static QApplication qapp; + private QtSignalMap csSignalMap; + private QtSignalMap cppSignalMap; + + public static QApplication qApp { + get {return qapp;} + set {qapp = value;} + } + + internal QtSignalMap CsSignalMap { + get { return csSignalMap; } + } + + internal QtSignalMap CppSignalMap { + get { return cppSignalMap; } + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_new_QObject (IntPtr parent, string name); + public QObject (QObject parent, string name) : this (QNull.Instance) + { + qparent = parent; + + if (qparent == null) + parent = new QWidget (IntPtr.Zero); + else + qparent.AddChild (this); + + rawObject = qt_new_QObject (parent.RawObject, name); + RegisterObject (this); + } + + public QObject (QObject parent) : this (parent, "") {} + + internal QObject () : this (QNull.Instance) {} + + internal QObject (IntPtr ptr) : this (QNull.Instance) + { + rawObject = ptr; + RegisterObject (this); + } + + internal QObject (QNull dummy) : base (QNull.Instance) + { + InitSignals (); + } + + // FIXME This ctor used only by QtSignal + internal QObject (NoSignalInit dummy) : base (QNull.Instance) + { + rawObject = qt_new_QObject (IntPtr.Zero, ""); + RegisterObject (this); + } + + ~QObject () + { + Dispose(false); + } + + protected override void Dispose (bool disposeManaged) + { + if (disposed) + return; + + if (rawObject == IntPtr.Zero) + deleted = true; + + if (disposeManaged) { + disposed = true; + + UnregisterObject (this); + + if (qparent != null ) { + if (qparent.Disposed) + deleted = true; + else + qparent.RemoveChild (this); + } + + Disconnect (); + + foreach (QtSupport qts in qchildren) + qts.Dispose (); + + // UnregisterObject (); // FIXME + } + + /* + DbgMsg ("({0}) {1}:: {2} managed. {3} native instance.", + deleted ? IntPtr.Zero : rawObject, + this, + disposeManaged ? "Disposing" : "Not disposing", + deleted ? "Not deleting" : "Deleting"); + */ + + qparent = null; + qchildren = null; + + Delete (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_del_QObject (IntPtr obj); + internal override void Delete () + { + if (deleted) return; + + qt_del_QObject (rawObject); + deleted = true; + } + + private void InitSignals () + { + csSignalMap = new QtSignalMap (this, "C# Signals"); + cppSignalMap = new QtSignalMap (this, "C++ Signals"); + + object[] attrs = GetType ().GetCustomAttributes (typeof (DeclareQtSignalAttribute), true); + + foreach (DeclareQtSignalAttribute attr in attrs) { + string signal = attr.SignalName; + + if (!CsSignalMap.Contains (signal)) + CsSignalMap[signal] = new QtSignal (this, signal); + } + } + + // [QtSlot] + internal protected void NativeDestroyed () + { + deleted = true; + Dispose (); + } + + public QObject QtCast() + { + string QtType = this.ClassName(); + Type newType = Type.GetType( "Qt." + QtType ); + object[] paramArray = { this.RawObject }; + return (QObject) Activator.CreateInstance( newType, paramArray ); + } + + public static bool Connect(QObject sender, string signal, QObject receiver, string slot) + { + return QtSignal.Connect(sender, signal, receiver, slot); + } + + public bool Connect (QObject sender, string signal, string member) + { + return Connect (sender, signal, this, member); + } + + public static bool Disconnect(QObject sender, string signal, QObject receiver, string slot) + { + return QtSignal.Disconnect(sender, signal, receiver, slot); + } + + public bool Disconnect () + { + return Disconnect (this, null, null, null); + } + + public bool Disconnect (string signal, QObject receiver, string member) + { + return Disconnect(this, signal, receiver, member); + } + + public bool Disconnect (QObject receiver, string slot) + { + return Disconnect (this, null, receiver, slot); + } + + public void Emit (string signal, params object[] args) + { + string sig = signal.Replace (" ", ""); + + if (CsSignalMap.Contains (sig)) + CsSignalMap[sig].Emit (args); + else + throw new ArgumentException (this+" does not emit requested signal '"+sig+"'"); + } + + public void DumpConnections() + { + ErrMsg ("** ({0}) {1}: Dumping '{2}' map.", rawObject, this, CsSignalMap.Name); + CsSignalMap.DumpMap (); + + ErrMsg ("** ({0}) {1}: Dumping '{2}' map.", rawObject, this, CppSignalMap.Name); + CppSignalMap.DumpMap (); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern string qt_QObject_className (IntPtr raw); + public string ClassName () + { + return qt_QObject_className (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QObject_tr (IntPtr raw, string arg1, string arg2); + public string Tr (string arg1, string arg2) + { + QString qstr = new QString (qt_QObject_tr (rawObject, arg1, arg2)); + string str = qstr.Latin1 (); + qstr.Dispose (); + return str; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QObject_trUtf8 (IntPtr raw, string arg1, string arg2); + public string TrUtf8 (string arg1, string arg2) + { + QString qstr = new QString (qt_QObject_trUtf8 (rawObject, arg1, arg2)); + string str = qstr.Latin1 (); + qstr.Dispose (); + return str; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QObject_metaObject (IntPtr raw); + public QMetaObject MetaObject () + { + return (QMetaObject)LookupObject (qt_QObject_metaObject (rawObject), typeof(QMetaObject)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QObject_event (IntPtr raw, IntPtr arg1); + public bool Q_event (QEvent arg1) + { + return qt_QObject_event (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QObject_eventFilter (IntPtr raw, IntPtr arg1, IntPtr arg2); + public bool EventFilter (QObject arg1, QEvent arg2) + { + return qt_QObject_eventFilter (rawObject, arg1.RawObject, arg2.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QObject_isA (IntPtr raw, string arg1); + public bool IsA (string arg1) + { + return qt_QObject_isA (rawObject, arg1); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QObject_inherits (IntPtr raw, string arg1); + public bool Inherits (string arg1) + { + return qt_QObject_inherits (rawObject, arg1); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern string qt_QObject_name (IntPtr raw); + public string Name () + { + return qt_QObject_name (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern string qt_QObject_name1 (IntPtr raw, string defaultName); + public string Name (string defaultName) + { + return qt_QObject_name1 (rawObject, defaultName); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QObject_setName (IntPtr raw, string name); + public void SetName (string name) + { + qt_QObject_setName (rawObject, name); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QObject_isWidgetType (IntPtr raw); + public bool IsWidgetType () + { + return qt_QObject_isWidgetType (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QObject_highPriority (IntPtr raw); + public bool HighPriority () + { + return qt_QObject_highPriority (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QObject_signalsBlocked (IntPtr raw); + public bool SignalsBlocked () + { + return qt_QObject_signalsBlocked (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QObject_blockSignals (IntPtr raw, bool b); + public void BlockSignals (bool b) + { + qt_QObject_blockSignals (rawObject, b); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QObject_startTimer (IntPtr raw, int interval); + public int StartTimer (int interval) + { + return qt_QObject_startTimer (rawObject, interval); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QObject_killTimer (IntPtr raw, int identifier); + public void KillTimer (int identifier) + { + qt_QObject_killTimer (rawObject, identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QObject_killTimers (IntPtr raw); + public void KillTimers () + { + qt_QObject_killTimers (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QObject_child (IntPtr raw, string objName, string inheritsClass, bool recursiveSearch); + public QObject Child (string objName, string inheritsClass, bool recursiveSearch) + { + return (QObject)LookupObject (qt_QObject_child (rawObject, objName, inheritsClass, recursiveSearch), typeof(QObject)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QObject_children (IntPtr raw); + public QObjectList Children () + { + return (QObjectList)LookupObject (qt_QObject_children (rawObject), typeof(QObjectList)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QObject_queryList (IntPtr raw, string inheritsClass, string objName, bool regexpMatch, bool recursiveSearch); + public QObjectList QueryList (string inheritsClass, string objName, bool regexpMatch, bool recursiveSearch) + { + return (QObjectList)LookupObject (qt_QObject_queryList (rawObject, inheritsClass, objName, regexpMatch, recursiveSearch), typeof(QObjectList)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QObject_insertChild (IntPtr raw, IntPtr arg1); + public void InsertChild (QObject arg1) + { + qt_QObject_insertChild (rawObject, arg1.RawObject); + } + + /*[DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QObject_removeChild (IntPtr raw, IntPtr arg1); + public void RemoveChild (QObject arg1) + { + qt_QObject_removeChild (rawObject, arg1.RawObject); + }*/ + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QObject_installEventFilter (IntPtr raw, IntPtr arg1); + public void InstallEventFilter (QObject arg1) + { + qt_QObject_installEventFilter (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QObject_removeEventFilter (IntPtr raw, IntPtr arg1); + public void RemoveEventFilter (QObject arg1) + { + qt_QObject_removeEventFilter (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QObject_dumpObjectTree (IntPtr raw); + public void DumpObjectTree () + { + qt_QObject_dumpObjectTree (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QObject_dumpObjectInfo (IntPtr raw); + public void DumpObjectInfo () + { + qt_QObject_dumpObjectInfo (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QObject_setProperty (IntPtr raw, string name, IntPtr value); + public bool SetProperty (string name, QVariant value) + { + return qt_QObject_setProperty (rawObject, name, value.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QObject_property (IntPtr raw, string name); + public QVariant Property (string name) + { + return (QVariant)LookupObject (qt_QObject_property (rawObject, name), typeof(QVariant)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QObject_parent (IntPtr raw); + public QObject Parent () + { + return (QObject)LookupObject (qt_QObject_parent (rawObject), typeof(QObject)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QObject_deleteLater (IntPtr raw); + public void DeleteLater () + { + qt_QObject_deleteLater (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QObject_objectTrees (); + public static QObjectList ObjectTrees () + { + return (QObjectList)LookupObject (qt_QObject_objectTrees (), typeof(QObjectList)); + } + + /*FIXME + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QObject_connectInternal (IntPtr sender, int signal_index, IntPtr receiver, int membcode, int member_index); + public static void ConnectInternal (QObject sender, int signal_index, QObject receiver, int membcode, int member_index) + { + qt_QObject_connectInternal (sender.RawObject, signal_index, receiver.RawObject, membcode, member_index); + } + */ + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QObject_activate_filters (IntPtr raw, IntPtr arg1); + protected bool Activate_filters (QEvent arg1) + { + return qt_QObject_activate_filters (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QObject_receivers (IntPtr raw, string signal); + protected QConnectionList Receivers (string signal) + { + return (QConnectionList)LookupObject (qt_QObject_receivers (rawObject, signal), typeof(QConnectionList)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QObject_receivers1 (IntPtr raw, int signal); + protected QConnectionList Receivers (int signal) + { + return (QConnectionList)LookupObject (qt_QObject_receivers1 (rawObject, signal), typeof(QConnectionList)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QObject_activate_signal (IntPtr raw, int signal); + protected void Activate_signal (int signal) + { + qt_QObject_activate_signal (rawObject, signal); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QObject_activate_signal1 (IntPtr raw, int signal, int arg1); + protected void Activate_signal (int signal, int arg1) + { + qt_QObject_activate_signal1 (rawObject, signal, arg1); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QObject_activate_signal2 (IntPtr raw, int signal, double arg1); + protected void Activate_signal (int signal, double arg1) + { + qt_QObject_activate_signal2 (rawObject, signal, arg1); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QObject_activate_signal3 (IntPtr raw, int signal, IntPtr arg1); + protected void Activate_signal (int signal, string arg1) + { + qt_QObject_activate_signal3 (rawObject, signal, new QString (arg1).RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QObject_activate_signal_bool (IntPtr raw, int signal, bool arg1); + protected void Activate_signal_bool (int signal, bool arg1) + { + qt_QObject_activate_signal_bool (rawObject, signal, arg1); + } + + /* + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QObject_activate_signal4 (IntPtr raw, IntPtr clist, IntPtr o); + protected void Activate_signal (QConnectionList clist, IntPtr o) + { + qt_QObject_activate_signal4 (rawObject, clist.RawObject, o); + } + */ + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QObject_sender (IntPtr raw); + protected QObject Sender () + { + return (QObject)LookupObject (qt_QObject_sender (rawObject), typeof(QObject)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QObject_connectNotify (IntPtr raw, string signal); + protected void ConnectNotify (string signal) + { + qt_QObject_connectNotify (rawObject, signal); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QObject_disconnectNotify (IntPtr raw, string signal); + protected void DisconnectNotify (string signal) + { + qt_QObject_disconnectNotify (rawObject, signal); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QObject_checkConnectArgs (IntPtr raw, string signal, IntPtr receiver, string member); + protected bool CheckConnectArgs (string signal, QObject receiver, string member) + { + return qt_QObject_checkConnectArgs (rawObject, signal, receiver.RawObject, member); + } + + /* + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QObject_normalizeSignalSlot (string signalSlot); + protected static QCString NormalizeSignalSlot (string signalSlot) + { + return (QCString)LookupObject (qt_QObject_normalizeSignalSlot (signalSlot), typeof(QCString)); + } + */ + + public QObject Child (string objName) + { + return Child(objName, null); + } + + public QObject Child (string objName, string inheritsClass) + { + return Child(objName, inheritsClass, true); + } + + public QObjectList QueryList () + { + return QueryList(""); + } + + public QObjectList QueryList (string inheritsClass) + { + return QueryList(inheritsClass, ""); + } + + public QObjectList QueryList (string inheritsClass, string objName) + { + return QueryList(inheritsClass, objName, true); + } + + public QObjectList QueryList (string inheritsClass, string objName, bool regexpMatch) + { + return QueryList(inheritsClass, objName, regexpMatch, true); + } + } + + // FIXME Used only by QtSignal + internal class NoSignalInit + { + public static readonly NoSignalInit Instance = new NoSignalInit (); + } +} diff --git a/qtsharp/src/bindings/static/QPopupMenu.cs b/qtsharp/src/bindings/static/QPopupMenu.cs new file mode 100644 index 00000000..a4b6da09 --- /dev/null +++ b/qtsharp/src/bindings/static/QPopupMenu.cs @@ -0,0 +1,830 @@ +// QPopupMenu.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Regenerated by Adam Treat on August 03 2002 +// +// TODO +// o Override Dispose method, make sure slots are disconnected. + +namespace Qt { + + using Qt; + using System; + using System.Collections; + using System.Runtime.InteropServices; + + public class QPopupMenu : QFrame, IQMenuData, IDisposable { + + private Hashtable menuConnections; + + public Hashtable MenuConnections { + get { return menuConnections; } + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_new_QPopupMenu (IntPtr parent, string name); + public QPopupMenu (QWidget parent, string name) : this (QNull.Instance) + { + qparent = parent; + if (qparent == null) parent = new QWidget (IntPtr.Zero); + rawObject = qt_new_QPopupMenu (parent.RawObject, name); + if (qparent == null) RegisterObject (this); + else qparent.AddChild (this); + } + + public QPopupMenu () : this (new QWidget ()) {} + + public QPopupMenu (QWidget parent) : this (parent, "") {} + + internal QPopupMenu (IntPtr ptr) : this (QNull.Instance) + { + rawObject = ptr; + RegisterObject(this); + } + + internal QPopupMenu (QNull dummy) : base (QNull.Instance) + { + menuConnections = new Hashtable(); + } + + ~QPopupMenu () + { + Dispose (false); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_del_QPopupMenu (IntPtr obj); + internal override void Delete () + { + if (deleted) return; + + qt_del_QPopupMenu (rawObject); + deleted = true; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QPopupMenu_popup (IntPtr raw, IntPtr pos, int indexAtPoint); + public void Popup (QPoint pos, int indexAtPoint) + { + qt_QPopupMenu_popup (rawObject, pos.RawObject, indexAtPoint); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QPopupMenu_updateItem (IntPtr raw, int identifier); + public void UpdateItem (int identifier) + { + qt_QPopupMenu_updateItem (rawObject, identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QPopupMenu_setCheckable (IntPtr raw, bool arg1); + public void SetCheckable (bool arg1) + { + qt_QPopupMenu_setCheckable (rawObject, arg1); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QPopupMenu_isCheckable (IntPtr raw); + public bool IsCheckable () + { + return qt_QPopupMenu_isCheckable (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QPopupMenu_setFont (IntPtr raw, IntPtr arg1); + public void SetFont (QFont arg1) + { + qt_QPopupMenu_setFont (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QPopupMenu_show (IntPtr raw); + public void Show () + { + qt_QPopupMenu_show (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QPopupMenu_hide (IntPtr raw); + public void Hide () + { + qt_QPopupMenu_hide (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QPopupMenu_exec (IntPtr raw); + public int Exec () + { + return qt_QPopupMenu_exec (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QPopupMenu_exec1 (IntPtr raw, IntPtr pos, int indexAtPoint); + public int Exec (QPoint pos, int indexAtPoint) + { + return qt_QPopupMenu_exec1 (rawObject, pos.RawObject, indexAtPoint); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QPopupMenu_setActiveItem (IntPtr raw, int arg1); + public void SetActiveItem (int arg1) + { + qt_QPopupMenu_setActiveItem (rawObject, arg1); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QPopupMenu_sizeHint (IntPtr raw); + public QSize SizeHint () + { + return (QSize)LookupObject (qt_QPopupMenu_sizeHint (rawObject), typeof(QSize)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QPopupMenu_idAt (IntPtr raw, int index); + public int IdAt (int index) + { + return qt_QPopupMenu_idAt (rawObject, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QPopupMenu_idAt1 (IntPtr raw, IntPtr pos); + public int IdAt (QPoint pos) + { + return qt_QPopupMenu_idAt1 (rawObject, pos.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QPopupMenu_customWhatsThis (IntPtr raw); + public bool CustomWhatsThis () + { + return qt_QPopupMenu_customWhatsThis (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QPopupMenu_insertTearOffHandle (IntPtr raw, int identifier, int index); + public int InsertTearOffHandle (int identifier, int index) + { + return qt_QPopupMenu_insertTearOffHandle (rawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QPopupMenu_activateItemAt (IntPtr raw, int index); + public void ActivateItemAt (int index) + { + qt_QPopupMenu_activateItemAt (rawObject, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QPopupMenu_itemGeometry (IntPtr raw, int index); + public QRect ItemGeometry (int index) + { + return (QRect)LookupObject (qt_QPopupMenu_itemGeometry (rawObject, index), typeof(QRect)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QPopupMenu_itemHeight (IntPtr raw, int arg1); + protected int ItemHeight (int arg1) + { + return qt_QPopupMenu_itemHeight (rawObject, arg1); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QPopupMenu_itemHeight1 (IntPtr raw, IntPtr mi); + protected int ItemHeight (QMenuItem mi) + { + return qt_QPopupMenu_itemHeight1 (rawObject, mi.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QPopupMenu_drawItem (IntPtr raw, IntPtr p, int tab, IntPtr mi, bool act, int x, int y, int w, int h); + protected void DrawItem (QPainter p, int tab, QMenuItem mi, bool act, int x, int y, int w, int h) + { + qt_QPopupMenu_drawItem (rawObject, p.RawObject, tab, mi.RawObject, act, x, y, w, h); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QPopupMenu_drawContents (IntPtr raw, IntPtr arg1); + protected void DrawContents (QPainter arg1) + { + qt_QPopupMenu_drawContents (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QPopupMenu_styleChange (IntPtr raw, IntPtr arg1); + protected void StyleChange (QStyle arg1) + { + qt_QPopupMenu_styleChange (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QPopupMenu_columns (IntPtr raw); + protected int Columns () + { + return qt_QPopupMenu_columns (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QPopupMenu_focusNextPrevChild (IntPtr raw, bool next); + protected bool FocusNextPrevChild (bool next) + { + return qt_QPopupMenu_focusNextPrevChild (rawObject, next); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QPopupMenu_itemAtPos (IntPtr raw, IntPtr arg1, bool ignoreSeparator); + protected int ItemAtPos (QPoint arg1, bool ignoreSeparator) + { + return qt_QPopupMenu_itemAtPos (rawObject, arg1.RawObject, ignoreSeparator); + } + + public void Popup (QPoint pos) + { + Popup(pos, (int) 0); + } + + public int Exec (QPoint pos) + { + return Exec(pos, (int) 0); + } + + public int InsertTearOffHandle () + { + return InsertTearOffHandle((int) -1); + } + + public int InsertTearOffHandle (int identifier) + { + return InsertTearOffHandle(identifier, (int) -1); + } + + protected int ItemAtPos (QPoint arg1) + { + return ItemAtPos(arg1, true); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QPopupMenu_QMenuData (IntPtr raw); + public IntPtr QMenuData () + { + return qt_QPopupMenu_QMenuData (rawObject); + } + + // Begin interface methods. + + + //********************* A temporary hack to divert connections to CSharpConnect *****************// + + public int InsertItem (string text, QObject receiver, string member, QKeySequence accel, int identifier, int index) + { + int id = InsertItem (text, identifier, index); + SetAccel (accel, id); + ConnectItem (id, receiver, member); + return id; + } + + public int InsertItem (QIconSet icon, string text, QObject receiver, string member, QKeySequence accel, int identifier, int index) + { + int id = InsertItem (icon, text, identifier, index); + SetAccel (accel, id); + ConnectItem (id, receiver, member); + return id; + } + + public int InsertItem (QPixmap pixmap, QObject receiver, string member, QKeySequence accel, int identifier, int index) + { + int id = InsertItem (pixmap, identifier, index); + SetAccel (accel, id); + ConnectItem (id, receiver, member); + return id; + } + + public int InsertItem (QIconSet icon, QPixmap pixmap, QObject receiver, string member, QKeySequence accel, int identifier, int index) + { + int id = InsertItem (icon, pixmap, identifier, index); + SetAccel (accel, id); + ConnectItem (id, receiver, member); + return id; + } + + public bool ConnectItem (int identifier, QObject receiver, string member) + { + return Qt.QMenuData.ConnectItem (this, QMenuData (), identifier, receiver, member); + } + + public bool DisconnectItem (int identifier, QObject receiver, string member) + { + return Qt.QMenuData.DisconnectItem (this, QMenuData (), identifier, receiver, member); + } + + //********************* A temporary hack to divert connections to CSharpConnect *****************// + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern uint qt_QMenuData_count (IntPtr raw); + public uint Count () + { + return qt_QMenuData_count (QMenuData ()); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem4 (IntPtr raw, IntPtr text, int identifier, int index); + public int InsertItem (string text, int identifier, int index) + { + return qt_QMenuData_insertItem4 (QMenuData (), new QString (text).RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem5 (IntPtr raw, IntPtr icon, IntPtr text, int identifier, int index); + public int InsertItem (QIconSet icon, string text, int identifier, int index) + { + return qt_QMenuData_insertItem5 (QMenuData (), icon.RawObject, new QString (text).RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem6 (IntPtr raw, IntPtr text, IntPtr popup, int identifier, int index); + public int InsertItem (string text, QPopupMenu popup, int identifier, int index) + { + return qt_QMenuData_insertItem6 (QMenuData (), new QString (text).RawObject, popup.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem7 (IntPtr raw, IntPtr icon, IntPtr text, IntPtr popup, int identifier, int index); + public int InsertItem (QIconSet icon, string text, QPopupMenu popup, int identifier, int index) + { + return qt_QMenuData_insertItem7 (QMenuData (), icon.RawObject, new QString (text).RawObject, popup.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem8 (IntPtr raw, IntPtr pixmap, int identifier, int index); + public int InsertItem (QPixmap pixmap, int identifier, int index) + { + return qt_QMenuData_insertItem8 (QMenuData (), pixmap.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem9 (IntPtr raw, IntPtr icon, IntPtr pixmap, int identifier, int index); + public int InsertItem (QIconSet icon, QPixmap pixmap, int identifier, int index) + { + return qt_QMenuData_insertItem9 (QMenuData (), icon.RawObject, pixmap.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem10 (IntPtr raw, IntPtr pixmap, IntPtr popup, int identifier, int index); + public int InsertItem (QPixmap pixmap, QPopupMenu popup, int identifier, int index) + { + return qt_QMenuData_insertItem10 (QMenuData (), pixmap.RawObject, popup.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem11 (IntPtr raw, IntPtr icon, IntPtr pixmap, IntPtr popup, int identifier, int index); + public int InsertItem (QIconSet icon, QPixmap pixmap, QPopupMenu popup, int identifier, int index) + { + return qt_QMenuData_insertItem11 (QMenuData (), icon.RawObject, pixmap.RawObject, popup.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem12 (IntPtr raw, IntPtr widget, int identifier, int index); + public int InsertItem (QWidget widget, int identifier, int index) + { + return qt_QMenuData_insertItem12 (QMenuData (), widget.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem13 (IntPtr raw, IntPtr icon, IntPtr custom, int identifier, int index); + public int InsertItem (QIconSet icon, QCustomMenuItem custom, int identifier, int index) + { + return qt_QMenuData_insertItem13 (QMenuData (), icon.RawObject, custom.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertItem14 (IntPtr raw, IntPtr custom, int identifier, int index); + public int InsertItem (QCustomMenuItem custom, int identifier, int index) + { + return qt_QMenuData_insertItem14 (QMenuData (), custom.RawObject, identifier, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_insertSeparator (IntPtr raw, int index); + public int InsertSeparator (int index) + { + return qt_QMenuData_insertSeparator (QMenuData (), index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_removeItem (IntPtr raw, int identifier); + public void RemoveItem (int identifier) + { + qt_QMenuData_removeItem (QMenuData (), identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_removeItemAt (IntPtr raw, int index); + public void RemoveItemAt (int index) + { + qt_QMenuData_removeItemAt (QMenuData (), index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_clear (IntPtr raw); + public void Clear () + { + qt_QMenuData_clear (QMenuData ()); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_accel (IntPtr raw, int identifier); + public QKeySequence Accel (int identifier) + { + return (QKeySequence)LookupObject (qt_QMenuData_accel (QMenuData (), identifier), typeof(QKeySequence)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_setAccel (IntPtr raw, IntPtr key, int identifier); + public void SetAccel (QKeySequence key, int identifier) + { + qt_QMenuData_setAccel (QMenuData (), key.RawObject, identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_iconSet (IntPtr raw, int identifier); + public QIconSet IconSet (int identifier) + { + return (QIconSet)LookupObject (qt_QMenuData_iconSet (QMenuData (), identifier), typeof(QIconSet)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_text (IntPtr raw, int identifier); + public string Text (int identifier) + { + QString qstr = new QString (qt_QMenuData_text (QMenuData (), identifier)); + string str = qstr.Latin1 (); + qstr.Dispose (); + return str; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_pixmap (IntPtr raw, int identifier); + public QPixmap Pixmap (int identifier) + { + return (QPixmap)LookupObject (qt_QMenuData_pixmap (QMenuData (), identifier), typeof(QPixmap)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_setWhatsThis (IntPtr raw, int identifier, IntPtr arg1); + public void SetWhatsThis (int identifier, string arg1) + { + qt_QMenuData_setWhatsThis (QMenuData (), identifier, new QString (arg1).RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_whatsThis (IntPtr raw, int identifier); + public string WhatsThis (int identifier) + { + QString qstr = new QString (qt_QMenuData_whatsThis (QMenuData (), identifier)); + string str = qstr.Latin1 (); + qstr.Dispose (); + return str; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_changeItem (IntPtr raw, int identifier, IntPtr text); + public void ChangeItem (int identifier, string text) + { + qt_QMenuData_changeItem (QMenuData (), identifier, new QString (text).RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_changeItem1 (IntPtr raw, int identifier, IntPtr pixmap); + public void ChangeItem (int identifier, QPixmap pixmap) + { + qt_QMenuData_changeItem1 (QMenuData (), identifier, pixmap.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_changeItem2 (IntPtr raw, int identifier, IntPtr icon, IntPtr text); + public void ChangeItem (int identifier, QIconSet icon, string text) + { + qt_QMenuData_changeItem2 (QMenuData (), identifier, icon.RawObject, new QString (text).RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_changeItem3 (IntPtr raw, int identifier, IntPtr icon, IntPtr pixmap); + public void ChangeItem (int identifier, QIconSet icon, QPixmap pixmap) + { + qt_QMenuData_changeItem3 (QMenuData (), identifier, icon.RawObject, pixmap.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_changeItem4 (IntPtr raw, IntPtr text, int identifier); + public void ChangeItem (string text, int identifier) + { + qt_QMenuData_changeItem4 (QMenuData (), new QString (text).RawObject, identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_changeItem5 (IntPtr raw, IntPtr pixmap, int identifier); + public void ChangeItem (QPixmap pixmap, int identifier) + { + qt_QMenuData_changeItem5 (QMenuData (), pixmap.RawObject, identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_changeItem6 (IntPtr raw, IntPtr icon, IntPtr text, int identifier); + public void ChangeItem (QIconSet icon, string text, int identifier) + { + qt_QMenuData_changeItem6 (QMenuData (), icon.RawObject, new QString (text).RawObject, identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QMenuData_isItemActive (IntPtr raw, int identifier); + public bool IsItemActive (int identifier) + { + return qt_QMenuData_isItemActive (QMenuData (), identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QMenuData_isItemEnabled (IntPtr raw, int identifier); + public bool IsItemEnabled (int identifier) + { + return qt_QMenuData_isItemEnabled (QMenuData (), identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_setItemEnabled (IntPtr raw, int identifier, bool enable); + public void SetItemEnabled (int identifier, bool enable) + { + qt_QMenuData_setItemEnabled (QMenuData (), identifier, enable); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QMenuData_isItemChecked (IntPtr raw, int identifier); + public bool IsItemChecked (int identifier) + { + return qt_QMenuData_isItemChecked (QMenuData (), identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_setItemChecked (IntPtr raw, int identifier, bool check); + public void SetItemChecked (int identifier, bool check) + { + qt_QMenuData_setItemChecked (QMenuData (), identifier, check); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_indexOf (IntPtr raw, int identifier); + public int IndexOf (int identifier) + { + return qt_QMenuData_indexOf (QMenuData (), identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_setId (IntPtr raw, int index, int identifier); + public void SetId (int index, int identifier) + { + qt_QMenuData_setId (QMenuData (), index, identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QMenuData_setItemParameter (IntPtr raw, int identifier, int param); + public bool SetItemParameter (int identifier, int param) + { + return qt_QMenuData_setItemParameter (QMenuData (), identifier, param); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QMenuData_itemParameter (IntPtr raw, int identifier); + public int ItemParameter (int identifier) + { + return qt_QMenuData_itemParameter (QMenuData (), identifier); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_findItem (IntPtr raw, int identifier); + public QMenuItem FindItem (int identifier) + { + return (QMenuItem)LookupObject (qt_QMenuData_findItem (QMenuData (), identifier), typeof(QMenuItem)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_findItem1 (IntPtr raw, int identifier, IntPtr parent); + public QMenuItem FindItem (int identifier, QMenuData parent) + { + return (QMenuItem)LookupObject (qt_QMenuData_findItem1 (QMenuData (), identifier, parent.RawObject), typeof(QMenuItem)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QMenuData_findPopup (IntPtr raw, IntPtr arg1, int[] index); + public QMenuItem FindPopup (QPopupMenu arg1, int[] index) + { + return (QMenuItem)LookupObject (qt_QMenuData_findPopup (QMenuData (), arg1.RawObject, index), typeof(QMenuItem)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_menuInsPopup (IntPtr raw, IntPtr arg1); + protected void MenuInsPopup (QPopupMenu arg1) + { + qt_QMenuData_menuInsPopup (QMenuData (), arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QMenuData_menuDelPopup (IntPtr raw, IntPtr arg1); + protected void MenuDelPopup (QPopupMenu arg1) + { + qt_QMenuData_menuDelPopup (QMenuData (), arg1.RawObject); + } + + public int InsertItem (string text, QObject receiver, string member) + { + return InsertItem(text, receiver, member, new QKeySequence ()); + } + + public int InsertItem (string text, QObject receiver, string member, QKeySequence accel) + { + return InsertItem(text, receiver, member, accel, (int) -1); + } + + public int InsertItem (string text, QObject receiver, string member, QKeySequence accel, int identifier) + { + return InsertItem(text, receiver, member, accel, identifier, (int) -1); + } + + public int InsertItem (QIconSet icon, string text, QObject receiver, string member) + { + return InsertItem(icon, text, receiver, member, new QKeySequence ()); + } + + public int InsertItem (QIconSet icon, string text, QObject receiver, string member, QKeySequence accel) + { + return InsertItem(icon, text, receiver, member, accel, (int) -1); + } + + public int InsertItem (QIconSet icon, string text, QObject receiver, string member, QKeySequence accel, int identifier) + { + return InsertItem(icon, text, receiver, member, accel, identifier, (int) -1); + } + + public int InsertItem (QPixmap pixmap, QObject receiver, string member) + { + return InsertItem(pixmap, receiver, member, new QKeySequence ()); + } + + public int InsertItem (QPixmap pixmap, QObject receiver, string member, QKeySequence accel) + { + return InsertItem(pixmap, receiver, member, accel, (int) -1); + } + + public int InsertItem (QPixmap pixmap, QObject receiver, string member, QKeySequence accel, int identifier) + { + return InsertItem(pixmap, receiver, member, accel, identifier, (int) -1); + } + + public int InsertItem (QIconSet icon, QPixmap pixmap, QObject receiver, string member) + { + return InsertItem(icon, pixmap, receiver, member, new QKeySequence ()); + } + + public int InsertItem (QIconSet icon, QPixmap pixmap, QObject receiver, string member, QKeySequence accel) + { + return InsertItem(icon, pixmap, receiver, member, accel, (int) -1); + } + + public int InsertItem (QIconSet icon, QPixmap pixmap, QObject receiver, string member, QKeySequence accel, int identifier) + { + return InsertItem(icon, pixmap, receiver, member, accel, identifier, (int) -1); + } + + public int InsertItem (string text) + { + return InsertItem(text, (int) -1); + } + + public int InsertItem (string text, int identifier) + { + return InsertItem(text, identifier, (int) -1); + } + + public int InsertItem (QIconSet icon, string text) + { + return InsertItem(icon, text, (int) -1); + } + + public int InsertItem (QIconSet icon, string text, int identifier) + { + return InsertItem(icon, text, identifier, (int) -1); + } + + public int InsertItem (string text, QPopupMenu popup) + { + return InsertItem(text, popup, (int) -1); + } + + public int InsertItem (string text, QPopupMenu popup, int identifier) + { + return InsertItem(text, popup, identifier, (int) -1); + } + + public int InsertItem (QIconSet icon, string text, QPopupMenu popup) + { + return InsertItem(icon, text, popup, (int) -1); + } + + public int InsertItem (QIconSet icon, string text, QPopupMenu popup, int identifier) + { + return InsertItem(icon, text, popup, identifier, (int) -1); + } + + public int InsertItem (QPixmap pixmap) + { + return InsertItem(pixmap, (int) -1); + } + + public int InsertItem (QPixmap pixmap, int identifier) + { + return InsertItem(pixmap, identifier, (int) -1); + } + + public int InsertItem (QIconSet icon, QPixmap pixmap) + { + return InsertItem(icon, pixmap, (int) -1); + } + + public int InsertItem (QIconSet icon, QPixmap pixmap, int identifier) + { + return InsertItem(icon, pixmap, identifier, (int) -1); + } + + public int InsertItem (QPixmap pixmap, QPopupMenu popup) + { + return InsertItem(pixmap, popup, (int) -1); + } + + public int InsertItem (QPixmap pixmap, QPopupMenu popup, int identifier) + { + return InsertItem(pixmap, popup, identifier, (int) -1); + } + + public int InsertItem (QIconSet icon, QPixmap pixmap, QPopupMenu popup) + { + return InsertItem(icon, pixmap, popup, (int) -1); + } + + public int InsertItem (QIconSet icon, QPixmap pixmap, QPopupMenu popup, int identifier) + { + return InsertItem(icon, pixmap, popup, identifier, (int) -1); + } + + public int InsertItem (QWidget widget) + { + return InsertItem(widget, (int) -1); + } + + public int InsertItem (QWidget widget, int identifier) + { + return InsertItem(widget, identifier, (int) -1); + } + + public int InsertItem (QIconSet icon, QCustomMenuItem custom) + { + return InsertItem(icon, custom, (int) -1); + } + + public int InsertItem (QIconSet icon, QCustomMenuItem custom, int identifier) + { + return InsertItem(icon, custom, identifier, (int) -1); + } + + public int InsertItem (QCustomMenuItem custom) + { + return InsertItem(custom, (int) -1); + } + + public int InsertItem (QCustomMenuItem custom, int identifier) + { + return InsertItem(custom, identifier, (int) -1); + } + + public int InsertSeparator () + { + return InsertSeparator((int) -1); + } + + public QMenuItem FindPopup (QPopupMenu arg1) + { + return FindPopup(arg1, new int[]{0}); + } + } +} diff --git a/qtsharp/src/bindings/static/QString.cs b/qtsharp/src/bindings/static/QString.cs new file mode 100644 index 00000000..fd532256 --- /dev/null +++ b/qtsharp/src/bindings/static/QString.cs @@ -0,0 +1,1340 @@ +// QString.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Static file customized to allow unicode strings and +// other features + + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public class QString : QtSupport, IDisposable { + + public enum SectionFlags { + SectionDefault = 0, + SectionSkipEmpty = 1, + SectionIncludeLeadingSep = 2, + SectionIncludeTrailingSep = 4, + SectionCaseInsensitiveSeps = 8 + } + + + [DllImport("libqtc")] + private static extern IntPtr qt_QString_null (); + public static readonly QString Null = new QString (qt_QString_null ()); + + // TODO: Is there a good reason why this C# constructor is public? + [DllImport("libqtc")] + private static extern IntPtr qt_new_QString (); + public QString () : this (QNull.Instance) + { + rawObject = qt_new_QString (); + } + + // TODO: Make sure there is a QChar constructor that + // handles unicode conversion + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_new_QString1 (IntPtr arg1); + public QString (QChar arg1) : this (QNull.Instance) + { + rawObject = qt_new_QString1 (arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_new_QString2 (IntPtr arg1); + public QString (QString arg1) : this (QNull.Instance) + { + rawObject = qt_new_QString2 (arg1.RawObject); + } + + // TODO: Verify that this works. We have weak support for + // QByteArray + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_new_QString3 (IntPtr arg1); + public QString (QByteArray arg1) : this (QNull.Instance) + { + rawObject = qt_new_QString3 (arg1.RawObject); + } + + // TODO: This signature is wrong. The C++ version is + // takes a pointer to a sequence of QChars, not a single + // QChar + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_new_QString4 (IntPtr unicode, uint length); + public QString (QChar unicode, uint length) : this (QNull.Instance) + { + rawObject = qt_new_QString4 (unicode.RawObject, length); + + } + + [DllImport("libqtc")] + private static extern IntPtr qt_QString_setUnicodeCodes( + IntPtr raw, + [MarshalAs(UnmanagedType.LPWStr)] string s, + uint len); + + public QString( string s ): this( QNull.Instance ) + { + rawObject = qt_new_QString (); + rawObject = qt_QString_setUnicodeCodes( + rawObject, s, (uint) s.Length ); + } + + internal QString (IntPtr ptr) : this (QNull.Instance) + { + rawObject = ptr; + + } + + internal QString (QNull dummy) : base (QNull.Instance) {} + + + [DllImport("libqtc")] + private static extern void qt_del_QString (IntPtr str); + ~QString () + { + qt_del_QString (rawObject); + } + + + [DllImport("libqtc")] + private static extern ushort qt_QChar_unicode (IntPtr raw); + + public char this[int index] + { + get + { + return (char) qt_QChar_unicode( + qt_QString_at( rawObject, (uint) index ) ); + } + } + + public static implicit operator string ( QString s ) + { + int length = (int) s.Length(); + char[] t = new char[length]; + + for (int i = 0; i < length; i++ ) + t[i] = s[i]; + + return new String(t); + } + + public static implicit operator QString ( string s ) + { + return new QString(s); + } + + public override string ToString () + { + return (string) this; + } + + public static QString operator + ( QString a, QString b ) + { + QString result = new QString (qt_new_QString2( a.rawObject )); + result.rawObject = + qt_QString_append2( result.rawObject, b.rawObject ); + return result; + } + + // TODO: Do we need ==, !=, Equals(), etc? + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QString_isNull (IntPtr raw); + public bool IsNull () + { + return qt_QString_isNull (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QString_isEmpty (IntPtr raw); + public bool IsEmpty () + { + return qt_QString_isEmpty (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern uint qt_QString_length (IntPtr raw); + public uint Length () + { + return qt_QString_length (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QString_truncate (IntPtr raw, uint pos); + public void Truncate (uint pos) + { + qt_QString_truncate (rawObject, pos); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_fill (IntPtr raw, IntPtr c, int len); + public QString Fill (QChar c, int len) + { + return new QString (qt_QString_fill (rawObject, c.RawObject, len)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_arg (IntPtr raw, long a, int fieldwidth, int Q_base); + public QString Arg (long a, int fieldwidth, int Q_base) + { + return new QString (qt_QString_arg (rawObject, a, fieldwidth, Q_base)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_arg1 (IntPtr raw, ulong a, int fieldwidth, int Q_base); + public QString Arg (ulong a, int fieldwidth, int Q_base) + { + return new QString (qt_QString_arg1 (rawObject, a, fieldwidth, Q_base)); + + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_arg2 (IntPtr raw, int a, int fieldwidth, int Q_base); + public QString Arg (int a, int fieldwidth, int Q_base) + { + return new QString (qt_QString_arg2 (rawObject, a, fieldwidth, Q_base)); + + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_arg3 (IntPtr raw, uint a, int fieldwidth, int Q_base); + public QString Arg (uint a, int fieldwidth, int Q_base) + { + return new QString (qt_QString_arg3 (rawObject, a, fieldwidth, Q_base)); + + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_arg4 (IntPtr raw, short a, int fieldwidth, int Q_base); + public QString Arg (short a, int fieldwidth, int Q_base) + { + return new QString (qt_QString_arg4 (rawObject, a, fieldwidth, Q_base)); + + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_arg5 (IntPtr raw, ushort a, int fieldwidth, int Q_base); + public QString Arg (ushort a, int fieldwidth, int Q_base) + { + return new QString (qt_QString_arg5 (rawObject, a, fieldwidth, Q_base)); + + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_arg6 (IntPtr raw, char a, int fieldwidth); + public QString Arg (char a, int fieldwidth) + { + return new QString (qt_QString_arg6 (rawObject, a, fieldwidth)); + + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_arg7 (IntPtr raw, IntPtr a, int fieldwidth); + public QString Arg (QChar a, int fieldwidth) + { + return new QString (qt_QString_arg7 (rawObject, a.RawObject, fieldwidth)); + + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_arg8 (IntPtr raw, IntPtr a, int fieldwidth); + public QString Arg (QString a, int fieldwidth) + { + return new QString (qt_QString_arg8 (rawObject, a.RawObject, fieldwidth)); + + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_arg9 (IntPtr raw, double a, int fieldwidth, char fmt, int prec); + public QString Arg (double a, int fieldwidth, char fmt, int prec) + { + return new QString (qt_QString_arg9 (rawObject, a, fieldwidth, fmt, prec)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QString_find (IntPtr raw, IntPtr c, int index, bool cs); + public int Find (QChar c, int index, bool cs) + { + return qt_QString_find (rawObject, c.RawObject, index, cs); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QString_find1 (IntPtr raw, char c, int index, bool cs); + public int Find (char c, int index, bool cs) + { + return qt_QString_find1 (rawObject, c, index, cs); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QString_find2 (IntPtr raw, IntPtr str, int index, bool cs); + public int Find (QString str, int index, bool cs) + { + return qt_QString_find2 (rawObject, str.RawObject, index, cs); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QString_find3 (IntPtr raw, IntPtr arg1, int index); + public int Find (QRegExp arg1, int index) + { + return qt_QString_find3 (rawObject, arg1.RawObject, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QString_find4 (IntPtr raw, string str, int index); + public int Find (string str, int index) + { + return qt_QString_find4 (rawObject, str, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QString_findRev (IntPtr raw, IntPtr c, int index, bool cs); + public int FindRev (QChar c, int index, bool cs) + { + return qt_QString_findRev (rawObject, c.RawObject, index, cs); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QString_findRev1 (IntPtr raw, char c, int index, bool cs); + public int FindRev (char c, int index, bool cs) + { + return qt_QString_findRev1 (rawObject, c, index, cs); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QString_findRev2 (IntPtr raw, IntPtr str, int index, bool cs); + public int FindRev (QString str, int index, bool cs) + { + return qt_QString_findRev2 (rawObject, str.RawObject, index, cs); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QString_findRev3 (IntPtr raw, IntPtr arg1, int index); + public int FindRev (QRegExp arg1, int index) + { + return qt_QString_findRev3 (rawObject, arg1.RawObject, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QString_findRev4 (IntPtr raw, string str, int index); + public int FindRev (string str, int index) + { + return qt_QString_findRev4 (rawObject, str, index); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QString_contains (IntPtr raw, IntPtr c, bool cs); + public int Contains (QChar c, bool cs) + { + return qt_QString_contains (rawObject, c.RawObject, cs); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QString_contains1 (IntPtr raw, char c, bool cs); + public int Contains (char c, bool cs) + { + return qt_QString_contains1 (rawObject, c, cs); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QString_contains2 (IntPtr raw, string str, bool cs); + public int Contains (string str, bool cs) + { + return qt_QString_contains2 (rawObject, str, cs); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QString_contains3 (IntPtr raw, IntPtr str, bool cs); + public int Contains (QString str, bool cs) + { + return qt_QString_contains3 (rawObject, str.RawObject, cs); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QString_contains4 (IntPtr raw, IntPtr arg1); + public int Contains (QRegExp arg1) + { + return qt_QString_contains4 (rawObject, arg1.RawObject); + } + + // TODO: This is wrong. sep should be a QChar* in C++ terms + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_section (IntPtr raw, IntPtr sep, int start, int end, QString.SectionFlags SectionFlags); + public QString Section (QChar sep, int start, int end, QString.SectionFlags SectionFlags) + { + return new QString (qt_QString_section (rawObject, sep.RawObject, start, end, SectionFlags)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_section1 (IntPtr raw, char sep, int start, int end, QString.SectionFlags SectionFlags); + public QString Section (char sep, int start, int end, QString.SectionFlags SectionFlags) + { + return new QString (qt_QString_section1 (rawObject, sep, start, end, SectionFlags)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_section2 (IntPtr raw, string in_sep, int start, int end, QString.SectionFlags SectionFlags); + public QString Section (string in_sep, int start, int end, QString.SectionFlags SectionFlags) + { + return new QString (qt_QString_section2 (rawObject, in_sep, start, end, SectionFlags)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_section3 (IntPtr raw, IntPtr in_sep, int start, int end, QString.SectionFlags SectionFlags); + public QString Section (QString in_sep, int start, int end, QString.SectionFlags SectionFlags) + { + return new QString (qt_QString_section3 (rawObject, in_sep.RawObject, start, end, SectionFlags)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_section4 (IntPtr raw, IntPtr reg, int start, int end, QString.SectionFlags SectionFlags); + public QString Section (QRegExp reg, int start, int end, QString.SectionFlags SectionFlags) + { + return new QString (qt_QString_section4 (rawObject, reg.RawObject, start, end, SectionFlags)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_left (IntPtr raw, uint len); + public QString Left (uint len) + { + return new QString (qt_QString_left (rawObject, len)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_right (IntPtr raw, uint len); + public QString Right (uint len) + { + return new QString (qt_QString_right (rawObject, len)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_mid (IntPtr raw, uint index, uint len); + public QString Mid (uint index, uint len) + { + return new QString (qt_QString_mid (rawObject, index, len)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_leftJustify (IntPtr raw, uint width, IntPtr fill, bool trunc); + public QString LeftJustify (uint width, QChar fill, bool trunc) + { + return new QString (qt_QString_leftJustify (rawObject, width, fill.RawObject, trunc)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_rightJustify (IntPtr raw, uint width, IntPtr fill, bool trunc); + public QString RightJustify (uint width, QChar fill, bool trunc) + { + return new QString (qt_QString_rightJustify (rawObject, width, fill.RawObject, trunc)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_lower (IntPtr raw); + public QString Lower () + { + return new QString (qt_QString_lower (rawObject)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_upper (IntPtr raw); + public QString Upper () + { + return new QString (qt_QString_upper (rawObject)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_stripWhiteSpace (IntPtr raw); + public QString StripWhiteSpace () + { + return new QString (qt_QString_stripWhiteSpace (rawObject)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_simplifyWhiteSpace (IntPtr raw); + public QString SimplifyWhiteSpace () + { + return new QString (qt_QString_simplifyWhiteSpace (rawObject)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_insert (IntPtr raw, uint index, IntPtr arg1); + public QString Insert (uint index, QString arg1) + { + return new QString (qt_QString_insert (rawObject, index, arg1.RawObject)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_insert1 (IntPtr raw, uint index, IntPtr arg1, uint len); + public QString Insert (uint index, QChar arg1, uint len) + { + return new QString (qt_QString_insert1 (rawObject, index, arg1.RawObject, len)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_insert2 (IntPtr raw, uint index, IntPtr arg1); + public QString Insert (uint index, QChar arg1) + { + return new QString (qt_QString_insert2 (rawObject, index, arg1.RawObject)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_insert3 (IntPtr raw, uint index, char c); + public QString Insert (uint index, char c) + { + return new QString (qt_QString_insert3 (rawObject, index, c)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_append (IntPtr raw, char arg1); + public QString Append (char arg1) + { + return new QString (qt_QString_append (rawObject, arg1)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_append1 (IntPtr raw, IntPtr arg1); + public QString Append (QChar arg1) + { + return new QString (qt_QString_append1 (rawObject, arg1.RawObject)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_append2 (IntPtr raw, IntPtr arg1); + public QString Append (QString arg1) + { + return new QString (qt_QString_append2 (rawObject, arg1.RawObject)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_prepend (IntPtr raw, char arg1); + public QString Prepend (char arg1) + { + return new QString (qt_QString_prepend (rawObject, arg1)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_prepend1 (IntPtr raw, IntPtr arg1); + public QString Prepend (QChar arg1) + { + return new QString (qt_QString_prepend1 (rawObject, arg1.RawObject)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_prepend2 (IntPtr raw, IntPtr arg1); + public QString Prepend (QString arg1) + { + return new QString (qt_QString_prepend2 (rawObject, arg1.RawObject)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_remove (IntPtr raw, uint index, uint len); + public QString Remove (uint index, uint len) + { + return new QString (qt_QString_remove (rawObject, index, len)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_replace (IntPtr raw, uint index, uint len, IntPtr arg1); + public QString Replace (uint index, uint len, QString arg1) + { + return new QString (qt_QString_replace (rawObject, index, len, arg1.RawObject)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_replace1 (IntPtr raw, uint index, uint len, IntPtr arg1, uint clen); + public QString Replace (uint index, uint len, QChar arg1, uint clen) + { + return new QString (qt_QString_replace1 (rawObject, index, len, arg1.RawObject, clen)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_replace2 (IntPtr raw, IntPtr arg1, IntPtr arg2); + public QString Replace (QRegExp arg1, QString arg2) + { + return new QString (qt_QString_replace2 (rawObject, arg1.RawObject, arg2.RawObject)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern short qt_QString_toShort (IntPtr raw, bool ok, int Q_base); + public short ToShort (bool ok, int Q_base) + { + return qt_QString_toShort (rawObject, ok, Q_base); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern ushort qt_QString_toUShort (IntPtr raw, bool ok, int Q_base); + public ushort ToUShort (bool ok, int Q_base) + { + return qt_QString_toUShort (rawObject, ok, Q_base); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QString_toInt (IntPtr raw, bool ok, int Q_base); + public int ToInt (bool ok, int Q_base) + { + return qt_QString_toInt (rawObject, ok, Q_base); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern uint qt_QString_toUInt (IntPtr raw, bool ok, int Q_base); + public uint ToUInt (bool ok, int Q_base) + { + return qt_QString_toUInt (rawObject, ok, Q_base); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern long qt_QString_toLong (IntPtr raw, bool ok, int Q_base); + public long ToLong (bool ok, int Q_base) + { + return qt_QString_toLong (rawObject, ok, Q_base); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern ulong qt_QString_toULong (IntPtr raw, bool ok, int Q_base); + public ulong ToULong (bool ok, int Q_base) + { + return qt_QString_toULong (rawObject, ok, Q_base); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern float qt_QString_toFloat (IntPtr raw, bool ok); + public float ToFloat (bool ok) + { + return qt_QString_toFloat (rawObject, ok); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern double qt_QString_toDouble (IntPtr raw, bool ok); + public double ToDouble (bool ok) + { + return qt_QString_toDouble (rawObject, ok); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_setNum (IntPtr raw, short arg1, int Q_base); + public QString SetNum (short arg1, int Q_base) + { + return new QString (qt_QString_setNum (rawObject, arg1, Q_base)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_setNum1 (IntPtr raw, ushort arg1, int Q_base); + public QString SetNum (ushort arg1, int Q_base) + { + return new QString (qt_QString_setNum1 (rawObject, arg1, Q_base)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_setNum2 (IntPtr raw, int arg1, int Q_base); + public QString SetNum (int arg1, int Q_base) + { + return new QString (qt_QString_setNum2 (rawObject, arg1, Q_base)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_setNum3 (IntPtr raw, uint arg1, int Q_base); + public QString SetNum (uint arg1, int Q_base) + { + return new QString (qt_QString_setNum3 (rawObject, arg1, Q_base)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_setNum4 (IntPtr raw, long arg1, int Q_base); + public QString SetNum (long arg1, int Q_base) + { + return new QString (qt_QString_setNum4 (rawObject, arg1, Q_base)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_setNum5 (IntPtr raw, ulong arg1, int Q_base); + public QString SetNum (ulong arg1, int Q_base) + { + return new QString (qt_QString_setNum5 (rawObject, arg1, Q_base)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_setNum6 (IntPtr raw, float arg1, char f, int prec); + public QString SetNum (float arg1, char f, int prec) + { + return new QString (qt_QString_setNum6 (rawObject, arg1, f, prec)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_setNum7 (IntPtr raw, double arg1, char f, int prec); + public QString SetNum (double arg1, char f, int prec) + { + return new QString (qt_QString_setNum7 (rawObject, arg1, f, prec)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QString_setExpand (IntPtr raw, uint index, IntPtr c); + public void SetExpand (uint index, QChar c) + { + qt_QString_setExpand (rawObject, index, c.RawObject); + } + + // TODO: The QChar functions need to get fixed + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_at (IntPtr raw, uint i); + public QChar At (uint i) + { + return LookupObject (qt_QString_at (rawObject, i), typeof (QChar)) as QChar; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_constref (IntPtr raw, uint i); + public QChar Constref (uint i) + { + return LookupObject (qt_QString_constref (rawObject, i), typeof (QChar)) as QChar; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_ref (IntPtr raw, uint i); + public QChar Q_ref (uint i) + { + return LookupObject (qt_QString_ref (rawObject, i), typeof (QChar)) as QChar; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_unicode (IntPtr raw); + public QChar Unicode () + { + return LookupObject (qt_QString_unicode (rawObject), typeof (QChar)) as QChar; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern string qt_QString_ascii (IntPtr raw); + public string Ascii () + { + return qt_QString_ascii (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern string qt_QString_latin1 (IntPtr raw); + public string Latin1 () + { + return qt_QString_latin1 (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_utf8 (IntPtr raw); + public QCString Utf8 () + { + return LookupObject (qt_QString_utf8 (rawObject), typeof (QCString)) as QCString; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_local8Bit (IntPtr raw); + public QCString Local8Bit () + { + return LookupObject (qt_QString_local8Bit (rawObject), typeof (QCString)) as QCString; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_setUnicode (IntPtr raw, IntPtr unicode, uint len); + public QString SetUnicode (QChar unicode, uint len) + { + return new QString (qt_QString_setUnicode (rawObject, unicode.RawObject, len)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_setLatin1 (IntPtr raw, string arg1, int len); + public QString SetLatin1 (string arg1, int len) + { + return new QString (qt_QString_setLatin1 (rawObject, arg1, len)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QString_compare (IntPtr raw, IntPtr s); + public int Compare (QString s) + { + return qt_QString_compare (rawObject, s.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QString_localeAwareCompare (IntPtr raw, IntPtr s); + public int LocaleAwareCompare (QString s) + { + return qt_QString_localeAwareCompare (rawObject, s.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QString_compose (IntPtr raw); + public void Compose () + { + qt_QString_compose (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern string qt_QString_data (IntPtr raw); + public string Data () + { + return qt_QString_data (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QString_startsWith (IntPtr raw, IntPtr arg1); + public bool StartsWith (QString arg1) + { + return qt_QString_startsWith (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QString_endsWith (IntPtr raw, IntPtr arg1); + public bool EndsWith (QString arg1) + { + return qt_QString_endsWith (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QString_setLength (IntPtr raw, uint newLength); + public void SetLength (uint newLength) + { + qt_QString_setLength (rawObject, newLength); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QString_simpleText (IntPtr raw); + public bool SimpleText () + { + return qt_QString_simpleText (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QString_isRightToLeft (IntPtr raw); + public bool IsRightToLeft () + { + return qt_QString_isRightToLeft (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_number (long arg1, int Q_base); + public static QString Number (long arg1, int Q_base) + { + return new QString (qt_QString_number (arg1, Q_base)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_number1 (ulong arg1, int Q_base); + public static QString Number (ulong arg1, int Q_base) + { + return new QString (qt_QString_number1 (arg1, Q_base)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_number2 (int arg1, int Q_base); + public static QString Number (int arg1, int Q_base) + { + return new QString (qt_QString_number2 (arg1, Q_base)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_number3 (uint arg1, int Q_base); + public static QString Number (uint arg1, int Q_base) + { + return new QString (qt_QString_number3 (arg1, Q_base)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_number4 (double arg1, char f, int prec); + public static QString Number (double arg1, char f, int prec) + { + return new QString (qt_QString_number4 (arg1, f, prec)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_fromLatin1 (string arg1, int len); + public static QString FromLatin1 (string arg1, int len) + { + return new QString (qt_QString_fromLatin1 (arg1, len)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_fromUtf8 (QString arg1, int len); + public static QString FromUtf8 (string arg1, int len) + { + return new QString (qt_QString_fromUtf8 (arg1, len)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QString_fromLocal8Bit (QString arg1, int len); + public static QString FromLocal8Bit (string arg1, int len) + { + return new QString (qt_QString_fromLocal8Bit (arg1, len)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QString_compare1 (IntPtr s1, IntPtr s2); + public static int Compare (QString s1, QString s2) + { + return qt_QString_compare1 (s1.RawObject, s2.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QString_localeAwareCompare1 (IntPtr s1, IntPtr s2); + public static int LocaleAwareCompare (QString s1, QString s2) + { + return qt_QString_localeAwareCompare1 (s1.RawObject, s2.RawObject); + } + + public QString Fill (QChar c) + { + return Fill(c, (int) -1); + } + + public QString Arg (long a) + { + return Arg(a, (int) 0); + } + + public QString Arg (long a, int fieldwidth) + { + return Arg(a, fieldwidth, (int) 10); + } + + public QString Arg (ulong a) + { + return Arg(a, (int) 0); + } + + public QString Arg (ulong a, int fieldwidth) + { + return Arg(a, fieldwidth, (int) 10); + } + + public QString Arg (int a) + { + return Arg(a, (int) 0); + } + + public QString Arg (int a, int fieldwidth) + { + return Arg(a, fieldwidth, (int) 10); + } + + public QString Arg (uint a) + { + return Arg(a, (int) 0); + } + + public QString Arg (uint a, int fieldwidth) + { + return Arg(a, fieldwidth, (int) 10); + } + + public QString Arg (short a) + { + return Arg(a, (int) 0); + } + + public QString Arg (short a, int fieldwidth) + { + return Arg(a, fieldwidth, (int) 10); + } + + public QString Arg (ushort a) + { + return Arg(a, (int) 0); + } + + public QString Arg (ushort a, int fieldwidth) + { + return Arg(a, fieldwidth, (int) 10); + } + + public QString Arg (char a) + { + return Arg(a, (int) 0); + } + + public QString Arg (QChar a) + { + return Arg(a, (int) 0); + } + + public QString Arg (QString a) + { + return Arg(a, (int) 0); + } + + public QString Arg (double a) + { + return Arg(a, (int) 0); + } + + public QString Arg (double a, int fieldwidth) + { + return Arg(a, fieldwidth, (char) 'g'); + } + + public QString Arg (double a, int fieldwidth, char fmt) + { + return Arg(a, fieldwidth, fmt, (int) -1); + } + + public int Find (QChar c) + { + return Find(c, (int) 0); + } + + public int Find (QChar c, int index) + { + return Find(c, index, true); + } + + public int Find (char c) + { + return Find(c, (int) 0); + } + + public int Find (char c, int index) + { + return Find(c, index, true); + } + + public int Find (QString str) + { + return Find(str, (int) 0); + } + + public int Find (QString str, int index) + { + return Find(str, index, true); + } + + public int Find (QRegExp arg1) + { + return Find(arg1, (int) 0); + } + + public int Find (string str) + { + return Find(str, (int) 0); + } + + public int FindRev (QChar c) + { + return FindRev(c, (int) -1); + } + + public int FindRev (QChar c, int index) + { + return FindRev(c, index, true); + } + + public int FindRev (char c) + { + return FindRev(c, (int) -1); + } + + public int FindRev (char c, int index) + { + return FindRev(c, index, true); + } + + public int FindRev (QString str) + { + return FindRev(str, (int) -1); + } + + public int FindRev (QString str, int index) + { + return FindRev(str, index, true); + } + + public int FindRev (QRegExp arg1) + { + return FindRev(arg1, (int) -1); + } + + public int FindRev (string str) + { + return FindRev(str, (int) -1); + } + + public int Contains (QChar c) + { + return Contains(c, true); + } + + public int Contains (char c) + { + return Contains(c, true); + } + + public int Contains (QString str) + { + return Contains(str, true); + } + + public int Contains (string str) + { + return Contains(str, true); + } + + public QString Section (QChar sep, int start) + { + return Section(sep, start, (int) 1); + } + + public QString Section (QChar sep, int start, int end) + { + return Section(sep, start, end, QString.SectionFlags.SectionDefault); + } + + public QString Section (char sep, int start) + { + return Section(sep, start, (int) 1); + } + + public QString Section (char sep, int start, int end) + { + return Section(sep, start, end, QString.SectionFlags.SectionDefault); + } + + public QString Section (QString in_sep, int start) + { + return Section(in_sep, start, (int) 1); + } + + public QString Section (QString in_sep, int start, int end) + { + return Section(in_sep, start, end, QString.SectionFlags.SectionDefault); + } + + public QString Section (string in_sep, int start) + { + return Section(in_sep, start, (int) 1); + } + + public QString Section (string in_sep, int start, int end) + { + return Section(in_sep, start, end, QString.SectionFlags.SectionDefault); + } + + public QString Section (QRegExp reg, int start) + { + return Section(reg, start, (int) 1); + } + + public QString Section (QRegExp reg, int start, int end) + { + return Section(reg, start, end, QString.SectionFlags.SectionDefault); + } + + public QString Mid (uint index) + { + return Mid(index, (uint) 1); + } + + public QString LeftJustify (uint width) + { + return LeftJustify(width, new QChar ()); + } + + public QString LeftJustify (uint width, QChar fill) + { + return LeftJustify(width, fill, false); + } + + public QString RightJustify (uint width) + { + return RightJustify(width, new QChar ()); + } + + public QString RightJustify (uint width, QChar fill) + { + return RightJustify(width, fill, false); + } + + public short ToShort () + { + return ToShort(false); + } + + public short ToShort (bool ok) + { + return ToShort(ok, (int) 10); + } + + public ushort ToUShort () + { + return ToUShort(false); + } + + public ushort ToUShort (bool ok) + { + return ToUShort(ok, (int) 10); + } + + public int ToInt () + { + return ToInt(false); + } + + public int ToInt (bool ok) + { + return ToInt(ok, (int) 10); + } + + public uint ToUInt () + { + return ToUInt(false); + } + + public uint ToUInt (bool ok) + { + return ToUInt(ok, (int) 10); + } + + public long ToLong () + { + return ToLong(false); + } + + public long ToLong (bool ok) + { + return ToLong(ok, (int) 10); + } + + public ulong ToULong () + { + return ToULong(false); + } + + public ulong ToULong (bool ok) + { + return ToULong(ok, (int) 10); + } + + public float ToFloat () + { + return ToFloat(false); + } + + public double ToDouble () + { + return ToDouble(false); + } + + public QString SetNum (short arg1) + { + return SetNum(arg1, (int) 10); + } + + public QString SetNum (ushort arg1) + { + return SetNum(arg1, (int) 10); + } + + public QString SetNum (int arg1) + { + return SetNum(arg1, (int) 10); + } + + public QString SetNum (uint arg1) + { + return SetNum(arg1, (int) 10); + } + + public QString SetNum (long arg1) + { + return SetNum(arg1, (int) 10); + } + + public QString SetNum (ulong arg1) + { + return SetNum(arg1, (int) 10); + } + + public QString SetNum (float arg1) + { + return SetNum(arg1, (char) 'g'); + } + + public QString SetNum (float arg1, char f) + { + return SetNum(arg1, f, (int) 6); + } + + public QString SetNum (double arg1) + { + return SetNum(arg1, (char) 'g'); + } + + public QString SetNum (double arg1, char f) + { + return SetNum(arg1, f, (int) 6); + } + + public QString SetLatin1 (QString arg1) + { + return SetLatin1(arg1, (int) -1); + } + + public static QString Number (long arg1) + { + return Number(arg1, (int) 10); + } + + public static QString Number (ulong arg1) + { + return Number(arg1, (int) 10); + } + + public static QString Number (int arg1) + { + return Number(arg1, (int) 10); + } + + public static QString Number (uint arg1) + { + return Number(arg1, (int) 10); + } + + public static QString Number (double arg1) + { + return Number(arg1, (char) 'g'); + } + + public static QString Number (double arg1, char f) + { + return Number(arg1, f, (int) 6); + } + + public static QString FromLatin1 (QString arg1) + { + return FromLatin1(arg1, (int) -1); + } + + public static QString FromUtf8 (QString arg1) + { + return FromUtf8(arg1, (int) -1); + } + + public static QString FromLocal8Bit (QString arg1) + { + return FromLocal8Bit(arg1, (int) -1); + } + } +} diff --git a/qtsharp/src/bindings/static/QStyle.cs b/qtsharp/src/bindings/static/QStyle.cs new file mode 100644 index 00000000..c61ec005 --- /dev/null +++ b/qtsharp/src/bindings/static/QStyle.cs @@ -0,0 +1,595 @@ +// QStyle.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public class QStyle : QObject, IDisposable { + + public enum PrimitiveElement: long { + PE_ButtonCommand = 0, + PE_ButtonDefault = 1, + PE_ButtonBevel = 2, + PE_ButtonTool = 3, + PE_ButtonDropDown = 4, + PE_FocusRect = 5, + PE_ArrowUp = 6, + PE_ArrowDown = 7, + PE_ArrowRight = 8, + PE_ArrowLeft = 9, + PE_SpinWidgetUp = 10, + PE_SpinWidgetDown = 11, + PE_SpinWidgetPlus = 12, + PE_SpinWidgetMinus = 13, + PE_Indicator = 14, + PE_IndicatorMask = 15, + PE_ExclusiveIndicator = 16, + PE_ExclusiveIndicatorMask = 17, + PE_DockWindowHandle = 18, + PE_DockWindowSeparator = 19, + PE_DockWindowResizeHandle = 20, + PE_Splitter = 21, + PE_Panel = 22, + PE_PanelPopup = 23, + PE_PanelMenuBar = 24, + PE_PanelDockWindow = 25, + PE_TabBarBase = 26, + PE_HeaderSection = 27, + PE_HeaderArrow = 28, + PE_StatusBarSection = 29, + PE_GroupBoxFrame = 30, + PE_Separator = 31, + PE_SizeGrip = 32, + PE_CheckMark = 33, + PE_ScrollBarAddLine = 34, + PE_ScrollBarSubLine = 35, + PE_ScrollBarAddPage = 36, + PE_ScrollBarSubPage = 37, + PE_ScrollBarSlider = 38, + PE_ScrollBarFirst = 39, + PE_ScrollBarLast = 40, + PE_ProgressBarChunk = 41, + PE_PanelLineEdit = 42, + PE_PanelTabWidget = 43, + PE_WindowFrame = 44, + PE_CustomBase = 251658240 + } + + public enum StyleFlags { + Style_Default = 0, + Style_Enabled = 1, + Style_Raised = 2, + Style_Sunken = 4, + Style_Off = 8, + Style_NoChange = 16, + Style_On = 32, + Style_Down = 64, + Style_Horizontal = 128, + Style_HasFocus = 256, + Style_Top = 512, + Style_Bottom = 1024, + Style_FocusAtBorder = 2048, + Style_AutoRaise = 4096, + Style_MouseOver = 8192, + Style_Up = 16384, + Style_Selected = 32768, + Style_Active = 65536, + Style_ButtonDefault = 131072 + } + + public enum ControlElement: long { + CE_PushButton = 0, + CE_PushButtonLabel = 1, + CE_CheckBox = 2, + CE_CheckBoxLabel = 3, + CE_RadioButton = 4, + CE_RadioButtonLabel = 5, + CE_TabBarTab = 6, + CE_TabBarLabel = 7, + CE_ProgressBarGroove = 8, + CE_ProgressBarContents = 9, + CE_ProgressBarLabel = 10, + CE_PopupMenuItem = 11, + CE_MenuBarItem = 12, + CE_ToolButtonLabel = 13, + CE_CustomBase = 4026531840 + } + + public enum SubRect: long { + SR_PushButtonContents = 0, + SR_PushButtonFocusRect = 1, + SR_CheckBoxIndicator = 2, + SR_CheckBoxContents = 3, + SR_CheckBoxFocusRect = 4, + SR_RadioButtonIndicator = 5, + SR_RadioButtonContents = 6, + SR_RadioButtonFocusRect = 7, + SR_ComboBoxFocusRect = 8, + SR_SliderFocusRect = 9, + SR_DockWindowHandleRect = 10, + SR_ProgressBarGroove = 11, + SR_ProgressBarContents = 12, + SR_ProgressBarLabel = 13, + SR_ToolButtonContents = 14, + SR_CustomBase = 4026531840 + } + + public enum ComplexControl: long { + CC_SpinWidget = 0, + CC_ComboBox = 1, + CC_ScrollBar = 2, + CC_Slider = 3, + CC_ToolButton = 4, + CC_TitleBar = 5, + CC_ListView = 6, + CC_CustomBase = 4026531840 + } + + public enum SubControl: long { + SC_None = 0, + SC_ScrollBarAddLine = 1, + SC_ScrollBarSubLine = 2, + SC_ScrollBarAddPage = 4, + SC_ScrollBarSubPage = 8, + SC_ScrollBarFirst = 16, + SC_ScrollBarLast = 32, + SC_ScrollBarSlider = 64, + SC_ScrollBarGroove = 128, + SC_SpinWidgetUp = 1, + SC_SpinWidgetDown = 2, + SC_SpinWidgetFrame = 4, + SC_SpinWidgetEditField = 8, + SC_SpinWidgetButtonField = 16, + SC_ComboBoxFrame = 1, + SC_ComboBoxEditField = 2, + SC_ComboBoxArrow = 4, + SC_SliderGroove = 1, + SC_SliderHandle = 2, + SC_SliderTickmarks = 4, + SC_ToolButton = 1, + SC_ToolButtonMenu = 2, + SC_TitleBarLabel = 1, + SC_TitleBarSysMenu = 2, + SC_TitleBarMinButton = 4, + SC_TitleBarMaxButton = 8, + SC_TitleBarCloseButton = 16, + SC_TitleBarNormalButton = 32, + SC_TitleBarShadeButton = 64, + SC_TitleBarUnshadeButton = 128, + SC_ListView = 1, + SC_ListViewBranch = 2, + SC_ListViewExpand = 4, + SC_All = 4294967295 + } + + public enum PixelMetric: long { + PM_ButtonMargin = 0, + PM_ButtonDefaultIndicator = 1, + PM_MenuButtonIndicator = 2, + PM_ButtonShiftHorizontal = 3, + PM_ButtonShiftVertical = 4, + PM_DefaultFrameWidth = 5, + PM_SpinBoxFrameWidth = 6, + PM_MaximumDragDistance = 7, + PM_ScrollBarExtent = 8, + PM_ScrollBarSliderMin = 9, + PM_SliderThickness = 10, + PM_SliderControlThickness = 11, + PM_SliderLength = 12, + PM_SliderTickmarkOffset = 13, + PM_SliderSpaceAvailable = 14, + PM_DockWindowSeparatorExtent = 15, + PM_DockWindowHandleExtent = 16, + PM_DockWindowFrameWidth = 17, + PM_MenuBarFrameWidth = 18, + PM_TabBarTabOverlap = 19, + PM_TabBarTabHSpace = 20, + PM_TabBarTabVSpace = 21, + PM_TabBarBaseHeight = 22, + PM_TabBarBaseOverlap = 23, + PM_ProgressBarChunkWidth = 24, + PM_SplitterWidth = 25, + PM_TitleBarHeight = 26, + PM_IndicatorWidth = 27, + PM_IndicatorHeight = 28, + PM_ExclusiveIndicatorWidth = 29, + PM_ExclusiveIndicatorHeight = 30, + PM_CustomBase = 4026531840 + } + + public enum ContentsType: long { + CT_PushButton = 0, + CT_CheckBox = 1, + CT_RadioButton = 2, + CT_ToolButton = 3, + CT_ComboBox = 4, + CT_Splitter = 5, + CT_DockWindow = 6, + CT_ProgressBar = 7, + CT_PopupMenuItem = 8, + CT_CustomBase = 4026531840 + } + + public enum StyleHint: long { + SH_EtchDisabledText = 0, + SH_GUIStyle = 1, + SH_ScrollBar_BackgroundMode = 2, + SH_ScrollBar_MiddleClickAbsolutePosition = 3, + SH_ScrollBar_ScrollWhenPointerLeavesControl = 4, + SH_TabBar_SelectMouseType = 5, + SH_TabBar_Alignment = 6, + SH_Header_ArrowAlignment = 7, + SH_Slider_SnapToValue = 8, + SH_Slider_SloppyKeyEvents = 9, + SH_ProgressDialog_CenterCancelButton = 10, + SH_ProgressDialog_TextLabelAlignment = 11, + SH_PrintDialog_RightAlignButtons = 12, + SH_MainWindow_SpaceBelowMenuBar = 13, + SH_FontDialog_SelectAssociatedText = 14, + SH_PopupMenu_AllowActiveAndDisabled = 15, + SH_PopupMenu_SpaceActivatesItem = 16, + SH_PopupMenu_SubMenuPopupDelay = 17, + SH_ScrollView_FrameOnlyAroundContents = 18, + SH_MenuBar_AltKeyNavigation = 19, + SH_ComboBox_ListMouseTracking = 20, + SH_PopupMenu_MouseTracking = 21, + SH_MenuBar_MouseTracking = 22, + SH_ItemView_ChangeHighlightOnFocus = 23, + SH_Widget_ShareActivation = 24, + SH_Workspace_FillSpaceOnMaximize = 25, + SH_ComboBox_Popup = 26, + SH_TitleBar_NoBorder = 27, + SH_ScrollBar_StopMouseOverSlider = 28, + SH_BlinkCursorWhenTextSelected = 29, + SH_RichText_FullWidthSelection = 30, + SH_CustomBase = 4026531840 + } + + public enum StylePixmap: long { + SP_TitleBarMinButton = 0, + SP_TitleBarMaxButton = 1, + SP_TitleBarCloseButton = 2, + SP_TitleBarNormalButton = 3, + SP_TitleBarShadeButton = 4, + SP_TitleBarUnshadeButton = 5, + SP_DockWindowCloseButton = 6, + SP_MessageBoxInformation = 7, + SP_MessageBoxWarning = 8, + SP_MessageBoxCritical = 9, + SP_CustomBase = 4026531840 + } + + internal QStyle () : this (QNull.Instance) {} + + internal QStyle (IntPtr ptr) : this (QNull.Instance) + { + rawObject = ptr; + RegisterObject(this); + } + + internal QStyle (QNull dummy) : base (QNull.Instance) {} + + ~QStyle () + { + Dispose(false); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_del_QStyle (IntPtr obj); + internal override void Delete () + { + if (deleted) return; + + qt_del_QStyle (rawObject); + deleted = true; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QStyle_polish (IntPtr raw, IntPtr arg1); + public void polish (QWidget arg1) + { + qt_QStyle_polish (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QStyle_unPolish (IntPtr raw, IntPtr arg1); + public void unPolish (QWidget arg1) + { + qt_QStyle_unPolish (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QStyle_polish1 (IntPtr raw, IntPtr arg1); + public void polish (QApplication arg1) + { + qt_QStyle_polish1 (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QStyle_unPolish1 (IntPtr raw, IntPtr arg1); + public void unPolish (QApplication arg1) + { + qt_QStyle_unPolish1 (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QStyle_polish2 (IntPtr raw, IntPtr arg1); + public void polish (QPalette arg1) + { + qt_QStyle_polish2 (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QStyle_polishPopupMenu (IntPtr raw, IntPtr arg1); + public void polishPopupMenu (QPopupMenu arg1) + { + qt_QStyle_polishPopupMenu (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QStyle_itemRect (IntPtr raw, IntPtr p, IntPtr r, int flags, bool enabled, IntPtr pixmap, IntPtr text, int len); + public QRect itemRect (QPainter p, QRect r, int flags, bool enabled, QPixmap pixmap, string text, int len) + { + return (QRect)LookupObject (qt_QStyle_itemRect (rawObject, p.RawObject, r.RawObject, flags, enabled, pixmap.RawObject, new QString (text).RawObject, len), typeof(QRect)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QStyle_drawItem (IntPtr raw, IntPtr p, IntPtr r, int flags, IntPtr g, bool enabled, IntPtr pixmap, IntPtr text, int len, IntPtr penColor); + public void drawItem (QPainter p, QRect r, int flags, QColorGroup g, bool enabled, QPixmap pixmap, string text, int len, QColor penColor) + { + qt_QStyle_drawItem (rawObject, p.RawObject, r.RawObject, flags, g.RawObject, enabled, pixmap.RawObject, new QString (text).RawObject, len, penColor.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QStyle_drawPrimitive (IntPtr raw, QStyle.PrimitiveElement pe, IntPtr p, IntPtr r, IntPtr cg, QStyle.StyleFlags flags, IntPtr arg1); + public void drawPrimitive (QStyle.PrimitiveElement pe, QPainter p, QRect r, QColorGroup cg, QStyle.StyleFlags flags, QStyleOption arg1) + { + qt_QStyle_drawPrimitive (rawObject, pe, p.RawObject, r.RawObject, cg.RawObject, flags, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QStyle_drawControl (IntPtr raw, QStyle.ControlElement element, IntPtr p, IntPtr widget, IntPtr r, IntPtr cg, QStyle.StyleFlags how, IntPtr arg1); + public void drawControl (QStyle.ControlElement element, QPainter p, QWidget widget, QRect r, QColorGroup cg, QStyle.StyleFlags how, QStyleOption arg1) + { + qt_QStyle_drawControl (rawObject, element, p.RawObject, widget.RawObject, r.RawObject, cg.RawObject, how, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QStyle_drawControlMask (IntPtr raw, QStyle.ControlElement element, IntPtr p, IntPtr widget, IntPtr r, IntPtr arg1); + public void drawControlMask (QStyle.ControlElement element, QPainter p, QWidget widget, QRect r, QStyleOption arg1) + { + qt_QStyle_drawControlMask (rawObject, element, p.RawObject, widget.RawObject, r.RawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QStyle_subRect (IntPtr raw, QStyle.SubRect r, IntPtr widget); + public QRect subRect (QStyle.SubRect r, QWidget widget) + { + return (QRect)LookupObject (qt_QStyle_subRect (rawObject, r, widget.RawObject), typeof(QRect)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QStyle_drawComplexControl (IntPtr raw, QStyle.ComplexControl control, IntPtr p, IntPtr widget, IntPtr r, IntPtr cg, QStyle.StyleFlags how, QStyle.SubControl sub, QStyle.SubControl subActive, IntPtr arg1); + public void drawComplexControl (QStyle.ComplexControl control, QPainter p, QWidget widget, QRect r, QColorGroup cg, QStyle.StyleFlags how, QStyle.SubControl sub, QStyle.SubControl subActive, QStyleOption arg1) + { + qt_QStyle_drawComplexControl (rawObject, control, p.RawObject, widget.RawObject, r.RawObject, cg.RawObject, how, sub, subActive, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QStyle_drawComplexControlMask (IntPtr raw, QStyle.ComplexControl control, IntPtr p, IntPtr widget, IntPtr r, IntPtr arg1); + public void drawComplexControlMask (QStyle.ComplexControl control, QPainter p, QWidget widget, QRect r, QStyleOption arg1) + { + qt_QStyle_drawComplexControlMask (rawObject, control, p.RawObject, widget.RawObject, r.RawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QStyle_querySubControlMetrics (IntPtr raw, QStyle.ComplexControl control, IntPtr widget, QStyle.SubControl sc, IntPtr arg1); + public QRect querySubControlMetrics (QStyle.ComplexControl control, QWidget widget, QStyle.SubControl sc, QStyleOption arg1) + { + return (QRect)LookupObject (qt_QStyle_querySubControlMetrics (rawObject, control, widget.RawObject, sc, arg1.RawObject), typeof(QRect)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern QStyle.SubControl qt_QStyle_querySubControl (IntPtr raw, QStyle.ComplexControl control, IntPtr widget, IntPtr pos, IntPtr arg1); + public QStyle.SubControl querySubControl (QStyle.ComplexControl control, QWidget widget, QPoint pos, QStyleOption arg1) + { + return qt_QStyle_querySubControl (rawObject, control, widget.RawObject, pos.RawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QStyle_pixelMetric (IntPtr raw, QStyle.PixelMetric metric, IntPtr widget); + public int pixelMetric (QStyle.PixelMetric metric, QWidget widget) + { + return qt_QStyle_pixelMetric (rawObject, metric, widget.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QStyle_sizeFromContents (IntPtr raw, QStyle.ContentsType contents, IntPtr widget, IntPtr contentsSize, IntPtr arg1); + public QSize sizeFromContents (QStyle.ContentsType contents, QWidget widget, QSize contentsSize, QStyleOption arg1) + { + return (QSize)LookupObject (qt_QStyle_sizeFromContents (rawObject, contents, widget.RawObject, contentsSize.RawObject, arg1.RawObject), typeof(QSize)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QStyle_styleHint (IntPtr raw, StyleHint stylehint, IntPtr widget, IntPtr arg1, IntPtr returnData); + public int styleHint (StyleHint stylehint, QWidget widget, QStyleOption arg1, IntPtr returnData) + { + return qt_QStyle_styleHint (rawObject, stylehint, widget.RawObject, arg1.RawObject, returnData); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QStyle_stylePixmap (IntPtr raw, QStyle.StylePixmap stylepixmap, IntPtr widget, IntPtr arg1); + public QPixmap stylePixmap (QStyle.StylePixmap stylepixmap, QWidget widget, QStyleOption arg1) + { + return (QPixmap)LookupObject (qt_QStyle_stylePixmap (rawObject, stylepixmap, widget.RawObject, arg1.RawObject), typeof(QPixmap)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QStyle_defaultFrameWidth (IntPtr raw); + public int defaultFrameWidth () + { + return qt_QStyle_defaultFrameWidth (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QStyle_tabbarMetrics (IntPtr raw, IntPtr t, int hf, int vf, int ov); + public void tabbarMetrics (QWidget t, int hf, int vf, int ov) + { + qt_QStyle_tabbarMetrics (rawObject, t.RawObject, hf, vf, ov); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QStyle_scrollBarExtent (IntPtr raw); + public QSize scrollBarExtent () + { + return (QSize)LookupObject (qt_QStyle_scrollBarExtent (rawObject), typeof(QSize)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QStyle_visualRect (IntPtr logical, IntPtr w); + public static QRect visualRect (QRect logical, QWidget w) + { + return (QRect)LookupObject (qt_QStyle_visualRect (logical.RawObject, w.RawObject), typeof(QRect)); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QStyle_visualRect1 (IntPtr logical, IntPtr bounding); + public static QRect visualRect (QRect logical, QRect bounding) + { + return (QRect)LookupObject (qt_QStyle_visualRect1 (logical.RawObject, bounding.RawObject), typeof(QRect)); + } + + public QRect itemRect (QPainter p, QRect r, int flags, bool enabled, QPixmap pixmap, string text) + { + return itemRect(p, r, flags, enabled, pixmap, text, (int) -1); + } + + public void drawItem (QPainter p, QRect r, int flags, QColorGroup g, bool enabled, QPixmap pixmap, string text) + { + drawItem(p, r, flags, g, enabled, pixmap, text, (int) -1); + } + + public void drawItem (QPainter p, QRect r, int flags, QColorGroup g, bool enabled, QPixmap pixmap, string text, int len) + { + drawItem(p, r, flags, g, enabled, pixmap, text, len, new QColor ()); + } + + public void drawPrimitive (QStyle.PrimitiveElement pe, QPainter p, QRect r, QColorGroup cg) + { + drawPrimitive(pe, p, r, cg, QStyle.StyleFlags.Style_Default); + } + + public void drawPrimitive (QStyle.PrimitiveElement pe, QPainter p, QRect r, QColorGroup cg, QStyle.StyleFlags flags) + { + drawPrimitive(pe, p, r, cg, flags, new QStyleOption ()); + } + + public void drawControl (QStyle.ControlElement element, QPainter p, QWidget widget, QRect r, QColorGroup cg) + { + drawControl(element, p, widget, r, cg, QStyle.StyleFlags.Style_Default); + } + + public void drawControl (QStyle.ControlElement element, QPainter p, QWidget widget, QRect r, QColorGroup cg, QStyle.StyleFlags how) + { + drawControl(element, p, widget, r, cg, how, new QStyleOption ()); + } + + public void drawControlMask (QStyle.ControlElement element, QPainter p, QWidget widget, QRect r) + { + drawControlMask(element, p, widget, r, new QStyleOption ()); + } + + public void drawComplexControl (QStyle.ComplexControl control, QPainter p, QWidget widget, QRect r, QColorGroup cg) + { + drawComplexControl(control, p, widget, r, cg, QStyle.StyleFlags.Style_Default); + } + + public void drawComplexControl (QStyle.ComplexControl control, QPainter p, QWidget widget, QRect r, QColorGroup cg, QStyle.StyleFlags how) + { + drawComplexControl(control, p, widget, r, cg, how, QStyle.SubControl.SC_All); + } + + public void drawComplexControl (QStyle.ComplexControl control, QPainter p, QWidget widget, QRect r, QColorGroup cg, QStyle.StyleFlags how, QStyle.SubControl sub) + { + drawComplexControl(control, p, widget, r, cg, how, sub, QStyle.SubControl.SC_None); + } + + public void drawComplexControl (QStyle.ComplexControl control, QPainter p, QWidget widget, QRect r, QColorGroup cg, QStyle.StyleFlags how, QStyle.SubControl sub, QStyle.SubControl subActive) + { + drawComplexControl(control, p, widget, r, cg, how, sub, subActive, new QStyleOption ()); + } + + public void drawComplexControlMask (QStyle.ComplexControl control, QPainter p, QWidget widget, QRect r) + { + drawComplexControlMask(control, p, widget, r, new QStyleOption ()); + } + + public QRect querySubControlMetrics (QStyle.ComplexControl control, QWidget widget, QStyle.SubControl sc) + { + return querySubControlMetrics(control, widget, sc, new QStyleOption ()); + } + + public QStyle.SubControl querySubControl (QStyle.ComplexControl control, QWidget widget, QPoint pos) + { + return querySubControl(control, widget, pos, new QStyleOption ()); + } + + public int pixelMetric (QStyle.PixelMetric metric) + { + return pixelMetric(metric, new QWidget ()); + } + + public QSize sizeFromContents (QStyle.ContentsType contents, QWidget widget, QSize contentsSize) + { + return sizeFromContents(contents, widget, contentsSize, new QStyleOption ()); + } + + public int styleHint (StyleHint stylehint) + { + return styleHint(stylehint, new QWidget ()); + } + + public int styleHint (StyleHint stylehint, QWidget widget) + { + return styleHint(stylehint, widget, new QStyleOption ()); + } + + public int styleHint (StyleHint stylehint, QWidget widget, QStyleOption arg1) + { + return styleHint(stylehint, widget, arg1, (IntPtr) 0); + } + + public QPixmap stylePixmap (QStyle.StylePixmap stylepixmap) + { + return stylePixmap(stylepixmap, new QWidget ()); + } + + public QPixmap stylePixmap (QStyle.StylePixmap stylepixmap, QWidget widget) + { + return stylePixmap(stylepixmap, widget, new QStyleOption ()); + } + + // Begin interface methods. + + } +} diff --git a/qtsharp/src/bindings/static/QToolButton.cs b/qtsharp/src/bindings/static/QToolButton.cs new file mode 100644 index 00000000..90f36785 --- /dev/null +++ b/qtsharp/src/bindings/static/QToolButton.cs @@ -0,0 +1,290 @@ +// QToolButton.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Created static file 26 January 2003 +// Marcus Urban + + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public class QToolButton : QButton, IDisposable { + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_new_QToolButton (IntPtr parent, string name); + public QToolButton (QWidget parent, string name) : this (QNull.Instance) + { + rawObject = qt_new_QToolButton (parent != null ? parent.RawObject : IntPtr.Zero, name); + + if ((qparent = parent) != null) + qparent.AddChild (this); + + RegisterObject (this); + Connect (this, SIGNAL ("destroyed ()"), SLOT ("NativeDestroyed ()")); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_new_QToolButton1 (IntPtr iconSet, IntPtr textLabel, IntPtr groupText, IntPtr receiver, string slot, IntPtr parent, string name); + public QToolButton (QIconSet iconSet, QString textLabel, QString groupText, QObject receiver, string slot, QToolBar parent, string name) : this (QNull.Instance) + { + rawObject = qt_new_QToolButton1 (iconSet.RawObject, textLabel.RawObject, groupText.RawObject, IntPtr.Zero, null, parent != null ? parent.RawObject : IntPtr.Zero, name); + Connect( this, SIGNAL("clicked()"), receiver, slot ); + + + if ((qparent = parent) != null) + qparent.AddChild (this); + + RegisterObject (this); + Connect (this, SIGNAL ("destroyed ()"), SLOT ("NativeDestroyed ()")); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_new_QToolButton2 (Qt.ArrowType type, IntPtr parent, string name); + public QToolButton (Qt.ArrowType type, QWidget parent, string name) : this (QNull.Instance) + { + rawObject = qt_new_QToolButton2 (type, parent != null ? parent.RawObject : IntPtr.Zero, name); + + if ((qparent = parent) != null) + qparent.AddChild (this); + + RegisterObject (this); + Connect (this, SIGNAL ("destroyed ()"), SLOT ("NativeDestroyed ()")); + } + + public QToolButton (QWidget parent) : this (parent, "") {} + + internal QToolButton () : this (QNull.Instance) {} + + internal QToolButton (IntPtr ptr) : this (QNull.Instance) + { + rawObject = ptr; + RegisterObject(this); + } + + internal QToolButton (QNull dummy) : base (QNull.Instance) {} + + ~QToolButton () + { + Dispose (false); + } + + internal override void Delete () + { + if (deleted) return; + + // libqtc lacks a qt_del_QToolButton function + deleted = true; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QToolButton_setUsesBigPixmap (IntPtr raw, bool enable); + public void SetUsesBigPixmap (bool enable) + { + if (disposed) + throw new ObjectDisposedException (this+": Attempted use of disposed object"); + + qt_QToolButton_setUsesBigPixmap (rawObject, enable); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QToolButton_setUsesTextLabel (IntPtr raw, bool enable); + public void SetUsesTextLabel (bool enable) + { + if (disposed) + throw new ObjectDisposedException (this+": Attempted use of disposed object"); + + qt_QToolButton_setUsesTextLabel (rawObject, enable); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QToolButton_setTextLabel (IntPtr raw, IntPtr arg1, bool arg2); + public void SetTextLabel (QString arg1, bool arg2) + { + if (disposed) + throw new ObjectDisposedException (this+": Attempted use of disposed object"); + + qt_QToolButton_setTextLabel (rawObject, arg1.RawObject, arg2); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QToolButton_setToggleButton (IntPtr raw, bool enable); + public void SetToggleButton (bool enable) + { + if (disposed) + throw new ObjectDisposedException (this+": Attempted use of disposed object"); + + qt_QToolButton_setToggleButton (rawObject, enable); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QToolButton_setOn (IntPtr raw, bool enable); + public void SetOn (bool enable) + { + if (disposed) + throw new ObjectDisposedException (this+": Attempted use of disposed object"); + + qt_QToolButton_setOn (rawObject, enable); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QToolButton_toggle (IntPtr raw); + public void Toggle () + { + if (disposed) + throw new ObjectDisposedException (this+": Attempted use of disposed object"); + + qt_QToolButton_toggle (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QToolButton_setTextLabel1 (IntPtr raw, IntPtr arg1); + public void SetTextLabel (QString arg1) + { + if (disposed) + throw new ObjectDisposedException (this+": Attempted use of disposed object"); + + qt_QToolButton_setTextLabel1 (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QToolButton_setIconSet (IntPtr raw, IntPtr set); + public void SetIconSet (QIconSet set) + { + if (disposed) + throw new ObjectDisposedException (this+": Attempted use of disposed object"); + + qt_QToolButton_setIconSet (rawObject, set.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QToolButton_setIconSet1 (IntPtr raw, IntPtr set, bool on); + public void SetIconSet (QIconSet set, bool on) + { + if (disposed) + throw new ObjectDisposedException (this+": Attempted use of disposed object"); + + qt_QToolButton_setIconSet1 (rawObject, set.RawObject, on); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QToolButton_iconSet (IntPtr raw, bool on); + public QIconSet IconSet (bool on) + { + if (disposed) + throw new ObjectDisposedException (this+": Attempted use of disposed object"); + + return LookupObject (qt_QToolButton_iconSet (rawObject, on), typeof (QIconSet)) as QIconSet; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QToolButton_setPopupDelay (IntPtr raw, int delay); + public void SetPopupDelay (int delay) + { + if (disposed) + throw new ObjectDisposedException (this+": Attempted use of disposed object"); + + qt_QToolButton_setPopupDelay (rawObject, delay); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QToolButton_popupDelay (IntPtr raw); + public int PopupDelay () + { + if (disposed) + throw new ObjectDisposedException (this+": Attempted use of disposed object"); + + return qt_QToolButton_popupDelay (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QToolButton_openPopup (IntPtr raw); + public void OpenPopup () + { + if (disposed) + throw new ObjectDisposedException (this+": Attempted use of disposed object"); + + qt_QToolButton_openPopup (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QToolButton_setAutoRaise (IntPtr raw, bool enable); + public void SetAutoRaise (bool enable) + { + if (disposed) + throw new ObjectDisposedException (this+": Attempted use of disposed object"); + + qt_QToolButton_setAutoRaise (rawObject, enable); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QToolButton_autoRaise (IntPtr raw); + public bool AutoRaise () + { + if (disposed) + throw new ObjectDisposedException (this+": Attempted use of disposed object"); + + return qt_QToolButton_autoRaise (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QToolButton_drawButtonLabel (IntPtr raw, IntPtr arg1); + protected void DrawButtonLabel (QPainter arg1) + { + if (disposed) + throw new ObjectDisposedException (this+": Attempted use of disposed object"); + + qt_QToolButton_drawButtonLabel (rawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QToolButton_uses3D (IntPtr raw); + protected bool Uses3D () + { + if (disposed) + throw new ObjectDisposedException (this+": Attempted use of disposed object"); + + return qt_QToolButton_uses3D (rawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QToolButton_eventFilter (IntPtr raw, IntPtr o, IntPtr e); + protected bool EventFilter (QObject o, QEvent e) + { + if (disposed) + throw new ObjectDisposedException (this+": Attempted use of disposed object"); + + return qt_QToolButton_eventFilter (rawObject, o.RawObject, e.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QToolButton_paletteChange (IntPtr raw, IntPtr arg1); + protected void PaletteChange (QPalette arg1) + { + if (disposed) + throw new ObjectDisposedException (this+": Attempted use of disposed object"); + + qt_QToolButton_paletteChange (rawObject, arg1.RawObject); + } + + // Begin interface methods. + + } +} diff --git a/qtsharp/src/bindings/static/QWidgetStack.cs b/qtsharp/src/bindings/static/QWidgetStack.cs new file mode 100644 index 00000000..f48da641 --- /dev/null +++ b/qtsharp/src/bindings/static/QWidgetStack.cs @@ -0,0 +1,173 @@ +// QWidgetStack.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Collections; + using System.Runtime.InteropServices; + + public class QWidgetStack : QFrame, IDisposable { + + private ArrayList widgets; + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_new_QWidgetStack (IntPtr parent, string name); + public QWidgetStack (QWidget parent, string name) : this (QNull.Instance) + { + if ((qparent = parent) != null) + qparent.AddChild (this); + rawObject = qt_new_QWidgetStack (parent != null ? parent.RawObject : IntPtr.Zero, name); + RegisterObject (this); + } + + public QWidgetStack () : this (new QWidget ()) {} + + public QWidgetStack (QWidget parent) : this (parent, "") {} + + internal QWidgetStack (IntPtr ptr) : this (QNull.Instance) + { + rawObject = ptr; + RegisterObject(this); + } + + internal QWidgetStack (QNull dummy) : base (QNull.Instance) + { + widgets = new ArrayList (); + } + + ~QWidgetStack () + { + Dispose (false); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_del_QWidgetStack (IntPtr raw); + internal override void Delete () + { + if (deleted) return; + + qt_del_QWidgetStack (rawObject); + deleted = true; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QWidgetStack_addWidget (IntPtr raw, IntPtr arg1, int arg2); + public int AddWidget (QWidget arg1, int arg2) + { + if (! widgets.Contains (arg1)) widgets.Add (arg1); + return qt_QWidgetStack_addWidget (RawObject, arg1.RawObject, arg2); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QWidgetStack_removeWidget (IntPtr raw, IntPtr arg1); + public void RemoveWidget (QWidget arg1) + { + widgets.Remove (arg1); + qt_QWidgetStack_removeWidget (RawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QWidgetStack_sizeHint (IntPtr raw); + public QSize SizeHint () + { + return LookupObject (qt_QWidgetStack_sizeHint (RawObject), typeof(QSize)) as QSize; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QWidgetStack_minimumSizeHint (IntPtr raw); + public QSize MinimumSizeHint () + { + return LookupObject (qt_QWidgetStack_minimumSizeHint (RawObject), typeof(QSize)) as QSize; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QWidgetStack_show (IntPtr raw); + public void Show () + { + qt_QWidgetStack_show (RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QWidgetStack_widget (IntPtr raw, int arg1); + public QWidget Widget (int arg1) + { + return LookupObject (qt_QWidgetStack_widget (RawObject, arg1), typeof(QWidget)) as QWidget; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern int qt_QWidgetStack_id (IntPtr raw, IntPtr arg1); + public int Id (QWidget arg1) + { + return qt_QWidgetStack_id (RawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern IntPtr qt_QWidgetStack_visibleWidget (IntPtr raw); + public QWidget VisibleWidget () + { + return LookupObject (qt_QWidgetStack_visibleWidget (RawObject), typeof(QWidget)) as QWidget; + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QWidgetStack_setFrameRect (IntPtr raw, IntPtr arg1); + public void SetFrameRect (QRect arg1) + { + qt_QWidgetStack_setFrameRect (RawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QWidgetStack_raiseWidget (IntPtr raw, int arg1); + public void RaiseWidget (int arg1) + { + qt_QWidgetStack_raiseWidget (RawObject, arg1); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QWidgetStack_raiseWidget1 (IntPtr raw, IntPtr arg1); + public void RaiseWidget (QWidget arg1) + { + qt_QWidgetStack_raiseWidget1 (RawObject, arg1.RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QWidgetStack_frameChanged (IntPtr raw); + protected void FrameChanged () + { + qt_QWidgetStack_frameChanged (RawObject); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_QWidgetStack_setChildGeometries (IntPtr raw); + protected void SetChildGeometries () + { + qt_QWidgetStack_setChildGeometries (RawObject); + } + + public int AddWidget (QWidget arg1) + { + return AddWidget(arg1, (int) -1); + } + + // Begin interface methods. + + } +} diff --git a/qtsharp/src/bindings/static/QtSignal.cs b/qtsharp/src/bindings/static/QtSignal.cs new file mode 100644 index 00000000..f76291f5 --- /dev/null +++ b/qtsharp/src/bindings/static/QtSignal.cs @@ -0,0 +1,848 @@ +// QtSignal.cs - Signal/slot connection support for Qt# +// +// Copyright (C) 2002 Nick Zigarovich (nick@chemlab.org) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// TODO +// o See about eliminating huge ConnectSignalTo* DisconnectSignalFrom* methods; +// want to make methods for each connection case that deal with QtSignal and +// QtSlot instances directly. +// + +namespace Qt { + using System; + using System.Collections; + using System.Runtime.InteropServices; + using System.Reflection; + + internal class QtSignal: QObject, IDisposable { + internal static bool traceConnects; + + static QtSignal () + { + traceConnects = false; + } + + private QObject sender; + private string signal; + private string name; + private string args; + private ArrayList slots; + private ArrayList signals; + + public string Identifier { + get { return MakeSigId(sender, signal); } + } + + public QObject Sender { + get { return sender; } + } + + public string Signal { + get { return signal; } + } + + public string Name { + get { return name; } + } + + public string Args { + get { return args; } + } + + public string MangledArgs { + get { return MangleArgs(Args); } + } + + public ArrayList Signals { + get { return signals; } + } + + public ArrayList Slots { + get { return slots; } + } + + public QtSignal (QObject sender, string signal): base (NoSignalInit.Instance) + { + this.sender = sender; + this.signal = signal; + string[] sigspl = signal.Split(new char[] {'('}); + name = sigspl[0]; + args = "(" + sigspl[1]; + slots = new ArrayList(); + signals = new ArrayList(); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern void qt_del_QObject (IntPtr obj); + internal override void Delete () + { + if (deleted) return; + + qt_del_QObject (rawObject); + deleted = true; + } + + public bool IsCSharpSignal() + { + return sender.CsSignalMap.Contains(signal); + } + + internal static bool Connect(QObject sender, string signal, QObject receiver, string slot) + { + if (IsSlot(signal)) { + return false; + // throw new ArgumentException("Received a slot where a signal was expected"); + } + + if (IsSignal(slot)) + return ConnectSignalToSignal(sender, NormalizeParam(signal), receiver, NormalizeParam(slot)); + else + return ConnectSignalToSlot(sender, NormalizeParam(signal), receiver, NormalizeParam(slot)); + } + + private static bool ConnectSignalToSlot(QObject sender, string signal, QObject receiver, string slot) + { + QtSignal sigobj; + QtSlot slotobj = new QtSlot(receiver, slot); + + if (traceConnects) + ErrMsg ("ConnectSignalToSlot: ({0}) {1}, {2}, ({3}) {4}, {5}", sender.RawObject, sender, signal, + receiver.RawObject, receiver, slot); + + // Connect C# signal to... + if (sender.CsSignalMap.Contains(signal)) { + sigobj = sender.CsSignalMap[signal]; + + // ...a C# slot + if (slotobj.IsCSharpSlot) { + if (sigobj.Slots.Contains(slotobj)) + return false; + + sigobj.Slots.Add(slotobj); + return true; + } + // ...a C++ slot + else { + // C++ slots are C# methods, so we should never get here. + throw new ArgumentException(receiver+" has no slot '"+slot+"'"); + } + } + // Connect C++ signal to... + else { + // ...a C# slot + if (slotobj.IsCSharpSlot) { + string id = MakeSigId(sender, signal); + + if (!sender.CppSignalMap.Contains(id)) + sigobj = sender.CppSignalMap[id] = new QtSignal(sender, signal); + else { + sigobj = sender.CppSignalMap[id]; + + if (sigobj.Slots.Contains(slotobj)) + return false; + } + + Delegate del; + string realsignal; + + switch (slotobj.Args) { + case "()": + del = Delegate.CreateDelegate (typeof (del_void), receiver, slotobj.Name); + slotobj.WrapperPtr = csharp_connect_void (sender.RawObject, SIGNAL (signal), receiver.RawObject, del); + break; + case "(bool)": + del = Delegate.CreateDelegate (typeof (del_bool), receiver, slotobj.Name); + slotobj.WrapperPtr = csharp_connect_bool (sender.RawObject, SIGNAL (signal), receiver.RawObject, del); + break; + case "(short)": + del = Delegate.CreateDelegate (typeof (del_short), receiver, slotobj.Name); + slotobj.WrapperPtr = csharp_connect_short (sender.RawObject, SIGNAL (signal), receiver.RawObject, del); + break; + case "(int)": + del = Delegate.CreateDelegate (typeof (del_int), receiver, slotobj.Name); + slotobj.WrapperPtr = csharp_connect_int (sender.RawObject, SIGNAL (signal), receiver.RawObject, del); + break; + case "(long)": + del = Delegate.CreateDelegate (typeof (del_long), receiver, slotobj.Name); + slotobj.WrapperPtr = csharp_connect_long (sender.RawObject, SIGNAL (signal), receiver.RawObject, del); + break; + case "(float)": + del = Delegate.CreateDelegate (typeof (del_float), receiver, slotobj.Name); + slotobj.WrapperPtr = csharp_connect_float (sender.RawObject, SIGNAL (signal), receiver.RawObject, del); + break; + case "(double)": + del = Delegate.CreateDelegate (typeof (del_double), receiver, slotobj.Name); + slotobj.WrapperPtr = csharp_connect_double (sender.RawObject, SIGNAL (signal), receiver.RawObject, del); + break; + case "(QString)": + realsignal = sigobj.Name + "(const QString&)"; + Console.WriteLine("Connecting signal, sigobj.Name = {0}, realsignal = {1}", + sigobj.Name, realsignal); + del = Delegate.CreateDelegate (typeof (del_QString), slotobj, "SlotBridge_QString"); + slotobj.WrapperPtr = csharp_connect_QString (sender.RawObject, SIGNAL (realsignal), receiver.RawObject, del); + break; + case "(QDockWindow)": + realsignal = sigobj.Name + "(QDockWindow*)"; + del = Delegate.CreateDelegate (typeof (del_QDockWindow), slotobj, "SlotBridge_QDockWindow"); + slotobj.WrapperPtr = csharp_connect_QDockWindow (sender.RawObject, SIGNAL (realsignal), receiver.RawObject, del); + break; + case "(QDropEvent)": + realsignal = sigobj.Name + "(QDropEvent*)"; + del = Delegate.CreateDelegate (typeof (del_QDropEvent), slotobj, "SlotBridge_QDropEvent"); + slotobj.WrapperPtr = csharp_connect_QDropEvent (sender.RawObject, SIGNAL (realsignal), receiver.RawObject, del); + break; + case "(QDropEvent,QListViewItem)": + realsignal = sigobj.Name + "(QDropEvent*,QListViewItem*)"; + del = Delegate.CreateDelegate (typeof (del_QDropEventQListViewItem), slotobj, "SlotBridge_QDropEventQListViewItem"); + slotobj.WrapperPtr = csharp_connect_QDropEventQListViewItem (sender.RawObject, SIGNAL (realsignal), receiver.RawObject, del); + break; + case "(QIconViewItem)": + realsignal = sigobj.Name + "(QIconViewItem*)"; + del = Delegate.CreateDelegate (typeof (del_QIconViewItem), slotobj, "SlotBridge_QIconViewItem"); + slotobj.WrapperPtr = csharp_connect_QIconViewItem (sender.RawObject, SIGNAL (realsignal), receiver.RawObject, del); + break; + case "(QListBoxItem)": + realsignal = sigobj.Name + "(QListBoxItem*)"; + del = Delegate.CreateDelegate (typeof (del_QListBoxItem), slotobj, "SlotBridge_QListBoxItem"); + slotobj.WrapperPtr = csharp_connect_QListBoxItem (sender.RawObject, SIGNAL (realsignal), receiver.RawObject, del); + break; + case "(QListViewItem)": + realsignal = sigobj.Name + "(QListViewItem*)"; + del = Delegate.CreateDelegate (typeof (del_QListViewItem), slotobj, "SlotBridge_QListViewItem"); + slotobj.WrapperPtr = csharp_connect_QListViewItem (sender.RawObject, SIGNAL (realsignal), receiver.RawObject, del); + break; + case "(QListViewItem,QListViewItem)": + realsignal = sigobj.Name + "(QListViewItem*,QListViewItem*)"; + del = Delegate.CreateDelegate (typeof (del_QListViewItemQListViewItem), slotobj, "SlotBridge_QListViewItemQListViewItem"); + slotobj.WrapperPtr = csharp_connect_QListViewItemQListViewItem (sender.RawObject, SIGNAL (realsignal), receiver.RawObject, del); + break; + case "(QListViewItem,QListViewItem,QListViewItem)": + realsignal = sigobj.Name + "(QListViewItem*,QListViewItem*,QListViewItem*)"; + del = Delegate.CreateDelegate (typeof (del_QListViewItemQListViewItemQListViewItem), slotobj, "SlotBridge_QListViewItemQListViewItemQListViewItem"); + slotobj.WrapperPtr = csharp_connect_QListViewItemQListViewItemQListViewItem (sender.RawObject, SIGNAL (realsignal), receiver.RawObject, del); + break; + case "(QNetworkOperation)": + realsignal = sigobj.Name + "(QNetworkOperation*)"; + del = Delegate.CreateDelegate (typeof (del_QNetworkOperation), slotobj, "SlotBridge_QNetworkOperation"); + slotobj.WrapperPtr = csharp_connect_QNetworkOperation (sender.RawObject, SIGNAL (realsignal), receiver.RawObject, del); + break; + case "(QObject)": + realsignal = sigobj.Name + "(QObject*)"; + del = Delegate.CreateDelegate (typeof (del_QObject), slotobj, "SlotBridge_QObject"); + slotobj.WrapperPtr = csharp_connect_QObject (sender.RawObject, SIGNAL (realsignal), receiver.RawObject, del); + break; + case "(QToolBar)": + realsignal = sigobj.Name + "(QToolBar*)"; + del = Delegate.CreateDelegate (typeof (del_QToolBar), slotobj, "SlotBridge_QToolBar"); + slotobj.WrapperPtr = csharp_connect_QToolBar (sender.RawObject, SIGNAL (realsignal), receiver.RawObject, del); + break; + case "(QWidget)": + realsignal = sigobj.Name + "(QWidget*)"; + del = Delegate.CreateDelegate (typeof (del_QWidget), slotobj, "SlotBridge_QWidget"); + slotobj.WrapperPtr = csharp_connect_QWidget (sender.RawObject, SIGNAL (realsignal), receiver.RawObject, del); + break; + case "(int,QIconViewItem)": + realsignal = sigobj.Name + "(int,QIconViewItem*)"; + del = Delegate.CreateDelegate (typeof (del_intQIconViewItem), slotobj, "SlotBridge_intQIconViewItem"); + slotobj.WrapperPtr = csharp_connect_intQIconViewItem (sender.RawObject, SIGNAL (realsignal), receiver.RawObject, del); + break; + case "(int,QListBoxItem)": + realsignal = sigobj.Name + "(int,QListBoxItem*)"; + del = Delegate.CreateDelegate (typeof (del_intQListBoxItem), slotobj, "SlotBridge_intQListBoxItem"); + slotobj.WrapperPtr = csharp_connect_intQListBoxItem (sender.RawObject, SIGNAL (realsignal), receiver.RawObject, del); + break; + case "(int,bool)": + del = Delegate.CreateDelegate (typeof (del_intbool), receiver, slotobj.Name); + slotobj.WrapperPtr = csharp_connect_intbool (sender.RawObject, SIGNAL (signal), receiver.RawObject, del); + break; + case "(int,int)": + del = Delegate.CreateDelegate (typeof (del_intint), receiver, slotobj.Name); + slotobj.WrapperPtr = csharp_connect_intint (sender.RawObject, SIGNAL (signal), receiver.RawObject, del); + break; + case "(int,int,int)": + del = Delegate.CreateDelegate (typeof (del_intintint), receiver, slotobj.Name); + slotobj.WrapperPtr = csharp_connect_intintint (sender.RawObject, SIGNAL (signal), receiver.RawObject, del); + break; + default: + throw new ArgumentException ("Unsupported method prototype for C++ signal -> C# slot connection: " + slotobj.Args); + } + + if (slotobj.WrapperPtr == IntPtr.Zero) + return false; + + slotobj.Callback = del; + + sigobj.Slots.Add(slotobj); + return true; + } + // ...a C++ slot. C++ slots are C# methods, so we should never get here. + else { + throw new ArgumentException(receiver+" has no slot '"+slot+"'"); + // return qt_QObject_connect1(sender.RawObject, SIGNAL(signal), receiver.RawObject, SLOT(slot)); + } + } + } + + private static bool ConnectSignalToSignal(QObject sender, string signal, QObject receiver, string target) + { + if (traceConnects) + ErrMsg ("ConnectSignalToSlot: ({0}) {1}, {2}, ({3}) {4}, {5}", sender.RawObject, sender, signal, + receiver.RawObject, receiver, target); + + // Connect C# signal to... + if (sender.CsSignalMap.Contains(signal)) { + QtSignal sigobj = sender.CsSignalMap[signal]; + + // ...a C# signal + if (receiver.CsSignalMap.Contains(target)) { + QtSignal targetobj = receiver.CsSignalMap[target]; + + if (sigobj.Signals.Contains(targetobj)) + return false; + + sigobj.Signals.Add(targetobj); + return true; + } + // ...a C++ signal + else + throw new NotImplementedException("C# signal <-> C++ signal connections not supported yet"); + } + // Connect C++ signal to... + else { + // ...a C# signal + if (receiver.CsSignalMap.Contains(target)) { + QtSignal targetobj = receiver.CsSignalMap[target]; + string args = targetobj.Args; + string mangle = MangleArgs(args); + + // HACK Wrap target signal in a slot and connect the slot to the sender. + return Connect(sender, SIGNAL(signal), targetobj, SLOT("Emit_"+mangle+args)); + } + // ...a C++ signal + else + return qt_QObject_connect1(sender.RawObject, SIGNAL(signal), receiver.RawObject, SIGNAL(target)); + } + } + + internal static bool Disconnect(QObject sender, string signal, QObject receiver, string slot) + { + if (signal == null && receiver == null && slot == null) + return DisconnectAll(sender); + else if (receiver == null && slot == null) + return DisconnectSignal(sender, NormalizeParam(signal)); + else if (signal == null && slot == null) + return DisconnectReceiver(sender, receiver); + else if (slot == null) + return DisconnectSignalFromReceiver(sender, NormalizeParam(signal), receiver); + else if (IsSlot(signal)) + throw new ArgumentException ("Expected a signal where a slot was found."); + else if (IsSignal(slot)) + return DisconnectSignalFromSignal(sender, NormalizeParam(signal), receiver, NormalizeParam(slot)); + else + return DisconnectSignalFromSlot(sender, NormalizeParam(signal), receiver, NormalizeParam(slot)); + } + + private static bool DisconnectSignalFromSlot(QObject sender, string signal, QObject receiver, string slot) + { + if (traceConnects) + ErrMsg ("DisconnectSignalFromSlot: ({0}) {1}, {2}, ({3}) {4}, {5}", sender.RawObject, sender, signal, + receiver.RawObject, receiver, slot); + + QtSignal sigobj; + QtSlot slotobj = new QtSlot(receiver, slot); + + // Disconnect C# signal from... + if (sender.CsSignalMap.Contains(signal)) { + sigobj = sender.CsSignalMap[signal]; + + // ...a C# slot + if (slotobj.IsCSharpSlot) { + if (!sigobj.Slots.Contains(slotobj)) + return false; + + sigobj.Slots.Remove(slotobj); + return true; + } + // ...a C++ slot + else { + // C++ slots are C# methods, so we should never get here. + throw new ArgumentException(receiver+" has no slot '"+slot+"'"); + } + } + // Disconnect C++ signal from... + else { + // ...a C# slot + if (slotobj.IsCSharpSlot) { + string id = MakeSigId(sender, signal); + if (!sender.CppSignalMap.Contains(id)) + return false; + + sigobj = sender.CppSignalMap[id]; + bool found = false; + foreach (QtSlot sobj in sigobj.Slots) { + if (slotobj.Equals(sobj)) { + found = true; + qt_del_QObject(sobj.WrapperPtr); + sigobj.Slots.Remove(sobj); + break; + } + } + + if (sigobj.Slots.Count == 0) + sender.CppSignalMap.Remove(id); + + return found; + } + // ...a C++ slot. C++ slots are C# methods, so we should never get here. + else { + throw new ArgumentException(receiver+" has no slot '"+slot+"'"); + // return qt_QObject_disconnect2(sender.RawObject, SIGNAL(signal), receiver.RawObject, SLOT(slot)); + } + } + } + + private static bool DisconnectSignalFromSignal(QObject sender, string signal, QObject receiver, string target) + { + if (traceConnects) + ErrMsg ("DisconnectSignalFromSignal: ({0}) {1}, {2}, ({3}) {4}, {5}", sender.RawObject, sender, signal, + receiver.RawObject, receiver, target); + + QtSignal sigobj; + + // Disconnect C# signal from... + if (sender.CsSignalMap.Contains(signal)) { + sigobj = sender.CsSignalMap[signal]; + + // ...a C# signal + if (receiver.CsSignalMap.Contains(target)) { + QtSignal targetobj = receiver.CsSignalMap[target]; + if (!sigobj.Signals.Contains(targetobj)) + return false; + + sigobj.Signals.Remove(targetobj); + return true; + } + // ...a C++ signal + else { + throw new NotImplementedException("C# signal <-> C++ signal (dis)connections not supported yet"); + } + } + // Disconnect C++ signal from... + else { + sigobj = new QtSignal(sender, signal); + + // ...a C# signal + if (receiver.CsSignalMap.Contains(target)) { + QtSignal targetobj = receiver.CsSignalMap[target]; + string args = "(" + target.Split(new char[] {'('})[1]; + return Disconnect(sender, SIGNAL(signal), targetobj, SLOT("emit_"+args)); + } + // ...a C++ signal + else { + return qt_QObject_disconnect2(sender.RawObject, SIGNAL(signal), receiver.RawObject, SLOT(target)); + } + } + } + + private static bool DisconnectAll(QObject sender) + { + if (traceConnects) + ErrMsg ("DisconnectAll: ({0}) {1}", sender.RawObject, sender); + + IDictionaryEnumerator cse = sender.CsSignalMap.GetEnumerator(); + IDictionaryEnumerator cppe = sender.CppSignalMap.GetEnumerator(); + + ArrayList signals = new ArrayList (); + + foreach (IDictionaryEnumerator de in new IDictionaryEnumerator[] { cse, cppe }) + while (de.MoveNext()) + signals.Add (de.Value); + + foreach (QtSignal signal in signals) + foreach (QtSlot slot in new ArrayList (signal.Slots)) + Disconnect (sender, SIGNAL (signal.Signal), slot.Receiver, SLOT (slot.Slot)); + + return true; + } + + private static bool DisconnectReceiver(QObject sender, QObject receiver) + { + if (traceConnects) + ErrMsg ("DisconnectReceiver: ({0}) {1}, ({2}) {3}", sender.RawObject, sender, receiver.RawObject, receiver); + + IDictionaryEnumerator cse = sender.CsSignalMap.GetEnumerator(); + IDictionaryEnumerator cppe = sender.CppSignalMap.GetEnumerator(); + + ArrayList signals = new ArrayList (); + + foreach (IDictionaryEnumerator de in new IDictionaryEnumerator[] { cse, cppe }) + while (de.MoveNext ()) + signals.Add (de.Value); + + foreach (QtSignal signal in signals) + foreach (QtSlot slot in new ArrayList (signal.Slots)) + Disconnect (signal.Sender, SIGNAL (signal.Name), receiver, SLOT (slot.Name)); + + return true; + } + + private static bool DisconnectSignal(QObject sender, string signal) + { + if (traceConnects) + ErrMsg ("DisconnectSignal: ({0}) {1}, {2}", sender.RawObject, sender, signal); + + foreach (QtSignalMap map in new QtSignalMap[] { sender.CsSignalMap, sender.CppSignalMap }) { + QtSignal sig = map[signal]; + if (sig != null) { + foreach (QtSlot slot in new ArrayList (sig.Slots)) + Disconnect (sender, SIGNAL(signal), slot.Receiver, SLOT(slot.Slot)); + } + } + + return true; + } + + private static bool DisconnectSignalFromReceiver (QObject sender, string signal, QObject receiver) + { + if (traceConnects) + ErrMsg ("DisconnectSignalFromReceiver: ({0}) {1}, {2}, ({3}), {4}", sender.RawObject, sender, + signal, receiver.RawObject, receiver); + + foreach (QtSignalMap map in new QtSignalMap[] { sender.CsSignalMap, sender.CppSignalMap }) { + QtSignal sig = map[signal]; + if (sig != null) { + foreach (QtSlot slot in new ArrayList (sig.Slots)) + if (slot.Receiver == receiver) + Disconnect (sender, signal, receiver, SLOT (slot.Name)); + } + } + + return true; + } + + private static string MangleArgs(string args) + { + // FIXME Char.Equals and Char.CompareTo don't seem to work on Mono. + string result = args.Replace ("(", ""); + result = result.Replace (")", ""); + result = result.Replace (" ", ""); + result = result.Replace ("unsigned ", "u"); + result = result.Replace ("byte", "char"); + return result.Replace (",", ""); + + /* + char[] evict = {'(', ')', ',', ' '}; + char[] result = new char[args.Length]; + int newlen = 0; + + foreach (char c in args.ToCharArray()) { + foreach (char cx in evict) { + if (c.Equals(cx)) continue; + } + result[newlen] = c; + newlen++; + } + + return new String(result); + */ + } + + private static string MakeSigId(QObject sender, string signal) + { + return sender.RawObject.ToString()+signal; + } + + internal static string NormalizeParam(string param) + { + string ret = param; + if (param.StartsWith("1") || param.StartsWith("2")) + ret = param.Substring(1); + return ret; + + } + + private static bool IsSignal(string name) + { + return name.StartsWith("2"); + } + + private static bool IsSlot(string name) + { + return name.StartsWith("1"); + } + + public void DumpConnections() + { + ErrMsg ("{0}::{1} Signal Information:", sender, signal); + + ErrMsg ("-------- Slot Connections --------"); + if (Slots.Count == 0) + ErrMsg ("--> No slot connections."); + else { + foreach (QtSlot slot in slots) { + ErrMsg ("--> ({0}) {1}::{2}", slot.Receiver.RawObject, slot.Receiver, slot.Slot); + } + } + + ErrMsg ("------- Signal Connections -------"); + if (Signals.Count == 0) + ErrMsg ("--> No signal connections."); + else { + foreach (QtSignal sig in signals) { + ErrMsg ("--> ({0}) {1}::{2}", sig.Sender.RawObject, sig.Sender, sig.Signal); + } + } + } + + public void Emit(object[] args) + { + foreach (QtSlot slot in slots) + slot.Invoke(args); + + foreach (QtSignal signal in signals) { + signal.Emit(args); + } + } + + public void Emit_void () + { + Emit (new object[0]); + } + + public void Emit_bool (bool value0) + { + Emit (new object[] { value0 }); + } + + public void Emit_short (short value0) + { + Emit (new object[] { value0 }); + } + + public void Emit_int (int value0) + { + Emit (new object[] { value0 }); + } + + public void Emit_long (long value0) + { + Emit (new object[] { value0 }); + } + + public void Emit_float (float value0) + { + Emit (new object[] { value0 }); + } + + public void Emit_double (double value0) + { + Emit (new object[] { value0 }); + } + + public void Emit_QDockWindow (IntPtr value0) + { + Emit (new object[] { value0 }); + } + + public void Emit_QDropEvent (IntPtr value0) + { + Emit (new object[] { value0 }); + } + + public void Emit_QDropEventQListViewItem (IntPtr value0, IntPtr value1) + { + Emit (new object[] { value0, value1 }); + } + + public void Emit_QIconViewItem (IntPtr value0) + { + Emit (new object[] { value0 }); + } + + public void Emit_QListBoxItem (IntPtr value0) + { + Emit (new object[] { value0 }); + } + + public void Emit_QListViewItem (IntPtr value0) + { + Emit (new object[] { value0 }); + } + + public void Emit_QListViewItemQListViewItem (IntPtr value0, IntPtr value1) + { + Emit (new object[] { value0, value1 }); + } + + public void Emit_QListViewItemQListViewItemQListViewItem (IntPtr value0, IntPtr value1, IntPtr value2) + { + Emit (new object[] { value0, value1, value2 }); + } + + public void Emit_QNetworkOperation (IntPtr value0) + { + Emit (new object[] { value0 }); + } + + public void Emit_QObject (IntPtr value0) + { + Emit (new object[] { value0 }); + } + + public void Emit_QToolBar (IntPtr value0) + { + Emit (new object[] { value0 }); + } + + public void Emit_QWidget (IntPtr value0) + { + Emit (new object[] { value0 }); + } + + public void Emit_intQIconViewItem (int value0, IntPtr value1) + { + Emit (new object[] { value0, value1 }); + } + + public void Emit_intQListBoxItem (int value0, IntPtr value1) + { + Emit (new object[] { value0, value1 }); + } + + public void Emit_intbool (int value0, bool value1) + { + Emit (new object[] { value0, value1 }); + } + + public void Emit_intint (int value0, int value1) + { + Emit (new object[] { value0, value1 }); + } + + public void Emit_intintint (int value0, int value1, int value2) + { + Emit (new object[] { value0, value1, value2 }); + } + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QObject_connect1 (IntPtr sender, string signal, IntPtr receiver, string member); + + [DllImport("libqtc", CharSet=CharSet.Ansi)] + private static extern bool qt_QObject_disconnect2 (IntPtr sender, string signal, IntPtr receiver, string member); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_void (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_bool (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_short (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_int (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_long (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_float (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_double (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_QString (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_QDockWindow (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_QDropEvent (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_QDropEventQListViewItem (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_QIconViewItem (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_QListBoxItem (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_QListViewItem (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_QListViewItemQListViewItem (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_QListViewItemQListViewItemQListViewItem (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_QNetworkOperation (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_QObject (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_QToolBar (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_QWidget (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_intQIconViewItem (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_intQListBoxItem (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_intbool (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_intint (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern IntPtr csharp_connect_intintint (IntPtr sender, string signal, IntPtr receiver, Delegate cb); + + public delegate void del_void (); + public delegate void del_bool (bool value0); + public delegate void del_short (short value0); + public delegate void del_int (int value0); + public delegate void del_long (long value0); + public delegate void del_float (float value0); + public delegate void del_double (double value0); + public delegate void del_QString (IntPtr value0); + public delegate void del_QDockWindow (IntPtr value0); + public delegate void del_QDropEvent (IntPtr value0); + public delegate void del_QDropEventQListViewItem (IntPtr value0, IntPtr value1); + public delegate void del_QIconViewItem (IntPtr value0); + public delegate void del_QListBoxItem (IntPtr value0); + public delegate void del_QListViewItem (IntPtr value0); + public delegate void del_QListViewItemQListViewItem (IntPtr value0, IntPtr value1); + public delegate void del_QListViewItemQListViewItemQListViewItem (IntPtr value0, IntPtr value1, IntPtr value2); + public delegate void del_QNetworkOperation (IntPtr value0); + public delegate void del_QObject (IntPtr value0); + public delegate void del_QToolBar (IntPtr value0); + public delegate void del_QWidget (IntPtr value0); + public delegate void del_intQIconViewItem (int value0, IntPtr value1); + public delegate void del_intQListBoxItem (int value0, IntPtr value1); + public delegate void del_intbool (int value0, bool value1); + public delegate void del_intint (int value0, int value1); + public delegate void del_intintint (int value0, int value1, int value2); + } +} diff --git a/qtsharp/src/bindings/static/QtSignalMap.cs b/qtsharp/src/bindings/static/QtSignalMap.cs new file mode 100644 index 00000000..38ab5ac3 --- /dev/null +++ b/qtsharp/src/bindings/static/QtSignalMap.cs @@ -0,0 +1,99 @@ +// QtSignalMap.cs - Hashtable wrapper for prettier code. +// +// Copyright (C) 2002 Nick Zigarovich (nick@chemlab.org) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// NOTES +// o By inheriting from QObject, we can use the child tracking features to +// ensure that instances of signal maps are deleted by their parents when +// the parent Dispose()es. +// +// FIXME +// o Override Dispose() and make sure everything gets cleaned up on deletion. + +namespace Qt { + using System; + using System.Collections; + using Qt; + + internal class QtSignalMap: QtSupport { + private Hashtable signalMap; + private string name; + + public string Name { + get { return name; } + } + + public QtSignalMap (QObject parent): this (parent, "QtSignalMap") {} + + public QtSignalMap (QObject parent, string name): base (QNull.Instance) + { + this.name = name; + signalMap = new Hashtable (); + } + + internal override void Delete () {} + + public void Add (QtSignal signal) + { + signalMap[signal.Identifier] = signal; + } + + public QtSignal Remove (string name) + { + QtSignal ret = signalMap[name] as QtSignal; + signalMap.Remove (name); + return ret; + } + + public bool Contains (string name) + { + return signalMap.ContainsKey (name); + } + + public QtSignal this[string idx] { + get { + if (signalMap.ContainsKey (idx)) + return signalMap[idx] as QtSignal; + else + return null; + } + + set { signalMap[idx] = value; } + } + + public IDictionaryEnumerator GetEnumerator () + { + return signalMap.GetEnumerator (); + } + + public void DumpMap() + { + if (signalMap.Count == 0) { + ErrMsg ("** {0}: No signals to dump.", name); + ErrMsg (""); + } + else { + IDictionaryEnumerator ide = signalMap.GetEnumerator(); + + while (ide.MoveNext ()) { + (ide.Value as QtSignal).DumpConnections (); + ErrMsg (""); + } + } + } + } +} diff --git a/qtsharp/src/bindings/static/QtSlot.cs b/qtsharp/src/bindings/static/QtSlot.cs new file mode 100644 index 00000000..6bf14da8 --- /dev/null +++ b/qtsharp/src/bindings/static/QtSlot.cs @@ -0,0 +1,284 @@ +// QtSlot.cs - Represents C# slot connections +// +// Copyright (C) 2002 Nick Zigarovich (nick@chemlab.org) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +namespace Qt { + using System; + using System.Reflection; + using System.Text; + + internal class QtSlot { + protected QObject receiver; + protected string slot; + private string name; + private string args; + protected MethodInfo slotInfo; + private IntPtr wrapperPtr; + private Delegate callback; + + public QObject Receiver { + get { return receiver; } + } + + public string Slot { + get { return slot; } + } + + public MethodInfo Info { + get { return slotInfo; } + } + + public string Identifier { + get { return receiver.RawObject.ToString()+slot; } + } + + public string Name { + get { return name; } + } + + public string Args { + get { return args; } + } + + public string NormalizedArgs { + get { return NormalizeSlotArgs(args); } + } + + public IntPtr WrapperPtr { + get { return wrapperPtr; } + set { wrapperPtr = value; } + } + + public Delegate Callback { + get { return callback; } + set { callback = value; } + } + + public bool IsCSharpSlot { + get { return slotInfo != null; } + } + + public QtSlot() {} + + public QtSlot(QObject receiver, string slot) + { + this.receiver = receiver; + this.slot = slot; + string[] slotsplit = slot.Split(new char[] {'('}); + + try { + name = slotsplit[0]; + args = "("+slotsplit[1]; + } + catch (IndexOutOfRangeException) { + throw new ArgumentException ("Invalid slot format: " + slot); + } + + slotInfo = LookupSlot(receiver, name, NormalizedArgs); + wrapperPtr = IntPtr.Zero; + callback = null; + } + + public void SlotBridge_QString (IntPtr value0) + { + QString csvalue0 = QtSupport.LookupObject (value0, typeof (QString)) as QString; + + Invoke (new object[] {csvalue0}); + } + + public void SlotBridge_QDockWindow (IntPtr value0) + { + QDockWindow csvalue0 = QtSupport.LookupObject (value0, typeof (QDockWindow)) as QDockWindow; + + Invoke (new object[] {csvalue0}); + } + + public void SlotBridge_QDropEvent (IntPtr value0) + { + QDropEvent csvalue0 = QtSupport.LookupObject (value0, typeof (QDropEvent)) as QDropEvent; + + Invoke (new object[] {csvalue0}); + } + + public void SlotBridge_QDropEventQListViewItem (IntPtr value0, IntPtr value1) + { + QDropEvent csvalue0 = QtSupport.LookupObject (value0, typeof (QDropEvent)) as QDropEvent; + QListViewItem csvalue1 = QtSupport.LookupObject (value1, typeof (QListViewItem)) as QListViewItem; + + Invoke (new object[] {csvalue0, csvalue1}); + } + + public void SlotBridge_QIconViewItem (IntPtr value0) + { + QIconViewItem csvalue0 = QtSupport.LookupObject (value0, typeof (QIconViewItem)) as QIconViewItem; + + Invoke (new object[] {csvalue0}); + } + + public void SlotBridge_QListBoxItem (IntPtr value0) + { + QListBoxItem csvalue0 = QtSupport.LookupObject (value0, typeof (QListBoxItem)) as QListBoxItem; + + Invoke (new object[] {csvalue0}); + } + + public void SlotBridge_QListViewItem (IntPtr value0) + { + QListViewItem csvalue0 = QtSupport.LookupObject (value0, typeof (QListViewItem)) as QListViewItem; + + Invoke (new object[] {csvalue0}); + } + + public void SlotBridge_QListViewItemQListViewItem (IntPtr value0, IntPtr value1) + { + QListViewItem csvalue0 = QtSupport.LookupObject (value0, typeof (QListViewItem)) as QListViewItem; + QListViewItem csvalue1 = QtSupport.LookupObject (value1, typeof (QListViewItem)) as QListViewItem; + + Invoke (new object[] {csvalue0, csvalue1}); + } + + public void SlotBridge_QListViewItemQListViewItemQListViewItem (IntPtr value0, IntPtr value1, IntPtr value2) + { + QListViewItem csvalue0 = QtSupport.LookupObject (value0, typeof (QListViewItem)) as QListViewItem; + QListViewItem csvalue1 = QtSupport.LookupObject (value1, typeof (QListViewItem)) as QListViewItem; + QListViewItem csvalue2 = QtSupport.LookupObject (value2, typeof (QListViewItem)) as QListViewItem; + + Invoke (new object[] {csvalue0, csvalue1, csvalue2}); + } + + public void SlotBridge_QNetworkOperation (IntPtr value0) + { + QNetworkOperation csvalue0 = QtSupport.LookupObject (value0, typeof (QNetworkOperation)) as QNetworkOperation; + + Invoke (new object[] {csvalue0}); + } + + public void SlotBridge_QObject (IntPtr value0) + { + QObject csvalue0 = QtSupport.LookupObject (value0, typeof (QObject)) as QObject; + + Invoke (new object[] {csvalue0}); + } + + public void SlotBridge_QToolBar (IntPtr value0) + { + QToolBar csvalue0 = QtSupport.LookupObject (value0, typeof (QToolBar)) as QToolBar; + + Invoke (new object[] {csvalue0}); + } + + public void SlotBridge_QWidget (IntPtr value0) + { + QWidget csvalue0 = QtSupport.LookupObject (value0, typeof (QWidget)) as QWidget; + + Invoke (new object[] {csvalue0}); + } + + public void SlotBridge_intQIconViewItem (int value0, IntPtr value1) + { + QIconViewItem csvalue1 = QtSupport.LookupObject (value1, typeof (QIconViewItem)) as QIconViewItem; + + Invoke (new object[] {value0, csvalue1}); + } + + public void SlotBridge_intQListBoxItem (int value0, IntPtr value1) + { + QListBoxItem csvalue1 = QtSupport.LookupObject (value1, typeof (QListBoxItem)) as QListBoxItem; + + Invoke (new object[] {value0, csvalue1}); + } + + public void Invoke(object[] args) + { + if (slotInfo != null) { + slotInfo.Invoke(receiver, args); + } + } + + private static MethodInfo LookupSlot(QObject receiver, string name, string args) + { + MethodInfo ret = null; + + foreach (MethodInfo info in receiver.GetType().GetMethods( + BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance )) + { + string infoargs = "(" + ShortArgs (info.ToString().Split(new char[] {'('})[1].Replace(" ", "")) + ")"; + string nargs = args.Replace ("string", "String"); // FIXME + + if (nargs.CompareTo(infoargs) == 0 && + name.CompareTo(info.Name) == 0) + { + ret = info; + break; + } + } + + return ret; + } + + private static string ShortArgs (string args) + { + StringBuilder builder = new StringBuilder (); + string [] s = args.TrimEnd (')').Split (','); + foreach (string st in s) { + string [] str = st.Trim (' ').Split ('.'); + string stri = str [str.Length -1]; + builder.Append (stri+", "); + } + return builder.ToString ().TrimEnd (',', ' '); + } + + private static string NormalizeSlotArgs(string methodargs) + { + string[] args = methodargs.Replace("(", "").Replace(")", "").Split(new char[] {','}); + StringBuilder sb = new StringBuilder(); + sb.Append("("); + int count = 0; + + // FIXME Handle unsigned, bool, and byte cases. Would lookups in a hashtable be faster? + foreach (string arg in args) { + if (count > 0) sb.Append(","); + + if (arg == "short") + sb.Append("Int16"); + else if (arg == "int") + sb.Append("Int32"); + else if (arg == "long") + sb.Append("Int64"); + else if (arg == "float") + sb.Append("Single"); + else if (arg == "double") + sb.Append("Double"); + else if (arg == "char") + sb.Append("Char"); + else + sb.Append(arg); + + count++; + } + + sb.Append(")"); + return sb.ToString(); + } + + // For ArrayList storage. + public override bool Equals(object obj) + { + return ((QtSlot)obj).Identifier == Identifier; + } + } +} diff --git a/qtsharp/src/bindings/static/QtSupport.cs b/qtsharp/src/bindings/static/QtSupport.cs new file mode 100644 index 00000000..eee74728 --- /dev/null +++ b/qtsharp/src/bindings/static/QtSupport.cs @@ -0,0 +1,750 @@ +// QtSupport.cs - QtSupport c-sharp support file +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +namespace Qt { + + using Qt; + using System; + using System.Collections; + using System.Reflection; + using System.Text.RegularExpressions; + using System.Runtime.InteropServices; + + public class QtSupport: IDisposable { + + private static Hashtable QtObjects; + private static int cleanCount; + private static int cleanLimit; + + private static QtEventHandler qtEventHandler; + + // Runtime flags, set by QApplication.ParseArguments + internal static bool enableDebug; + internal static bool disableTracking; + internal static bool traceObjects; + internal static bool traceChildren; + + static QtSupport() { + //QtObjects = Hashtable.Synchronized (new Hashtable ()); + QtObjects = new Hashtable(); + + cleanCount = 0; + cleanLimit = 750; + + enableDebug = false; + disableTracking = false; + traceObjects = false; + traceChildren = false; + } + + internal protected IntPtr rawObject; + internal protected bool disposed; + internal bool deleted; + protected QtSupport qparent; + protected ArrayList qchildren; + + internal IntPtr RawObject { + get { return rawObject; } + } + + public bool Disposed { + get { return disposed; } + } + + public QtSupport QParent { + get { return qparent; } + } + + public ArrayList QChildren { + get { return qchildren; } + } + + // A dummy constructor for inherited classes + internal QtSupport (QNull dummy) { + disposed = false; + deleted = false; + qchildren = new ArrayList (); + } + + public void Dispose () + { + GC.SuppressFinalize (this); + Dispose (true); + } + + protected virtual void Dispose (bool disposeManaged) + { + if (disposed) + return; + + if (rawObject == IntPtr.Zero) + deleted = true; + + if (disposeManaged) { + disposed = true; + + UnregisterObject (this); + + if (qparent != null && ! qparent.Disposed) + qparent.RemoveChild (this); + + foreach (QtSupport qts in qchildren) + qts.Dispose (); + } + + /* + DbgMsg ("({0}) {1}: {2} managed. {3} native instance.", + deleted ? IntPtr.Zero : rawObject, + this, + disposeManaged ? "Disposing" : "Not disposing", + deleted ? "Not deleting" : "Deleting"); + */ + + qparent = null; + qchildren = null; + + Delete (); + } + + internal virtual void Delete () + { + WarnMsg ("({0}) {1}: QtSupport.Dispose() running", rawObject, this); + deleted = true; + } + + /************************** General Utility Methods *********************************/ + + public static void QAssert (bool value) + { + if (!value) throw new ApplicationException ("Assertion failed"); + } + + public static void QAssert (bool value, string message) + { + if (!value) throw new ApplicationException ("Assertion failed: " + message); + } + + internal bool IsQObject () + { + return GetType ().IsSubclassOf (typeof (QObject)); + } + + internal static void WarnMsg (string format, params object[] arg) + { + if (enableDebug) + Console.Error.WriteLine ("Qt# Warning: " + format, arg); + } + + internal static void DbgMsg (string format, params object[] arg) + { + if (enableDebug) Console.WriteLine (format, arg); + } + + internal static void ErrMsg (string format, params object[] arg) + { + Console.Error.WriteLine (format, arg); + } + + internal static void Msg (string format, params object[] arg) + { + Console.WriteLine (format, arg); + } + + public static string SIGNAL (string signal) + { + return "2"+ + Regex.Replace (signal, @"\s*\(\s*\)", "()"); + + + } + + public static string SLOT (string slot) + { + return "1" + + Regex.Replace (slot, @"\s*\(\s*\)", "()"); + } + + /************************** Object Tracking/Boxing and Disposal *********************************/ + + internal static void RegisterObject (QtSupport o) + { + if (disableTracking) return; + + if (o.RawObject == IntPtr.Zero) { + WarnMsg ("Asked to register object with null pointer: {0}", o); + return; + } + + string replacing = String.Empty; + WeakReference wref; + + if (QtObjects.ContainsKey (o.RawObject)) + { + wref = QtObjects[o.RawObject] as WeakReference; + QAssert (! wref.IsAlive, + "New object "+o+" has same RawObject as "+(QtSupport)wref.Target+"! Please report this error!"); + replacing = "(replacing)"; + QtObjects.Remove (o.RawObject); + } + + if (traceObjects) + ErrMsg ("Object Registered: {0} ({1}) {2}", o, o.RawObject, replacing); + + QtObjects[o.RawObject] = new WeakReference (o); + + if (cleanCount > cleanLimit) { + cleanCount = 0; + IDictionaryEnumerator de = QtObjects.GetEnumerator (); + ArrayList obituaries = new ArrayList (); + + while (de.MoveNext ()) { + wref = de.Value as WeakReference; + if (!wref.IsAlive) obituaries.Add (de.Key); + } + + if (traceObjects) + ErrMsg ("RegisterObject: Removing {0} of {1} references from QtObjects", obituaries.Count, QtObjects.Count); + + foreach (IntPtr p in obituaries) + QtObjects.Remove (p); + } + else + cleanCount++; + } + + internal static void UnregisterObject (QtSupport o) + { + if (disableTracking) return; + if (traceObjects) ErrMsg ("Object Unregistered: {0} ({1})", o, o.RawObject); + + if (o.RawObject == IntPtr.Zero) { + WarnMsg ("Asked to unregister object with null pointer: {0}", o); + return; + } + + QtObjects.Remove (o.RawObject); + } + + internal static QtSupport LookupObject (IntPtr ptr) + { + if (disableTracking) return null; + + if (ptr == IntPtr.Zero) { + WarnMsg ("Asked to lookup null pointer"); + return null; + } + + QtSupport ret = null; + + if (QtObjects.ContainsKey (ptr)) { + WeakReference wref = QtObjects[ptr] as WeakReference; + if (wref.IsAlive) + ret = wref.Target as QtSupport; + else + QtObjects.Remove (ptr); + } + + return ret; + } + + internal static QtSupport LookupObject (IntPtr ptr, Type type) + { + if (ptr == IntPtr.Zero) { + WarnMsg ("Asked to lookup null pointer of type {0}", type); + return null; + } + + if (! (type.IsSubclassOf (typeof(QtSupport)) || type == typeof (QtSupport)) ) + throw new ArgumentException ("Type '" +type+ "' is not related to QtSupport."); + + QtSupport qtsObj = LookupObject (ptr); + + if (qtsObj == null) { + //DbgMsg (type+" ("+ptr+"): Boxing foreign object"); + qtsObj = (QtSupport)Activator.CreateInstance ( + type, + BindingFlags.NonPublic | BindingFlags.Instance, + null, + new object[] {ptr}, + null); + + // FIXME Must handle cases where qtsObj is a QObject root + // or child. Should we box the entire object tree in + // C#? Also, RegisterObject will only track this object + // if it is a root node. Child nodes are assumed to be + // referenced by their parents. Must ponder and seek + // opinions. + } + + return qtsObj; + } + + internal virtual void AddChild (QtSupport o) { + // FIXME: Faster way to do this? O(n), where n == Count + if (!qchildren.Contains(o)) { + qchildren.Add(o); + if (traceChildren) + ErrMsg ("({0}) {1}::AddChild: ({2}) {3}", rawObject, this, o.RawObject, o); + } + } + + internal virtual void RemoveChild (QtSupport o) { + // FIXME: Faster way to do this? O(n), where n == Count + if (qchildren.Contains(o)) { + qchildren.Remove(o); + if (traceChildren) + ErrMsg ("({0}) {1}::RemoveChild: ({2}) {3}", rawObject, this, o.RawObject, o); + } + } + + /************************** The Event Handler ******************************************/ + + private delegate void QtEventHandler (IntPtr instance, string eventname, IntPtr eventinstance, string eventclass); + + private static QEventList eventList = new QEventList (); + + [DllImport("libqtsharp", CharSet=CharSet.Ansi)] + private static extern void qtsharp_QObject_registerEventDelegate + ([MarshalAs (UnmanagedType.FunctionPtr)] Delegate qtdelegate); + + internal static void RegisterEventDelegate () + { + qtEventHandler = new QtEventHandler (DispatchEvent); + qtsharp_QObject_registerEventDelegate (qtEventHandler); + } + + internal static QEventList EventList { + get { return eventList; } + } + + private static void DispatchEvent (IntPtr instance, string eventname, IntPtr eventinstance, string eventclass) + { + ArrayList array; + QObject obj; + QEvent ev; + Type evtype = Type.GetType ("Qt."+eventclass+",Qt"); + + if ((obj = (QObject)LookupObject (instance)) == null) return; + + try + { + if ((ev = (QEvent)LookupObject (eventinstance)) == null) { + object[] args = new object[] { eventinstance }; + BindingFlags bflags = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public; + ev = Activator.CreateInstance (evtype, bflags, null, args, null) as QEvent; + } + + // Notify global event handlers first. + if ((array = EventList.QEventHandlers (eventclass)) != null) { + foreach (Delegate del in array) { + QEventArgs evargs = new QEventArgs (eventname, ev); + del.DynamicInvoke (new object[] { obj, evargs }); + } + } + + // Notify local event handlers second. + if ((array = EventList.QEventHandlers (eventname)) != null) { + foreach (Delegate del in array) { + if (ReferenceEquals (del.Target, obj)) + del.DynamicInvoke (new object[] { ev }); + } + } + } + catch (TargetInvocationException e) { + throw e.InnerException; + } + + ev.deleted = true; // Qt deletes events for us + ev.Dispose (); + } + + // Global events. + public static event QChildHandler childHandler { + add { EventList.Add ("QChildEvent", value); } + remove { EventList.Remove ("QChildEvent", value); } + } + public static event QDragEnterHandler dragEnterHandler { + add { EventList.Add ("QDragEnterEvent", value); } + remove { EventList.Remove ("QDragEnterEvent", value); } + } + public static event QDropHandler dropHandler { + add { EventList.Add ("QDropEvent", value); } + remove { EventList.Remove ("QDropEvent", value); } + } + public static event QIMHandler imHandler { + add { EventList.Add ("QIMEvent", value); } + remove { EventList.Remove ("QIMEvent", value); } + } + public static event QPaintHandler paintHandler { + add { EventList.Add ("QPaintEvent", value); } + remove { EventList.Remove ("QPaintEvent", value); } + } + public static event QTimerHandler timerHandler { + add { EventList.Add ("QTimerEvent", value); } + remove { EventList.Remove ("QTimerEvent", value); } + } + public static event QCloseHandler closeHandler { + add { EventList.Add ("QCloseEvent", value); } + remove { EventList.Remove ("QCloseEvent", value); } + } + public static event QDragLeaveHandler dragLeaveHandler { + add { EventList.Add ("QDragLeaveEvent", value); } + remove { EventList.Remove ("QDragLeaveEvent", value); } + } + public static event QEventHandler eventHandler { + add { EventList.Add ("QEventEvent", value); } + remove { EventList.Remove ("QEventEvent", value); } + } + public static event QKeyHandler keyHandler { + add { EventList.Add ("QKeyEvent", value); } + remove { EventList.Remove ("QKeyEvent", value); } + } + public static event QResizeHandler resizeHandler { + add { EventList.Add ("QResizeEvent", value); } + remove { EventList.Remove ("QResizeEvent", value); } + } + public static event QWheelHandler wheelHandler { + add { EventList.Add ("QWheelEvent", value); } + remove { EventList.Remove ("QWheelEvent", value); } + } + public static event QContextMenuHandler contextMenuHandler { + add { EventList.Add ("QContextMenuEvent", value); } + remove { EventList.Remove ("QContextMenuEvent", value); } + } + public static event QDragMoveHandler dragMoveHandler { + add { EventList.Add ("QDragMoveEvent", value); } + remove { EventList.Remove ("QDragMoveEvent", value); } + } + public static event QFocusHandler focusHandler { + add { EventList.Add ("QFocusEvent", value); } + remove { EventList.Remove ("QFocusEvent", value); } + } + public static event QMouseHandler mouseHandler { + add { EventList.Add ("QMouseEvent", value); } + remove { EventList.Remove ("QMouseEvent", value); } + } + public static event QShowHandler showHandler { + add { EventList.Add ("QShowEvent", value); } + remove { EventList.Remove ("QShowEvent", value); } + } + public static event QCustomHandler customHandler { + add { EventList.Add ("QCustomEvent", value); } + remove { EventList.Remove ("QCustomEvent", value); } + } + public static event QDragResponseHandler dragResponseHandler { + add { EventList.Add ("QDragResponseEvent", value); } + remove { EventList.Remove ("QDragResponseEvent", value); } + } + public static event QHideHandler hideHandler { + add { EventList.Add ("QHideEvent", value); } + remove { EventList.Remove ("QHideEvent", value); } + } + public static event QMoveHandler moveHandler { + add { EventList.Add ("QMoveEvent", value); } + remove { EventList.Remove ("QMoveEvent", value); } + } + public static event QTabletHandler tabletHandler { + add { EventList.Add ("QTabletEvent", value); } + remove { EventList.Remove ("QTabletEvent", value); } + } + + // Local events. + protected static event ChildEvent childEvent { + add { EventList.Add ("childEvent", value); } + remove { EventList.Remove ("childEvent", value); } + } + protected static event CloseEvent closeEvent { + add { EventList.Add ("closeEvent", value); } + remove { EventList.Remove ("closeEvent", value); } + } + protected static event ContentsContextMenuEvent contentsContextMenuEvent { + add { EventList.Add ("contentsContextMenuEvent", value); } + remove { EventList.Remove ("contentsContextMenuEvent", value); } + } + protected static event ContentsDragEnterEvent contentsDragEnterEvent { + add { EventList.Add ("contentsDragEnterEvent", value); } + remove { EventList.Remove ("contentsDragEnterEvent", value); } + } + protected static event ContentsDragLeaveEvent contentsDragLeaveEvent { + add { EventList.Add ("contentsDragLeaveEvent", value); } + remove { EventList.Remove ("contentsDragLeaveEvent", value); } + } + protected static event ContentsDragMoveEvent contentsDragMoveEvent { + add { EventList.Add ("contentsDragMoveEvent", value); } + remove { EventList.Remove ("contentsDragMoveEvent", value); } + } + protected static event ContentsDropEvent contentsDropEvent { + add { EventList.Add ("contentsDropEvent", value); } + remove { EventList.Remove ("contentsDropEvent", value); } + } + protected static event ContentsMouseDoubleClickEvent contentsMouseDoubleClickEvent { + add { EventList.Add ("contentsMouseDoubleClickEvent", value); } + remove { EventList.Remove ("contentsMouseDoubleClickEvent", value); } + } + protected static event ContentsMouseMoveEvent contentsMouseMoveEvent { + add { EventList.Add ("contentsMouseMoveEvent", value); } + remove { EventList.Remove ("contentsMouseMoveEvent", value); } + } + protected static event ContentsMousePressEvent contentsMousePressEvent { + add { EventList.Add ("contentsMousePressEvent", value); } + remove { EventList.Remove ("contentsMousePressEvent", value); } + } + protected static event ContentsMouseReleaseEvent contentsMouseReleaseEvent { + add { EventList.Add ("contentsMouseReleaseEvent", value); } + remove { EventList.Remove ("contentsMouseReleaseEvent", value); } + } + protected static event ContentsWheelEvent contentsWheelEvent { + add { EventList.Add ("contentsWheelEvent", value); } + remove { EventList.Remove ("contentsWheelEvent", value); } + } + protected static event ContextMenuEvent contextMenuEvent { + add { EventList.Add ("contextMenuEvent", value); } + remove { EventList.Remove ("contextMenuEvent", value); } + } + protected static event CustomEvent customEvent { + add { EventList.Add ("customEvent", value); } + remove { EventList.Remove ("customEvent", value); } + } + protected static event DragEnterEvent dragEnterEvent { + add { EventList.Add ("dragEnterEvent", value); } + remove { EventList.Remove ("dragEnterEvent", value); } + } + protected static event DragLeaveEvent dragLeaveEvent { + add { EventList.Add ("dragLeaveEvent", value); } + remove { EventList.Remove ("dragLeaveEvent", value); } + } + protected static event DragMoveEvent dragMoveEvent { + add { EventList.Add ("dragMoveEvent", value); } + remove { EventList.Remove ("dragMoveEvent", value); } + } + protected static event DropEvent dropEvent { + add { EventList.Add ("dropEvent", value); } + remove { EventList.Remove ("dropEvent", value); } + } + protected static event EnterEvent enterEvent { + add { EventList.Add ("enterEvent", value); } + remove { EventList.Remove ("enterEvent", value); } + } + protected static event FocusInEvent focusInEvent { + add { EventList.Add ("focusInEvent", value); } + remove { EventList.Remove ("focusInEvent", value); } + } + protected static event FocusOutEvent focusOutEvent { + add { EventList.Add ("focusOutEvent", value); } + remove { EventList.Remove ("focusOutEvent", value); } + } + protected static event HideEvent hideEvent { + add { EventList.Add ("hideEvent", value); } + remove { EventList.Remove ("hideEvent", value); } + } + protected static event IMComposeEvent imComposeEvent { + add { EventList.Add ("imComposeEvent", value); } + remove { EventList.Remove ("imComposeEvent", value); } + } + protected static event IMEndEvent imEndEvent { + add { EventList.Add ("imEndEvent", value); } + remove { EventList.Remove ("imEndEvent", value); } + } + protected static event IMStartEvent imStartEvent { + add { EventList.Add ("imStartEvent", value); } + remove { EventList.Remove ("imStartEvent", value); } + } + protected static event KeyPressEvent keyPressEvent { + add { EventList.Add ("keyPressEvent", value); } + remove { EventList.Remove ("keyPressEvent", value); } + } + protected static event KeyReleaseEvent keyReleaseEvent { + add { EventList.Add ("keyReleaseEvent", value); } + remove { EventList.Remove ("keyReleaseEvent", value); } + } + protected static event LeaveEvent leaveEvent { + add { EventList.Add ("leaveEvent", value); } + remove { EventList.Remove ("leaveEvent", value); } + } + protected static event MouseDoubleClickEvent mouseDoubleClickEvent { + add { EventList.Add ("mouseDoubleClickEvent", value); } + remove { EventList.Remove ("mouseDoubleClickEvent", value); } + } + protected static event MouseMoveEvent mouseMoveEvent { + add { EventList.Add ("mouseMoveEvent", value); } + remove { EventList.Remove ("mouseMoveEvent", value); } + } + protected static event MousePressEvent mousePressEvent { + add { EventList.Add ("mousePressEvent", value); } + remove { EventList.Remove ("mousePressEvent", value); } + } + protected static event MouseReleaseEvent mouseReleaseEvent { + add { EventList.Add ("mouseReleaseEvent", value); } + remove { EventList.Remove ("mouseReleaseEvent", value); } + } + protected static event MoveEvent moveEvent { + add { EventList.Add ("moveEvent", value); } + remove { EventList.Remove ("moveEvent", value); } + } + protected static event PaintEvent paintEvent { + add { EventList.Add ("paintEvent", value); } + remove { EventList.Remove ("paintEvent", value); } + } + protected static event ResizeEvent resizeEvent { + add { EventList.Add ("resizeEvent", value); } + remove { EventList.Remove ("resizeEvent", value); } + } + protected static event ShowEvent showEvent { + add { EventList.Add ("showEvent", value); } + remove { EventList.Remove ("showEvent", value); } + } + protected static event TabletEvent tabletEvent { + add { EventList.Add ("tabletEvent", value); } + remove { EventList.Remove ("tabletEvent", value); } + } + protected static event TimerEvent timerEvent { + add { EventList.Add ("timerEvent", value); } + remove { EventList.Remove ("timerEvent", value); } + } + protected static event ViewportContextMenuEvent viewportContextMenuEvent { + add { EventList.Add ("viewportContextMenuEvent", value); } + remove { EventList.Remove ("viewportContextMenuEvent", value); } + } + protected static event ViewportDragEnterEvent viewportDragEnterEvent { + add { EventList.Add ("viewportDragEnterEvent", value); } + remove { EventList.Remove ("viewportDragEnterEvent", value); } + } + protected static event ViewportDragLeaveEvent viewportDragLeaveEvent { + add { EventList.Add ("viewportDragLeaveEvent", value); } + remove { EventList.Remove ("viewportDragLeaveEvent", value); } + } + protected static event ViewportDragMoveEvent viewportDragMoveEvent { + add { EventList.Add ("viewportDragMoveEvent", value); } + remove { EventList.Remove ("viewportDragMoveEvent", value); } + } + protected static event ViewportDropEvent viewportDropEvent { + add { EventList.Add ("viewportDropEvent", value); } + remove { EventList.Remove ("viewportDropEvent", value); } + } + protected static event ViewportMouseDoubleClickEvent viewportMouseDoubleClickEvent { + add { EventList.Add ("viewportMouseDoubleClickEvent", value); } + remove { EventList.Remove ("viewportMouseDoubleClickEvent", value); } + } + protected static event ViewportMouseMoveEvent viewportMouseMoveEvent { + add { EventList.Add ("viewportMouseMoveEvent", value); } + remove { EventList.Remove ("viewportMouseMoveEvent", value); } + } + protected static event ViewportMousePressEvent viewportMousePressEvent { + add { EventList.Add ("viewportMousePressEvent", value); } + remove { EventList.Remove ("viewportMousePressEvent", value); } + } + protected static event ViewportMouseReleaseEvent viewportMouseReleaseEvent { + add { EventList.Add ("viewportMouseReleaseEvent", value); } + remove { EventList.Remove ("viewportMouseReleaseEvent", value); } + } + protected static event ViewportPaintEvent viewportPaintEvent { + add { EventList.Add ("viewportPaintEvent", value); } + remove { EventList.Remove ("viewportPaintEvent", value); } + } + protected static event ViewportResizeEvent viewportResizeEvent { + add { EventList.Add ("viewportResizeEvent", value); } + remove { EventList.Remove ("viewportResizeEvent", value); } + } + protected static event ViewportWheelEvent viewportWheelEvent { + add { EventList.Add ("viewportWheelEvent", value); } + remove { EventList.Remove ("viewportWheelEvent", value); } + } + protected static event WheelEvent wheelEvent { + add { EventList.Add ("wheelEvent", value); } + remove { EventList.Remove ("wheelEvent", value); } + } + + // The local event delegates. + protected delegate void ChildEvent (QChildEvent e); + protected delegate void CloseEvent (QCloseEvent e); + protected delegate void ContentsContextMenuEvent (QContextMenuEvent e); + protected delegate void ContentsDragEnterEvent (QDragEnterEvent e); + protected delegate void ContentsDragLeaveEvent (QDragLeaveEvent e); + protected delegate void ContentsDragMoveEvent (QDragMoveEvent e); + protected delegate void ContentsDropEvent (QDropEvent e); + protected delegate void ContentsMouseDoubleClickEvent (QMouseEvent e); + protected delegate void ContentsMouseMoveEvent (QMouseEvent e); + protected delegate void ContentsMousePressEvent (QMouseEvent e); + protected delegate void ContentsMouseReleaseEvent (QMouseEvent e); + protected delegate void ContentsWheelEvent (QWheelEvent e); + protected delegate void ContextMenuEvent (QContextMenuEvent e); + protected delegate void CustomEvent (QCustomEvent e); + protected delegate void DragEnterEvent (QDragEnterEvent e); + protected delegate void DragLeaveEvent (QDragLeaveEvent e); + protected delegate void DragMoveEvent (QDragMoveEvent e); + protected delegate void DropEvent (QDropEvent e); + protected delegate void EnterEvent (QEvent e); + protected delegate void FocusInEvent (QFocusEvent e); + protected delegate void FocusOutEvent (QFocusEvent e); + protected delegate void HideEvent (QHideEvent e); + protected delegate void IMComposeEvent (QIMEvent e); + protected delegate void IMEndEvent (QIMEvent e); + protected delegate void IMStartEvent (QIMEvent e); + protected delegate void KeyPressEvent (QKeyEvent e); + protected delegate void KeyReleaseEvent (QKeyEvent e); + protected delegate void LeaveEvent (QEvent e); + protected delegate void MouseDoubleClickEvent (QMouseEvent e); + protected delegate void MouseMoveEvent (QMouseEvent e); + protected delegate void MousePressEvent (QMouseEvent e); + protected delegate void MouseReleaseEvent (QMouseEvent e); + protected delegate void MoveEvent (QMoveEvent e); + protected delegate void PaintEvent (QPaintEvent e); + protected delegate void ResizeEvent (QResizeEvent e); + protected delegate void ShowEvent (QShowEvent e); + protected delegate void TabletEvent (QTabletEvent e); + protected delegate void TimerEvent (QTimerEvent e); + protected delegate void ViewportContextMenuEvent (QContextMenuEvent e); + protected delegate void ViewportDragEnterEvent (QDragEnterEvent e); + protected delegate void ViewportDragLeaveEvent (QDragLeaveEvent e); + protected delegate void ViewportDragMoveEvent (QDragMoveEvent e); + protected delegate void ViewportDropEvent (QDropEvent e); + protected delegate void ViewportMouseDoubleClickEvent (QMouseEvent e); + protected delegate void ViewportMouseMoveEvent (QMouseEvent e); + protected delegate void ViewportMousePressEvent (QMouseEvent e); + protected delegate void ViewportMouseReleaseEvent (QMouseEvent e); + protected delegate void ViewportPaintEvent (QPaintEvent e); + protected delegate void ViewportResizeEvent (QResizeEvent e); + protected delegate void ViewportWheelEvent (QWheelEvent e); + protected delegate void WheelEvent (QWheelEvent e); + } + + + // The global event delegates. + public delegate void QChildHandler (QObject sender, QEventArgs e); + public delegate void QDragEnterHandler (QObject sender, QEventArgs e); + public delegate void QDropHandler (QObject sender, QEventArgs e); + public delegate void QIMHandler (QObject sender, QEventArgs e); + public delegate void QPaintHandler (QObject sender, QEventArgs e); + public delegate void QTimerHandler (QObject sender, QEventArgs e); + public delegate void QCloseHandler (QObject sender, QEventArgs e); + public delegate void QDragLeaveHandler (QObject sender, QEventArgs e); + public delegate void QEventHandler (QObject sender, QEventArgs e); + public delegate void QKeyHandler (QObject sender, QEventArgs e); + public delegate void QResizeHandler (QObject sender, QEventArgs e); + public delegate void QWheelHandler (QObject sender, QEventArgs e); + public delegate void QContextMenuHandler (QObject sender, QEventArgs e); + public delegate void QDragMoveHandler (QObject sender, QEventArgs e); + public delegate void QFocusHandler (QObject sender, QEventArgs e); + public delegate void QMouseHandler (QObject sender, QEventArgs e); + public delegate void QShowHandler (QObject sender, QEventArgs e); + public delegate void QCustomHandler (QObject sender, QEventArgs e); + public delegate void QDragResponseHandler (QObject sender, QEventArgs e); + public delegate void QHideHandler (QObject sender, QEventArgs e); + public delegate void QMoveHandler (QObject sender, QEventArgs e); + public delegate void QTabletHandler (QObject sender, QEventArgs e); +} diff --git a/qtsharp/src/bindings/static/RasterOp.cs b/qtsharp/src/bindings/static/RasterOp.cs new file mode 100644 index 00000000..ed94088d --- /dev/null +++ b/qtsharp/src/bindings/static/RasterOp.cs @@ -0,0 +1,48 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum RasterOp { + CopyROP = 0, + OrROP = 1, + XorROP = 2, + NotAndROP = 3, + EraseROP = NotAndROP, + NotCopyROP = 5, + NotOrROP = 6, + NotXorROP = 7, + AndROP = 8, + NotEraseROP = AndROP, + NotROP = 10, + ClearROP = 11, + SetROP = 12, + NopROP = 13, + AndNotROP = 14, + OrNotROP = 15, + NandROP = 16, + NorROP = 17, + LastROP = NorROP + } +} \ No newline at end of file diff --git a/qtsharp/src/bindings/static/StringComparisonMode.cs b/qtsharp/src/bindings/static/StringComparisonMode.cs new file mode 100644 index 00000000..833025e0 --- /dev/null +++ b/qtsharp/src/bindings/static/StringComparisonMode.cs @@ -0,0 +1,34 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum StringComparisonMode { + CaseSensitive = 1, + BeginsWith = 2, + EndsWith = 4, + Contains = 8, + ExactMatch = 16 + } +} \ No newline at end of file diff --git a/qtsharp/src/bindings/static/TextFlags.cs b/qtsharp/src/bindings/static/TextFlags.cs new file mode 100644 index 00000000..96904f7d --- /dev/null +++ b/qtsharp/src/bindings/static/TextFlags.cs @@ -0,0 +1,37 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum TextFlags { + SingleLine = 128, + DontClip = 256, + ExpandTabs = 512, + ShowPrefix = 1024, + WordBreak = 2048, + BreakAnywhere = 4096, + DontPrint = 8192, + NoAccel = 16384 + } +} diff --git a/qtsharp/src/bindings/static/TextFormat.cs b/qtsharp/src/bindings/static/TextFormat.cs new file mode 100644 index 00000000..06365f3e --- /dev/null +++ b/qtsharp/src/bindings/static/TextFormat.cs @@ -0,0 +1,32 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum TextFormat { + PlainText = 0, + RichText = 1, + AutoText = 2 + } +} \ No newline at end of file diff --git a/qtsharp/src/bindings/static/UIEffect.cs b/qtsharp/src/bindings/static/UIEffect.cs new file mode 100644 index 00000000..15913e09 --- /dev/null +++ b/qtsharp/src/bindings/static/UIEffect.cs @@ -0,0 +1,35 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum UIEffect { + UI_General = 0, + UI_AnimateMenu = 1, + UI_FadeMenu = 2, + UI_AnimateCombo = 3, + UI_AnimateTooltip = 4, + UI_FadeTooltip = 5 + } +} \ No newline at end of file diff --git a/qtsharp/src/bindings/static/WidgetFlags.cs b/qtsharp/src/bindings/static/WidgetFlags.cs new file mode 100644 index 00000000..fde21e59 --- /dev/null +++ b/qtsharp/src/bindings/static/WidgetFlags.cs @@ -0,0 +1,66 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum WidgetFlags { + WWinOwnDC = 0, + WType_TopLevel = 1, + WType_Dialog = 2, + WType_Popup = 4, + WType_Desktop = 8, + WType_Mask = 15, + WStyle_Customize = 16, + WStyle_NormalBorder = 32, + WStyle_DialogBorder = 64, + WStyle_NoBorder = 8192, + WStyle_Title = 128, + WStyle_SysMenu = 256, + WStyle_Minimize = 512, + WStyle_Maximize = 1024, + WStyle_MinMax = WStyle_Minimize|WStyle_Maximize, + WStyle_Tool = 2048, + WStyle_StaysOnTop = 4096, + WStyle_ContextHelp = 16384, + WStyle_Reserved = 32768, + WStyle_Mask = 65520, + WDestructiveClose = 65536, + WPaintDesktop = 131072, + WPaintUnclipped = 262144, + WPaintClever = 524288, + WResizeNoErase = 1048576, + WMouseNoMask = 2097152, + WStaticContents = 4194304, + WRepaintNoErase = 8388608, + WX11BypassWM = 16777216, + WGroupLeader = 33554432, + WShowModal = 67108864, + WNoMousePropagation = 134217728, + WSubWindow = 268435456, + WNorthWestGravity = WStaticContents, + WType_Modal = WType_Dialog|WShowModal, + WStyle_Dialog = WType_Dialog, + WStyle_NoBorderEx = WStyle_NoBorder + } +} diff --git a/qtsharp/src/bindings/static/WidgetState.cs b/qtsharp/src/bindings/static/WidgetState.cs new file mode 100644 index 00000000..8afc9024 --- /dev/null +++ b/qtsharp/src/bindings/static/WidgetState.cs @@ -0,0 +1,53 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum WidgetState { + WState_Created = 1, + WState_Disabled = 2, + WState_Visible = 4, + WState_ForceHide = 8, + WState_OwnCursor = 16, + WState_MouseTracking = 32, + WState_CompressKeys = 64, + WState_BlockUpdates = 128, + WState_InPaintEvent = 256, + WState_Reparented = 512, + WState_ConfigPending = 1024, + WState_Resized = 2048, + WState_AutoMask = 4096, + WState_Polished = 8192, + WState_DND = 16384, + WState_Reserved0 = 32768, + WState_Reserved1 = 65536, + WState_Reserved2 = 131072, + WState_Reserved3 = 262144, + WState_Maximized = 524288, + WState_Minimized = 1048576, + WState_ForceDisabled = 2097152, + WState_Exposed = 4194304, + WState_HasMouse = 8388608 + } +} \ No newline at end of file diff --git a/qtsharp/src/bindings/static/WindowsVersion.cs b/qtsharp/src/bindings/static/WindowsVersion.cs new file mode 100644 index 00000000..da81ea4c --- /dev/null +++ b/qtsharp/src/bindings/static/WindowsVersion.cs @@ -0,0 +1,38 @@ +// QApplication.cs - A Qt to C# binding. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +// Generated File. Do Not Modify. + +namespace Qt { + + using Qt; + using System; + using System.Runtime.InteropServices; + + public enum WindowsVersion { + WV_32s = 1, + WV_95 = 2, + WV_98 = 3, + WV_Me = 4, + WV_DOS_based = 15, + WV_NT = 16, + WV_2000 = 32, + WV_XP = 48, + WV_NT_based = 240 + } +} \ No newline at end of file diff --git a/qtsharp/src/examples/Makefile.am b/qtsharp/src/examples/Makefile.am new file mode 100644 index 00000000..7905a37d --- /dev/null +++ b/qtsharp/src/examples/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = samples tutorials diff --git a/qtsharp/src/examples/samples/Makefile.am b/qtsharp/src/examples/samples/Makefile.am new file mode 100644 index 00000000..eae1d7cc --- /dev/null +++ b/qtsharp/src/examples/samples/Makefile.am @@ -0,0 +1,24 @@ +all: + csant -D$(CSC_NAME)=$(CSC) -C $(CSC_NAME) + chmod 0755 *.exe + +clean: + rm -rf *.exe + +distclean: clean + +install: + mkdir -p $(DESTDIR)$(datadir)/doc/qtcsharp/samples + cat display.cs | gzip -9c > $(DESTDIR)$(datadir)/doc/qtcsharp/samples/display.cs.gz + cat eventhandling.cs | gzip -9c > $(DESTDIR)$(datadir)/doc/qtcsharp/samples/eventhandling.cs.gz + cat hello.cs | gzip -9c > $(DESTDIR)$(datadir)/doc/qtcsharp/samples/hello.cs.gz + cat scribblewindow.cs | gzip -9c > $(DESTDIR)$(datadir)/doc/qtcsharp/samples/scribblewindow.cs.gz + cat mandelbrot.cs | gzip -9c > $(DESTDIR)$(datadir)/doc/qtcsharp/samples/mandelbrot.cs.gz + cat quantumfractals.cs | gzip -9c > $(DESTDIR)$(datadir)/doc/qtcsharp/samples/quantumfractals.cs.gz + cat mandelbrot2.cs | gzip -9c > $(DESTDIR)$(datadir)/doc/qtcsharp/samples/mandelbrot2.cs.gz + +uninstall: + rm -rf $(datadir)/doc/qtcsharp/samples/*.cs.gz + rm -rf $(datadir)/doc/qtcsharp/samples/*.cs + +.PHONY: all clean distclean install 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; + } + } +} diff --git a/qtsharp/src/examples/samples/emit.cs b/qtsharp/src/examples/samples/emit.cs new file mode 100644 index 00000000..e9c3c40a --- /dev/null +++ b/qtsharp/src/examples/samples/emit.cs @@ -0,0 +1,41 @@ +// Illustrates basic usage of custom signals. +// Also see the t7 tutorial. + +namespace QtSamples { + using System; + using Qt; + + [DeclareQtSignal ("MySignal()")] + public class EmitSample: QVBox { + public EmitSample (): this (null, "") {} + + public EmitSample (QWidget parent, string name): base () + { + QPushButton pb = new QPushButton ("Papa Smurf", this); + + Connect (pb, SIGNAL ("clicked ()"), SLOT ("DoEmit ()")); + Connect (this, SIGNAL ("MySignal ()"), SLOT ("PrintStuff ()")); + } + + public void DoEmit () + { + Emit ("MySignal()"); + } + + public void PrintStuff () + { + Console.WriteLine ("Emitted MySignal"); + } + + public static int Main (string[] args) + { + QApplication app = new QApplication (args); + EmitSample es = new EmitSample (); + app.SetMainWidget (es); + es.Show (); + int ret = app.Exec (); + es.Dispose(); + return ret; + } + } +} diff --git a/qtsharp/src/examples/samples/eventhandling.cs b/qtsharp/src/examples/samples/eventhandling.cs new file mode 100644 index 00000000..ee410dd3 --- /dev/null +++ b/qtsharp/src/examples/samples/eventhandling.cs @@ -0,0 +1,52 @@ +// eventhandling.cs - qt-sharp Hello World +// +// Author: Adam Treat +// +// (c) 2002 Adam Treat +// +// Licensed under the terms of the GNU GPL + +namespace QtSamples { + + using Qt; + using System; + + public class EventHandling : QVBox { + + public static void Main (String[] args) + { + QApplication app = new QApplication (args); + EventHandling evh = new EventHandling (); + app.SetMainWidget (evh); + evh.Show (); + app.Exec (); + } + + public EventHandling () : base (null) + { + // This is the global event handler for QMouseEvents + mouseHandler += new QMouseHandler(mouseEvents); + + MyButton pb = new MyButton (this); + } + + public void mouseEvents (QObject sender, QEventArgs e) + { + Console.WriteLine ("Mouse event: " + e.Name); + } + + class MyButton : QPushButton { + + public MyButton (QWidget parent) : base ("Hello Qt-Sharp-0.7!", parent) + { + // This is the local event handler for mousePressEvents + mousePressEvent += new MousePressEvent (pressEvent); + } + + public void pressEvent (QMouseEvent e) + { + Console.WriteLine ("I've been clicked"); + } + } + } +} diff --git a/qtsharp/src/examples/samples/hello.cs b/qtsharp/src/examples/samples/hello.cs new file mode 100644 index 00000000..db6890e5 --- /dev/null +++ b/qtsharp/src/examples/samples/hello.cs @@ -0,0 +1,36 @@ +// helloworld.cs - qt-sharp Hello World +// +// Author: Adam Treat +// +// (c) 2002 Adam Treat +// +// Licensed under the terms of the GNU GPL + +namespace QtSamples { + + using Qt; + using System; + + public class HelloWorld : QVBox { + + public static void Main (String[] args) + { + QApplication app = new QApplication (args); + HelloWorld hello = new HelloWorld (); + app.SetMainWidget (hello); + hello.Show (); + app.Exec (); + } + + public HelloWorld () : base (null) + { + QPushButton pb = new QPushButton ("Hello Qt-Sharp-0.7!", this); + QObject.Connect (pb, SIGNAL ("clicked()"), this, SLOT("SlotClicked()")); + } + + public void SlotClicked () + { + Console.WriteLine ("QPushButton Clicked!"); + } + } +} diff --git a/qtsharp/src/examples/samples/mandelbrot.cs b/qtsharp/src/examples/samples/mandelbrot.cs new file mode 100644 index 00000000..5dbd9b85 --- /dev/null +++ b/qtsharp/src/examples/samples/mandelbrot.cs @@ -0,0 +1,264 @@ +// Mandelbrot 0.1: A demonstration of Qt# +// +// Copyright 2002 Marcus Urban +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +// NOTE: +// Variables with names like PlotXMin are in the cartesian coordinate plane. +// Those with names like ImageXMin was in a translated coordinate system +// where (0, 0) is the upper-left corner. + + +using System; +using Qt; + + +// This struct is a simple implementation of complex numbers. +// It was originally in a separate file because it is useful +// in its own right. It is included here file only to make the +// compilation process simpler of new users. + +public struct Complex { + + private double re, im; + //private int x; + + public Complex (double re, double im) + { + this.re = re; + this.im = im; + } + + public static implicit operator Complex (double re) + { + return new Complex (re, 0.0); + } + + public double Re + { + get { return re; } + } + + public double Im + { + get { return im; } + } + + public static double Abs (Complex a) + { + return Math.Abs (a.re) >= Math.Abs (a.im) ? + Math.Abs (a.re) * Math.Sqrt( 1.0 + (a.im/a.re)*(a.im/a.re) ) : + Math.Abs (a.im) * Math.Sqrt( 1.0 + (a.re/a.im)*(a.re/a.im) ); + } + + public static Complex operator + (Complex a, Complex b) + { + return new Complex (a.re + b.re, a.im + b.im); + } + + public static Complex operator - (Complex a, Complex b) + { + return new Complex (a.re - b.re, a.im - b.im); + } + + public static Complex operator * (Complex a, Complex b) + { + return new Complex ( a.re*b.re - a.im*b.im, a.im*b.re + a.re*b.im ); + } + + // Division isn't pretty. Do it later. + + public override string ToString () + { + return this.re.ToString () + "+" + this.im.ToString () + "i"; + } +} + + +public class Mandelbrot { + + public static int Iterations ( Complex c ) + { + const int MaximumIterations = 16; + Complex value = c; + int currentDepth = 1; + + while ( Complex.Abs(value) < 2.0 && currentDepth <= MaximumIterations ) { + ++currentDepth; + value = (value * value) + c; + } + return currentDepth; + } + + + public static void Main (string[] args) + { + QApplication app = new QApplication (args); + + ImageDialog dialog = new ImageDialog (null, "Mandelbrot", false, 0); + dialog.Show (); + app.SetMainWidget (dialog); + app.Exec (); + + } +} + + +public class ImageDialog : QDialog { + + const double DefaultPlotXMin = -2.0; + const double DefaultPlotXMax = 2.0; + const double DefaultPlotYMin = -1.5; + const double DefaultPlotYMax = 1.5; + + QHBoxLayout dialogLayout; + QGridLayout gridLayout; + QVBoxLayout leftLayout; + QHBoxLayout buttonLayout; + QPushButton redrawButton; + QLabel pixmapLabel; + QSizePolicy fixedSizePolicy; + + QLabel XMinLabel, XMaxLabel, YMinLabel, YMaxLabel; + QLineEdit editXMin, editXMax, editYMin, editYMax; + + public ImageDialog (QWidget parent, string name, bool modal, WidgetFlags fl): + base (parent, name, modal, fl) + { + if (name == string.Empty) + SetName ("imageDialog"); + SetCaption ("Mandelbrot Image"); + + dialogLayout = new QHBoxLayout (this, 11, 6); + gridLayout = new QGridLayout (null, 1, 1, 0, 6, "gridLayout"); + leftLayout = new QVBoxLayout (null, 0, 6, "leftLayout"); + + fixedSizePolicy = new QSizePolicy (); + fixedSizePolicy.SetHorData (QSizePolicy.SizeType.Fixed); + fixedSizePolicy.SetVerData (QSizePolicy.SizeType.Fixed); + + XMinLabel = new QLabel ("Xmin", this); + XMinLabel.SetSizePolicy (fixedSizePolicy); + gridLayout.AddWidget (XMinLabel, 0, 0); + + XMaxLabel = new QLabel ("Xmax", this); + XMaxLabel.SetSizePolicy(fixedSizePolicy); + gridLayout.AddWidget (XMaxLabel, 1, 0); + + YMinLabel = new QLabel ("Ymin", this); + YMinLabel.SetSizePolicy (fixedSizePolicy); + gridLayout.AddWidget (YMinLabel, 2, 0); + + YMaxLabel = new QLabel ("Ymax", this); + YMaxLabel.SetSizePolicy (fixedSizePolicy); + gridLayout.AddWidget (YMaxLabel, 3, 0); + + QDoubleValidator validator = new QDoubleValidator (this); + + editXMin = new QLineEdit (this, "editXMin"); + editXMin.SetText (Convert.ToString (DefaultPlotXMin)); + editXMin.SetValidator (validator); + gridLayout.AddWidget (editXMin, 0, 1); + + editXMax = new QLineEdit (this, "editXMax"); + editXMax.SetText (Convert.ToString(DefaultPlotXMax)); + editXMax.SetValidator (validator); + gridLayout.AddWidget (editXMax, 1, 1); + + editYMin = new QLineEdit (this, "editYMin"); + editYMin.SetText (Convert.ToString(DefaultPlotYMin)); + editYMin.SetValidator (validator); + gridLayout.AddWidget (editYMin, 2, 1); + + editYMax = new QLineEdit (this, "editYMax"); + editYMax.SetText (Convert.ToString(DefaultPlotYMax)); + editYMax.SetValidator (validator); + gridLayout.AddWidget (editYMax, 3, 1); + + leftLayout.AddLayout (gridLayout); + QSpacerItem spacer1 = new QSpacerItem (0, 0, 0, 0); + leftLayout.AddItem (spacer1); + + buttonLayout = new QHBoxLayout (null, 0, 6, "buttonLayout"); + QSpacerItem spacer2 = new QSpacerItem (0, 0, 0, 0); + buttonLayout.AddItem (spacer2); + + redrawButton = new QPushButton ("Redraw", this); + redrawButton.SetDefault (true); + buttonLayout.AddWidget (redrawButton); + + QSpacerItem spacer3 = new QSpacerItem (0, 0, 0, 0); + buttonLayout.AddItem (spacer3); + + leftLayout.AddLayout (buttonLayout); + + dialogLayout.AddLayout (leftLayout); + QSpacerItem spacer4 = new QSpacerItem (0, 0, 0, 0); + dialogLayout.AddItem (spacer4); + + pixmapLabel = new QLabel (this, "pixmapLabel", 0); + pixmapLabel.SetScaledContents (true); + dialogLayout.AddWidget (pixmapLabel); + + QObject.Connect (redrawButton, SIGNAL ("clicked()"), this, SLOT ("Redraw()")); + + Redraw (); + } + + + QImage MandelbrotImage () + { + int depth; + double real, imag; + + double PlotXMin = Convert.ToDouble ( editXMin.Text () ); + double PlotXMax = Convert.ToDouble ( editXMax.Text () ); + double PlotYMin = Convert.ToDouble ( editYMin.Text () ); + double PlotYMax = Convert.ToDouble ( editYMax.Text () ); + + int ImageXMax = pixmapLabel.Width (); + int ImageYMax = pixmapLabel.Height (); + + QImage image = new QImage (ImageXMax, ImageYMax, 32, 0); + + for (int x = 0; x <= ImageXMax - 1; x+=1) { + for (int y = 0; y <= ImageYMax - 1; y+=1) { + real = (PlotXMax - PlotXMin)/ImageXMax * x + PlotXMin; + imag = (PlotYMin - PlotYMax)/ImageYMax * y + PlotYMax; + depth = Mandelbrot.Iterations ( new Complex (real, imag) ); + image.SetPixel ( x, y, (uint) depth*16 ); + } + } + + return image; + } + + public void Redraw () + { + QSize s = pixmapLabel.BaseSize (); + pixmapLabel.Resize (400,300); + QApplication.SetOverrideCursor ( new QCursor( (int) CursorShape.WaitCursor )); + QImage image = MandelbrotImage (); + QPixmap pixmap = new QPixmap (image); + pixmapLabel.SetPixmap( pixmap); + image.Dispose (); + pixmap.Dispose (); + this.AdjustSize (); + QApplication.RestoreOverrideCursor (); + } +} + + diff --git a/qtsharp/src/examples/samples/mandelbrot2.cs b/qtsharp/src/examples/samples/mandelbrot2.cs new file mode 100644 index 00000000..bcb0a360 --- /dev/null +++ b/qtsharp/src/examples/samples/mandelbrot2.cs @@ -0,0 +1,309 @@ +// Mandelbrot 0.1: A demonstration of Qt# +// +// Copyright 2002 Marcus Urban +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +// NOTE: +// Variables with names like PlotXMin are in the cartesian coordinate plane. +// Those with names like ImageXMin was in a translated coordinate system +// where (0, 0) is the upper-left corner. + + +using System; +using Qt; + + +// This struct is a simple implementation of complex numbers. +// It was originally in a separate file because it is useful +// in its own right. It is included here file only to make the +// compilation process simpler of new users. + +public struct Complex { + + private double re, im; + //private int x; + + public Complex (double re, double im) + { + this.re = re; + this.im = im; + } + + public static implicit operator Complex (double re) + { + return new Complex (re, 0.0); + } + + public double Re + { + get { return re; } + } + + public double Im + { + get { return im; } + } + + public static double Abs (Complex a) + { + return Math.Abs (a.re) >= Math.Abs (a.im) ? + Math.Abs (a.re) * Math.Sqrt( 1.0 + (a.im/a.re)*(a.im/a.re) ) : + Math.Abs (a.im) * Math.Sqrt( 1.0 + (a.re/a.im)*(a.re/a.im) ); + } + + public static Complex operator + (Complex a, Complex b) + { + return new Complex (a.re + b.re, a.im + b.im); + } + + public static Complex operator - (Complex a, Complex b) + { + return new Complex (a.re - b.re, a.im - b.im); + } + + public static Complex operator * (Complex a, Complex b) + { + return new Complex ( a.re*b.re - a.im*b.im, a.im*b.re + a.re*b.im ); + } + + // Division isn't pretty. Do it later. + + public override string ToString () + { + return this.re.ToString () + "+" + this.im.ToString () + "i"; + } +} + + +public class Mandelbrot +{ + public static ImageDialog dialog; + + public static int Iterations ( Complex c ) + { + const int MaximumIterations = 16; + Complex value = c; + int currentDepth = 1; + + while ( Complex.Abs(value) < 2.0 && currentDepth <= MaximumIterations ) { + ++currentDepth; + value = (value * value) + c; + } + return currentDepth; + } + + + public static void Main (string[] args) + { + QApplication app = new QApplication (args); + + dialog = new ImageDialog (null, "Mandelbrot", false, 0); + dialog.SetGeometry(0, 0, 550, 300 ); + dialog.Show(); + app.SetMainWidget (dialog); + app.Exec (); + + } +} + + +public class PicLabel: QFrame +{ + QPixmap newPixmap; + int newWidth = 400; + int newHeight = 300; + + public PicLabel( QWidget parent, string name, WidgetFlags flags ): + base( parent, name, flags ) + { + SetBackgroundMode (Qt.BackgroundMode.NoBackground); + resizeEvent += new ResizeEvent (PerformResize); + paintEvent += new PaintEvent (PerformPaint); + + } + + protected void PerformResize (QResizeEvent e) + { + Console.WriteLine("Resizing to {0} by {1}", + e.Size().Width(), e.Size().Height() ); + + newWidth = e.Size().Width(); + newHeight = e.Size().Height(); + + } + + + protected void PerformPaint(QPaintEvent e ) + { + Console.WriteLine("Making a new image {0} by {1}", newWidth, newHeight ); + + QImage image = Mandelbrot.dialog.MandelbrotImage( newWidth, newHeight ); + newPixmap = new QPixmap( image ); + + BitBlt(this, 0, 0, newPixmap, + 0, 0, -1, -1, RasterOp.CopyROP, false); + Console.WriteLine("PerformPaint"); + } +} + + + +public class ImageDialog : QDialog { + + const double DefaultPlotXMin = -2.0; + const double DefaultPlotXMax = 2.0; + const double DefaultPlotYMin = -1.5; + const double DefaultPlotYMax = 1.5; + + QHBoxLayout dialogLayout; + QGridLayout gridLayout; + QVBoxLayout leftLayout; + QHBoxLayout buttonLayout; + QPushButton redrawButton; + public PicLabel pixmapLabel; + QSizePolicy fixedSizePolicy; + + QLabel XMinLabel, XMaxLabel, YMinLabel, YMaxLabel; + QLineEdit editXMin, editXMax, editYMin, editYMax; + + + public ImageDialog (QWidget parent, string name, bool modal, WidgetFlags fl): + base (parent, name, modal, fl) + { + if (name == string.Empty) + SetName ("imageDialog"); + SetCaption ("Mandelbrot Image"); + + dialogLayout = new QHBoxLayout (this, 11, 6); + gridLayout = new QGridLayout (null, 1, 1, 0, 6, "gridLayout"); + leftLayout = new QVBoxLayout (null, 0, 6, "leftLayout"); + + fixedSizePolicy = new QSizePolicy ( QSizePolicy.SizeType.Fixed, + QSizePolicy.SizeType.Fixed, false ); + + XMinLabel = new QLabel ("Xmin", this); + XMinLabel.SetSizePolicy (fixedSizePolicy); + gridLayout.AddWidget (XMinLabel, 0, 0); + + XMaxLabel = new QLabel ("Xmax", this); + XMaxLabel.SetSizePolicy(fixedSizePolicy); + gridLayout.AddWidget (XMaxLabel, 1, 0); + + YMinLabel = new QLabel ("Ymin", this); + YMinLabel.SetSizePolicy (fixedSizePolicy); + gridLayout.AddWidget (YMinLabel, 2, 0); + + YMaxLabel = new QLabel ("Ymax", this); + YMaxLabel.SetSizePolicy (fixedSizePolicy); + gridLayout.AddWidget (YMaxLabel, 3, 0); + + QDoubleValidator validator = new QDoubleValidator (this); + + editXMin = new QLineEdit (this, "editXMin"); + editXMin.SetSizePolicy( fixedSizePolicy ); + editXMin.SetText (Convert.ToString (DefaultPlotXMin)); + editXMin.SetValidator (validator); + gridLayout.AddWidget (editXMin, 0, 1); + + editXMax = new QLineEdit (this, "editXMax"); + editXMax.SetSizePolicy( fixedSizePolicy ); + editXMax.SetText (Convert.ToString(DefaultPlotXMax)); + editXMax.SetValidator (validator); + gridLayout.AddWidget (editXMax, 1, 1); + + editYMin = new QLineEdit (this, "editYMin"); + editYMin.SetSizePolicy( fixedSizePolicy ); + editYMin.SetText (Convert.ToString(DefaultPlotYMin)); + editYMin.SetValidator (validator); + gridLayout.AddWidget (editYMin, 2, 1); + + editYMax = new QLineEdit (this, "editYMax"); + editYMax.SetSizePolicy( fixedSizePolicy ); + editYMax.SetText (Convert.ToString(DefaultPlotYMax)); + editYMax.SetValidator (validator); + gridLayout.AddWidget (editYMax, 3, 1); + + leftLayout.AddLayout (gridLayout); + QSpacerItem spacer1 = new QSpacerItem (0, 0, 0, 0); + leftLayout.AddItem (spacer1); + + buttonLayout = new QHBoxLayout (null, 0, 6, "buttonLayout"); + QSpacerItem spacer2 = new QSpacerItem (0, 0, 0, 0); + buttonLayout.AddItem (spacer2); + + redrawButton = new QPushButton ("Redraw", this); + redrawButton.SetSizePolicy ( fixedSizePolicy ); + redrawButton.SetDefault (true); + buttonLayout.AddWidget (redrawButton); + + QSpacerItem spacer3 = new QSpacerItem (0, 0, 0, 0); + buttonLayout.AddItem (spacer3); + + leftLayout.AddLayout (buttonLayout); + + dialogLayout.AddLayout (leftLayout); + QSpacerItem spacer4 = new QSpacerItem (0, 0, 0, 0); + dialogLayout.AddItem (spacer4); + + pixmapLabel = new PicLabel (this, "pixmapLabel", 0); + //pixmapLabel.SetScaledContents (true); + pixmapLabel.SetSizePolicy( QSizePolicy.SizeType.Minimum, + QSizePolicy.SizeType.Minimum, false ); + pixmapLabel.SetGeometry( 0, 0, 400, 300 ); + pixmapLabel.Show(); + pixmapLabel.Resize(400,300); + dialogLayout.AddWidget (pixmapLabel); + + + //QImage image = MandelbrotImage( 400, 300 ); + //pixmapLabel.SetPixmap( new QPixmap( image ) ); + + + QObject.Connect (redrawButton, SIGNAL ("clicked()"), pixmapLabel, SLOT ("Repaint()")); + + //Redraw (); + } + + public QImage MandelbrotImage ( int width, int height) + { + int depth; + double real, imag; + + double PlotXMin = Convert.ToDouble ( editXMin.Text () ); + double PlotXMax = Convert.ToDouble ( editXMax.Text () ); + double PlotYMin = Convert.ToDouble ( editYMin.Text () ); + double PlotYMax = Convert.ToDouble ( editYMax.Text () ); + + int ImageXMax = width; + int ImageYMax = height; + + QImage image = new QImage (ImageXMax, ImageYMax, 32, 0); + + for (int x = 0; x <= ImageXMax - 1; x+=1) { + for (int y = 0; y <= ImageYMax - 1; y+=1) { + real = (PlotXMax - PlotXMin)/ImageXMax * x + PlotXMin; + imag = (PlotYMin - PlotYMax)/ImageYMax * y + PlotYMax; + depth = Mandelbrot.Iterations ( new Complex (real, imag) ); + image.SetPixel ( x, y, (uint) depth*16 ); + } + } + + return image; + } + +} + + diff --git a/qtsharp/src/examples/samples/qstring-slot.cs b/qtsharp/src/examples/samples/qstring-slot.cs new file mode 100644 index 00000000..e6d5110a --- /dev/null +++ b/qtsharp/src/examples/samples/qstring-slot.cs @@ -0,0 +1,38 @@ +// Demo of a QString slot +// Implemented by Marcus Urban + +using System; +using Qt; + +public class MyWidget : QVBox +{ + QLineEdit lineEdit; + QLabel label; + + public MyWidget (QWidget parent, String name) : base (parent, name) + { + lineEdit = new QLineEdit( this, "lineEdit" ); + label = new QLabel( this, "label" ); + label.SetText("Default"); + + QObject.Connect( lineEdit, SIGNAL("textChanged(QString)"), + label, "SetText(QString)" ); + } + + + public MyWidget (QWidget parent) : this (parent, "") {} + public MyWidget () : this (null, "") {} +} + +public class Example { + + public static int Main (String[] args) + { + QApplication a = new QApplication (args); + + MyWidget w = new MyWidget (); + a.SetMainWidget (w); + w.Show (); + return a.Exec (); + } +} diff --git a/qtsharp/src/examples/samples/quantumfractals.cs b/qtsharp/src/examples/samples/quantumfractals.cs new file mode 100644 index 00000000..56898912 --- /dev/null +++ b/qtsharp/src/examples/samples/quantumfractals.cs @@ -0,0 +1,828 @@ +// quantumfractals.cs - Port of eeqt to Qt# +// Author: Adam Treat +// (c) 2002 Adam Treat +// Licensed under the terms of the GNU GPL + +namespace Qf { + + using Qt; + using System; + using System.Threading; + + public class FractalViewer : QMainWindow { + + //Menuing + private QMenuBar menubar; + private QPopupMenu filemenu; + private QPopupMenu shapemenu; + private QPopupMenu settingsmenu; + + public static int Main (string[] args) + { + //Initialize and start the main event loop + QApplication app = new QApplication (args); + FractalViewer view = new FractalViewer (); + app.SetMainWidget (view); + view.Show (); + return app.Exec (); + } + + public FractalViewer (): base (null, "main") + { + SetCaption ("Quantum Fractals"); + + //Setup the display + Display display = new Display (this); + SetCentralWidget (display); + + //Setup the filemenu + filemenu = new QPopupMenu (null, "filemenu"); + filemenu.InsertItem ("&Screenshot", display, SLOT ("SlotScreenshot()")); + filemenu.InsertSeparator (); + filemenu.InsertItem ("&Quit", qApp, SLOT ("quit()")); + + //Setup the shapemenu + shapemenu = new QPopupMenu (null, "typemenu"); + shapemenu.InsertItem( "&Tetrahedron", 0); + shapemenu.InsertItem( "&Cube", 1); + shapemenu.InsertItem( "&Octahedron", 2); + shapemenu.InsertItem( "&Icosahedron", 3); + shapemenu.InsertItem( "&Dodecahedron", 4); + shapemenu.InsertItem( "&Double Tetrahedron", 5); + shapemenu.InsertItem( "&Icosidodecahedron", 6); + + //Connect the shapemenu + QObject.Connect (shapemenu, SIGNAL ("activated(int)"), + display, SLOT("SlotShapeMenu(int)")); + + //Setup the settingsmenu + settingsmenu = new QPopupMenu (null, "settingsmenu"); + settingsmenu.InsertItem ("&Alpha", display, SLOT ("SlotSetAlpha()")); + + //Setup the menubar + menubar = new QMenuBar (this, ""); + menubar.InsertItem ("&File", filemenu); + menubar.InsertItem ("&Shape", shapemenu); + menubar.InsertItem ("&Settings", settingsmenu); + } + } + + public class Display: QWidget, IQuantumFractal { + + //Labels + QLabel count; + QLabel shape; + QLabel alpha; + + //Buttons + QPushButton start; + QPushButton stop; + QPushButton reset; + QPushButton gray; + QPushButton intense; + + //Drawable region + QPaintBuffer buffer; + + //Layouts + QVBoxLayout layout; + QHBoxLayout buttons; + QVBoxLayout labels; + + //Engine controller variables + int[] topDensity = new int[0]; + int[] bottomDensity = new int[0]; + int resolution = 400; + int scale = 1; + double centerX = 0; + double centerY = 0; + int i = 0; + bool Grayscale = true; + bool Intense = false; + bool Running = false; + bool WasRunning = false; + + //The engine + QuantumFractals qf; + Thread engine; + + public Display (QWidget parent): base (parent) + { + //Setup the sizes + QSize size = new QSize (resolution, resolution); + parent.SetBaseSize (size); + + //Some nice colors + SetPaletteBackgroundColor (new QColor ("Black")); + SetPaletteForegroundColor (new QColor ("LightBlue")); + + //Setup the buttons + start = new QPushButton ("Start", this); + stop = new QPushButton ("Stop", this); + reset = new QPushButton ("Reset", this); + gray = new QPushButton ("Color", this); + intense = new QPushButton ("Intensity", this); + + //Setup the labels + count = new QLabel (this); + alpha = new QLabel (this); + shape = new QLabel (this); + + //Setup the drawable + buffer = new QPaintBuffer (this); + buffer.SetMinimumSize (size); + + //Create the layouts + layout = new QVBoxLayout (this); + buttons = new QHBoxLayout (layout); + + //Add some buttons + buttons.AddWidget (start); + buttons.AddWidget (stop); + buttons.AddWidget (reset); + buttons.AddWidget (gray); + buttons.AddWidget (intense); + + //Connect the buttons and SlotQuit + QObject.Connect (start, SIGNAL ("clicked()"), + this, SLOT ("SlotStart()")); + QObject.Connect (stop, SIGNAL ("clicked()"), + this, SLOT ("SlotStop()")); + QObject.Connect (reset, SIGNAL ("clicked()"), + this, SLOT ("SlotReset()")); + QObject.Connect (gray, SIGNAL ("clicked()"), + this, SLOT ("SlotGray()")); + QObject.Connect (intense, SIGNAL ("clicked()"), + this, SLOT ("SlotIntense()")); + QObject.Connect (buffer, SIGNAL ("Painted()"), + this, SLOT ("SlotSetLabels()")); + QObject.Connect (qApp, SIGNAL ("lastWindowClosed ()"), + this, SLOT ("SlotQuit ()")); + + //Layout labels + labels = new QVBoxLayout (layout); + labels.AddWidget (count); + labels.AddWidget (shape); + labels.AddWidget (alpha); + + //Layout buffer + layout.AddWidget (buffer, 1); + + //Finally create the data engine + qf = new QuantumFractals (this); + + //Handle resize events + resizeEvent += new ResizeEvent (TouchResize); + } + + //This is where the controller receives data from the engine + public void UpdateData (double[] d) + { + i++; //Keep track of the number of points + + //Set the density arrays to match the resolution + if (resolution * resolution != topDensity.Length) { + topDensity = new int[resolution * resolution]; + bottomDensity = new int[resolution * resolution]; + } + + //setup the sphere + int res = resolution; + int res2 = res / 2; + int x = res / 2 + (int)(res2 * scale * (d[0] - centerX)); + int y = res / 2 + (int)(res2 * scale * (d[1] - centerY)); + double z = d[2]; + + if ((x < res) && (x >= 0) && (y >= 0) && (y < res)) { + + if (z >= 0) + topDensity[y * resolution + x]++; + else + bottomDensity[y * resolution + x]++; + + } + + //Convert the density into a color + int top = topDensity[y * resolution + x]; + //int bot = bottomDensity[y * resolution + x]; + top = Math.Min (top, 255); + //bot = Math.Min (bot, 255); + + //Log color system not working well :( + if (Intense) { + top = (int)(Math.Log (top + 1)); + //bot = (int)(Math.Log (bot + 1)); + } + + int topdepth = RGB (top,top,top); + //int botdepth = RGB (bot,bot,bot); + + //Finally draw the pixel + SetPixel (x, y, topdepth); + //SetPixel (x, y, botdepth); + } + + //Calls the drawable + public void SetPixel (int x, int y, int depth) + { + buffer.PaintPixel (x, y, depth); + } + + //Convert the color into a depth + public int RGB (int r, int g, int b) + { + if (!Grayscale) { + + r = Intensity (r < 128 ? 128 - r : 0); + g = Intensity (128 - Math.Abs (g - 128)); + b = Intensity (b < 128 ? 0 : b - 128); + + } else { + + r = Intensity (r); + g = Intensity (g); + b = Intensity (b); + + } + //Console.WriteLine ("{0} {1} {2}", r,g,b); + return 256 * 256 * r + 256 * g + b; + } + + //This provides more detail + private int Intensity(int val) + { + int ret; + + double bases = 64; + double scale = 256.0 / (256.0 - bases); + ret = (int)(bases + ((double)val) / scale); + + //if gray then black, if color then white + if (val == 0 && Grayscale) + ret = 0; + else if (val == 0) + ret = 255; + return ret; + } + + //Draw the labels + private void SlotSetLabels () + { + count.SetText ("Count: " + i.ToString ()); + shape.SetText ("Shape: " + qf.GetPolytope ()); + alpha.SetText ("Alpha: " + qf.Alpha.ToString ()); + } + + //Start the engine + private void SlotStart () + { + engine = new Thread(new ThreadStart(qf.Start)); + engine.Start (); + Running = true; + } + + //Stop the engine + private void SlotStop () + { + if (engine != null) + if (engine.IsAlive) + engine.Abort (); + Running = false; + } + + //Reset everything + private void SlotReset () + { + SlotStop (); + ResetBuffer (); + SlotStart (); + } + + //Reset the drawable + private void ResetBuffer () + { + i = 0; + SlotSetLabels (); + topDensity = new int[0]; + bottomDensity = new int[0]; + buffer.Reset (); + } + + //Toggles the color scheme + private void SlotGray () + { + Grayscale = !Grayscale; + } + + //Toggles log color scheme + //Not working so well :( + private void SlotIntense () + { + Intense = !Intense; + } + + //Change the platonic shape + private void SlotShapeMenu (int item) + { + WasRunning = Running ? true : false; + + SlotStop (); + ResetBuffer (); + + switch(item) { + + case 0: + qf.SetPolytope (0); + break; + case 1: + qf.SetPolytope (1); + break; + case 2: + qf.SetPolytope (2); + break; + case 3: + qf.SetPolytope (3); + break; + case 4: + qf.SetPolytope (4); + break; + case 5: + qf.SetPolytope (5); + break; + case 6: + qf.SetPolytope (6); + break; + Default: + qf.SetPolytope (0); + break; + } + + if (WasRunning) + SlotStart (); + } + + //Save the drawable as a screenshot + private void SlotScreenshot () + { + WasRunning = Running ? true : false; + + SlotStop (); + string filename = QFileDialog.GetSaveFileName ( + + QDir.HomeDirPath (), "*", this, "save", + "Save Screenshot", "*.png", true + ); + + if (filename != null) + buffer.Save (filename); + + if (WasRunning) + SlotStart (); + } + + //Set the alpha engine variable + private void SlotSetAlpha () + { + WasRunning = Running ? true : false; + + SlotStop (); + qf.Alpha = QInputDialog.GetDouble ( + + "Set Alpha", "Alpha: ", qf.Alpha, 0, 2, 32 + ); + + if (WasRunning) + SlotStart (); + else + SlotSetLabels (); + } + + //Make sure to quit all threads upon exit + private void SlotQuit () + { + SlotStop (); + buffer.Stop (); + } + + //Need to reset the resolution upon resize + private void TouchResize (QResizeEvent e) + { + int height = buffer.Size ().Height (); + int width = buffer.Size ().Width (); + + resolution = height > width ? width : height; + } + } + + [DeclareQtSignal ("Painted()")] + public class QPaintBuffer : QFrame { + + //Drawables + private QPixmap buffer; + private QImage image; + + //Timer + private TimerCallback call; + private Timer timer; + + public QPaintBuffer (QWidget parent) : base (parent) + { + SetBackgroundMode (Qt.BackgroundMode.NoBackground); + + //Create drawables + buffer = new QPixmap (); + image = new QImage (Size (), 32); + + //Setup the event handlers + paintEvent += new PaintEvent (TouchPaint); + resizeEvent += new ResizeEvent (TouchResize); + focusInEvent += new FocusInEvent (TouchFocus); + focusOutEvent += new FocusOutEvent (TouchFocus); + + //Start the timer + call = new TimerCallback(PaintImage); + timer = new Timer(call, null, 1000, 1000); + + } + + //Resets the drawables + public void Reset () + { + buffer = new QPixmap (); + image = new QImage (Size (), 32); + PaintImage (null); + } + + //Paints a pixel to the image + public void PaintPixel (int x, int y, int depth) + { + lock (this) { + if (x < image.Width () && y < image.Height ()) + image.SetPixel (x, y, (uint)depth); + } + } + + //Saves the image to a file + public void Save (string filename) + { + image.Save (filename, "PNG"); + } + + //Paints the image to the screen and emits Painted + private void PaintImage (object state) + { + buffer.ConvertFromImage (image); + PerformPaint (); + Emit ("Painted()"); + } + + //The actual bitblt to the screen + private void PerformPaint () + { + BitBlt(this, 0, 0, buffer, + 0, 0, -1, -1, RasterOp.CopyROP, false); + } + + //Receive focus events + private void TouchFocus (QFocusEvent e) + { + PerformPaint (); + } + + //Receive paint events + private void TouchPaint (QPaintEvent e) + { + PerformPaint (); + } + + //Receive resize events + private void TouchResize (QResizeEvent e) + { + image = new QImage (e.Size (), 32); + buffer.Resize (e.Size()); + buffer.Fill (new QColor("black")); + BitBlt (buffer, 0, 0, new QPixmap (buffer), + 0, 0, -1, -1, RasterOp.CopyROP, false); + } + + //Dispose of the timer + public void Stop () + { + timer.Dispose (); + } + } + + public interface IQuantumFractal { + + void UpdateData (Double [] data); + } + + //Polytope types + public enum Shapes { + TETRAHEDRON = 0, + CUBE = 1, + OCTAHEDRON = 2, + ICOSAHEDRON = 3, + DODECAHEDRON = 4, + DOUBLE_TETRAHEDRON = 5, + ICOSIDODECAHEDRON = 6 + } + + public class QuantumFractals { + + private int t = 0; + private double[] p; //Detector probabilities + private double[] fp; //Fractal point + private double[][] n; //Detector points + private double[] counter; //Detect counter + private double alpha = 0.61803398874989288039384209090709; //Initialize to 1/phi + + private Random random; + private Shapes polytope; + private IQuantumFractal consumer; + + public QuantumFractals (IQuantumFractal consumer) + { + this.consumer = consumer; + SetPolytope (0); + Init (); + } + + public double Alpha + { + get { return alpha; } + set { alpha = value; } + } + + private void Init () + { + random = new Random (); + + //Default values + t = 0; + + counter = new double[n.Length]; //Detect counter + fp = new double[3]; //Fractal point + p = new double[n.Length]; + + //Initial state + fp[0] = random.NextDouble () -0.5; + fp[1] = random.NextDouble () -0.5; + fp[2] = random.NextDouble () -0.5; + + double sum = Math.Sqrt (Product (fp, fp)); + + fp[0] = fp[0] / sum; + fp[1] = fp[1] / sum; + fp[2] = fp[2] / sum; + } + + //Main fractal generator loop + public void Start () + { + Init (); + + //double n1 = (1.0) / n.Length as double; + double n1 = (1.0) / n.Length; + + double alpha12 = 2 * alpha / (n.Length * (1 + alpha * alpha)); + + do { + //Increase t + t++; + + //Calculate detector click probabilities + for (int i = 0; i < p.Length; i++) + p[i] = n1 + alpha12 * Product (n[i], fp); + + //Get next random number + double r = random.NextDouble (); + + //Check which detector that clicked + double ptmp = 0; + double[] detector = null; + + for (int i = 0; i < p.Length; i++) { + + ptmp += p[i]; + + if (r <= ptmp) { + //We found which detector clicked + detector = n[i]; + counter[i]++; + break; + } + } + + if (detector == null) + detector = n[p.Length - 1]; + + //Project + double sc = Product (fp, detector); + + for (int j = 0; j < 3; j++) + fp[j]= (1 - alpha * alpha) * fp[j] + 2 * alpha * (1 + alpha * sc) * detector[j]; + + //Normalize + double norm = Math.Sqrt (Product (fp, fp)); + + for (int j=0; j<3; j++) + fp[j] /= norm; + + consumer.UpdateData (fp); + + } while (true); + } + + + //Calculate the scalar product of two vectors + private double Product (double[] v1, double[] v2) + { + double sc = 0; + for(int i=0; i < v1.Length; i++) + sc += v1[i] * v2[i]; + return sc; + } + + public string GetPolytope () + { + string ret = String.Empty; + switch (polytope) { + case Shapes.TETRAHEDRON: + ret = "Tetrahedron"; + break; + case Shapes.CUBE: + ret = "Cube"; + break; + case Shapes.OCTAHEDRON: + ret = "Octahedron"; + break; + case Shapes.ICOSAHEDRON: + ret = "Icosahedron"; + break; + case Shapes.DODECAHEDRON: + ret = "Dodecahedron"; + break; + case Shapes.DOUBLE_TETRAHEDRON: + ret = "Double Tetrahedron"; + break; + case Shapes.ICOSIDODECAHEDRON: + ret = "Icosidodecahedron"; + break; + Default: + ret = "Unknown"; + break; + } + return ret; + } + + public void SetPolytope (int type) + { + polytope = (Qf.Shapes)type; + + switch (type) { + + case 0: { + + n = new double[4][]; + n[0] = new double[] {0,0,1.0}; + n[1] = new double[] {0.9428090415820634,0,-0.3333333333333333}; + n[2] = new double[] {-0.4714045207910317,0.816496580927726,-0.3333333333333333}; + n[3] = new double[] {-0.4714045207910317, -0.816496580927726, -0.3333333333333333}; + + break; + } + + case 1: { + + n = new double[8][]; + n[0] = new double[] {0, 0, 1.0}; + n[1] = new double[] {0.9428090415820634, 0, 0.3333333333333333}; + n[2] = new double[] {-0.4714045207910317, 0.816496580927726, 0.3333333333333333}; + n[3] = new double[] {-0.4714045207910317, -0.816496580927726, 0.3333333333333333}; + n[4] = new double[] {0.4714045207910317, 0.816496580927726, -0.3333333333333333}; + n[5] = new double[] {0.4714045207910317, -0.816496580927726, -0.3333333333333333}; + n[6] = new double[] {-0.9428090415820634, 0, -0.3333333333333333}; + n[7] = new double[] {0, 0, -1.0}; + break; + } + + case 2: { + + n = new double[6][]; + n[0] = new double[] {0, 0, 1.0}; + n[1] = new double[] {1.0, 0, 0}; + n[2] = new double[] {0, 1.0, 0}; + n[3] = new double[] {-1.0, 0, 0}; + n[4] = new double[] {0, -1.0, 0}; + n[5] = new double[] {0, 0, -1.0}; + + break; + } + + case 3: { + + n = new double[12][]; + n[0] = new double[] {0, 0, 1.0}; + n[1] = new double[] {0.8944271909999159, 0, 0.4472135954999579}; + n[2] = new double[] {0.276393202250021, 0.85065080835204, 0.4472135954999579}; + n[3] = new double[] {-0.723606797749979, 0.5257311121191336, 0.4472135954999579}; + n[4] = new double[] {-0.723606797749979, -0.5257311121191336, 0.4472135954999579}; + n[5] = new double[] {0.276393202250021, -0.85065080835204, 0.4472135954999579}; + n[6] = new double[] {0.723606797749979, 0.5257311121191336, -0.4472135954999579}; + n[7] = new double[] {0.723606797749979, -0.5257311121191336, -0.4472135954999579}; + n[8] = new double[] {-0.276393202250021, 0.85065080835204, -0.4472135954999579}; + n[9] = new double[] {-0.8944271909999159, 0, -0.4472135954999579}; + n[10] = new double[] {-0.276393202250021, -0.85065080835204, -0.4472135954999579}; + n[11] = new double[] {0, 0, -1.0}; + + break; + } + + case 4: { + + n = new double[20][]; + n[0] = new double[] {0, 0, 1.0}; + n[1] = new double[] {0.6666666666666666, 0, 0.7453559924999299}; + n[2] = new double[] {-0.3333333333333333, 0.5773502691896257, 0.7453559924999299}; + n[3] = new double[] {-0.3333333333333333, -0.5773502691896257, 0.7453559924999299}; + n[4] = new double[] {0.7453559924999299, 0.5773502691896257, 0.3333333333333333}; + n[5] = new double[] {0.7453559924999299, -0.5773502691896257, 0.3333333333333333}; + n[6] = new double[] {-0.8726779962499649, 0.35682208977308993, 0.3333333333333333}; + n[7] = new double[] {0.12732200375003502, 0.9341723589627157, 0.3333333333333333}; + n[8] = new double[] {0.12732200375003502, -0.9341723589627157, 0.3333333333333333}; + n[9] = new double[] {-0.8726779962499649, -0.35682208977308993, 0.3333333333333333}; + n[10] = new double[] {0.8726779962499649, 0.35682208977308993, -0.3333333333333333}; + n[11] = new double[] {0.8726779962499649, -0.35682208977308993, -0.3333333333333333}; + n[12] = new double[] {-0.7453559924999299, 0.5773502691896257, -0.3333333333333333}; + n[13] = new double[] {-0.12732200375003502, 0.9341723589627157, -0.3333333333333333}; + n[14] = new double[] {-0.12732200375003502, -0.9341723589627157, -0.3333333333333333}; + n[15] = new double[] {-0.7453559924999299, -0.5773502691896257, -0.3333333333333333}; + n[16] = new double[] {0.3333333333333333, 0.5773502691896257, -0.7453559924999299}; + n[17] = new double[] {0.3333333333333333, -0.5773502691896257, -0.7453559924999299}; + n[18] = new double[] {-0.6666666666666666, 0, -0.7453559924999299}; + n[19] = new double[] {0, 0, -1.0}; + break; + } + + case 5: { + + n = new double[8][]; + n[0] = new double[] {0,0,1.0}; + n[1] = new double[] {0.9428090415820634,0,-0.3333333333333333}; + n[2] = new double[] {-0.4714045207910317,0.816496580927726,-0.3333333333333333}; + n[3] = new double[] {-0.4714045207910317, -0.816496580927726, -0.3333333333333333}; + n[4] = new double[] {0,0,-1.0}; + n[5] = new double[] {-0.9428090415820634,0,0.3333333333333333}; + n[6] = new double[] {0.4714045207910317,-0.816496580927726,0.3333333333333333}; + n[7] = new double[] {0.4714045207910317, 0.816496580927726, 0.3333333333333333}; + + break; + } + + case 6: { + + double u=0.5; + double v=0.8090169943749475; // (1/2)*phi + double w=0.3090169943749474; // (1/2)/phi + + n = new double[30][]; + n[0] = new double[] {1,0,0}; + n[1] = new double[] {-1,0,0}; + n[2] = new double[] {0,1,0}; + n[3] = new double[] {0,-1,0}; + n[4] = new double[] {0,0,1}; + n[5] = new double[] {0,0,-1}; + n[6] = new double[] {u,v,w}; + n[7] = new double[] {-u,v,w}; + n[8] = new double[] {u,-v,w}; + n[9] = new double[] {u,v,-w}; + n[10] = new double[] {-u,-v,w}; + n[11] = new double[] {u,-v,-w}; + n[12] = new double[] {-u,v,-w}; + n[13] = new double[] {-u,-v,-w}; + n[14] = new double[] {v,w,u}; + n[15] = new double[] {v,w,-u}; + n[16] = new double[] {-v,w,u}; + n[17] = new double[] {v,-w,u}; + n[18] = new double[] {-v,w,-u}; + n[19] = new double[] {-v,-w,u}; + n[20] = new double[] {v,-w,-u}; + n[21] = new double[] {-v,-w,-u}; + n[22] = new double[] {w,u,v}; + n[23] = new double[] {w,-u,v}; + n[24] = new double[] {w,u,-v}; + n[25] = new double[] {-w,u,v}; + n[26] = new double[] {w,-u,-v}; + n[27] = new double[] {-w,u,-v}; + n[28] = new double[] {-w,-u,v}; + n[29] = new double[] {-w,-u,-v}; + break; + } + + Default: + break; + } + } + } +} diff --git a/qtsharp/src/examples/samples/samples.build b/qtsharp/src/examples/samples/samples.build new file mode 100644 index 00000000..08a314ab --- /dev/null +++ b/qtsharp/src/examples/samples/samples.build @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qtsharp/src/examples/samples/scribblewindow.cs b/qtsharp/src/examples/samples/scribblewindow.cs new file mode 100644 index 00000000..6b594eb8 --- /dev/null +++ b/qtsharp/src/examples/samples/scribblewindow.cs @@ -0,0 +1,212 @@ +// scribblewindow.cs - Qt# scribblewindow +// +// Author: Adam Treat +// (c) 2002 Adam Treat +// Licensed under the terms of the GNU GPL + +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; + public ScribbleArea scribblearea; + + enum Color {Black, Red, Blue, Green, Yellow}; + + public static int Main (String[] args) + { + QApplication app = new QApplication (args); + ScribbleWindow demo = new ScribbleWindow (); + demo.SetGeometry (50, 500, 400, 400); + app.SetMainWidget (demo); + demo.SetCaption ("Qt# 0.7!"); + demo.Show (); + return app.Exec (); + } + + ScribbleWindow () : base (null, null) + { + filemenu = new QPopupMenu (null, "filemenu"); + filemenu.InsertItem ("&Load", this, SLOT ("SlotLoad()") ); + filemenu.InsertItem ("&Save", this, SLOT ("SlotSave()") ); + filemenu.InsertSeparator (); + filemenu.InsertItem ("&Quit", qApp, SLOT ("quit()")); + + aboutmenu = new QPopupMenu (null, "helpmenu"); + aboutmenu.InsertItem ("&About Qt-Sharp", this, SLOT ("SlotAboutQtSharp()")); + aboutmenu.InsertItem ("&About Qt", this, SLOT ("SlotAboutQt()")); + + menubar = new QMenuBar (this, ""); + menubar.InsertItem ("&File", filemenu); + menubar.InsertItem ("&Color", this, SLOT("SlotColorChooser()")); + menubar.InsertItem ("&About", aboutmenu); + + scrollview = new QScrollView (this); + scrollview.SetGeometry (0, menubar.Height (), Width (), Height () - menubar.Height ()); + scribblearea = new ScribbleArea (this); + scribblearea.SetGeometry (0, 0, 1000, 1000); + scrollview.AddChild (scribblearea); + 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)") ); + } + + public void SlotLoad () + { + string filename = QFileDialog.GetOpenFileName (".", "*.bmp", this, + null, "Load File", QString.Null, true); + + if ( filename != null ) + Emit ("load(QString)", (QString) filename); + } + + public void SlotSave () + { + string filename = QFileDialog.GetSaveFileName (".", "*.bmp", this, + null, "Save File", QString.Null, true); + + if ( filename != null ) + { + if ( ! filename.ToLower().EndsWith(".bmp") ) + filename += ".bmp"; + Emit ("save(QString)", (QString) filename); + } + } + + public void SlotAboutQtSharp () + { + QMessageBox.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" + + "(c) 2002 Adam Treat. Licensed under the terms of the GNU GPL.\n" + ); + } + + public void SlotAboutQt () + { + QMessageBox.AboutQt (this, "About Qt"); + } + + public void SlotColorChooser () + { + QColor chosenColor = QColorDialog.GetColor(); + if (chosenColor.IsValid()) + Emit ("colorChanged(QColor)", chosenColor); + } + + public class ScribbleArea : QFrame { + private QPoint last; + private QPixmap buffer; + private QColor currentcolor = new QColor("Black"); + private QPopupMenu popupmenu; + + public ScribbleArea (QWidget parent) : base (parent) + { + buffer = new QPixmap (); + last = new QPoint (); + SetBackgroundMode (Qt.BackgroundMode.NoBackground); + + popupmenu = new QPopupMenu(); + popupmenu.InsertItem ("&Clear", this, SLOT ("SlotClearArea()") ); + + mouseMoveEvent += new MouseMoveEvent (MouseMoved); + mousePressEvent += new MousePressEvent (MousePressed); + paintEvent += new PaintEvent (PerformPaint); + resizeEvent += new ResizeEvent (PerformResize); + } + + public void PerformLoad (QString filename) + { + if ( ! buffer.Load(filename) ) + QMessageBox.Warning (null, "Load error", "Could not load file"); + Repaint(); + } + + public void PerformSave (QString filename) + { + if ( ! buffer.Save (filename, "BMP") ) + QMessageBox.Warning( null, "Save error", "Could not save file"); + } + + public void SlotClearArea () + { + buffer.Fill( new QColor ("white") ); + BitBlt (this, 0, 0, buffer, 0, 0, -1, -1, Qt.RasterOp.CopyROP, false); + } + + + public void SlotSetColor (QColor 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 + // 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) + { + if (e.Button() == ButtonState.RightButton ) + popupmenu.Exec (QCursor.Pos ()); + else { + last.Dispose (); + last = e.Pos(); + } + } + + protected void MouseMoved (QMouseEvent e) + { + QPainter windowPainter = new QPainter (); + QPainter bufferPainter = new QPainter (); + + windowPainter.Begin (this); + bufferPainter.Begin (buffer); + + windowPainter.SetPen (currentcolor); + bufferPainter.SetPen (currentcolor); + + windowPainter.DrawLine (last, e.Pos()); + bufferPainter.DrawLine (last, e.Pos()); + + windowPainter.End (); + bufferPainter.End (); + + last.Dispose (); + last = e.Pos (); + } + + protected void PerformPaint (QPaintEvent e) + { + BitBlt(this, 0, 0, buffer, + 0, 0, -1, -1, RasterOp.CopyROP, false); + } + + protected void PerformResize (QResizeEvent e) + { + QPixmap save = new QPixmap (buffer); + buffer.Resize (e.Size()); + buffer.Fill (new QColor("white")); + BitBlt (buffer, 0, 0, save, + 0, 0, -1, -1, RasterOp.CopyROP, false); + } + } + } +} diff --git a/qtsharp/src/examples/test-results.html b/qtsharp/src/examples/test-results.html new file mode 100644 index 00000000..43ddae93 --- /dev/null +++ b/qtsharp/src/examples/test-results.html @@ -0,0 +1,203 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
2003-02-09
Mono 0.19
Ilrun 0.5.2








T3IlrunMono
MandelbrotIlrunMono
Csc


CscPassFail (4)
CsccPassPass
CsccPassFail (4)
McsPassPass
McsPassFail (2)







T5IlrunMono
QuantumfractalsIlrunMono
Csc


CscFail (1)Pass
CsccPassPass
CsccFail (1)Pass
McsPassPass
McsFail (1)Pass







T7IlrunMono
ScribblewindowIlrunMono
Csc


CscFail (3)Pass
CsccPassPass
CsccFail (3)Pass
McsPassPass
McsFail (3)Pass














(1) No crashes, but no drawing
(2) Closing window results in a double QObject deletion and then application locks up
(3) Random lockups occur after a large amount of scribbling is performed; background fails to initialized properly sometimes
(4) Closing window results in application locking up (unlike (2) there is no double deletion message)
+ + + + diff --git a/qtsharp/src/examples/test-results.sxc b/qtsharp/src/examples/test-results.sxc new file mode 100644 index 00000000..6caab7e0 Binary files /dev/null and b/qtsharp/src/examples/test-results.sxc differ diff --git a/qtsharp/src/examples/tutorials/Makefile.am b/qtsharp/src/examples/tutorials/Makefile.am new file mode 100644 index 00000000..52d1adce --- /dev/null +++ b/qtsharp/src/examples/tutorials/Makefile.am @@ -0,0 +1,24 @@ +all: + csant -D$(CSC_NAME)=$(CSC) -C $(CSC_NAME) + chmod 0755 *.exe + +clean: + rm -rf *.exe + +distclean: clean + +install: + mkdir -p $(DESTDIR)$(datadir)/doc/qtcsharp/tutorials + cat t1.cs | gzip -9c > $(DESTDIR)$(datadir)/doc/qtcsharp/tutorials/t1.cs.gz + cat t2.cs | gzip -9c > $(DESTDIR)$(datadir)/doc/qtcsharp/tutorials/t2.cs.gz + cat t3.cs | gzip -9c > $(DESTDIR)$(datadir)/doc/qtcsharp/tutorials/t3.cs.gz + cat t4.cs | gzip -9c > $(DESTDIR)$(datadir)/doc/qtcsharp/tutorials/t4.cs.gz + cat t5.cs | gzip -9c > $(DESTDIR)$(datadir)/doc/qtcsharp/tutorials/t5.cs.gz + cat t6.cs | gzip -9c > $(DESTDIR)$(datadir)/doc/qtcsharp/tutorials/t6.cs.gz + cat t7.cs | gzip -9c > $(DESTDIR)$(datadir)/doc/qtcsharp/tutorials/t7.cs.gz + +uninstall: + rm -rf $(datadir)/doc/qtcsharp/tutorials/*.cs.gz + rm -rf $(datadir)/doc/qtcsharp/tutorials/*.cs + +.PHONY: all clean distclean install diff --git a/qtsharp/src/examples/tutorials/README b/qtsharp/src/examples/tutorials/README new file mode 100644 index 00000000..21e302ea --- /dev/null +++ b/qtsharp/src/examples/tutorials/README @@ -0,0 +1,14 @@ +These tutorials are translations of the C++ versions provided with +Qt 3.0.x. Tutorial 7 is included, but it does not yet work properly +because it is not yet possible to create custom signals. + +Assuming that you're using Mono and that Qt.dll has been +installed in /opt/kde/lib you can compile the first tutorial +using + +> mcs -L /opt/kde/lib -r Qt t1.cs + +To run the first tutorial, use + +> mono t1.exe + diff --git a/qtsharp/src/examples/tutorials/t1.cs b/qtsharp/src/examples/tutorials/t1.cs new file mode 100644 index 00000000..3dc075b1 --- /dev/null +++ b/qtsharp/src/examples/tutorials/t1.cs @@ -0,0 +1,23 @@ +// Qt# tutorial 1 +// Based on the Qt tutorial +// Implemented by Marcus Urban + +using System; +using Qt; + +public class Example { + + public static int Main (String[] args) + { + QApplication a = new QApplication (args); + + QPushButton hello = new QPushButton ("Hello world!", null); + // In C++, the second parameter is 0 (null pointer) + + hello.Resize (100, 30); + + a.SetMainWidget (hello); + hello.Show (); + return a.Exec (); + } +} diff --git a/qtsharp/src/examples/tutorials/t2.cs b/qtsharp/src/examples/tutorials/t2.cs new file mode 100644 index 00000000..44eb304b --- /dev/null +++ b/qtsharp/src/examples/tutorials/t2.cs @@ -0,0 +1,28 @@ +// Qt# tutorial 2 +// Based on the Qt tutorial +// Implemented by Marcus Urban + +using System; +using Qt; + +public class Example { + + public static int Main (String[] args) + { + QApplication a = new QApplication (args); + + QPushButton quit = new QPushButton ("Quit", null); + // In C++, the second parameter is 0 (null pointer) + + quit.Resize (75, 30); + quit.SetFont (new QFont ("Times", 18, QFont.Weight.Bold)); + // In C++, QFont::Bold is sufficient + + QObject.Connect ( quit, QtSupport.SIGNAL ("clicked()"), a, QtSupport.SLOT ("Quit()") ); + // SIGNAL and SLOT are static functions of QtSupport + + a.SetMainWidget (quit); + quit.Show (); + return a.Exec (); + } +} diff --git a/qtsharp/src/examples/tutorials/t3.cs b/qtsharp/src/examples/tutorials/t3.cs new file mode 100644 index 00000000..a1c76ce4 --- /dev/null +++ b/qtsharp/src/examples/tutorials/t3.cs @@ -0,0 +1,29 @@ +// Qt# tutorial 3 +// Based on the Qt tutorial +// Implemented by Marcus Urban + +using System; +using Qt; + + +public class Example { + + public static int Main (String[] args) + { + QApplication a = new QApplication (args); + + QVBox box = new QVBox (); + box.Resize (200, 120); + + QPushButton quit = new QPushButton ("Quit", box); + quit.SetFont (new QFont ("Times", 18, QFont.Weight.Bold)); + // In C++, QFont::Bold is sufficient + + QObject.Connect ( quit, QtSupport.SIGNAL ("clicked()"), a, QtSupport.SLOT ("Quit()") ); + // SIGNAL and SLOT are static functions of QtSupport + + a.SetMainWidget (box); + box.Show (); + return a.Exec (); + } +} diff --git a/qtsharp/src/examples/tutorials/t4.cs b/qtsharp/src/examples/tutorials/t4.cs new file mode 100644 index 00000000..5373af19 --- /dev/null +++ b/qtsharp/src/examples/tutorials/t4.cs @@ -0,0 +1,44 @@ +// Qt# tutorial 4 +// Based on the Qt tutorial +// Implemented by Marcus Urban + +using System; +using Qt; + +public class MyWidget : QWidget { + + public MyWidget (QWidget parent, String name) : base (parent, name) + // In C++, parent and name have default values of 0 (null pointer) + { + this.SetMinimumSize (200, 120); + this.SetMaximumSize (200, 120); + + QPushButton quit = new QPushButton ("Quit", this, "quit"); + quit.SetGeometry (62, 40, 75, 30); + quit.SetFont (new QFont ("Times", 18, QFont.Weight.Bold) ); + + Connect ( quit, SIGNAL ("clicked()"), qApp, SLOT ("Quit()") ); + // In C++, qApp is a global variable. Here it's a property of the QObject + // class, which we inherit, giving the same effect. We also inherit the + // static method connect(). + } + + public MyWidget (QWidget parent) : this (parent, "") {} + public MyWidget () : this (null, "") {} + // Note that it was necessary to use an empty string ("") + // in the above. Using null does not work at runtime. +} + +public class Example { + + public static int Main (String[] args) + { + QApplication a = new QApplication (args); + + MyWidget w = new MyWidget (); + w.SetGeometry (100, 100, 200, 120); + a.SetMainWidget (w); + w.Show (); + return a.Exec (); + } +} diff --git a/qtsharp/src/examples/tutorials/t5.cs b/qtsharp/src/examples/tutorials/t5.cs new file mode 100644 index 00000000..4feadae5 --- /dev/null +++ b/qtsharp/src/examples/tutorials/t5.cs @@ -0,0 +1,45 @@ +// Qt# tutorial 5 +// Based on the Qt tutorial +// Implemented by Marcus Urban + +using System; +using Qt; + +public class MyWidget : QVBox { + + public MyWidget (QWidget parent, String name) : base (parent, name) + // In C++, parent and name have default values of 0 (null pointer) + { + QPushButton quit = new QPushButton ("Quit", this, "quit"); + quit.SetFont ( new QFont ("Times", 18, QFont.Weight.Bold) ); + + QObject.Connect ( quit, SIGNAL ("clicked()"), qApp, SLOT ("Quit()") ); + + QLCDNumber lcd = new QLCDNumber (2, this, "lcd" ); + + QSlider slider = new QSlider (Orientation.Horizontal, this, "slider"); + // Note that Orientation is defined in the Qt class + slider.SetRange (0, 99); + slider.SetValue (0); + + Connect ( slider, SIGNAL ("valueChanged(int)"), lcd, SLOT ("Display(int)") ); + } + + public MyWidget (QWidget parent) : this (parent, "") {} + public MyWidget () : this (null, "") {} + // Note that it was necessary to use an empty string ("") + // in the above. Using null does not work at runtime. +} + +public class Example { + + public static int Main (String[] args) + { + QApplication a = new QApplication (args); + + MyWidget w = new MyWidget (); + a.SetMainWidget (w); + w.Show (); + return a.Exec (); + } +} diff --git a/qtsharp/src/examples/tutorials/t6.cs b/qtsharp/src/examples/tutorials/t6.cs new file mode 100644 index 00000000..223e0ff1 --- /dev/null +++ b/qtsharp/src/examples/tutorials/t6.cs @@ -0,0 +1,58 @@ +// Qt# tutorial 6 +// Based on the Qt tutorial +// Implemented by Marcus Urban + +using System; +using Qt; + +public class LCDRange : QVBox { + + public LCDRange (QWidget parent, String name) : base (parent, name) + // In C++, parent and name have default values of 0 (null pointer) + { + QLCDNumber lcd = new QLCDNumber (2, this, "lcd" ); + QSlider slider = new QSlider (Orientation.Horizontal, this, "slider"); + slider.SetRange (0, 99); + slider.SetValue (0); + + Connect ( slider, SIGNAL ("valueChanged(int)"), lcd, SLOT ("Display(int)") ); + } + + public LCDRange (QWidget parent) : this (parent, "") {} + public LCDRange () : this (null, "") {} + // Note that it was necessary to use an empty string ("") + // in the above. Using null does not work at runtime. +} + +public class MyWidget : QVBox { + + MyWidget (QWidget parent, String name) : base (parent, name) + { + QPushButton quit = new QPushButton ("Quit", this, "quit"); + quit.SetFont ( new QFont ("Times", 18, QFont.Weight.Bold) ); + + Connect ( quit, SIGNAL ("clicked()"), qApp, SLOT ("Quit()") ); + + QGrid grid = new QGrid (4, this); + + for ( int c =0; c < 4; c++ ) + for ( int r = 0; r < 4; r++ ) + new LCDRange (grid); + } + + public MyWidget (QWidget parent) : this (parent, "") {} + public MyWidget () : this (null, "") {} +} + +public class Example { + + public static int Main (String[] args) + { + QApplication a = new QApplication (args); + + MyWidget w = new MyWidget (); + a.SetMainWidget (w); + w.Show (); + return a.Exec (); + } +} diff --git a/qtsharp/src/examples/tutorials/t7.cs b/qtsharp/src/examples/tutorials/t7.cs new file mode 100644 index 00000000..de9011f2 --- /dev/null +++ b/qtsharp/src/examples/tutorials/t7.cs @@ -0,0 +1,78 @@ +// Qt# tutorial 7 +// Based on the Qt tutorial +// Implemented by Marcus Urban +// +// This example currently does not funtion properly because custom +// signals are not yet implemented. + +using System; +using Qt; + +[DeclareQtSignal ("valueChanged(int)")] +public class LCDRange : QVBox { + + QSlider slider; + + public LCDRange (QWidget parent, String name) : base (parent, name) + // In C++, parent and name have default values of 0 (null pointer) + { + QLCDNumber lcd = new QLCDNumber (2, this, "lcd" ); + slider = new QSlider (Orientation.Horizontal, this, "slider"); + slider.SetRange (0, 99); + slider.SetValue (0); + + Connect ( slider, SIGNAL ("valueChanged(int)"), lcd, SLOT ("Display(int)") ); + Connect ( slider, SIGNAL ("valueChanged(int)"), SIGNAL ("valueChanged(int)")); + } + + public LCDRange (QWidget parent) : this (parent, "") {} + public LCDRange () : this (null, "") {} + // Note that it was necessary to use an empty string ("") + // in the above. Using null does not work at runtime. + + public void SetValue (int value) + { + slider.SetValue (value); + } +} + +public class MyWidget : QVBox { + + MyWidget (QWidget parent, String name) : base (parent, name) + { + QPushButton quit = new QPushButton ("Quit", this, "quit"); + quit.SetFont ( new QFont ("Times", 18, QFont.Weight.Bold) ); + + Connect ( quit, SIGNAL ("clicked()"), qApp, SLOT ("Quit()") ); + + QGrid grid = new QGrid (4, this); + + LCDRange previous = null; + + for ( int c =0; c < 4; c++ ) { + for ( int r = 0; r < 4; r++ ) { + LCDRange lr = new LCDRange (grid); + if (previous != null) + Connect (lr, SIGNAL ("valueChanged(int)"), + previous, SLOT ("SetValue(int)") ); + previous = lr; + } + } + } + + public MyWidget (QWidget parent) : this (parent, "") {} + public MyWidget () : this (null, "") {} +} + +public class Example { + + public static int Main (String[] args) + { + QApplication a = new QApplication (args); + + MyWidget w = new MyWidget (); + a.SetMainWidget (w); + w.Show (); + return a.Exec (); + } +} diff --git a/qtsharp/src/examples/tutorials/tutorials.build b/qtsharp/src/examples/tutorials/tutorials.build new file mode 100644 index 00000000..f3b211f2 --- /dev/null +++ b/qtsharp/src/examples/tutorials/tutorials.build @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/qtsharp/src/generator/Converter.cs b/qtsharp/src/generator/Converter.cs new file mode 100644 index 00000000..143aa9da --- /dev/null +++ b/qtsharp/src/generator/Converter.cs @@ -0,0 +1,464 @@ +// A Qt to C# binding generator. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +using System; +using System.Text; +using System.Collections; +using System.Collections.Specialized; +//using System.Text.RegularExpressions; + +namespace QtCSharp { + + public class Converter { + + ArrayList qtypes; + QType qtype; + QTypeMap qmap; + StringCollection sigs; + StringBuilder sig; + + public Converter (ArrayList qtypes, QType qtype, QTypeMap qmap) + { + this.qtypes = qtypes; + this.qtype = qtype; + this.qmap = qmap; + sigs = new StringCollection (); + sig = new StringBuilder (); + if (!qtype.IsConverted) + Convert (); + Ancestors (); + qtype.IsConverted = true; + } + + public QType GetQType () + { + return qtype; + } + + public void Convert () + { + foreach (QCtor qctor in qtype.QCtors) { + qctor.Name = qmap.ReservedType (qctor.Name); + if (!qctor.Overload) { + ConvertCSharpParams (qctor.CSharpParams); + ConvertPinvokeCallParams (qctor.PinvokeCallParams); + ConvertPinvokeParams (qctor.PinvokeParams); + } else { + ConvertOverloadParams (qctor.OverloadParams); + } + CheckSig (qctor); + } + foreach (QMethod qmethod in qtype.QMethods) { + if (qmethod.Name.StartsWith ("protected_")) + qmethod.Name = qmethod.Name.Replace ("protected_", ""); + qmethod.Name = qmap.ReservedType (qmethod.Name); + if (!qmethod.Overload) { + ConvertCSharpParams (qmethod.CSharpParams); + ConvertPinvokeCallParams (qmethod.PinvokeCallParams); + ConvertPinvokeParams (qmethod.PinvokeParams); + ConvertReturnType (qmethod); + } else { + ConvertOverloadParams (qmethod.OverloadParams); + ConvertReturnType (qmethod); + } + qmethod.PascalName = ToPascalCase (qmethod.Name); + CheckSig (qmethod); + } + } + + public void CheckSig (QMethod qmethod) + { + sig.Append (qmethod.PascalName); + foreach (QParam qparam in qmethod.CSharpParams) { + sig.Append (qparam.Type); + } + if (!sigs.Contains (sig.ToString ()) && !sigs.Contains ("The"+sig.ToString ())) { + sigs.Add (sig.ToString ()); + } else { + Console.WriteLine ("Throttling "+qtype.Name+" "+qmethod.PascalName); + qmethod.Throttle = true; + } + sig.Length = 0; + } + + public void CheckSig (QCtor qctor) + { + sig.Append (qctor.Name); + foreach (QParam qparam in qctor.CSharpParams) { + //if (qparam.Type == "QWidget" && qparam.Name == "parent") + if (qparam.Name == "parent") + qctor.Parent = true; + sig.Append (qparam.Type); + } + if (!sigs.Contains (sig.ToString ())) + sigs.Add (sig.ToString ()); + else { + Console.WriteLine ("Throttling "+qtype.Name+" "+qctor.Access+" "+qctor.Name); + qctor.Throttle = true; + } + sig.Length = 0; + } + + public void ConvertCSharpParams (ArrayList qparams) + { + foreach (QParam qparam in qparams) { + qparam.Type = qmap.ArrayType (qparam.Type); + qparam.Type = StripBad (qparam.Type); + qparam.Type = qmap.CSharpType (qparam.Type); + qparam.Type = ConvertQString (qparam.Type); + qparam.Name = qmap.ReservedType (qparam.Name); + } + } + + public void ConvertPinvokeCallParams (ArrayList qparams) + { + foreach (QParam qparam in qparams) { + qparam.Type = qmap.ArrayType (qparam.Type); + qparam.Type = StripBad (qparam.Type); + qparam.Type = qmap.CSharpType (qparam.Type); + qparam.Name = qmap.ReservedType (qparam.Name); + if (IsQObject (qparam.Type)) + qparam.Name = qparam.Name + ".RawObject"; + if (IsIQObject (qparam.Type)) + qparam.Name = qparam.Name + "." + StripInterface (qparam.Type) + " ()"; + /* if (IsQString (qparam.Type)) + qparam.Name = "new QString ("+StripPtr(qparam.Name)+").RawObject";*/ + qparam.Type = ""; + } + } + + public void ConvertPinvokeParams (ArrayList qparams) + { + foreach (QParam qparam in qparams) { + qparam.Type = qmap.ArrayType (qparam.Type); + qparam.Type = StripBad (qparam.Type); + qparam.Type = qmap.PinvokeType (qparam.Type); + qparam.Name = qmap.ReservedType (qparam.Name); + if (IsQObject (qparam.Type) || IsIQObject (qparam.Type)) + qparam.Type = "IntPtr"; + } + } + + public void ConvertOverloadParams (ArrayList qparams) + { + foreach (QParam qparam in qparams) { + qparam.Type = qmap.ArrayType (qparam.Type); + qparam.Type = StripBad (qparam.Type); + qparam.Type = qmap.CSharpType (qparam.Type); + OverloadedLastParam (qparam, qparams); + OverloadedNull (qparam); + OverloadedQString (qparam); + OverloadedQObject (qparam); + OverloadedNestedEnum (qparam); + OverloadedNullString (qparam); + OverloadedBool (qparam); + OverloadedEnum (qparam); + OverloadedArray (qparam); + OverloadedHex (qparam); + OverloadedDefault (qparam); + } + } + + public void OverloadedLastParam (QParam qparam, ArrayList qparams) + { + if (qparams.IndexOf (qparam) != qparams.Count - 1) + qparam.Default = null; + } + + public void OverloadedNull (QParam qparam) + { + if (qparam.Default == null) + qparam.Type = ""; + } + + public void OverloadedQString (QParam qparam) + { + if (IsQString (qparam.Type)){ + qparam.Type = "QString"; + if (qparam.Default == "QString::null") + qparam.Default = "null"; + else if (qparam.Default == "quotquot") + qparam.Default = "null"; + else + qparam.Default = "\""+qparam.Default+"\""; + } + } + + public void OverloadedQObject (QParam qparam) + { + if (IsQObject (qparam.Type)) { + qparam.Name = "new "+qparam.Type+" ()"; + qparam.Type = ""; + } + } + + public void OverloadedNestedEnum (QParam qparam) + { + foreach (QEnum qenum in qtype.QEnums) { + if (qparam.Type == qenum.Name) { + foreach (QItem qitem in qenum.QItems) { + if (qparam.Default == qitem.Name) { + qparam.Name = qparam.Type+"."+qparam.Default; + qparam.Type = ""; + } + } + } + } + } + + public void OverloadedNullString (QParam qparam) + { + if (qmap.OverloadType (qparam.Type) == "string" && qparam.Default == "0") { + qparam.Type = ""; + qparam.Name = "\"\""; + } + } + + public void OverloadedBool (QParam qparam) + { + if (qparam.Default == "TRUE") { + qparam.Type = ""; + qparam.Name = "true"; + } else if (qparam.Default == "FALSE") { + qparam.Type = ""; + qparam.Name = "false"; + } else if (qparam.Type == "bool" && qparam.Default == "1") { + qparam.Type = ""; + qparam.Name = "true"; + } else if (qparam.Type == "bool" && qparam.Default == "0") { + qparam.Type = ""; + qparam.Name = "false"; + } + } + + public void OverloadedEnum (QParam qparam) + { + if (IsEnum (qparam.Type)) { + qparam.Name = qparam.Type + "." + EnumValue (qparam.Type, qparam.Default); + qparam.Type = ""; + } + } + + public void OverloadedArray (QParam qparam) + { + if (IsArray (qparam.Type)) { + qparam.Name = "new "+qparam.Type+"{"+qparam.Default+"}"; + qparam.Type = ""; + } + } + + public void OverloadedHex (QParam qparam) + { + if (qparam.Default == "0xffffffff") + qparam.Default = "1"; + } + + public void OverloadedDefault (QParam qparam) + { + if (qparam.Type != "") { + qparam.Type = "("+qmap.OverloadType (qparam.Type)+")"; + qparam.Name = qparam.Default; + } + } + + public void ConvertReturnType (QMethod qmethod) + { + qmethod.Return = qmap.ArrayType (qmethod.Return); + qmethod.Return = qmap.PinvokeType (StripBad (qmethod.Return)); + if (IsQObject(qmethod.Return)) { + qmethod.Boxer = true; + qmethod.PinvokeReturn = "IntPtr"; + } else { + qmethod.PinvokeReturn = qmethod.Return; + } + if (qmethod.Return == "QString") { + qmethod.QStringReturn = true; + } + } + + public string StripBad (string str) + { + str = StripPointer (str); + str = StripColon (str); + return str; + } + + public string StripPointer (string str) + { + str = str.Replace ("*", ""); + str = str.Replace ("&", ""); + if (str.StartsWith ("amp")) + str = str.Replace ("amp", ""); + if (str.EndsWith ("amp")) + str = str.Replace ("amp", ""); + return str; + } + + public string ConvertQString (string str) + { + if (IsQString (str)) + return "QString"; + else + return str; + } + + public string StripColon (string str) + { + return str = str.Replace ("::", "."); + } + + public string StripPtr (string str) + { + return str = str.Replace (".RawObject", ""); + } + + public string StripInterface (string str) + { + return str = str.Replace ("I", ""); + } + + public string StripEnum (string str) + { + str = StripColon (str); + if (str.IndexOf (".") > 0) + return str.Substring (str.IndexOf (".")+1); + else + return str; + } + + public string ToPascalCase (string name) + { + string pascal = System.Char.ToUpper (name[0]).ToString ()+name.Substring (1, name.Length -1); + foreach (QEnum qenum in qtype.QEnums) { + if (pascal == qenum.Name) + pascal = "The"+pascal; + } + return pascal; + } + + public string EnumValue (string type, string value) + { + bool match = false; + string enumname = StripEnum (type); + value = StripEnum (value); + + // There _has_ to be a better way, but I'm tired... + foreach (QType qtype in qtypes) { + foreach (QEnum qenum in qtype.QEnums) { + if (enumname == qenum.Name) { + foreach (QItem qitem in qenum.QItems) { + if (value == qitem.Name) { + match = true; + } + } + if (!match) { + foreach (QItem qitem in qenum.QItems) { + value = qitem.Name; + break; + } + } + } + } + } + return value; + } + + public void Ancestors () + { + if (qtype.IsInterface || qtype.QAncestors.Count < 2) + return; + + string iname = ""; + foreach (QAncestor qancestor in qtype.QAncestors) { + iname = qmap.InterfaceType (qancestor.Name); + foreach (QType _qtype in qtypes) { + if (_qtype.Name == qancestor.Name && iname != qancestor.Name) { + if (!_qtype.IsConverted) { + Converter converter = new Converter (qtypes, _qtype, qmap); + } + qtype.AddQMethod (instPointer (qancestor.Name)); + qancestor.QMethods = _qtype.QMethods; + qancestor.IsInterface = true; + qancestor.IName = iname; + foreach (QMethod qmethod in qancestor.QMethods) { + CheckSig (qmethod); + } + } + } + } + } + + public QMethod instPointer (string name) + { + QMethod qmethod = new QMethod (); + qmethod.Name = name; + qmethod.PascalName = name; + qmethod.Access = "public"; + qmethod.PinvokeReturn = "IntPtr"; + qmethod.Return = "IntPtr"; + qmethod.Id = "0"; + return qmethod; + } + + public bool IsQString (string str) + { + if (qtype.Name == "QString") + return true; + else if (IsQObject (str) && str == "QString") + return true; + else + return false; + } + + public bool IsQObject (string str) + { + //IndexOf is a hack to search for a char ;-) + if (str.StartsWith ("Q") && str.IndexOf (".") < 0) + return true; + else + return false; + } + + public bool IsIQObject (string str) + { + //IndexOf is a hack to search for a char ;-) + if (str == "IntPtr") return false; + if (str.StartsWith ("I") && str.IndexOf (".") < 0) + return true; + else + return false; + } + + public bool IsEnum (string str) + { + //IndexOf is a hack to search for a char ;-) + if (str.IndexOf (".") > 0) + return true; + else + return false; + } + + public bool IsArray (string str) + { + if (str.EndsWith ("[]")) + return true; + else + return false; + } + } +} diff --git a/qtsharp/src/generator/Generator.cs b/qtsharp/src/generator/Generator.cs new file mode 100644 index 00000000..68b1e031 --- /dev/null +++ b/qtsharp/src/generator/Generator.cs @@ -0,0 +1,97 @@ +// A Qt to C# binding generator. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +using System; +using System.IO; + +namespace QtCSharp { + + public class Generator { + + void Usage () + { + Console.Write ( + "generator -f file.cs -d directory\n\n" + + " -f || --file file.xml The csharp source file to parse.\n\n" + + " -d || --directory Specifies the output directory.\n\n"); + } + + public static void Main (string[] args) + { + Generator gen = new Generator (args); + } + + public Generator (string[] args) + { + string xmlfile = null; + string directory = null; + + int argc = args.Length; + for (int i = 0; i < argc; i++) { + string arg = args[i]; + if (arg.StartsWith("-") || arg.StartsWith("/")) { + switch (arg) { + case "-f": case "--file": + if ((i + 1) >= argc) { + Usage(); + return; + } + xmlfile = args[++i]; + continue; + case "-d": case "--directory": + if ((i + 1) >= argc) { + Usage (); + return; + } + directory = args[++i]; + continue; + default: + Usage (); + return; + } + } + } + + if (xmlfile == null) { + Usage(); + return; + } else if (directory == null) { + Usage (); + return; + } + + if (!File.Exists (xmlfile)) { + Console.WriteLine ("\n No Xml file at {0}\n", args[0]); + return; + } + //if (!Directory.Exists( directory) && directory != null) { + + //Directory.CreateDirectory (directory); + //} + + ParseAPI parseapi = new ParseAPI (xmlfile); + QTypeMap qmap = new QTypeMap (); + Console.WriteLine ("Parsing "+parseapi.QTypes.Count+" Qt classes..."); + + foreach (QType qtype in parseapi.QTypes) { + Converter converter = new Converter (parseapi.QTypes, qtype, qmap); + Printer printer = new Printer (converter.GetQType (), directory); + } + } + } +} diff --git a/qtsharp/src/generator/Makefile.am b/qtsharp/src/generator/Makefile.am new file mode 100644 index 00000000..31532ae8 --- /dev/null +++ b/qtsharp/src/generator/Makefile.am @@ -0,0 +1,16 @@ +all: generator.exe + +generator.exe: $(wildcard *.cs) + csant -D$(CSC_NAME)=$(CSC) -C $(CSC_NAME) + chmod 755 $@ + +clean: + rm -rf generator.exe + +distclean: clean + +install: + +uninstall: + +.PHONY: all clean distclean install uninstall diff --git a/qtsharp/src/generator/ParseAPI.cs b/qtsharp/src/generator/ParseAPI.cs new file mode 100644 index 00000000..57569c7b --- /dev/null +++ b/qtsharp/src/generator/ParseAPI.cs @@ -0,0 +1,90 @@ +// A Qt to C# binding generator. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +using System; +using System.IO; +using System.Xml; +using System.Collections; + +namespace QtCSharp { + + public class ParseAPI { + + XmlTextReader xtr; + ArrayList qtypes; + + public ParseAPI (string xmlfile) + { + xtr = new XmlTextReader (xmlfile); + qtypes = new ArrayList (); + Parse (); + } + + public ArrayList QTypes + { + get {return qtypes;} + } + + public void Parse () + { + Hashtable typehash = new Hashtable(); + while(xtr.Read ()) { + if (xtr.NodeType != XmlNodeType.EndElement) { + switch(xtr.Name) { + case "qtype": + QType t = AddQType (); + typehash[t.Name] = t; + continue; + default: + continue; + } + } + } + + foreach (QType t in qtypes) { + t.IsQObject = IsQObject(t, typehash); + } + } + + public QType AddQType () + { + Parser parser = new Parser (xtr.ReadOuterXml ()); + QType type = parser.GetQType (); + qtypes.Add (type); + return type; + } + + private static bool IsQObject(QType t, Hashtable typehash) + { + if (t.IsInterface) return false; + if (t.Name == "QObject") return true; + + foreach (QAncestor a in t.QAncestors) { + QType at = (QType)typehash[a.Name]; + if (at == null) + continue; + else if (at.Name == "QObject") + return true; + else if (IsQObject(at, typehash)) + return true; + } + + return false; + } + } +} diff --git a/qtsharp/src/generator/Parser.cs b/qtsharp/src/generator/Parser.cs new file mode 100644 index 00000000..cea811d3 --- /dev/null +++ b/qtsharp/src/generator/Parser.cs @@ -0,0 +1,323 @@ +// A Qt to C# binding generator. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +using System; +using System.Collections; +using System.IO; +using System.Xml; + +namespace QtCSharp { + + public class Parser { + + XmlTextReader xtr; + QType qtype; + + public Parser (string xmlFragment) + { + qtype = new QType (); + XmlNameTable nt = new NameTable (); + XmlNamespaceManager nsMgr = new XmlNamespaceManager (nt); + XmlParserContext parserContext = new XmlParserContext (null, nsMgr, null, XmlSpace.None); + xtr = new XmlTextReader (xmlFragment, XmlNodeType.Document, parserContext); + Parse (); + OverLoad (); + NewQCtors (); + } + + public QType GetQType () + { + return qtype; + } + + public void Parse () + { + while(xtr.Read ()) { + if (xtr.NodeType != XmlNodeType.EndElement) { + switch (xtr.Name) { + case "qtype": + ParseQType (); + continue; + case "qancestor": + ParseQAncestor (); + continue; + case "qenum": + ParseQEnum (); + continue; + case "qctor": + ParseQCtor (); + continue; + case "qdctor": + ParseQDCtor (); + continue; + case "qmethod": + ParseQMethod (); + continue; + default: + continue; + } + } + } + } + + public void NewQCtors () + { + // A ctor for inherited classes + QCtor _qctor = new QCtor(); + _qctor.Name = qtype.Name; + _qctor.Access = "internal"; + _qctor.Inherited = true; + qtype.AddQCtor(_qctor); + + // A ctor for type boxing + QCtor __qctor = new QCtor(); + __qctor.Name = qtype.Name; + __qctor.Access = "internal"; + __qctor.Boxer = true; + QParam qparam = new QParam(); + qparam.Type = "IntPtr"; + qparam.Name = "_ptr"; + __qctor.AddCSharpParam(qparam); + qtype.AddQCtor(__qctor); + + // A dummy ctor + QCtor ___qctor = new QCtor(); + ___qctor.Name = qtype.Name; + ___qctor.Access = "internal"; + ___qctor.Dummy = true; + QParam ___qparam = new QParam(); + ___qparam.Type = "QNull"; + ___qparam.Name = "dummy"; + ___qctor.AddCSharpParam(___qparam); + qtype.AddQCtor(___qctor); + } + + public void OverLoad () + { + ArrayList additions = new ArrayList (); + + foreach (QCtor qctor in qtype.QCtors){ + foreach (QParam pinvokeparam in qctor.PinvokeParams) { + if (pinvokeparam.Default != null) { + QCtor _qctor = new QCtor(); + _qctor.Name = qctor.Name; + _qctor.Access = qctor.Access; + _qctor.Overload = true; + for (int j = 0; j < qctor.PinvokeParams.IndexOf(pinvokeparam)+1; j++) { + _qctor.AddPinvokeParam((QParam)qctor.PinvokeParams[j]); + _qctor.AddPinvokeCallParam((QParam)qctor.PinvokeCallParams[j]); + _qctor.AddCSharpParam((QParam)qctor.CSharpParams[j]); + _qctor.AddOverloadParam((QParam) (( QParam) qctor.CSharpParams[j]).Clone()); + } + _qctor.CSharpParams.RemoveAt(_qctor.CSharpParams.Count-1); + //qtype.AddQCtor(_qctor); + additions.Add (_qctor); + } + } + } + + foreach (QCtor ctor in additions) qtype.AddQCtor (ctor); + additions = new ArrayList (); + + foreach (QMethod qmethod in qtype.QMethods){ + foreach (QParam pinvokeparam in qmethod.PinvokeParams) { + if (pinvokeparam.Default != null) { + QMethod _qmethod = new QMethod(); + _qmethod.Name = qmethod.Name; + _qmethod.Access = qmethod.Access; + _qmethod.Return = qmethod.Return; + _qmethod.Overload = true; + for (int j = 0; j < qmethod.PinvokeParams.IndexOf(pinvokeparam)+1; j++) { + _qmethod.AddPinvokeParam((QParam)qmethod.PinvokeParams[j]); + _qmethod.AddPinvokeCallParam((QParam)qmethod.PinvokeCallParams[j]); + _qmethod.AddCSharpParam((QParam)qmethod.CSharpParams[j]); + _qmethod.AddOverloadParam((QParam) ((QParam) qmethod.CSharpParams[j]).Clone()); + + } + _qmethod.CSharpParams.RemoveAt(_qmethod.CSharpParams.Count-1); + //qtype.AddQMethod(_qmethod); + additions.Add (_qmethod); + } + } + } + + foreach (QMethod method in additions) qtype.AddQMethod (method); + } + + public void ParseQType () + { + if (xtr.MoveToAttribute("name")) { + qtype.Name = xtr.Value; + } + + if (xtr.MoveToAttribute("access")) { + qtype.Access = xtr.Value; + } + } + + public void ParseQAncestor () + { + QAncestor qancestor = new QAncestor(); + if (xtr.MoveToAttribute("name")) { + qancestor.Name = xtr.Value; + } + qtype.AddQAncestor(qancestor); + } + + public void ParseQEnum () + { + bool match = false; + QEnum qenum = new QEnum(); + if (xtr.MoveToAttribute("name")) + qenum.Name = xtr.Value; + if (xtr.MoveToAttribute("access")) + qenum.Access = xtr.Value; + while (xtr.Read()) { + if (xtr.Name == "qitem") { + QItem qitem = ParseQItem(); + qenum.AddQItem(qitem); + long parse = 0; + try { + parse = Int64.Parse(qitem.Value); + } catch { + } + if (parse >= 2147483647) + qenum.Type = "uint"; + } else if (xtr.Name == "") { + } else { + break; + } + } + qtype.AddQEnum(qenum); + } + + public void ParseQCtor () + { + bool IsEmpty = xtr.IsEmptyElement; + QCtor qctor = new QCtor(); + if (xtr.MoveToAttribute("name")) { + qctor.Name = xtr.Value; + } + if (xtr.MoveToAttribute("access")) { + qctor.Access = xtr.Value; + } + if (xtr.MoveToAttribute("id")) { + qctor.Id = xtr.Value; + } + if (!IsEmpty) { + while (xtr.Read()) { + if (xtr.Name == "qparam") { + qctor.AddPinvokeParam(ParseQParam()); + qctor.AddPinvokeCallParam(ParseQParam()); + qctor.AddCSharpParam(ParseQParam()); + } else if (xtr.Name == ""){ + } else { + break; + } + } + } + qtype.AddQCtor(qctor); + } + + public void ParseQDCtor () + { + bool IsEmpty = xtr.IsEmptyElement; + QDCtor qdctor = new QDCtor(); + if (xtr.MoveToAttribute("name")) { + qdctor.Name = xtr.Value; + } + if (xtr.MoveToAttribute("access")) { + qdctor.Access = xtr.Value; + } + if (!IsEmpty) { + while (xtr.Read()) { + if (xtr.Name == "qparam") { + qdctor.AddQParam(ParseQParam()); + } else if (xtr.Name == "") { + } else { + break; + } + } + } + qtype.AddQDCtor(qdctor); + } + + public void ParseQMethod () + { + bool IsEmpty = xtr.IsEmptyElement; + QMethod qmethod = new QMethod(); + if (xtr.MoveToAttribute("name")) { + qmethod.Name = xtr.Value; + } + if (xtr.MoveToAttribute("access")) { + qmethod.Access = xtr.Value; + } + if (xtr.MoveToAttribute("return")) { + qmethod.Return = xtr.Value; + } + if (xtr.MoveToAttribute("id")) { + qmethod.Id = xtr.Value; + } + if (xtr.MoveToAttribute("throttle")) { + if (String.Compare(xtr.Value, "true", true) == 0) { + qmethod.Throttle = true; + } + } + if (!IsEmpty) { + while (xtr.Read()) { + if (xtr.Name == "qparam") { + qmethod.AddPinvokeParam(ParseQParam()); + qmethod.AddPinvokeCallParam(ParseQParam()); + qmethod.AddCSharpParam(ParseQParam()); + } else if (xtr.Name == ""){ + } else { + break; + } + } + } + qtype.AddQMethod(qmethod); + } + + public QItem ParseQItem () + { + QItem qitem = new QItem(); + if (xtr.MoveToAttribute("name")) { + qitem.Name = xtr.Value; + } + if (xtr.MoveToAttribute("value")) { + qitem.Value = xtr.Value; + } + return qitem; + } + + public QParam ParseQParam () + { + QParam qparam = new QParam(); + if (xtr.MoveToAttribute("type")) { + qparam.Type = xtr.Value; + } + if (xtr.MoveToAttribute("name")) { + qparam.Name = xtr.Value; + } + if (xtr.MoveToAttribute("default")) { + qparam.Default = xtr.Value; + } + return qparam; + } + } +} diff --git a/qtsharp/src/generator/Printer.cs b/qtsharp/src/generator/Printer.cs new file mode 100644 index 00000000..c4f6df87 --- /dev/null +++ b/qtsharp/src/generator/Printer.cs @@ -0,0 +1,526 @@ +// A Qt to C# binding generator. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +using System; +using System.IO; +using System.Text; +using System.Collections; + +namespace QtCSharp { + + public class Printer { + + QType qtype; + string tab, directory; + + public Printer (QType qtype, string directory) + { + this.qtype = qtype; + this.directory = directory; + tab = "\t"; + if (qtype.IsInterface) + PrintInterface (); + else + Print (); + } + + public void Print () + { + StreamWriter writer = new StreamWriter(directory + Path.DirectorySeparatorChar + + qtype.Name + ".cs", false, new ASCIIEncoding()); + writer.Write(Header); + writer.Write(StartClass(qtype.Name, qtype.Access, new ArrayList(qtype.QAncestors))); + + foreach (QEnum qenum in qtype.QEnums) { + writer.Write(StartEnum(qenum.Name, qenum.Access, qenum.Type)); + writer.Write(Items(qenum.QItems)); + writer.Write(EndMember); + } + + foreach (QCtor qctor in qtype.QCtors) { + if (qctor.Throttle) { + } else if (qctor.Inherited) { + writer.Write (WriteInherited (qctor.Name, qctor.Access)); + } else if (qctor.Dummy) { + writer.Write (WriteDummy (qctor.Name, qctor.Access)); + } else if (qctor.Boxer) { + writer.Write (WriteBoxer (qctor.Name, qctor.Access)); + } else if (!qctor.Overload) { + writer.Write (ImportAttrib); + writer.Write (ImportCtorCall (qctor.Name, qctor.Id, qctor.PinvokeParams)); + writer.Write (StartCtor (qctor.Name, qctor.Access, qctor.CSharpParams)); + writer.Write (RawObject (qctor.Name, qctor.Id, qctor.PinvokeCallParams)); + writer.Write (CheckParent (qctor.Parent)); + writer.Write (Register); + writer.Write (DefaultConnections ()); + writer.Write (EndMember); + } else { + writer.Write (OverLoadCtor(qctor.Name, qctor.Access, qctor.CSharpParams, qctor.OverloadParams)); + } + } + + writer.Write (StartDCtor (qtype.Name)); + writer.Write (DCtorCall); + writer.Write (EndMember); + + //writer.Write (DisposePublic ()); + + foreach (QDCtor qdctor in qtype.QDCtors) { + writer.Write (ImportAttrib); + writer.Write (ImportDCtorCall (qdctor.Name)); + } + + //writer.Write (DisposeProtected ()); + writer.Write (Delete ()); + + foreach (QMethod qmethod in qtype.QMethods) { + if (qmethod.Throttle) { + } else if (!qmethod.Overload) { + writer.Write(ImportAttrib); + if (qmethod.Access == "public" || qmethod.Access == "protected" || qmethod.Access == "internal") { + writer.Write(ImportMethodCall(qtype.Name, qmethod.Name, qmethod.Id, qmethod.PinvokeReturn, qmethod.PinvokeParams)); + writer.Write(StartMethod(qmethod.PascalName, qmethod.Access, qmethod.Return, qmethod.CSharpParams)); + writer.Write(MethodCall(qmethod.QStringReturn, qmethod.Boxer, qtype.Name, qmethod.Name, "rawObject", qmethod.Id, qmethod.Return, qmethod.PinvokeCallParams)); + } else { + writer.Write(StaticImportMethodCall(qtype.Name, qmethod.Name, qmethod.Id, qmethod.PinvokeReturn, qmethod.PinvokeParams)); + writer.Write(StartMethod(qmethod.PascalName, qmethod.Access, qmethod.Return, qmethod.CSharpParams)); + writer.Write(StaticMethodCall(qmethod.QStringReturn, qmethod.Boxer, qtype.Name, qmethod.Name, qmethod.Id, qmethod.Return, qmethod.PinvokeCallParams)); + } + writer.Write(EndMember); + } else { + writer.Write(OverLoadMethod(qmethod.PascalName, qmethod.Access, qmethod.Return, qmethod.CSharpParams, qmethod.OverloadParams)); + } + } + + foreach (QAncestor qancestor in qtype.QAncestors) { + writer.Write("\n\n"+tab+tab+"// Begin interface methods.\n"); + if (qancestor.IsInterface) { + Printer printer = new Printer (qancestor, directory); + foreach (QMethod qmethod in qancestor.QMethods) { + if (qmethod.Throttle) { + } else if (!qmethod.Overload) { + writer.Write(ImportAttrib); + if (qmethod.Access == "public" || qmethod.Access == "protected") { + writer.Write(ImportMethodCall(qancestor.Name, qmethod.Name, qmethod.Id, qmethod.PinvokeReturn, qmethod.PinvokeParams)); + writer.Write(StartMethod(qmethod.PascalName, qmethod.Access, qmethod.Return, qmethod.CSharpParams)); + writer.Write(MethodCall(qmethod.QStringReturn, qmethod.Boxer, qancestor.Name, qmethod.Name, qancestor.Name+" ()", qmethod.Id, qmethod.Return, qmethod.PinvokeCallParams)); + } else { + writer.Write(StaticImportMethodCall(qancestor.Name, qmethod.Name, qmethod.Id, qmethod.PinvokeReturn, qmethod.PinvokeParams)); + writer.Write(StartMethod(qmethod.PascalName, qmethod.Access, qmethod.Return, qmethod.CSharpParams)); + writer.Write(StaticMethodCall(qmethod.QStringReturn, qmethod.Boxer, qancestor.Name, qmethod.Name, qmethod.Id, qmethod.Return, qmethod.PinvokeCallParams)); + } + writer.Write(EndMember); + } else { + writer.Write(OverLoadMethod(qmethod.PascalName, qmethod.Access, qmethod.Return, qmethod.CSharpParams, qmethod.OverloadParams)); + } + } + } + } + + writer.Write(EndClass); + writer.Write(Footer); + writer.Close(); + } + + public void PrintInterface () + { + StreamWriter writer = new StreamWriter(directory + Path.DirectorySeparatorChar + + qtype.IName + ".cs", false, new ASCIIEncoding()); + writer.Write(Header); + writer.Write(StartClass(qtype.IName, "public", qtype.QAncestors)); + + foreach (QMethod qmethod in qtype.QMethods) { + if (qmethod.Throttle || qmethod.Access == "public static" || qmethod.Access == "protected") { + } else { + writer.Write(IMethod(qmethod.PascalName, qmethod.Return, qmethod.CSharpParams)); + } + } + writer.Write("\n"+tab+tab+" IntPtr "+qtype.Name+" ();"); + writer.Write(EndClass); + writer.Write(Footer); + writer.Close(); + } + + public string StartClass (string name, string access, ArrayList qancestors) + { + StringBuilder sb = new StringBuilder (); + + if (qtype.IsInterface) { + sb.Append(tab+access+" interface "+name+" {"); + return sb.ToString (); + } + + sb.Append(tab+access+" class "+name+" : "); + if (qancestors.Count == 0) sb.Append ("QtSupport"); + foreach (QAncestor qancestor in qancestors) { + if (!qancestor.IsInterface) { + if (qancestor.Name == "Qt") { + sb.Append ("QtSupport"); + break; + } else { + sb.Append (qancestor.Name); + qancestors.Remove (qancestor); + break; + } + } + } + + foreach (QAncestor qancestor in qancestors) { + if (qancestor.IsInterface) { + sb.Append (", "+qancestor.IName); + } + } + + sb.Append (", IDisposable {"); + return sb.ToString (); + } + + public string EndClass + { + get {return "\n"+tab+"}";} + } + + public string StartEnum (string name, string access, string type) + { + if (type != null) + return "\n\n"+tab+tab+access+" enum "+name+" : "+type+" {"; + else + return "\n\n"+tab+tab+access+" enum "+name+" {"; + } + + public string WriteInherited (string name, string access) + { + return "\n\n"+tab+tab+access+" "+name+" () : this (QNull.Instance) {}"; + } + + public string WriteDummy (string name, string access) + { + return "\n\n"+tab+tab+access+" "+name+" (QNull dummy) : base (QNull.Instance) {}"; + } + + public string WriteBoxer (string name, string access) + { + return "\n\n" + + tab+tab+access+" "+name+" (IntPtr ptr) : this (QNull.Instance)\n"+tab+tab+"{\n" + + tab+tab+tab+"rawObject = ptr;\n" + + tab+tab+tab+"RegisterObject(this);\n" + + tab+tab+"}"; + } + + public string CheckParent (bool check) + { + if (check) + return "\n\n\t\t\tif ((qparent = parent) != null)\n" + + "\t\t\t\tqparent.AddChild (this);\n"; + else + return ""; + } + + public string StartCtor (string name, string access, ArrayList csharpparams) + { + return "\n"+tab+tab+access+" "+name+" ("+Params(csharpparams)+") : this (QNull.Instance)\n"+tab+tab+"{\n"; + } + + public string StartDCtor (string name) + { + return "\n\n"+tab+tab+"~"+name+" ()\n"+tab+tab+"{\n"; + } + + public string StartMethod (string name, string access, string returntype, ArrayList csharpparams) + { + string str = "\n"+tab+tab+access+" "+returntype+" "+name+" ("+Params(csharpparams)+")\n"+tab+tab+"{\n"; + + // QEvents should never be disposed inside C# + if (access.IndexOf ("static") <= 0) + str += "\t\t\tif (disposed)\n\t\t\t\tthrow new ObjectDisposedException (this+\": Attempted use of disposed object\");\n\n"; + + return str; + } + + public string IMethod (string name, string returntype, ArrayList csharpparams) + { + return "\n"+tab+tab+" "+returntype+" "+name+" ("+Params(csharpparams)+");"; + } + + public string EndMember + { + get {return "\n"+tab+tab+"}";} + } + + public string OverLoadCtor (string name, string access, ArrayList csharpparams, ArrayList overloadparams) + { + return "\n\n"+tab+tab+access+" "+name+" ("+Params(csharpparams)+") : this ("+Params(overloadparams)+") {}"; + } + + public string OverLoadMethod (string name, string access, string returntype, ArrayList csharpparams, ArrayList overloadparams) + { + string str; + + if (returntype == "void") + str = name + "(" + Params(overloadparams) + ");\n" + tab + tab; + else + str = "return "+name+"("+Params(overloadparams)+");\n" + tab+tab; + + return "\n\n"+tab+tab+access+" "+returntype+" "+name + + " ("+Params(csharpparams)+")\n" + tab+tab+"{\n" + tab+tab+tab+ str + "}"; + } + + public string Items (ArrayList qitems) + { + int count = 0; + StringBuilder sb = new StringBuilder(); + foreach (QItem qitem in qitems) { + count++; + sb.Append("\n"+tab+tab+tab+qitem.Name+" = "+qitem.Value); + if (count != qitems.Count) + sb.Append(","); + } + return sb.ToString(); + } + + public string Params (ArrayList qparams) + { + int count = 0; + StringBuilder sb = new StringBuilder(); + foreach (QParam qparam in qparams) { + count++; + if (qparam.Type != "") + sb.Append(qparam.Type+" "+qparam.Name); + else + sb.Append(qparam.Name); + + if (count != qparams.Count) + sb.Append(", "); + } + return sb.ToString(); + } + + public string ImportCtorCall (string name, string id, ArrayList qparams) + { + if (id != "0") + return "\n"+tab+tab+"private static extern IntPtr qt_new_"+name+id+" ("+Params(qparams)+");"; + else + return "\n"+tab+tab+"private static extern IntPtr qt_new_"+name+" ("+Params(qparams)+");"; + } + + public string ImportDCtorCall (string name) + { + return "\n"+tab+tab+"private static extern void qt_del_"+name+" (IntPtr raw);"; + } + + public string ImportMethodCall (string type, string name, string id, string returntype, ArrayList qparams) + { + if (name.StartsWith ("Q_")) + name = name.Replace ("Q_", ""); + string comma = ""; + if (qparams.Count != 0) comma = ", "; + if (id != "0") + return "\n"+tab+tab+"private static extern "+returntype+" qt_"+type+"_"+name+id+" (IntPtr raw"+comma+Params(qparams)+");"; + else + return "\n"+tab+tab+"private static extern "+returntype+" qt_"+type+"_"+name+" (IntPtr raw"+comma+Params(qparams)+");"; + } + + public string StaticImportMethodCall (string type, string name, string id, string returntype, ArrayList qparams) + { + if (name.StartsWith ("Q_")) + name = name.Replace ("Q_", ""); + if (id != "0") + return "\n"+tab+tab+"private static extern "+returntype+" qt_"+type+"_"+name+id+" ("+Params(qparams)+");"; + else + return "\n"+tab+tab+"private static extern "+returntype+" qt_"+type+"_"+name+" ("+Params(qparams)+");"; + } + + public string RawObject (string name, string id, ArrayList qparams) + { + if (qtype.IsQObject) { + ArrayList newparams = new ArrayList (); + + foreach (QParam parm in qparams) { + //Console.WriteLine ("--> {0}", parm.Name); + if (parm.Name == "parent.RawObject") { + QParam newparm = parm.Clone() as QParam; + newparm.Name = "parent != null ? parent.RawObject : IntPtr.Zero"; + newparams.Add (newparm); + } + else + newparams.Add (parm); + } + + if (id != "0") + return tab+tab+tab+"rawObject = qt_new_"+name+id+" ("+Params(newparams)+");"; + else + return tab+tab+tab+"rawObject = qt_new_"+name+" ("+Params(newparams)+");"; + } + else { + if (id != "0") + return tab+tab+tab+"rawObject = qt_new_"+name+id+" ("+Params(qparams)+");"; + else + return tab+tab+tab+"rawObject = qt_new_"+name+" ("+Params(qparams)+");"; + } + } + + public string DCtorCall { + get { + return tab+tab+tab+"Dispose (false);"; + } + } + + public string MethodCall (bool qstring, bool boxer, string type, string name, string instPtr, string id, string ReturnType, ArrayList qparams) + { + if (name.StartsWith ("Q_")) + name = name.Replace ("Q_", ""); + + string ret = ""; + string comma = qparams.Count == 0 ? "" : ", "; + string newid = id == "0" ? "" : id; + + if (boxer && qstring) { + ret = "\t\t\treturn new QString (qt_"+type+"_"+name+newid+" ("+instPtr+comma+Params (qparams)+"));\n"; + } + else if (boxer) { + ret = "\t\t\treturn LookupObject (qt_"+type+"_"+name+newid+" ("+instPtr+comma+Params (qparams)+"), typeof ("+ReturnType+")) as "+ReturnType+";"; + } + else { + ret = "qt_"+type+"_"+name+newid+" ("+instPtr+comma+Params (qparams)+");"; + + if (ReturnType != "void") + ret = "return " + ret; + + ret = "\t\t\t" + ret; + } + + return ret; + } + + public string StaticMethodCall (bool qstring, bool boxer, string type, string name, string id, string ReturnType, ArrayList qparams) + { + if (name.StartsWith ("Q_")) + name = name.Replace ("Q_", ""); + + string ret; + string newid = id == "0" ? "" : id; + + if (boxer && qstring) { + ret = "\t\t\treturn new QString (qt_"+type+"_"+name+newid+" ("+Params (qparams)+"));\n"; + } + else if (boxer) { + ret = "\t\t\treturn LookupObject (qt_"+type+"_"+name+newid+" ("+Params (qparams)+"), typeof ("+ReturnType+")) as "+ReturnType+";\n"; + } + else { + ret = "qt_"+type+"_"+name+newid+" ("+Params (qparams)+");"; + + if (ReturnType != "void") + ret = "return " + ret; + + ret = "\t\t\t" + ret; + } + + return ret; + } + + public string ImportAttrib + { + get {return "\n\n"+tab+tab+"[DllImport(\"libqtc\", CharSet=CharSet.Ansi)]";} + } + + public string Import () { + if (!qtype.IsInterface) { + return tab + "using System.Runtime.InteropServices;\n\n"; + } else { + return "\n"; + } + } + + public string Header + { + get { + return "// "+qtype.Name+".cs - A Qt to C# binding.\n" + + "//\n" + + "// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com)\n" + + "//\n" + + "// This program is free software; you can redistribute it and/or\n" + + "// modify it under the terms of the GNU General Public License\n" + + "// as published by the Free Software Foundation; either version 2\n" + + "// of the License, or (at your option) any later version.\n" + + "//\n" + + "// This program is distributed in the hope that it will be useful,\n" + + "// but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + + "// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + + "// GNU General Public License for more details.\n" + + "//\n" + + "// You should have received a copy of the GNU General Public License\n" + + "// along with this program; if not, write to the Free Software\n" + + "// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n" + + "//\n" + + "// Generated File. Do Not Modify.\n" + + "\n" + + "namespace Qt {\n" + + "\n" + + tab + "using Qt;\n" + + tab + "using System;\n" + Import (); + } + } + + public string Footer + { + get {return "\n}";} + } + + public string Register + { + get + { + return "\n"+tab+tab+tab+"RegisterObject (this);"; + } + } + + public string Delete () + { + + string ret = "\n" + + "\t\tinternal override void Delete ()\n" + + "\t\t{\n"; + + // Let Qt manage QEvents + if (! (qtype.Name.StartsWith ("Q") && qtype.Name.EndsWith ("Event"))) + { + ret += "\t\t\tif (deleted) return;\n\n"; + + if (qtype.QDCtors.Count > 0) + ret += "\t\t\tqt_del_"+qtype.Name+" (rawObject);\n"; + else + ret = "\n" + ret + "\t\t\t// libqtc lacks a qt_del_"+qtype.Name+" function\n"; + + ret += "\t\t\tdeleted = true;\n"; + } + + ret += "\t\t}"; + + return ret; + + } + + public string DefaultConnections () + { + if (qtype.IsQObject) + return "\n\t\t\tConnect (this, SIGNAL (\"destroyed ()\"), SLOT (\"NativeDestroyed ()\"));"; + else + return ""; + } + } +} diff --git a/qtsharp/src/generator/QAncestor.cs b/qtsharp/src/generator/QAncestor.cs new file mode 100644 index 00000000..5467a902 --- /dev/null +++ b/qtsharp/src/generator/QAncestor.cs @@ -0,0 +1,26 @@ +// A Qt to C# binding generator. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +using System; + +namespace QtCSharp { + + public class QAncestor : QType { + + } +} diff --git a/qtsharp/src/generator/QCtor.cs b/qtsharp/src/generator/QCtor.cs new file mode 100644 index 00000000..880bf13b --- /dev/null +++ b/qtsharp/src/generator/QCtor.cs @@ -0,0 +1,47 @@ +// A Qt to C# binding generator. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +using System; +//using System.IO; +using System.Collections; + +namespace QtCSharp { + + public class QCtor : QMember{ + + bool dummy, parent, inherited; + + public bool Dummy + { + get {return dummy;} + set {dummy = value;} + } + + public bool Parent + { + get {return parent;} + set {parent = value;} + } + + public bool Inherited + { + get {return inherited;} + set {inherited = value;} + } + } +} diff --git a/qtsharp/src/generator/QDCtor.cs b/qtsharp/src/generator/QDCtor.cs new file mode 100644 index 00000000..8aef33c0 --- /dev/null +++ b/qtsharp/src/generator/QDCtor.cs @@ -0,0 +1,57 @@ +// A Qt to C# binding generator. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +using System; +//using System.IO; +using System.Collections; + +namespace QtCSharp { + + public class QDCtor { + + string name, access; + ArrayList qparams; + + public QDCtor() + { + qparams = new ArrayList(); + } + + public void AddQParam(QParam qparam) + { + qparams.Add(qparam); + } + + public string Name + { + get {return name;} + set {name = value;} + } + + public string Access + { + get {return access;} + set {access = value;} + } + + public ArrayList QParams + { + get {return qparams;} + } + } +} diff --git a/qtsharp/src/generator/QEnum.cs b/qtsharp/src/generator/QEnum.cs new file mode 100644 index 00000000..1be81b41 --- /dev/null +++ b/qtsharp/src/generator/QEnum.cs @@ -0,0 +1,63 @@ +// A Qt to C# binding generator. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +using System; +//using System.IO; +using System.Collections; + +namespace QtCSharp { + + public class QEnum { + + string name, access, type; + ArrayList qitems; + + public QEnum() + { + qitems = new ArrayList(); + } + + public void AddQItem(QItem qitem) + { + qitems.Add(qitem); + } + + public string Name + { + get {return name;} + set {name = value;} + } + + public string Access + { + get {return access;} + set {access = value;} + } + + public string Type + { + get {return type;} + set {type = value;} + } + + public ArrayList QItems + { + get {return qitems;} + } + } +} diff --git a/qtsharp/src/generator/QItem.cs b/qtsharp/src/generator/QItem.cs new file mode 100644 index 00000000..22e23c63 --- /dev/null +++ b/qtsharp/src/generator/QItem.cs @@ -0,0 +1,44 @@ +// A Qt to C# binding generator. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +using System; +//using System.IO; + +namespace QtCSharp { + + public class QItem { + + string name, qvalue; + + public QItem() + { + } + + public string Name + { + get {return name;} + set {name = value;} + } + + public string Value + { + get {return qvalue;} + set {qvalue = value;} + } + } +} diff --git a/qtsharp/src/generator/QMember.cs b/qtsharp/src/generator/QMember.cs new file mode 100644 index 00000000..95c00280 --- /dev/null +++ b/qtsharp/src/generator/QMember.cs @@ -0,0 +1,116 @@ +// A Qt to C# binding generator. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +using System; +using System.IO; +using System.Collections; + +namespace QtCSharp { + + public class QMember { + + string name, access, id; + bool overload, throttle, boxer; + ArrayList pinvokeparams, pinvokecallparams, csharpparams, overloadparams; + + public QMember() + { + pinvokeparams = new ArrayList(); + pinvokecallparams = new ArrayList(); + csharpparams = new ArrayList(); + overloadparams = new ArrayList(); + } + + + public void AddPinvokeParam(QParam pinvokeparam) + { + pinvokeparams.Add(pinvokeparam); + } + + public void AddPinvokeCallParam(QParam pinvokecallparam) + { + pinvokecallparams.Add(pinvokecallparam); + } + + public void AddCSharpParam(QParam csharpparam) + { + csharpparams.Add(csharpparam); + } + + public void AddOverloadParam(QParam overloadparam) + { + overloadparams.Add(overloadparam); + } + + public string Name + { + get {return name;} + set {name = value;} + } + + public string Access + { + get {return access;} + set {access = value;} + } + + public bool Overload + { + get {return overload;} + set {overload = value;} + } + + public string Id + { + get {return id;} + set {id = value;} + } + + public bool Throttle + { + get {return throttle;} + set {throttle = value;} + } + + public bool Boxer + { + get {return boxer;} + set {boxer = value;} + } + + public ArrayList PinvokeParams + { + get {return pinvokeparams;} + } + + public ArrayList PinvokeCallParams + { + get {return pinvokecallparams;} + } + + public ArrayList CSharpParams + { + get {return csharpparams;} + } + + public ArrayList OverloadParams + { + get {return overloadparams;} + } + } +} diff --git a/qtsharp/src/generator/QMethod.cs b/qtsharp/src/generator/QMethod.cs new file mode 100644 index 00000000..6bd6eebd --- /dev/null +++ b/qtsharp/src/generator/QMethod.cs @@ -0,0 +1,54 @@ +// A Qt to C# binding generator. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +using System; +//using System.IO; +using System.Collections; + +namespace QtCSharp { + + public class QMethod : QMember { + + bool qstringreturn; + string returntype, pinvokereturn, pascalname; + + public string Return + { + get {return returntype;} + set {returntype = value;} + } + + public string PinvokeReturn + { + get {return pinvokereturn;} + set {pinvokereturn = value;} + } + + public bool QStringReturn + { + get {return qstringreturn;} + set {qstringreturn = value;} + } + + public string PascalName + { + get {return pascalname;} + set {pascalname = value;} + } + } +} diff --git a/qtsharp/src/generator/QParam.cs b/qtsharp/src/generator/QParam.cs new file mode 100644 index 00000000..53212bad --- /dev/null +++ b/qtsharp/src/generator/QParam.cs @@ -0,0 +1,54 @@ +// A Qt to C# binding generator. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +using System; +//using System.IO; + +namespace QtCSharp { + + public class QParam: ICloneable { + + string type, name, defaultvalue; + + public QParam() + {} + + public object Clone() + { + return MemberwiseClone(); + } + + public string Type + { + get {return type;} + set {type = value;} + } + + public string Name + { + get {return name;} + set {name = value;} + } + + public string Default + { + get {return defaultvalue;} + set {defaultvalue = value;} + } + } +} diff --git a/qtsharp/src/generator/QType.cs b/qtsharp/src/generator/QType.cs new file mode 100644 index 00000000..16ba8f56 --- /dev/null +++ b/qtsharp/src/generator/QType.cs @@ -0,0 +1,126 @@ +// A Qt to C# binding generator. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +using System; +//using System.IO; +using System.Collections; + +namespace QtCSharp { + + public class QType { + + string name, access, iname; + bool isInterface, isConverted, isQObject; + ArrayList qancestors, qenums, qctors, qdctors, qmethods; + + public QType () + { + qancestors = new ArrayList (); + qenums = new ArrayList (); + qctors = new ArrayList (); + qdctors = new ArrayList (); + qmethods = new ArrayList (); + } + + public void AddQAncestor (QAncestor qancestor) + { + qancestors.Add (qancestor); + } + + public void AddQEnum (QEnum qenum) + { + qenums.Add (qenum); + } + + public void AddQCtor (QCtor qctor) + { + qctors.Add (qctor); + } + + public void AddQDCtor (QDCtor qdctor) + { + qdctors.Add (qdctor); + } + + public void AddQMethod (QMethod qmethod) + { + qmethods.Add (qmethod); + } + + public string Name + { + get {return name;} + set {name = value;} + } + + public string Access + { + get {return access;} + set {access = value;} + } + + public bool IsInterface + { + get {return isInterface;} + set {isInterface = value;} + } + + public bool IsConverted + { + get {return isConverted;} + set {isConverted = value;} + } + + public bool IsQObject { + get { return isQObject; } + set { isQObject = value; } + } + + public string IName + { + get {return iname;} + set {iname = value;} + } + + public ArrayList QAncestors + { + get {return qancestors;} + } + + public ArrayList QEnums + { + get {return qenums;} + } + + public ArrayList QCtors + { + get {return qctors;} + } + + public ArrayList QDCtors + { + get {return qdctors;} + } + + public ArrayList QMethods + { + get {return qmethods;} + set {qmethods = value;} + } + } +} diff --git a/qtsharp/src/generator/QTypeMap.cs b/qtsharp/src/generator/QTypeMap.cs new file mode 100644 index 00000000..241dc825 --- /dev/null +++ b/qtsharp/src/generator/QTypeMap.cs @@ -0,0 +1,477 @@ +// A Qt to C# binding generator. +// +// Copyright (C) 2002 Adam Treat (manyoso@yahoo.com) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +using System; +using System.Collections; + +namespace QtCSharp { + + public class QTypeMap { + + Hashtable arraymap, mastermap, pinvoketypes, pinvokecalltypes, csharptypes, overloadtypes, reserved, interfaces; + + public QTypeMap () + { + arraymap = new Hashtable (); + arraymap.Add ("void*", "int[]"); + arraymap.Add ("void *", "int[]"); + arraymap.Add ("int*", "int[]"); + arraymap.Add ("int *", "int[]"); + arraymap.Add ("double*", "double[]"); + arraymap.Add ("double *", "double[]"); + arraymap.Add ("short*", "short[]"); + arraymap.Add ("short *", "short[]"); + arraymap.Add ("char**", "string[]"); + arraymap.Add ("char **", "string[]"); + arraymap.Add ("char*", "string"); + arraymap.Add ("uchar**", "string[]"); + arraymap.Add ("uchar **", "string[]"); + + mastermap = new Hashtable (); + mastermap.Add ("void", "void"); + // mastermap.Add ("QByteArray", "byte[]"); + mastermap.Add ("QBitArray", "byte[]"); + mastermap.Add ("uchar", "string"); + mastermap.Add ("unsigned int", "uint"); + mastermap.Add ("unsigned short", "ushort"); + mastermap.Add ("unsigned long", "ulong"); + mastermap.Add ("unsigned char", "string"); + mastermap.Add ("HANDLE", "uint"); + mastermap.Add ("HBITMAP", "uint"); + mastermap.Add ("HCURSOR", "uint"); + mastermap.Add ("HDC", "uint"); + mastermap.Add ("HFONT", "uint"); + mastermap.Add ("HPALETTE", "uint"); + mastermap.Add ("HRGN", "uint"); + mastermap.Add ("Display", "IntPtr"); + mastermap.Add ("Q_REFCOUNT bool", "bool"); + mastermap.Add ("EventRef", "IntPtr"); + mastermap.Add ("MSG", "IntPtr"); + mastermap.Add ("XEvent", "IntPtr"); + mastermap.Add ("QWSEvent", "IntPtr"); + mastermap.Add ("GDHandle", "IntPtr"); + mastermap.Add ("QRgb", "int"); + mastermap.Add ("QWSDecoration", "IntPtr"); + mastermap.Add ("QTextParag", "IntPtr"); + mastermap.Add ("Qt.HANDLE", "IntPtr"); + mastermap.Add ("QUObject", "IntPtr"); + mastermap.Add ("QGfx", "IntPtr"); + mastermap.Add ("QRESULT", "long"); + mastermap.Add ("QUnknownInterface", "IntPtr"); + mastermap.Add ("QPtrCollection.Item", "int"); + mastermap.Add ("type", "IntPtr"); + mastermap.Add ("array_data", "IntPtr"); + mastermap.Add ("bitarr_data", "IntPtr"); + mastermap.Add ("Offset", "int"); + mastermap.Add ("Q_INT16", "short"); + mastermap.Add ("Q_INT32", "int"); + mastermap.Add ("Q_INT8", "char"); + mastermap.Add ("Q_LONG", "long"); + mastermap.Add ("Q_PACKED", "uint"); + mastermap.Add ("Q_UINT16", "ushort"); + mastermap.Add ("Q_UINT32", "uint"); + mastermap.Add ("Q_UINT8", "char"); + mastermap.Add ("Q_ULONG", "long"); + mastermap.Add ("QStyleHintReturn", "IntPtr"); + mastermap.Add ("QFileInfoList", "IntPtr"); + mastermap.Add ("QDomNodePrivate", "IntPtr"); + mastermap.Add ("GUID", "System.Guid"); + mastermap.Add ("FILE", "string"); + mastermap.Add ("EncoderFn", "int"); + mastermap.Add ("DecoderFn", "int"); + mastermap.Add ("QDiskFont", "IntPtr"); + mastermap.Add ("pointer", "IntPtr"); + mastermap.Add ("T", "IntPtr"); + mastermap.Add ("T1", "IntPtr"); + mastermap.Add ("T2", "IntPtr"); + mastermap.Add ("Iterator", "IntPtr"); + mastermap.Add ("iterator", "IntPtr"); + mastermap.Add ("_iterator", "IntPtr"); + mastermap.Add ("reference", "IntPtr"); + mastermap.Add ("_reference", "IntPtr"); + mastermap.Add ("ConstIterator", "int"); + mastermap.Add ("QWSDisplay", "IntPtr"); + mastermap.Add ("CGContextRef", "IntPtr"); + mastermap.Add ("WId", "uint"); + mastermap.Add ("QWidgetMapper", "IntPtr"); + mastermap.Add ("size_type", "int"); + mastermap.Add ("Item", "IntPtr"); + mastermap.Add ("image_io_handler", "int"); + mastermap.Add ("QCOORD", "short"); + mastermap.Add ("key_type", "IntPtr"); + mastermap.Add ("K", "IntPtr"); + mastermap.Add ("NodePtr", "int"); + mastermap.Add ("QTextFormat", "IntPtr"); + mastermap.Add ("QTextDocument", "IntPtr"); + mastermap.Add ("QTextCursor", "IntPtr"); + mastermap.Add ("_NPStream", "IntPtr"); + mastermap.Add ("PID", "long"); + mastermap.Add ("Region", "int"); + mastermap.Add ("RgnHandle", "IntPtr"); + mastermap.Add ("QRemoteInterface", "IntPtr"); + mastermap.Add ("mode_t", "int"); + mastermap.Add ("QSqlFieldInfo", "IntPtr"); + mastermap.Add ("QSqlRecordInfo", "IntPtr"); + mastermap.Add ("QSqlRecordPrivate", "IntPtr"); + mastermap.Add ("QTSMFI", "int"); + mastermap.Add ("Widget", "QWidget"); + mastermap.Add ("WidgetClass", "int"); + mastermap.Add ("ArgList", "int"); + mastermap.Add ("Cardinal", "int"); + mastermap.Add ("XrmOptionDescRec", "IntPtr"); + mastermap.Add ("size_t", "int"); + mastermap.Add ("ULONG_MAX", "UInt64.MaxValue"); + + // Enums + mastermap.Add ("Event", "QAccessible.Event"); + mastermap.Add ("Role", "QAccessible.Role"); + mastermap.Add ("NavDirection", "QAccessible.NavDirection"); + mastermap.Add ("Text", "QAccessible.Text"); + mastermap.Add ("ColorSpec", "QApplication.ColorSpec"); + mastermap.Add ("ToggleState", "QButton.ToggleState"); + mastermap.Add ("RttiValues", "QCanvasItem.RttiValues"); + mastermap.Add ("FrameAnimationType", "QCanvasSprite.FrameAnimationType"); + mastermap.Add ("Category", "QChar.Category"); + mastermap.Add ("Decomposition", "QChar.Decomposition"); + mastermap.Add ("Joining", "QChar.Joining"); + mastermap.Add ("CombiningClass", "QChar.CombiningClass"); + mastermap.Add ("Spec", "QColor.Spec"); + mastermap.Add ("ColorRole", "QColorGroup.ColorRole"); + mastermap.Add ("Boundary", "QDataBrowser.Boundary"); + mastermap.Add ("ByteOrder", "QDataStream.ByteOrder"); + mastermap.Add ("Refresh", "QDataTable.Refresh"); + mastermap.Add ("Order", "QDateEdit.Order"); + mastermap.Add ("DialogCode", "QDialog.DialogCode"); + mastermap.Add ("FilterSpec", "QDir.FilterSpec"); + mastermap.Add ("SortSpec", "QDir.SortSpec"); + mastermap.Add ("RecordType", "QDns.RecordType"); + mastermap.Add ("HandlePosition", "QDockArea.HandlePosition"); + mastermap.Add ("Place", "QDockWindow.Place"); + mastermap.Add ("CloseMode", "QDockWindow.CloseMode"); + mastermap.Add ("NodeType", "QDomNode.NodeType"); + mastermap.Add ("DragMode", "QDragObject.DragMode"); + mastermap.Add ("Action", "QDropEvent.Action"); + mastermap.Add ("ViewMode", "QFileDialog.ViewMode"); + mastermap.Add ("PreviewMode", "QFileDialog.PreviewMode"); + mastermap.Add ("PermissionSpec", "QFileInfo.PermissionSpec"); + mastermap.Add ("StyleStrategy", "QFont.StyleStrategy"); + mastermap.Add ("Weight", "QFont.Weight"); + mastermap.Add ("Script", "QFont.Script"); + mastermap.Add ("Shadow", "QFrame.Shadow"); + mastermap.Add ("FormatOption", "QGL.FormatOption"); + mastermap.Add ("Corner", "QGridLayout.Corner"); + mastermap.Add ("Size", "QIconSet.Size"); + mastermap.Add ("Arrangement", "QIconView.Arrangement"); + mastermap.Add ("ItemTextPos", "QIconView.ItemTextPos"); + mastermap.Add ("Endian", "QImage.Endian"); + mastermap.Add ("ScaleMode", "QImage.ScaleMode"); + mastermap.Add ("PaintDeviceFlags", "QInternal.PaintDeviceFlags"); + mastermap.Add ("Rules", "QJpUnicodeConv.Rules"); + mastermap.Add ("SegmentStyle", "QLCDNumber.SegmentStyle"); + mastermap.Add ("LayoutMode", "QListBox.LayoutMode"); + mastermap.Add ("WidthMode", "QListView.WidthMode"); + mastermap.Add ("RenameAction", "QListView.RenameAction"); + mastermap.Add ("DockWindows", "QMainWindow.DockWindows"); + mastermap.Add ("Color", "QMapNodeBase.Color"); + mastermap.Add ("Separator", "QMenuBar.Separator"); + mastermap.Add ("Icon", "QMessageBox.Icon"); + mastermap.Add ("Access", "QMetaData.Access"); + mastermap.Add ("Flags", "QMetaProperty.Flags"); + mastermap.Add ("Status", "QMovie.Status"); + mastermap.Add ("InstanceMode", "QNPInstance.InstanceMode"); + mastermap.Add ("StreamMode", "QNPInstance.StreamMode"); + mastermap.Add ("Operation", "QNetworkProtocol.Operation"); + mastermap.Add ("ConnectionState", "QNetworkProtocol.ConnectionState"); + mastermap.Add ("DisposalMethod", "QPNGImageWriter.DisposalMethod"); + mastermap.Add ("PDevCmd", "QPaintDevice.PDevCmd"); + mastermap.Add ("CoordinateMode", "QPainter.CoordinateMode"); + mastermap.Add ("TextDirection", "QPainter.TextDirection"); + mastermap.Add ("ColorGroup", "QPalette.ColorGroup"); + mastermap.Add ("Optimization", "QPixmap.Optimization"); + mastermap.Add ("Edge", "QPolygonScanner.Edge"); + mastermap.Add ("PrinterMode", "QPrinter.PrinterMode"); + mastermap.Add ("PageSize", "QPrinter.PageSize"); + mastermap.Add ("PageOrder", "QPrinter.PageOrder"); + mastermap.Add ("PaperSource", "QPrinter.PaperSource"); + mastermap.Add ("Communication", "QProcess.Communication"); + mastermap.Add ("RegionType", "QRegion.RegionType"); + mastermap.Add ("ResizePolicy", "QScrollView.ResizePolicy"); + mastermap.Add ("ScrollBarMode", "QScrollView.ScrollBarMode"); + mastermap.Add ("RestartHint", "QSessionManager.RestartHint"); + mastermap.Add ("System", "QSettings.System"); + mastermap.Add ("SizeType", "QSizePolicy.SizeType"); + mastermap.Add ("ExpandData", "QSizePolicy.ExpandData"); + mastermap.Add ("TickSetting", "QSlider.TickSetting"); + mastermap.Add ("Op", "QSql.Op"); + mastermap.Add ("Location", "QSql.Location"); + mastermap.Add ("Confirm", "QSql.Confirm"); + mastermap.Add ("DriverFeature", "QSqlDriver.DriverFeature"); + mastermap.Add ("SectionFlags", "QString.SectionFlags"); + mastermap.Add ("PrimitiveElement", "QStyle.PrimitiveElement"); + mastermap.Add ("StyleFlags", "QStyle.StyleFlags"); + mastermap.Add ("SFlags", "QStyle.StyleFlags"); + mastermap.Add ("ControlElement", "QStyle.ControlElement"); + mastermap.Add ("SubRect", "QStyle.SubRect"); + mastermap.Add ("ComplexControl", "QStyle.ComplexControl"); + mastermap.Add ("SubControl", "QStyle.SubControl"); + mastermap.Add ("SCFlags", "QStyle.SubControl"); + mastermap.Add ("PixelMetric", "QStyle.PixelMetric"); + mastermap.Add ("ContentsType", "QStyle.ContentsType"); + mastermap.Add ("StylePixmap", "QStyle.StylePixmap"); + mastermap.Add ("StyleOptionDefault", "QStyleOption.StyleOptionDefault"); + mastermap.Add ("AdditionalStyleValues", "QStyleSheetItem.AdditionalStyleValues"); + mastermap.Add ("DisplayMode", "QStyleSheetItem.DisplayMode"); + mastermap.Add ("WhiteSpaceMode", "QStyleSheetItem.WhiteSpaceMode"); + mastermap.Add ("Margin", "QStyleSheetItem.Margin"); + mastermap.Add ("ListStyle", "QStyleSheetItem.ListStyle"); + mastermap.Add ("FocusStyle", "QTable.FocusStyle"); + mastermap.Add ("EditMode", "QTable.EditMode"); + mastermap.Add ("EditType", "QTableItem.EditType"); + mastermap.Add ("TabletDevice", "QTabletEvent.TabletDevice"); + mastermap.Add ("KeyboardAction", "QTextEdit.KeyboardAction"); + mastermap.Add ("CursorAction", "QTextEdit.CursorAction"); + mastermap.Add ("SaveMode", "QTranslator.SaveMode"); + mastermap.Add ("Prefix", "QTranslatorMessage.Prefix"); + mastermap.Add ("FocusPolicy", "QWidget.FocusPolicy"); + mastermap.Add ("BackgroundOrigin", "QWidget.BackgroundOrigin"); + mastermap.Add ("ButtonState", "Qt.ButtonState"); + mastermap.Add ("AlignmentFlags", "Qt.AlignmentFlags"); + mastermap.Add ("TextFlags", "Qt.TextFlags"); + mastermap.Add ("WidgetState", "Qt.WidgetState"); + mastermap.Add ("WState", "Qt.WidgetState"); + mastermap.Add ("WidgetFlags", "Qt.WidgetFlags"); + mastermap.Add ("WFlags", "Qt.WidgetFlags"); + mastermap.Add ("ImageConversionFlags", "Qt.ImageConversionFlags"); + mastermap.Add ("BGMode", "Qt.BGMode"); + mastermap.Add ("PaintUnit", "Qt.PaintUnit"); + mastermap.Add ("GUIStyle", "Qt.GUIStyle"); + mastermap.Add ("Modifier", "Qt.Modifier"); + mastermap.Add ("Key", "Qt.Key"); + mastermap.Add ("ArrowType", "Qt.ArrowType"); + mastermap.Add ("RasterOp", "Qt.RasterOp"); + mastermap.Add ("PenStyle", "Qt.PenStyle"); + mastermap.Add ("PenCapStyle", "Qt.PenCapStyle"); + mastermap.Add ("PenJoinStyle", "Qt.PenJoinStyle"); + mastermap.Add ("BrushStyle", "Qt.BrushStyle"); + mastermap.Add ("WindowsVersion", "Qt.WindowsVersion"); + mastermap.Add ("UIEffect", "Qt.UIEffect"); + mastermap.Add ("CursorShape", "Qt.CursorShape"); + mastermap.Add ("TextFormat", "Qt.TextFormat"); + mastermap.Add ("Dock", "Qt.Dock"); + mastermap.Add ("DateFormat", "Qt.DateFormat"); + mastermap.Add ("BackgroundMode", "Qt.BackgroundMode"); + mastermap.Add ("StringComparisonMode", "Qt.StringComparisonMode"); + mastermap.Add ("ComparisonFlags", "Qt.StringComparisonMode"); + + // We need to make sure all params use the interfaces, ie IQPaintDevice + /*mastermap.Add ("QAccessibleFactoryInterface", "IQAccessibleFactory"); + mastermap.Add ("QAccessibleInterface", "IQAccessible");*/ + mastermap.Add ("QPaintDevice", "IQPaintDevice"); + /*mastermap.Add ("QMenuData", "IQMenuData"); + mastermap.Add ("QRangeControl", "IQRangeControl"); + mastermap.Add ("QMimeSource", "IQMimeSource"); + mastermap.Add ("QLayoutItem", "IQLayoutItem"); + mastermap.Add ("QUrl", "IQUrl"); + mastermap.Add ("QIODevice", "IQIODevice"); + mastermap.Add ("QXmlContentHandler", "IQXmlContentHandler"); + mastermap.Add ("QXmlErrorHandler", "IQXmlErrorHandler"); + mastermap.Add ("QXmlDTDHandler", "IQXmlDTDHandler"); + mastermap.Add ("QXmlEntityResolver", "IQXmlEntityResolver"); + //mastermap.Add ("QXmlLexicalHandler", "IQXmlLexicalHandler"); + mastermap.Add ("QXmlDeclHandler", "IQXmlDeclHandler"); + mastermap.Add ("QwAbsSpriteFieldView", "IQwAbsSpriteFieldView"); + mastermap.Add ("QSqlQuery", "IQSqlQuery"); + mastermap.Add ("QFeatureListInterface", "IQFeatureList"); + mastermap.Add ("QUnknownInterface", "IQUnknown"); + mastermap.Add ("QShared", "IQShared");*/ + + // Key Duplication + //mastermap.Add ("Direction", "QBoxLayout.Direction"); + //mastermap.Add ("Direction", "QChar.Direction"); + //mastermap.Add ("Reason", "QContextMenuEvent.Reason"); + //mastermap.Add ("Reason", "QFocusEvent.Reason"); + //mastermap.Add ("Reason", "QNPInstance.Reason"); + //mastermap.Add ("Mode", "QFileDialog.Mode"); + //mastermap.Add ("Mode", "QIconSet.Mode"); + //mastermap.Add ("Mode", "QLCDNumber.Mode"); + //mastermap.Add ("Mode", "QSqlCursor.Mode"); + //mastermap.Add ("Shape", "QFrame.Shape"); + //mastermap.Add ("Shape", "QTabBar.Shape"); + //mastermap.Add ("KeyType", "QGCache.KeyType"); + //mastermap.Add ("KeyType", "QGDict.KeyType"); + //mastermap.Add ("State", "QAccessible.State"); + //mastermap.Add ("State", "QNetworkProtocol.State"); + //mastermap.Add ("State", "QSocket.State"); + //mastermap.Add ("State", "QValidator.State"); + //mastermap.Add ("ResizeMode", "QIconView.ResizeMode"); + //mastermap.Add ("ResizeMode", "QLayout.ResizeMode"); + //mastermap.Add ("ResizeMode", "QListView.ResizeMode"); + //mastermap.Add ("ResizeMode", "QListView.ResizeMode"); + //mastermap.Add ("EchoMode", "QLineEdit.EchoMode"); + //mastermap.Add ("EchoMode", "QtMultiLineEdit.EchoMode"); + //mastermap.Add ("ColorMode", "QApplication.ColorMode"); + //mastermap.Add ("ColorMode", "QPrinter.ColorMode"); + //mastermap.Add ("ColorMode", "QPixmap.ColorMode"); + //mastermap.Add ("SelectionMode", "QIconView.SelectionMode"); + //mastermap.Add ("SelectionMode", "QListBox.SelectionMode"); + //mastermap.Add ("SelectionMode", "QListView.SelectionMode"); + //mastermap.Add ("SelectionMode", "QTable.SelectionMode"); + //mastermap.Add ("Error", "QSocket.Error"); + //mastermap.Add ("Error", "QSocketDevice.Error"); + //mastermap.Add ("Error", "QNetworkProtocol.Error"); + //mastermap.Add ("ButtonSymbols", "QSpinBox.ButtonSymbols"); + //mastermap.Add ("ButtonSymbols", "QSpinWidget.ButtonSymbols"); + //mastermap.Add ("StyleHint", "QStyle.StyleHint"); + //mastermap.Add ("StyleHint", "QFont.StyleHint"); + //mastermap.Add ("Encoding", "QApplication.Encoding"); + //mastermap.Add ("Encoding", "QTextStream.Encoding"); + //mastermap.Add ("VerticalAlignment", "QTextEdit.VerticalAlignment"); + //mastermap.Add ("VerticalAlignment", "QStyleSheetItem.VerticalAlignment"); + //mastermap.Add ("Orientation", "QPrinter.Orientation"); + //mastermap.Add ("Orientation", "Qt.Orientation"); + //mastermap.Add ("WrapPolicy", "QTextEdit.WrapPolicy"); + //mastermap.Add ("WrapPolicy", "QtMultiLineEdit.WrapPolicy"); + //mastermap.Add ("WordWrap", "QTextEdit.WordWrap"); + //mastermap.Add ("WordWrap", "QtMultiLineEdit.WordWrap"); + + // These are here in case we need to override the mastermap + pinvoketypes = new Hashtable (); + pinvokecalltypes = new Hashtable (); + csharptypes = new Hashtable (); + overloadtypes = new Hashtable (); + + // These are reserved keywords. + reserved = new Hashtable (); + reserved.Add ("lock", "Q_lock"); + reserved.Add ("object", "Q_object"); + reserved.Add ("ref", "Q_ref"); + reserved.Add ("base", "Q_base"); + reserved.Add ("string", "Q_string"); + reserved.Add ("const", "Q_const"); + reserved.Add ("event", "Q_event"); + + // The allowed interfaces + interfaces = new Hashtable (); + interfaces.Add ("QAccessibleFactoryInterface", "IQAccessibleFactory"); + interfaces.Add ("QAccessibleInterface", "IQAccessible"); + interfaces.Add ("QPaintDevice", "IQPaintDevice"); + interfaces.Add ("QMenuData", "IQMenuData"); + interfaces.Add ("QRangeControl", "IQRangeControl"); + interfaces.Add ("QMimeSource", "IQMimeSource"); + interfaces.Add ("QLayoutItem", "IQLayoutItem"); + interfaces.Add ("QUrl", "IQUrl"); + interfaces.Add ("QIODevice", "IQIODevice"); + interfaces.Add ("QXmlContentHandler", "IQXmlContentHandler"); + interfaces.Add ("QXmlErrorHandler", "IQXmlErrorHandler"); + interfaces.Add ("QXmlDTDHandler", "IQXmlDTDHandler"); + interfaces.Add ("QXmlEntityResolver", "IQXmlEntityResolver"); + //interfaces.Add ("QXmlLexicalHandler", "IQXmlLexicalHandler"); + interfaces.Add ("QXmlDeclHandler", "IQXmlDeclHandler"); + interfaces.Add ("QwAbsSpriteFieldView", "IQwAbsSpriteFieldView"); + interfaces.Add ("QSqlQuery", "IQSqlQuery"); + interfaces.Add ("QFeatureListInterface", "IQFeatureList"); + interfaces.Add ("QUnknownInterface", "IQUnknown"); + interfaces.Add ("QShared", "IQShared"); + } + + public string PinvokeType (string str) + { + if ((string)mastermap[str] != null) + if((string)pinvoketypes[(string)mastermap[str]] != null) + return (string)pinvoketypes[(string)mastermap[str]]; + else + return (string)mastermap[str]; + else if ((string)pinvoketypes[str] != null) + return (string)pinvoketypes[str]; + else + return str; + } + + public string PinvokeCallType (string str) + { + + if ((string)mastermap[str] != null) + if((string)pinvokecalltypes[(string)mastermap[str]] != null) + return (string)pinvokecalltypes[(string)mastermap[str]]; + else + return (string)mastermap[str]; + else if ((string)pinvokecalltypes[str] != null) + return (string)pinvokecalltypes[str]; + else + return str; + } + + public string CSharpType (string str) + { + if ((string)mastermap[str] != null) + if((string)csharptypes[(string)mastermap[str]] != null) + return (string)csharptypes[(string)mastermap[str]]; + else + return (string)mastermap[str]; + else if ((string)csharptypes[str] != null) + return (string)csharptypes[str]; + else + return str; + } + + public string OverloadType (string str) + { + if ((string)mastermap[str] != null) + if((string)overloadtypes[(string)mastermap[str]] != null) + return (string)overloadtypes[(string)mastermap[str]]; + else + return (string)mastermap[str]; + else if ((string)overloadtypes[str] != null) + return (string)overloadtypes[str]; + else + return str; + } + + public string ArrayType (string str) + { + if ((string)arraymap[str] != null) + return (string)arraymap[str]; + else + return str; + } + + public string ReservedType (string str) + { + if ((string)reserved[str] != null) + return (string)reserved[str]; + else + return str; + } + + public string ReturnType (string str) + { + if ((string)reserved[str] != null) + return (string)reserved[str]; + else + return str; + } + + public string InterfaceType (string str) + { + if ((string)interfaces[str] != null) + return (string)interfaces[str]; + else + return str; + } + } +} diff --git a/qtsharp/src/generator/generator.build b/qtsharp/src/generator/generator.build new file mode 100644 index 00000000..dd703536 --- /dev/null +++ b/qtsharp/src/generator/generator.build @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/qtsharp/src/libqtsharp/Makefile.am b/qtsharp/src/libqtsharp/Makefile.am new file mode 100644 index 00000000..387c6bfa --- /dev/null +++ b/qtsharp/src/libqtsharp/Makefile.am @@ -0,0 +1,12 @@ + +lib_LTLIBRARIES = libqtsharp.la +libqtsharp_la_SOURCES = customslot.cpp qtsharp.cpp + +libqtsharp_la_LDFLAGS = $(QT_LDFLAGS) $(LIB_QT) -no-undefined -version-info 0:0:0 $(all_libraries) ../../../qtc/clib/qtc/libqtc.la + +KDE_OPTIONS = qtonly + +INCLUDES= $(all_includes) + +libqtsharp_la_METASOURCES = AUTO + diff --git a/qtsharp/src/libqtsharp/customslot.cpp b/qtsharp/src/libqtsharp/customslot.cpp new file mode 100644 index 00000000..f23b9cee --- /dev/null +++ b/qtsharp/src/libqtsharp/customslot.cpp @@ -0,0 +1,254 @@ + +#include "customslot.h" + +CustomSlot::CustomSlot (void (*ptr)(void), QObject *parent, const char *name): QObject (parent, name) +{ + p0 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(bool), QObject *parent, const char *name): QObject (parent, name) +{ + p1 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(short), QObject *parent, const char *name): QObject (parent, name) +{ + p2 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(int), QObject *parent, const char *name): QObject (parent, name) +{ + p3 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(long), QObject *parent, const char *name): QObject (parent, name) +{ + p4 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(float), QObject *parent, const char *name): QObject (parent, name) +{ + p5 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(double), QObject *parent, const char *name): QObject (parent, name) +{ + p6 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(QDockWindow*), QObject *parent, const char *name): QObject (parent, name) +{ + p7 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(QDropEvent*), QObject *parent, const char *name): QObject (parent, name) +{ + p8 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(QDropEvent*,QListViewItem*), QObject *parent, const char *name): QObject (parent, name) +{ + p9 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(QIconViewItem*), QObject *parent, const char *name): QObject (parent, name) +{ + p10 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(QListBoxItem*), QObject *parent, const char *name): QObject (parent, name) +{ + p11 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(QListViewItem*), QObject *parent, const char *name): QObject (parent, name) +{ + p12 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(QListViewItem*,QListViewItem*), QObject *parent, const char *name): QObject (parent, name) +{ + p13 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(QListViewItem*,QListViewItem*,QListViewItem*), QObject *parent, const char *name): QObject (parent, name) +{ + p14 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(QNetworkOperation*), QObject *parent, const char *name): QObject (parent, name) +{ + p15 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(QObject*), QObject *parent, const char *name): QObject (parent, name) +{ + p16 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(QToolBar*), QObject *parent, const char *name): QObject (parent, name) +{ + p17 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(QWidget*), QObject *parent, const char *name): QObject (parent, name) +{ + p18 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(int,QIconViewItem*), QObject *parent, const char *name): QObject (parent, name) +{ + p19 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(int,QListBoxItem*), QObject *parent, const char *name): QObject (parent, name) +{ + p20 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(int,bool), QObject *parent, const char *name): QObject (parent, name) +{ + p21 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(int,int), QObject *parent, const char *name): QObject (parent, name) +{ + p22 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(int,int,int), QObject *parent, const char *name): QObject (parent, name) +{ + p23 = ptr; +} + +CustomSlot::CustomSlot (void (*ptr)(const QString&), QObject *parent, const char *name): QObject (parent, name) +{ + p24 = ptr; +} + +void CustomSlot::callback (void) +{ + p0 (); +} + +void CustomSlot::callback (bool value0) +{ + p1 (value0); +} + +void CustomSlot::callback (short value0) +{ + p2 (value0); +} + +void CustomSlot::callback (int value0) +{ + p3 (value0); +} + +void CustomSlot::callback (long value0) +{ + p4 (value0); +} + +void CustomSlot::callback (float value0) +{ + p5 (value0); +} + +void CustomSlot::callback (double value0) +{ + p6 (value0); +} + +void CustomSlot::callback (QDockWindow* value0) +{ + p7 (value0); +} + +void CustomSlot::callback (QDropEvent* value0) +{ + p8 (value0); +} + +void CustomSlot::callback (QDropEvent* value0, QListViewItem* value1) +{ + p9 (value0, value1); +} + +void CustomSlot::callback (QIconViewItem* value0) +{ + p10 (value0); +} + +void CustomSlot::callback (QListBoxItem* value0) +{ + p11 (value0); +} + +void CustomSlot::callback (QListViewItem* value0) +{ + p12 (value0); +} + +void CustomSlot::callback (QListViewItem* value0, QListViewItem* value1) +{ + p13 (value0, value1); +} + +void CustomSlot::callback (QListViewItem* value0, QListViewItem* value1, QListViewItem* value2) +{ + p14 (value0, value1, value2); +} + +void CustomSlot::callback (QNetworkOperation* value0) +{ + p15 (value0); +} + +void CustomSlot::callback (QObject* value0) +{ + p16 (value0); +} + +void CustomSlot::callback (QToolBar* value0) +{ + p17 (value0); +} + +void CustomSlot::callback (QWidget* value0) +{ + p18 (value0); +} + +void CustomSlot::callback (int value0, QIconViewItem* value1) +{ + p19 (value0, value1); +} + +void CustomSlot::callback (int value0, QListBoxItem* value1) +{ + p20 (value0, value1); +} + +void CustomSlot::callback (int value0, bool value1) +{ + p21 (value0, value1); +} + +void CustomSlot::callback (int value0, int value1) +{ + p22 (value0, value1); +} + +void CustomSlot::callback (int value0, int value1, int value2) +{ + p23 (value0, value1, value2); +} + +void CustomSlot::callback( const QString& value0 ) +{ + p24 (value0); +} + +#include "customslot.moc" diff --git a/qtsharp/src/libqtsharp/customslot.h b/qtsharp/src/libqtsharp/customslot.h new file mode 100644 index 00000000..5182f354 --- /dev/null +++ b/qtsharp/src/libqtsharp/customslot.h @@ -0,0 +1,120 @@ +#ifndef _CUSTOMSLOT_H_ +#define _CUSTOMSLOT_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +class CustomSlot: public QObject +{ + Q_OBJECT + +public: + + CustomSlot (void (*ptr)(void), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(bool), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(short), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(int), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(long), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(float), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(double), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(const QString&), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(QDockWindow*), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(QDropEvent*), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(QDropEvent*,QListViewItem*), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(QIconViewItem*), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(QListBoxItem*), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(QListViewItem*), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(QListViewItem*,QListViewItem*), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(QListViewItem*,QListViewItem*,QListViewItem*), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(QNetworkOperation*), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(QObject*), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(QToolBar*), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(QWidget*), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(int,QIconViewItem*), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(int,QListBoxItem*), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(int,bool), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(int,int), QObject *parent, const char *name=0); + CustomSlot (void (*ptr)(int,int,int), QObject *parent, const char *name=0); + +public slots: + void callback (void); + void callback (bool); + void callback (short); + void callback (int); + void callback (long); + void callback (float); + void callback (double); + void callback (const QString&); + void callback (QDockWindow*); + void callback (QDropEvent*); + void callback (QDropEvent*,QListViewItem*); + void callback (QIconViewItem*); + void callback (QListBoxItem*); + void callback (QListViewItem*); + void callback (QListViewItem*,QListViewItem*); + void callback (QListViewItem*,QListViewItem*,QListViewItem*); + void callback (QNetworkOperation*); + void callback (QObject*); + void callback (QToolBar*); + void callback (QWidget*); + void callback (int,QIconViewItem*); + void callback (int,QListBoxItem*); + void callback (int,bool); + void callback (int,int); + void callback (int,int,int); + +private: + void (*p0)(void); + void (*p1)(bool); + void (*p2)(short); + void (*p3)(int); + void (*p4)(long); + void (*p5)(float); + void (*p6)(double); + void (*p7)(QDockWindow*); + void (*p8)(QDropEvent*); + void (*p9)(QDropEvent*,QListViewItem*); + void (*p10)(QIconViewItem*); + void (*p11)(QListBoxItem*); + void (*p12)(QListViewItem*); + void (*p13)(QListViewItem*,QListViewItem*); + void (*p14)(QListViewItem*,QListViewItem*,QListViewItem*); + void (*p15)(QNetworkOperation*); + void (*p16)(QObject*); + void (*p17)(QToolBar*); + void (*p18)(QWidget*); + void (*p19)(int,QIconViewItem*); + void (*p20)(int,QListBoxItem*); + void (*p21)(int,bool); + void (*p22)(int,int); + void (*p23)(int,int,int); + void (*p24)(const QString&); +}; + +#endif // _CUSTOMSLOT_H_ diff --git a/qtsharp/src/libqtsharp/qtsharp.cpp b/qtsharp/src/libqtsharp/qtsharp.cpp new file mode 100644 index 00000000..903e89c0 --- /dev/null +++ b/qtsharp/src/libqtsharp/qtsharp.cpp @@ -0,0 +1,291 @@ +#include "qtsharp.h" +#include + +static qtsharp_EventDelegate QtSharp_EventDelegate = 0; + +static int qtsharp_delegateBridge (void *arg1, char *arg2, void *arg3, char *arg4) +{ + if (QtSharp_EventDelegate) + (*QtSharp_EventDelegate)(arg1, arg2, arg3, arg4); + + return 0; +} + +extern "C" +void qtsharp_QObject_registerEventDelegate (qtsharp_EventDelegate delegate) +{ + QtSharp_EventDelegate = delegate; + qt_QObject_registerEventDelegate (qtsharp_delegateBridge); + return; +} + +QObject *csharp_connect_void (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(void)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (void)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_item_void (QMenuData *instance, int id, QObject *receiver, void (*ptr)(void)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! instance->connectItem (id, cs, SLOT (callback (void)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_bool (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(bool)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (bool)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_short (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(short)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (short)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_int (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(int)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (int)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_item_int (QMenuData *instance, int id, QObject *receiver, void (*ptr)(int)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! instance->connectItem (id, cs, SLOT (callback (int)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_long (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(long)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (long)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_float (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(float)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (float)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_double (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(double)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (double)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_QString (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(const QString&)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (const QString&)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_QDockWindow (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QDockWindow*)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (QDockWindow*)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_QDropEvent (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QDropEvent*)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (QDropEvent*)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_QDropEventQListViewItem (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QDropEvent*,QListViewItem*)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (QDropEvent*,QListViewItem*)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_QIconViewItem (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QIconViewItem*)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (QIconViewItem*)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_QListBoxItem (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QListBoxItem*)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (QListBoxItem*)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_QListViewItem (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QListViewItem*)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (QListViewItem*)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_QListViewItemQListViewItem (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QListViewItem*,QListViewItem*)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (QListViewItem*,QListViewItem*)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_QListViewItemQListViewItemQListViewItem (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QListViewItem*,QListViewItem*,QListViewItem*)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (QListViewItem*,QListViewItem*,QListViewItem*)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_QNetworkOperation (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QNetworkOperation*)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (QNetworkOperation*)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_QObject (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QObject*)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (QObject*)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_QToolBar (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QToolBar*)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (QToolBar*)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_QWidget (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QWidget*)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (QWidget*)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_intQIconViewItem (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(int,QIconViewItem*)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (int,QIconViewItem*)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_intQListBoxItem (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(int,QListBoxItem*)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (int,QListBoxItem*)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_intbool (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(int,bool)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (int,bool)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_intint (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(int,int)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (int,int)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + +QObject *csharp_connect_intintint (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(int,int,int)) +{ + CustomSlot *cs = new CustomSlot (ptr, receiver); + if (! QObject::connect (sender, signal, cs, SLOT (callback (int,int,int)))) { + delete cs; + cs = 0L; + } + return (QObject *)cs; +} + diff --git a/qtsharp/src/libqtsharp/qtsharp.h b/qtsharp/src/libqtsharp/qtsharp.h new file mode 100644 index 00000000..26321fb1 --- /dev/null +++ b/qtsharp/src/libqtsharp/qtsharp.h @@ -0,0 +1,67 @@ +#ifndef _QTSHARP_H_ +#define _QTSHARP_H_ + +#include "customslot.h" + +extern "C" { + +typedef void (*qtsharp_EventDelegate)(void *, char *, void *, char *); +typedef int (*qt_EventDelegate)(void *, char *, void *, char *); + +void qt_QObject_registerEventDelegate (qt_EventDelegate delegate); + +QObject *csharp_connect_void (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(void)); +QObject *csharp_connect_item_void (QMenuData *instance, int id, QObject *receiver, void (*ptr)(void)); + +QObject *csharp_connect_bool (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(bool)); + +QObject *csharp_connect_short (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(short)); + +QObject *csharp_connect_int (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(int)); +QObject *csharp_connect_item_int (QMenuData *instance, int id, QObject *receiver, void (*ptr)(int)); + +QObject *csharp_connect_long (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(long)); + +QObject *csharp_connect_float (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(float)); + +QObject *csharp_connect_double (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(double)); + +QObject *csharp_connect_QString (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(const QString&)); + +QObject *csharp_connect_QDockWindow (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QDockWindow*)); + +QObject *csharp_connect_QDropEvent (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QDropEvent*)); + +QObject *csharp_connect_QDropEventQListViewItem (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QDropEvent*,QListViewItem*)); + +QObject *csharp_connect_QIconViewItem (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QIconViewItem*)); + +QObject *csharp_connect_QListBoxItem (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QListBoxItem*)); + +QObject *csharp_connect_QListViewItem (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QListViewItem*)); + +QObject *csharp_connect_QListViewItemQListViewItem (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QListViewItem*,QListViewItem*)); + +QObject *csharp_connect_QListViewItemQListViewItemQListViewItem (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QListViewItem*,QListViewItem*,QListViewItem*)); + +QObject *csharp_connect_QNetworkOperation (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QNetworkOperation*)); + +QObject *csharp_connect_QObject (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QObject*)); + +QObject *csharp_connect_QToolBar (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QToolBar*)); + +QObject *csharp_connect_QWidget (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(QWidget*)); + +QObject *csharp_connect_intQIconViewItem (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(int,QIconViewItem*)); + +QObject *csharp_connect_intQListBoxItem (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(int,QListBoxItem*)); + +QObject *csharp_connect_intbool (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(int,bool)); + +QObject *csharp_connect_intint (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(int,int)); + +QObject *csharp_connect_intintint (QObject *sender, const char *signal, QObject *receiver, void (*ptr)(int,int,int)); + +} // extern "C" + +#endif // _QTSHARP_H_ diff --git a/qtsharp/src/tests/Makefile.am b/qtsharp/src/tests/Makefile.am new file mode 100644 index 00000000..a2642055 --- /dev/null +++ b/qtsharp/src/tests/Makefile.am @@ -0,0 +1,11 @@ +#TESTS = lookuptest.exe +TESTS = + +all-local: $(TESTS) + +lookuptest.exe: lookuptest.cs + $(MCS) -o $@ $^ -r Qt -lib:../bindings + chmod 755 $@ + +CLEANFILES = $(TESTS) + diff --git a/qtsharp/src/tests/lookuptest.cs b/qtsharp/src/tests/lookuptest.cs new file mode 100644 index 00000000..9882678f --- /dev/null +++ b/qtsharp/src/tests/lookuptest.cs @@ -0,0 +1,50 @@ +// Demonstrates that auto-boxing of foreign C++ objects works. +// Set QTCSHARP_DEBUG to true in your environment to see this work. +// +// TODO +// o Turn this into an nunit test. +// o Mono won't let this test call LookupObject because +// it is marked 'internal', even though they're both +// in the same namespace. Mono bug? + +namespace Qt { + + using Qt; + using System; + + public class LookupTest : QVBox, IDisposable { + + public LookupTest() : base (null) + { + QPushButton button = new QPushButton ("Quit", this); + QPushButton button2 = (QPushButton)QtSupport.LookupObject (button.Ptr); // Lookup a child object that exists in C# + + if (button.GetHashCode () != button2.GetHashCode ()) + Console.WriteLine ("ERROR: Hash codes differ for button and button2!"); + + QSize size = button2.SizeHint (); // Wrap a non-C# object. Lookup is called from the C# sizeHint method. + QSize size2 = (QSize)QtSupport.LookupObject (size.Ptr); + + if (size.GetHashCode () != size2.GetHashCode ()) + Console.WriteLine ("ERROR: Hash codes differ for size and size2!"); + + Connect (button, SIGNAL ("clicked()"), QObject.qApp, SLOT ("Quit()")); + } + + public static void Main (string[] args) + { + QApplication a = new QApplication (args); + LookupTest lt = new LookupTest (); + a.SetMainWidget (lt); + lt.Show (); + + LookupTest lt2 = (LookupTest)QtSupport.LookupObject (lt.Ptr); // Lookup a root object that exists in C# + + if (lt.GetHashCode () != lt2.GetHashCode ()) + Console.WriteLine ("ERROR: Hash codes differ for lt and lt2!"); + + a.Exec (); + lt.Dispose (); + } + } +} diff --git a/qtsharp/src/uicsharp/Makefile.am b/qtsharp/src/uicsharp/Makefile.am new file mode 100644 index 00000000..ac42d99c --- /dev/null +++ b/qtsharp/src/uicsharp/Makefile.am @@ -0,0 +1,21 @@ +all: uicsharp.exe + +uicsharp.exe: $(wildcard *.cs) + csant -D$(CSC_NAME)=$(CSC) -C $(CSC_NAME) + chmod 0755 $@ + +clean: + -rm uicsharp.exe + +distclean: clean + +install: uicsharp.exe + -$(MAKE) uninstall + -mkdir $(bindir) + install -o root -g root -m 0755 uicsharp.exe $(bindir)/uicsharp.exe + ln -s $(bindir)/uicsharp.exe $(bindir)/uicsharp + +uninstall: + -rm -rf $(bindir)/uicsharp.exe $(bindir)/uicsharp + +.PHONY: all clean install uninstall diff --git a/qtsharp/src/uicsharp/tests/form1.ui b/qtsharp/src/uicsharp/tests/form1.ui new file mode 100644 index 00000000..e5895a10 --- /dev/null +++ b/qtsharp/src/uicsharp/tests/form1.ui @@ -0,0 +1,43 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 600 + 480 + + + + + unnamed + + + + LineEdit1 + + + + + PushButton1 + + + PushButton1 + + + + + TextLabel1 + + + TextLabel1 + + + + + + diff --git a/qtsharp/src/uicsharp/tests/form10.ui b/qtsharp/src/uicsharp/tests/form10.ui new file mode 100644 index 00000000..50b27bb6 --- /dev/null +++ b/qtsharp/src/uicsharp/tests/form10.ui @@ -0,0 +1,131 @@ + +Form2 + + + Form2 + + + + 0 + 0 + 600 + 480 + + + + + WidgetStack1 + + + + 70 + 80 + 357 + 301 + + + + + page + + + 0 + + + + unnamed + + + + CheckBox2 + + + CheckBox2 + + + + + RadioButton2 + + + RadioButton2 + + + + + + + page + + + 1 + + + + unnamed + + + + + Column 1 + + + true + + + true + + + + + New Item + + + + + + + ListView1 + + + + + Table1 + + + 3 + + + 3 + + + + + + + page + + + 2 + + + + unnamed + + + + Table2 + + + 3 + + + 3 + + + + + + + + diff --git a/qtsharp/src/uicsharp/tests/form2.ui b/qtsharp/src/uicsharp/tests/form2.ui new file mode 100644 index 00000000..4d6545d5 --- /dev/null +++ b/qtsharp/src/uicsharp/tests/form2.ui @@ -0,0 +1,138 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 600 + 480 + + + + + unnamed + + + + GroupBox1 + + + GroupBox1 + + + + unnamed + + + + CheckBox1 + + + CheckBox1 + + + + + CheckBox2 + + + CheckBox2 + + + + + CheckBox3 + + + CheckBox3 + + + + + CheckBox4 + + + CheckBox4 + + + + + CheckBox5 + + + CheckBox5 + + + + + CheckBox6 + + + CheckBox6 + + + + + CheckBox7 + + + CheckBox7 + + + + + CheckBox8 + + + CheckBox8 + + + + + CheckBox9 + + + CheckBox9 + + + + + + + Frame3 + + + StyledPanel + + + Raised + + + + unnamed + + + + LineEdit1 + + + + + + New Item + + + + ListBox1 + + + + + + + + diff --git a/qtsharp/src/uicsharp/tests/form3.ui b/qtsharp/src/uicsharp/tests/form3.ui new file mode 100644 index 00000000..2e77c2bd --- /dev/null +++ b/qtsharp/src/uicsharp/tests/form3.ui @@ -0,0 +1,206 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 600 + 480 + + + + + unnamed + + + + Layout1 + + + + unnamed + + + + GroupBox1 + + + GroupBox1 + + + + unnamed + + + + CheckBox1 + + + CheckBox1 + + + + + CheckBox2 + + + CheckBox2 + + + + + CheckBox3 + + + CheckBox3 + + + + + CheckBox4 + + + CheckBox4 + + + + + CheckBox5 + + + CheckBox5 + + + + + CheckBox6 + + + CheckBox6 + + + + + CheckBox7 + + + CheckBox7 + + + + + CheckBox8 + + + CheckBox8 + + + + + CheckBox9 + + + CheckBox9 + + + + + + + GroupBox2 + + + GroupBox2 + + + + unnamed + + + + PushButton1 + + + PushButton1 + + + + + PushButton2 + + + PushButton2 + + + + + + + GroupBox3 + + + GroupBox3 + + + + unnamed + + + + PushButton3 + + + PushButton3 + + + + + PushButton4 + + + PushButton4 + + + + + + + + + Frame3 + + + StyledPanel + + + Raised + + + + unnamed + + + + LineEdit1 + + + + + + New Item + + + + ListBox1 + + + + + + + + diff --git a/qtsharp/src/uicsharp/tests/form4.ui b/qtsharp/src/uicsharp/tests/form4.ui new file mode 100644 index 00000000..bb18f36e --- /dev/null +++ b/qtsharp/src/uicsharp/tests/form4.ui @@ -0,0 +1,224 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 600 + 480 + + + + + unnamed + + + + Layout1 + + + + unnamed + + + + GroupBox1 + + + GroupBox1 + + + + unnamed + + + + CheckBox1 + + + CheckBox1 + + + + + CheckBox2 + + + CheckBox2 + + + + + CheckBox3 + + + CheckBox3 + + + + + CheckBox4 + + + CheckBox4 + + + + + CheckBox5 + + + CheckBox5 + + + + + CheckBox6 + + + CheckBox6 + + + + + CheckBox7 + + + CheckBox7 + + + + + CheckBox8 + + + CheckBox8 + + + + + CheckBox9 + + + CheckBox9 + + + + + + + GroupBox2 + + + GroupBox2 + + + + unnamed + + + + PushButton1 + + + PushButton1 + + + + + PushButton2 + + + PushButton2 + + + + + + + GroupBox3 + + + GroupBox3 + + + + unnamed + + + + PushButton3 + + + PushButton3 + + + + + Layout2 + + + + unnamed + + + + CheckBox10 + + + CheckBox10 + + + + + CheckBox11 + + + CheckBox11 + + + + + + + + + + + Frame3 + + + StyledPanel + + + Raised + + + + unnamed + + + + LineEdit1 + + + + + + New Item + + + + ListBox1 + + + + + + + + diff --git a/qtsharp/src/uicsharp/tests/form5.ui b/qtsharp/src/uicsharp/tests/form5.ui new file mode 100644 index 00000000..47cd7d91 --- /dev/null +++ b/qtsharp/src/uicsharp/tests/form5.ui @@ -0,0 +1,450 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 600 + 480 + + + + + + menubar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + toolBar + + + Tools + + + + + + + + + + + + + + + + fileNewAction + + + image0 + + + New + + + &New + + + Ctrl+N + + + + + fileOpenAction + + + image1 + + + Open + + + &Open... + + + Ctrl+O + + + + + fileSaveAction + + + image2 + + + Save + + + &Save + + + Ctrl+S + + + + + fileSaveAsAction + + + Save As + + + Save &As... + + + + + + + + filePrintAction + + + image3 + + + Print + + + &Print... + + + Ctrl+P + + + + + fileExitAction + + + Exit + + + E&xit + + + + + + + + editUndoAction + + + image4 + + + Undo + + + &Undo + + + Ctrl+Z + + + + + editRedoAction + + + image5 + + + Redo + + + &Redo + + + Ctrl+Y + + + + + editCutAction + + + image6 + + + Cut + + + &Cut + + + Ctrl+X + + + + + editCopyAction + + + image7 + + + Copy + + + C&opy + + + Ctrl+C + + + + + editPasteAction + + + image8 + + + Paste + + + &Paste + + + Ctrl+V + + + + + editFindAction + + + image9 + + + Find + + + &Find... + + + Ctrl+F + + + + + helpContentsAction + + + Contents + + + &Contents... + + + + + + + + helpIndexAction + + + Index + + + &Index... + + + + + + + + helpAboutAction + + + About + + + &About + + + + + + + + + 789cedd2b10ac2301405d03d5ff148b62056035241fc04c5511087f425a2432b681d44fc777ba329d6b47fe07d19dee50cc9904cd376b3229d896b6deb13131fed85b4bb95e57db75f3e8434869a93d3548e841c13d3fa5c79ecaad9d52404b540351e83caa833c6a03ad4798e41f5a86c30a816f510126ee94d14d52611fb8e2ad49070a4445ca4447ca4446ca444da07fecac7ffd2956ebe64f81ff4c873215e0583a9b0 + + + 789cad914d0ac2301085f739c5d0d915b11a140ae211149782b898448b2e5a41eb42c4bb9b9fa6a67644045f0299978f37134896c27ab5803413979aeaa3067da033a4bb6b59de36dbf95d245282d953182703910c41c3f254ed6d8da6c69193b5dada7c924b6fc9dac2c85b156c51b83eacfe41d0c89defc4dfa2dd7c37fc44b025a179043c4152a4b055f4365414ad0e8901fd94c1ae5e19441da9211c68e7f44098d3074d86019e70a0210c089958df7ffb31134fa13797a8 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022530543251d2e253d856405bffcbc54105b19c856360003103711c4b530b13082709340dc644310047193c1dcc424d314883958015846190b80ca24262a2721012087349964a030ba69c9c9303d403e9132087b68279388ecff4414193440948c32aa71d86470bb80863258a21b9a0eb0a7905a6b2e006d59a436 + + + 789c7d944973db461085effa152cf54d956a932089a55239c896572d96bcc4b253390033186ea2488aa416a7f2dfd3db0cbd44e6d340f8f8def43406209e1c742ecf4f3b074ff6d69b7a33711d37ae6f3a077e3b9f3ffcf5f71fffeced675987fecab293edffb6b77fb1e9b8ced9e2ba65c08c00baf2117e2f5c86d02d99e196b9d7ed963df53f2ab3c47789258fa7c26564688d4bf30f23673de113e6ac1719ae9459e27f4d5c893f17ae126f8d2be3ebc87d9dff4e3904f317ccfd5ef23f28b3c45f26963c7e510ec1fc9570157dd81857967f883c90cd8635f3208b8c0b6596f863e17a500fd597fe8744c35afc1be33aef8bff5ad9b5e637cc7993f7f346fca571637c1fb9d0f99f9543b07ab2df453ff9723d0551a1f3d791cb8170573904f3a5bf725034e66f133be96fa44c1246799e4a573495e461a29cfcbbc8e64f8d9df96564f5519e876a1019668975fda05c593d5c25d67a6f945d6ef3bdb08b3ed491eba1e467c6561fcf229bff4ad9b5c6c7ccf530fa8089bdf8136596703fb1f800c23ee5ff548e3e7a636f3c8ddc68bd8ab91926066596b05c5fe359c285b2cf8de5f7ed7296f050b825d6f74763dc1a0f227bcdbf60f679e29789353f5666093f4facfe857208e63f156e93df8bdc16c223e358ff28b2f939735b240eca2ce1678983f0a57208e6bf150ec96f8d83f127e650b084cf85e5a32fdf9d10b0c6c6e44835c9631dfd9ff235b618925ad1e89779278af5750df7681ea40316d8111eef876a79ad977ae773d8257ec8efead629fdeb3ca4ba9ae6e11fcdbbef6aa72b7934ef695702eddf4e631a13d2f4c73cd599e115f533a639bbc173e6788d0b5cf23a314fe915dee01a37df698bb77887f7f8805ff190e64c342fb59fe2333ca2e373d30b7c89aff035bec1634a9e904ef1417faf78866ff1fc275de03b7c4fa3a1553e50fd8f78a2ef0bfcf43fe973bcc4cff805bb74d6a3de0e31b37c9f561fe090c6583a19612e9d1dd179417db1575237191eeafb172b9cd22a7d409a7bcc8f0c4e68f01900ef44090db8547f4ee9a966456732445083078f779a8756dfdf52f19b1cd59c699254e31c46d0703f30b6fa5239a5d27faabc22b78409de838316bdd51fd1377730a531a12bd363c949aa3d936f1a6821e8fda566aef8fe011d612eba860569495a9196721ebe7d7ed0c30dac491b58d2bd21c116b634bf25ddd2fd9dd9f3f6efef7bff0111915e41 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54105b19c8563600020b13103711c4b530b1308270f5b082019251068344848c32b23808206494a1e23015890819653db8b81e44255c0659025d460fa70c6e3d78ec814b21b90d052422fb070540f50ebaf84196a9b5e6020011bc73cc + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54103b11c8563600020b13105719c4b530b1308270f5b0027acb28278201a64c221c4084136132ca7011885c225c06c91890542256193d98a198327a386570ea49449581bb4d2f114d0624a08c230c50fd4f5cb80da04cad351700f7fd8672 + + + 789cd3d7528808f055d0d2e72a2e492cc94c5648ce482c52d04a29cdcdad8c8eb5ade6523232520022630543251d2e253d856405bffcbc54105b19c856360003103711c6b53002abc40a90649491482ac92863955146d6822ca387474619c9301419a03842825819245bd064129513b1cb242602512216994430d44bc4904984c8c1a5e032897a3019a8144c26518f800c92715864d0ec81ab4dc4701b924fb0850e8a4cad351700fbd07ccb + + + 789c9d92cb0ac2301045f7f98aa1d915b1da8214c44f505c0ae26226b1e8a20a5a1722febb9924a5af58c19b40e77238a1842431ecb66b881371afb03a2b5027bc41ac1f65f9dc1f562f11a52998bd80793411d114146cae9723cfd2cc7266c395ea9aa75c15d74c65aad05c35d79c727215b91636f6d860c689f40910b4e92147d840b3be39d8416d877c860eb9af478d23919c4b8a7a0ed68eb628e4a04521c7fd46c07138e47448dbf1f32fc767e8d43735741af287d3ced83b782fc5075b18a5a5 + + + 789c7d92d10a82301486eff714c3dd49649984103d42d165105dcce3465d58507611d1bbb773d674aed93f85fd7efb183ab394ef771b9e66ecdecaf60c1c4ef2c6d3fad134cfc371fd62499e7373957c9e4c5832e5c0b7d78bc2b9307331a36055ae960556c05a16656e69e5aaa5355658c202965825566d62176b57b5a64da3f188c084841e0a29a5e831910ef8885e4854501922e8a6b923586a176a8e40051ec1e63b7d0267387c6738424775091d653f98565a858e26c110447107d1886350d4a1c41c3dea7864e87c37f3ce47fc3aee7cd5207ffe90f78a7d0007c6c175 + + + 789cb5d5594f1b491007f0773e8545bda1d53ff81a7bb4da07830103b603b92059edc34cf78c0ff0812f3051befb5677554f56c24428d2aa78e0a7aeaeea6be0dd41e9f6aa573a78b7b75c25ab91299961b2281dd8f564b2fdfb9fbfbeefed572a25fe291f46a5cafe1f7bfbd7ab9229f567d3cc81fa0caa945d785f78c72ebc2f9dabb10bef9e73ade2c21913e77ae2c28f2fc48d6a947ab7c4b169d6bc8f9ca3aa0b3fbfaf4e35ff4c5cccdf8813db34de1def34e4c3881b3cc38fb7d5a918f78525ff46dcaca9576a23a627715cd3f53e8a131b7b63edecba69fd8d3af41b1496fa6d7153f78f86b8a86f0bcbfe9ec5493d16cfc5695dfad34c6d651ca9f7cffdbd173743fd441cd64f0f85a5fe489c6a3fd4d5613c0d4eeade43b189747c1b2ce3683abbeebadf5a702ae343716c743d53313f1febc7bfa843bf1371581f9d06ebf8581df257e2b01eba57675a5fea19177e7c109cfa712271aceba58938b13a6ec4a13fba62ee27f53fa9b51fe5c1ba7f7f1f71cd85f7545cdcf73ad8f8ef137762de9fd4ef898b7e51b0d63f52877e65b10de3c785657eacced4fe7b77b763236fab36fa3e1ec5a9d5f341b0e4d3526c42bd4ab0eee7505cf4fb28ce1aea6fc146fa7f76e6d3e115fafa5d7112cebf254eeb328e6a70967b9f8b437fba13db4ceb2fc5453f7f5ffcfac2795f046bbd0fe2a2df486c42bd2bb18dd46375e89f89b99fccf7ef2dadbbf0eea8add6bf16db4cbd1067b9de8fafc7b7a1ef13cf6213e50defadd846b9acff569c3574fe833ad7fa5fc57943cfdb9f9f894cd8cf93982748fdb9386f64dee4df97c978ff52ef4c9d69ff9938cff53cfdf7ec5627f5ae576f8fdfcf0721410ac391c222fb753e720c30c408638e3bdcf31c7a3d9fb3279862c631c70316586285f5ae1e727fd8e091f3e678c216cf68e108c768e3e4957ccb2b39e5fc337470ce71814b74d143ffe59ae4ff01ae7825d7f8c0753fe213d7ff8c2ffcfb0deccefc016ef115df380e51460555d4504784069aafe48f798f87885126a04a4409a564c8be92bfc115655cb94c395a34409d8634a231afe7c58ee5ef35d7bae3dc2eddd384a634a339c7032d90efcce7bba225ad38525aa3461b7ae478da75037a5f2758d196525ec93359aedde23882a563ae95edc8cf90529b4ee894c6bcf2844f66e2ce1239cf9afc7755c5fbc9b8479fdabcc71b3aa38ee4d039d7b9a04b1ecb5ebe677ea1964712ead2f9cf8aac1ecfd10a6f79ffdc7b4d7dee92bcfd7be1bd5ff29ccedbbf2f90dbfbfffefdfef873ef5fce01d04a + + + + + fileNewAction + activated() + Form1 + fileNew() + + + fileOpenAction + activated() + Form1 + fileOpen() + + + fileSaveAction + activated() + Form1 + fileSave() + + + fileSaveAsAction + activated() + Form1 + fileSaveAs() + + + filePrintAction + activated() + Form1 + filePrint() + + + fileExitAction + activated() + Form1 + fileExit() + + + editUndoAction + activated() + Form1 + editUndo() + + + editRedoAction + activated() + Form1 + editRedo() + + + editCutAction + activated() + Form1 + editCut() + + + editCopyAction + activated() + Form1 + editCopy() + + + editPasteAction + activated() + Form1 + editPaste() + + + editFindAction + activated() + Form1 + editFind() + + + helpIndexAction + activated() + Form1 + helpIndex() + + + helpContentsAction + activated() + Form1 + helpContents() + + + helpAboutAction + activated() + Form1 + helpAbout() + + + + fileNew() + fileOpen() + fileSave() + fileSaveAs() + filePrint() + fileExit() + editUndo() + editRedo() + editCut() + editCopy() + editPaste() + editFind() + helpIndex() + helpContents() + helpAbout() + + + diff --git a/qtsharp/src/uicsharp/tests/form6.ui b/qtsharp/src/uicsharp/tests/form6.ui new file mode 100644 index 00000000..7e67784c --- /dev/null +++ b/qtsharp/src/uicsharp/tests/form6.ui @@ -0,0 +1,167 @@ + +MyDialog + + + MyDialog + + + + 0 + 0 + 594 + 470 + + + + true + + + + unnamed + + + + Splitter1 + + + Vertical + + + + + Column 1 + + + true + + + true + + + + + New Item + + + + + + + ListView1 + + + + + + New Item + + + image0 + + + + IconView1 + + + + + + Layout5 + + + + unnamed + + + 0 + + + 6 + + + + buttonOk + + + &OK + + + + + + true + + + true + + + + + buttonCancel + + + &Cancel + + + + + + true + + + + + buttonHelp + + + &Help + + + F1 + + + true + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + + + + + 789c7dd3c14ac4301405d07dbf22f4ed8a743ace0882f8098a4b415ca4c92475310a3a2e44fc777393a64df2dabed7452e1c6eb368778d787e7a10cdaefabac8cb9b126a909fa2d1dfe7f3cfcbebfd6f551fae857bf69dd8d75755dd0a251e3fde4f38933b53e707b10f518df18478e8b08803e271c21af1e6168b681165e7f688681055874594211a13a242347efc95da9688dad58946ca75e58d6be9e5ba0a46e92d351a952aa2d3b2495459989849f949546632b5688c32c65aeadde428ed0132da23306e4c5863f1ba017042738f6fc138a5fdbd0a135b2203ec7bca7b723022e23d19628601cb0d6f59e8612dce0c2b2641658fb5650b375a0795a2c2b8afcaaba4859ba852c4cda4364da9964daed64caa60c2475d9a590503c54d54d1d0a2096abb67541bf79955fc0debbfbbea1f81b84f0e + + + + + buttonOk + clicked() + MyDialog + accept() + + + buttonCancel + clicked() + MyDialog + reject() + + + + diff --git a/qtsharp/src/uicsharp/tests/form7.ui b/qtsharp/src/uicsharp/tests/form7.ui new file mode 100644 index 00000000..6cf51c06 --- /dev/null +++ b/qtsharp/src/uicsharp/tests/form7.ui @@ -0,0 +1,339 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 600 + 480 + + + + + GroupBox3 + + + + 382 + 12 + 206 + 150 + + + + GroupBox3 + + + + PushButton3 + + + + 11 + 30 + 82 + 26 + + + + PushButton3 + + + + + CheckBox10 + + + + 100 + 21 + 94 + 19 + + + + CheckBox10 + + + + + CheckBox11 + + + + 100 + 46 + 94 + 19 + + + + CheckBox11 + + + + + + GroupBox1 + + + + 12 + 12 + 202 + 150 + + + + GroupBox1 + + + + CheckBox1 + + + + 11 + 20 + 87 + 19 + + + + CheckBox1 + + + + + CheckBox2 + + + + 11 + 45 + 87 + 19 + + + + CheckBox2 + + + + + CheckBox3 + + + + 11 + 70 + 87 + 19 + + + + CheckBox3 + + + + + CheckBox4 + + + + 11 + 95 + 87 + 19 + + + + CheckBox4 + + + + + CheckBox5 + + + + 104 + 20 + 87 + 19 + + + + CheckBox5 + + + + + CheckBox6 + + + + 104 + 70 + 87 + 19 + + + + CheckBox6 + + + + + CheckBox7 + + + + 104 + 95 + 87 + 19 + + + + CheckBox7 + + + + + CheckBox8 + + + + 104 + 120 + 87 + 19 + + + + CheckBox8 + + + + + CheckBox9 + + + + 11 + 120 + 87 + 19 + + + + CheckBox9 + + + + + + GroupBox2 + + + + 220 + 12 + 156 + 150 + + + + GroupBox2 + + + + PushButton1 + + + + 11 + 20 + 134 + 26 + + + + PushButton1 + + + + + PushButton2 + + + + 11 + 52 + 134 + 26 + + + + PushButton2 + + + + + + Frame3 + + + + 11 + 169 + 578 + 300 + + + + StyledPanel + + + Raised + + + + LineEdit1 + + + + 11 + 139 + 275 + 22 + + + + + + + New Item + + + + ListBox1 + + + + 292 + 11 + 275 + 278 + + + + + + + diff --git a/qtsharp/src/uicsharp/tests/form8.ui b/qtsharp/src/uicsharp/tests/form8.ui new file mode 100644 index 00000000..09f20bef --- /dev/null +++ b/qtsharp/src/uicsharp/tests/form8.ui @@ -0,0 +1,75 @@ + +Form1 + + + Form1 + + + + 0 + 0 + 600 + 480 + + + + + PushButton1 + + + + 100 + 70 + 161 + 51 + + + + PushButton1 + + + + + RadioButton1 + + + + 100 + 130 + 96 + 20 + + + + RadioButton1 + + + + + CheckBox1 + + + + 60 + 170 + 131 + 41 + + + + + Century Schoolbook l [Urw] + 34 + 1 + 1 + 1 + 1 + + + + CheckBox1 + + + + + diff --git a/qtsharp/src/uicsharp/tests/form9.ui b/qtsharp/src/uicsharp/tests/form9.ui new file mode 100644 index 00000000..b1e61488 --- /dev/null +++ b/qtsharp/src/uicsharp/tests/form9.ui @@ -0,0 +1,211 @@ + +MyDialog1 + + + MyDialog1 + + + + 0 + 0 + 528 + 368 + + + + true + + + + unnamed + + + 11 + + + 6 + + + + tabWidget + + + + Widget8 + + + Tab + + + + ComboBox1 + + + + 27 + 75 + 61 + 21 + + + + + + + New Item + + + + ListBox1 + + + + 187 + 65 + 88 + 60 + + + + + + TextLabel1 + + + + 77 + 145 + 131 + 41 + + + + TextLabel1 + + + + + + Widget9 + + + Tab + + + + unnamed + + + + + New Item + + + + ListBox2 + + + + + TextEdit1 + + + + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + buttonHelp + + + &Help + + + F1 + + + true + + + + + Horizontal Spacing2 + + + Horizontal + + + Expanding + + + + 20 + 20 + + + + + + buttonOk + + + &OK + + + + + + true + + + true + + + + + buttonCancel + + + &Cancel + + + + + + true + + + + + + + + + buttonOk + clicked() + MyDialog1 + accept() + + + buttonCancel + clicked() + MyDialog1 + reject() + + + + diff --git a/qtsharp/src/uicsharp/uicsharp.build b/qtsharp/src/uicsharp/uicsharp.build new file mode 100644 index 00000000..d4bf8f5f --- /dev/null +++ b/qtsharp/src/uicsharp/uicsharp.build @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/qtsharp/src/uicsharp/uicsharp.cs b/qtsharp/src/uicsharp/uicsharp.cs new file mode 100644 index 00000000..a2553d23 --- /dev/null +++ b/qtsharp/src/uicsharp/uicsharp.cs @@ -0,0 +1,934 @@ +// A Qt compatible UI to C# generator. +// +// Copyright (C) 2002 Joseph Wenninger (jowenn@kde.org) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation. +// +// MODIFICATION: ONLY VERSION 2 IS VALID +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +using System; +using System.IO; +using System.Xml; +using System.Text; +using System.Collections; +using System.Reflection; +using Qt; + +namespace QtSharp { + + enum ElementType{LayoutType,WidgetType,PropertyType}; + + + public class Generator { + + void Usage () + { + Console.Write ( + "generator -f file.ui -m\n\n" + + " -f || --file file.ui The file to parse.\n"+ + " -m Create test main.\n\n" ); + } + + public static void Main (string[] args) + { + Generator gen = new Generator (args); + } + + + + XmlTextReader xtr; + TextWriter writer; + Hashtable fields; + String uifile; + bool createMain; + String generatedClass; + + Assembly qtAssembly; + + + public Generator (string[] args) + { + + + try { + String []dummyargs=new String[0]; + QApplication dummyapp=new QApplication(dummyargs,false); + qtAssembly=Assembly.GetAssembly(dummyapp.GetType()); +// qtAssembly=Assembly.Load("Qt.dll"); + Console.WriteLine("CodeBase="+qtAssembly.CodeBase); + } + catch (Exception e) { + Console.WriteLine(e.Message); + Console.WriteLine("exiting"); + return; + } + + uifile = null; + string outfile = null; + createMain=false; + generatedClass=null; + + int argc = args.Length; + for (int i = 0; i < argc; i++) { + string arg = args[i]; + if (arg.StartsWith("-") || arg.StartsWith("/")) { + switch (arg) { + case "-f": case "--file": + if ((i + 1) >= argc) { + Usage(); + return; + } + uifile = args[++i]; + continue; + case "-m": createMain=true; break; + default: + Usage (); + return; + } + } + } + if (uifile == null) { + Usage(); + return; + } + if (!uifile.EndsWith(".ui")) + { + Usage(); + return; + } + + if (!File.Exists (uifile)) { + Console.WriteLine ("\n No UI file at {0}\n", uifile); + return; + } + + outfile=uifile.Substring(0,uifile.Length-3); + outfile+=".cs"; + Console.WriteLine ("\n Converting {0} ==> {1}\n",uifile,outfile); + + + writer = new StreamWriter(outfile, false, new ASCIIEncoding()); + + writer.WriteLine("//**********************************************************************"); + writer.WriteLine("// This file has been generated by the uicsharp User Interface compiler"); + writer.WriteLine("// the input file has been: "+uifile); + writer.WriteLine("//**********************************************************************"); + writer.WriteLine("\nusing System;\nusing Qt;\n"); + fields= new Hashtable(); + createClass(); + writer.Flush(); + writer.Close(); + + } + + + XmlDocument uiDoc; + XmlElement widgetElement; + XmlElement menubarElement; + XmlElement toolbarsElement; + XmlElement actionsElement; + XmlElement imagesElement; + String className; + String defLayoutSpacing; + String defLayoutMargin; + String buddyList; + + + public void createClass () + { + menubarElement=null; + toolbarsElement=null; + actionsElement=null; + imagesElement=null; + defLayoutSpacing="1"; + defLayoutMargin="1"; + String classname=null; + String ancestor=null; + buddyList=""; + uiDoc=new XmlDocument(); + uiDoc.Load(uifile); + Console.WriteLine(uiDoc.DocumentElement.Name); + XmlElement dummy=uiDoc.DocumentElement.FirstChild as XmlElement; + while (dummy!=null) + { + Console.WriteLine("not null"); + switch (dummy.Name) { + case "class": className=dummy.InnerText; + break; + case "widget": widgetElement=dummy; + Console.WriteLine("Widget element has been found"); + break; + case "menubar": menubarElement=dummy; + break; + case "toolbars": toolbarsElement=dummy; + break; + case "actions": actionsElement=dummy; + break; + case "images": imagesElement=dummy; + break; + case "layoutdefaults": defLayoutSpacing=dummy.GetAttribute("spacing"); + defLayoutMargin=dummy.GetAttribute("margin"); + break; + } + dummy=dummy.NextSibling as XmlElement; + } + Console.WriteLine("class should be named: "+className); + writer.WriteLine("public class "+className+" : "+widgetElement.GetAttribute("class")+"\n{"); + addSubMembers(widgetElement); + addImagesMembers(); + addMenuBarMembers(); + addToolBarMembers(); + addActionMembers(); + + createConstructor(); +// setupSignalsSlots(); + + if (createMain) writeMain(); + writer.WriteLine("}"); + } + + + private void addImagesMembers() + { + if (imagesElement==null) return; + writer.WriteLine("\t//Images member fields"); + foreach (XmlNode node in imagesElement.ChildNodes) { + XmlElement el=node as XmlElement; + writer.WriteLine("\tString[] "+el.GetAttribute("name")+"_data={\"22 22 7 1\","+ + "\". c None\",\"# c #000000\",\"b c #2e2e2e\",\"c c #5c5c5c\","+ + "\"d c #878787\",\"e c #c2c2c2\",\"a c #ffffff\","+ + "\"......................\",\"....##########........\","+ +"\"....#aaaaaaa#b#.......\",\"....#aaaaaaa#cb#......\",\"....#aaaaaaa#dcb#.....\","+ +"\"....#aaaaaaa#edcb#....\",\"....#aaaaaaa#aedcb#...\",\"....#aaaaaaa#######...\","+ +"\"....#aaaaaaaaaaaaa#...\",\"....#aaaaaaaaaaaaa#...\",\"....#aaaaaaaaaaaaa#...\","+ +"\"....#aaaaaaaaaaaaa#...\",\"....#aaaaaaaaaaaaa#...\",\"....#aaaaaaaaaaaaa#...\","+ +"\"....#aaaaaaaaaaaaa#...\",\"....#aaaaaaaaaaaaa#...\",\"....#aaaaaaaaaaaaa#...\","+ +"\"....#aaaaaaaaaaaaa#...\",\"....#aaaaaaaaaaaaa#...\",\"....###############...\","+ +"\"......................\",\"......................\"};"); + writer.WriteLine("\tQPixmap {0};",el.GetAttribute("name")); + + } + } + + private void addMenuBarMembers() + { + if (menubarElement==null) return; + writer.WriteLine("\t//Menubar member fields"); + writer.WriteLine("\t QMenuBar menubar;"); + foreach (XmlNode node in menubarElement.ChildNodes) { + XmlElement el=node as XmlElement; + if (el.Name=="item") { + writer.WriteLine("\tpublic QPopupMenu {0};",el.GetAttribute("name")); + } + } + } + + private void addActionMembers() + { + if (actionsElement==null) return; + writer.WriteLine("\t//Action member fields"); + foreach (XmlNode node in actionsElement.ChildNodes) { + XmlElement el=node as XmlElement; + if (el.Name=="action") { + writer.WriteLine("\tpublic QAction {0};",getName(el)); + } + } + } + + private void addToolBarMembers() + { + if (toolbarsElement==null) return; + writer.WriteLine("\t//Toolbar member fields"); + foreach (XmlNode node in toolbarsElement.ChildNodes) { + XmlElement el=node as XmlElement; + if (el.Name=="toolbar") { + writer.WriteLine("\tpublic QToolBar {0};",getName(el)); + } + } + } + + + + private void addSubMembers(XmlElement widget) + { + String [] membertypes={"widget","vbox","hbox","grid"}; + foreach (String membertype in membertypes) { + XmlNodeList nl=widget.GetElementsByTagName(membertype); + foreach (XmlNode submembernode in nl) { + if (submembernode.ParentNode!=widget) continue; // I think this is a workaround for a classlib bug + XmlElement submember=submembernode as XmlElement; + addSubMembers(submember); + if (submember.GetAttribute("class")=="QLayoutWidget") continue; //they are private + String membername=getName(submember); + if (membername==String.Empty) continue; + writer.WriteLine("\t"+submember.GetAttribute("class")+" "+membername+";"); + Console.WriteLine((submember as XmlElement).Name); + } + } + } + + private String getName(XmlElement element) + { + if (element.GetAttribute("uicsharp_name")!=String.Empty) + return element.GetAttribute("uicsharp_name"); + foreach(XmlNode property in element.ChildNodes) { + //if (property.ParentNode!=element) continue ;//see comment in addSubMembers + XmlElement prop=property as XmlElement; + if (prop.Name!="property") continue; + if (prop.GetAttribute("name")=="name") { + return (prop.FirstChild.InnerXml=="unnamed")?String.Empty:prop.FirstChild.InnerXml; + } + } + return String.Empty; + } + + + private void setupTabOrder() + { + foreach (XmlNode node in uiDoc.DocumentElement.ChildNodes) { + XmlElement element=node as XmlElement; + if (element.Name!="tabstops") continue; + writer.WriteLine("\n\t\t// tab stop order"); + foreach( XmlNode tsnode in element.ChildNodes) { + XmlElement ts=tsnode as XmlElement; + if (ts.NextSibling==null) break; + XmlElement ts1=ts.NextSibling as XmlElement; + writer.WriteLine("\t\tSetTabOrder({0},{1});",ts.InnerText,ts1.InnerText); + } + break; + } + + } + + private void setupConnections() + { + return; + foreach (XmlNode node in uiDoc.DocumentElement.ChildNodes) { + XmlElement element=node as XmlElement; + if (element.Name!="connections") continue; + writer.WriteLine("\n\t\t// setting up signal / slot connections"); + foreach( XmlNode connnode in element.ChildNodes) { + XmlElement conn=connnode as XmlElement; + + XmlElement tmp=conn.FirstChild as XmlElement; + String sender=tmp.InnerText; + sender=(sender==className)?"this":sender; + tmp=tmp.NextSibling as XmlElement; + String signal=tmp.InnerText; + + tmp=tmp.NextSibling as XmlElement; + String receiver=tmp.InnerText; + receiver=(receiver==className)?"this":receiver; + + tmp=tmp.NextSibling as XmlElement; + String slot=tmp.InnerText; + + writer.WriteLine("\t\tQObject.Connect({0},SIGNAL(\"{1}\"),{2},SLOT(\"{3}\"));", + sender,signal,receiver,slot); + } + break; + } + + } + + + private void createConstructor() + { + //Later handle non qwidgets better (dialog,....) + writer.WriteLine("\n\tpublic "+className+"(QWidget parent, String name) :base(parent, name) {"); + writer.WriteLine("\t\tif (name==null) SetName(\""+className+"\");"); + setupImages(); + setupActions(); + setupToolBars(); + setupMenuBar(); + constructEverything(); + setupConnections(); + setupTabOrder(); + setProperties(widgetElement); + + if (buddyList!=String.Empty) writer.WriteLine("\n\t\t//link buddies\n"+buddyList); + +// writer.WriteLine("\t\tinit();\n\t}"); + writer.WriteLine("\n\t}"); + } + + + private void setupImages() + { + if (imagesElement==null) return; + writer.WriteLine("\t//images"); + foreach (XmlNode node in imagesElement.ChildNodes) { + XmlElement el=node as XmlElement; + writer.WriteLine("\t\t{0}=new QPixmap({1}_data);", + el.GetAttribute("name"),el.GetAttribute("name")); + } + } + + private void setupActions() + { + if (actionsElement==null) return; + writer.WriteLine("\t//actions"); + foreach (XmlNode aNode in actionsElement.ChildNodes) { + XmlElement action=aNode as XmlElement; + if (action.Name!="action") continue; + writer.WriteLine("\t\t{0}= new QAction(this,\"{1}\");",getName(action),getName(action)); + foreach (XmlNode pNode in action.ChildNodes) { + XmlElement prop=pNode as XmlElement; + if (prop.Name!="property") continue; + if (prop.GetAttribute("name")=="name") continue; + writer.WriteLine(generateSetProperty(getName(action),"",prop)); + } + } + } + + + private void setupMenuBar() + { + if (menubarElement==null) return; + writer.WriteLine("\t//menubar"); + String barname=getName(menubarElement); + writer.WriteLine("\t\t{0}=new QMenuBar(this,\"{1}\");",barname,barname); + int count=0; + foreach (XmlNode mNode in menubarElement.ChildNodes) { + XmlElement item=mNode as XmlElement; + if (item.Name!="item") continue; + String submenu_name=item.GetAttribute("name"); + String submenu_text=stringify(item.GetAttribute("text")); + writer.WriteLine("\t\t{0}=new QPopupMenu(this);",submenu_name); + + foreach (XmlNode node in item.ChildNodes) { + XmlElement element=node as XmlElement; + if ((element.Name=="property") && (element.GetAttribute("name")!="name")) generateSetProperty(barname,"",element); + else if (element.Name=="separator") writer.WriteLine("\t\t{0}.InsertSeparator();",submenu_name); + else if (element.Name=="action") writer.WriteLine("\t\t{0}.AddTo({1});",element.GetAttribute("name"),submenu_name); + } + writer.WriteLine("\t\t{0}.InsertItem(\"{1}\",{2},{3});",barname, + submenu_text,submenu_name,count.ToString()); + count++; + + } + } + + private void setupToolBars() + { + if (toolbarsElement==null) return; + writer.WriteLine("\t//toolbars"); + foreach (XmlNode tNode in toolbarsElement.ChildNodes) { + XmlElement toolbar=tNode as XmlElement; + if (toolbar.Name!="toolbar") continue; + String varname=getName(toolbar); + writer.WriteLine("\t\t{0}=new QToolBar(this,\"{1}\");",varname,varname); + writer.WriteLine("\t\tthis.AddDockWindow({0},(Qt.Dock){1},false);",varname,toolbar.GetAttribute("dock")); + foreach (XmlNode node in toolbar.ChildNodes) { + XmlElement element=node as XmlElement; + if ((element.Name=="property") && (element.GetAttribute("name")!="name")) generateSetProperty(varname,"",element); + else if (element.Name=="separator") writer.WriteLine("\t\t{0}.AddSeparator();",varname); + else if (element.Name=="action") writer.WriteLine("\t\t{0}.AddTo({1});",element.GetAttribute("name"),varname); + } + } + } + + private ElementType elementType(XmlElement el) + { + switch (el.Name) { + case "widget": return (el.GetAttribute("class")=="QLayoutWidget")? + ElementType.LayoutType:ElementType.WidgetType; + case "vbox": return ElementType.LayoutType; + case "hbox": return ElementType.LayoutType; + case "grid": return ElementType.LayoutType; + case "spacer": return ElementType.LayoutType; + default: return ElementType.PropertyType; + } + } + + private void constructEverything() + { + foreach (XmlNode subNode in widgetElement.ChildNodes) + { + XmlElement obj=subNode as XmlElement; + switch (elementType(obj)) { + case ElementType.WidgetType: constructChild("this",obj,true); + widgetAdd("this",widgetElement,obj); + break; + case ElementType.LayoutType: constructChild("this",obj,true); + break; + default: break; + } + } + + } + + + private void widgetAdd(String parname,XmlElement par, XmlElement obj) + { + if (par==widgetElement) { + if (par.GetAttribute("class")=="QWizard") + { + writer.WriteLine("\t\tAddPage("+getName(obj)+", "+getName(obj)+".Caption());"); + } + } + else { + if (elementType(par)==ElementType.LayoutType) { + if (getLayoutType(par)=="grid") { + writer.WriteLine("\t\t"+getName(par)+insertIntoGrid("Widget",getName(obj),obj)); + } + else writer.WriteLine("\t\t"+parname+".Add("+getName(obj)+");"); + } + else switch(par.GetAttribute("class")) { + case "QTabWidget": writer.WriteLine("\t\t"+parname+".InsertTab("+getName(obj)+",\"\");"); + break; + default: break; + } + } + } + + + private String getLayoutType(XmlElement el) + { + String tmp=el.Name; + if (tmp=="widget") tmp=el.GetAttribute("uicsharp_type"); + return tmp; + } + + + private String insertIntoGrid(String what, String name, XmlElement obj) + { + String col,row,colspan,rowspan,endcol,endrow; + + int tmpcols=int.Parse( + (obj.GetAttribute("column")==String.Empty)? + "0":obj.GetAttribute("column"))+ + int.Parse((obj.GetAttribute("colspan")==String.Empty)? + "1":obj.GetAttribute("colspan"))-1; + + int tmprows=int.Parse( + (obj.GetAttribute("row")==String.Empty)? + "0":obj.GetAttribute("row"))+ + int.Parse((obj.GetAttribute("rowspan")==String.Empty)? + "1":obj.GetAttribute("rowspan"))-1; + + col=obj.GetAttribute("column"); + row=obj.GetAttribute("row"); + endcol=tmpcols.ToString(); + endrow=tmprows.ToString(); + if ((col==endcol) && (row==endrow)) + { + return ".Add"+what+"( "+name+", "+row + ", "+col +");"; + } + else + { + what=(what=="Item")?"":what; + return ".AddMultiCell"+what+"( "+name+", "+row+","+endrow+", "+col+", "+endcol+");"; + } + + } + + private void layoutAdd(XmlElement par, XmlElement obj) + { + String what=(getLayoutType(obj)=="spacer")?"Item":"Layout"; + if (getLayoutType(par)!="grid"){ + writer.WriteLine("\t\t"+getName(par)+".Add"+what+"("+getName(obj)+");"); + } + else + { + writer.WriteLine("\t\t"+getName(par)+insertIntoGrid(what,getName(obj),obj)); + } + } + + + void createSpacer(String name, XmlElement obj) { + String orientation; + String sizeType; + String shx,shy; + orientation=null; + sizeType=null; + shx=null; + shy=null; + foreach (XmlNode node in obj.ChildNodes) { + XmlElement el=node as XmlElement; + if (el.Name!="property") continue; + switch (el.GetAttribute("name")) { + case "orientation": orientation=(((el.FirstChild as XmlElement).InnerText).ToUpper()); + break; + case "sizeType" : sizeType=(((el.FirstChild as XmlElement).InnerText)); + break; + case "sizeHint" : foreach (XmlNode shn in (el.FirstChild as XmlElement).ChildNodes) { + XmlElement she=shn as XmlElement; + switch (she.Name) { + case "width": shx=she.InnerText; + break; + case "height": shy=she.InnerText; + break; + } + } + break; + } + } + writer.WriteLine("\t\tQSpacerItem {0}=new QSpacerItem({1},{2},{3},{4});", + name,shx,shy, + (orientation=="VERTICAL")?"Qt.QSizePolicy.SizeType.Minimum":("Qt.QSizePolicy.SizeType."+toPascal(sizeType)), + (orientation!="VERTICAL")?"Qt.QSizePolicy.SizeType.Minimum":("Qt.QSizePolicy.SizeType."+toPascal(sizeType))); + } + + int layoutcnt=1; + + XmlElement createLayout(String parent, XmlElement obj, ref String name, bool privateLayout) + { + name = ((name==String.Empty)?getName(obj):name); + if (name==String.Empty) + { + name="my_internal_Layout"+layoutcnt; + privateLayout=true; + layoutcnt++; + } + + if ((privateLayout) && (obj.Name!="widget")) + obj.SetAttribute("uicsharp_name",name); + + if ((obj.Name!="widget") && (obj.GetAttribute("uicsharp_parent")!=String.Empty)) + parent=obj.GetAttribute("uicsharp_parent"); + + switch (obj.Name) { + case "vbox": writer.WriteLine("\t\t"+(privateLayout?"QVBoxLayout ":"")+name+"= new QVBoxLayout("+ + ((parent==null)?"":parent)+");"); + setupLayout(name,obj); + return obj; + case "hbox": writer.WriteLine("\t\t"+(privateLayout?"QHBoxLayout ":"")+name+"= new QHBoxLayout("+ + ((parent==null)?"":parent)+");"); + setupLayout(name,obj); + return obj; + case "spacer": createSpacer(name,obj); + return obj; + case "widget": + foreach (XmlNode node in obj.ChildNodes) + { + if (elementType(node as XmlElement)==ElementType.LayoutType) { + (node as XmlElement).SetAttribute("uicsharp_margin","0"); + XmlElement el=createLayout(parent,node as XmlElement,ref name,true); + obj.SetAttribute("uicsharp_name",getName(el)); + obj.SetAttribute("uicsharp_type",el.Name); + return el; + } + } + return null; + case "grid": + int cols=1; + int rows=1; + foreach (XmlNode node in obj.ChildNodes){ + XmlElement elem=node as XmlElement; + ElementType etype=elementType(elem); + if ((etype==ElementType.LayoutType) || + (etype==ElementType.WidgetType)) { + Console.WriteLine("Grid size calculation group"); + int tmpcols=int.Parse( + (elem.GetAttribute("column")==String.Empty)? + "0":elem.GetAttribute("column"))+ + int.Parse((elem.GetAttribute("colspan")==String.Empty)? + "1":elem.GetAttribute("colspan"))-1; + + int tmprows=int.Parse( + (elem.GetAttribute("row")==String.Empty)? + "0":elem.GetAttribute("row"))+ + int.Parse((elem.GetAttribute("rowspan")==String.Empty)? + "1":elem.GetAttribute("rowspan"))-1; + + cols=(tmpcolsENUM TRANSLATION<"); + } + + break; + case "iconset" : sc += "new QIconSet("+value.InnerText+")"; + break; + case "bool" : sc += value.InnerText; + break; + case "font": String fvn=varName+"_Font"; + sc="\t\tQFont "+fvn+" = ("+varName+".Font());\n"; + foreach(XmlNode fn in value.ChildNodes) { + XmlElement fe=fn as XmlElement; + switch (fe.Name) { + case "pointsize": + sc+="\t\t"+fvn+".SetPointSize("+fe.InnerText+");\n"; + break; + case "bold": + sc+="\t\t"+fvn+".SetBold("+toBool(fe.InnerText)+");\n"; + break; + case "italic": + sc+="\t\t"+fvn+".SetItalic("+toBool(fe.InnerText)+");\n"; + break; + case "underline": + sc+="\t\t"+fvn+".SetUnderline("+toBool(fe.InnerText)+");\n"; + break; + case "strikeout": + sc+="\t\t"+fvn+".SetStrikeOut("+toBool(fe.InnerText)+");\n"; + break; + } + } + sc +="\t\t"+varName+".SetFont("+fvn+");"; + return sc; + default: Console.WriteLine("Not yet supported property type : "+value.Name); + return String.Empty; + } + + sc += " )"; + return "\t\t"+varName+"."+sc+";"; + + } + + + private void setProperties(XmlElement obj) + { + String myWidgetClass=null; + XmlElement dummy=null; + + widgetType(obj, ref myWidgetClass, ref dummy,false); + + foreach (XmlNode node in obj.ChildNodes) { + XmlElement prop = node as XmlElement; + if (prop.Name!="property") continue; + if (prop.GetAttribute("name")=="buddy") { + buddyList+="\n"+generateSetProperty(getName(obj),myWidgetClass,prop); + continue; + } + if (prop.GetAttribute("name")=="name") continue; + String str=generateSetProperty((obj==widgetElement)?"this":getName(obj),myWidgetClass,prop); + if (str!=String.Empty) writer.WriteLine(str); + } + } + + + private void constructChild(String parent,XmlElement obj,bool mainLayout) + { + ElementType mytype=elementType(obj); + String myname=getName(obj); + XmlElement lobj=null; + switch (mytype){ + case ElementType.WidgetType: + String widgettype=null; + XmlElement tmpobj=null; + widgetType(obj,ref widgettype,ref tmpobj,true); + mainLayout=true; + XmlElement origNode=obj; + if (tmpobj!=null) { + mytype=ElementType.LayoutType; + lobj=obj; + obj=tmpobj; + mainLayout=false; + } + writer.WriteLine("\t\t"+myname+"=new "+widgettype + +"("+parent+", \""+myname+"\");"); + specialInit(origNode); + setProperties(origNode); + parent=myname; + break; + case ElementType.LayoutType: + lobj=obj; + myname=""; + obj=createLayout(mainLayout?parent:null,obj,ref myname,false); + mainLayout=false; + break; + default: return; + } + + foreach (XmlNode subNode in obj.ChildNodes) + { + XmlElement subObj=subNode as XmlElement; + switch (elementType(subObj)) { + case ElementType.WidgetType: constructChild(parent,subObj,mainLayout); + widgetAdd(myname,obj,subObj); + break; + case ElementType.LayoutType: constructChild(parent,subObj,mainLayout); + if (mytype==ElementType.LayoutType) layoutAdd(lobj,subObj); + break; + default: break; + } + } + + } + + + private void writeMain() + { + writer.WriteLine("\tpublic static void Main (String[] args)\n"+ + "\t{\n"+ + "\t\tQApplication app = new QApplication (args);\n"+ + "\t\t"+className+" test = new "+className+" (null,\"\");\n"+ + "\t\tapp.SetMainWidget (test);\n"+ + "\t\ttest.Show ();\n"+ + "\t\tapp.Exec ();\n"+ + "\t}"); + } + } +} -- cgit v1.2.1