From 5d096f616b2e2481c4f582a8886a2afa64412bad Mon Sep 17 00:00:00 2001 From: Alex Corrado Date: Tue, 15 Nov 2011 15:21:25 -0500 Subject: [PATCH] Commit last qt bindings work from the summer --- qt/Makefile.am | 4 +++- qt/demos/hello.cs | 2 ++ qt/qt-gui-filters.xml | 16 +++++++++++++++- qt/qt-gui.h | 1 + qt/src/QFlags.cs | 13 +++++++++++++ qt/src/QPoint.cs | 20 ++++++++++++++++++++ 6 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 qt/src/QFlags.cs create mode 100644 qt/src/QPoint.cs diff --git a/qt/Makefile.am b/qt/Makefile.am index f229f2f6..a00b5a40 100644 --- a/qt/Makefile.am +++ b/qt/Makefile.am @@ -9,7 +9,9 @@ HANDWRITTEN = \ QCoreApplication.cs \ QSize.cs \ QPushButton.cs \ - QWidget.cs + QWidget.cs \ + QPoint.cs \ + QFlags.cs all: hello.exe diff --git a/qt/demos/hello.cs b/qt/demos/hello.cs index 112178d4..dc52527b 100644 --- a/qt/demos/hello.cs +++ b/qt/demos/hello.cs @@ -1,6 +1,7 @@ using System; using System.Diagnostics; using Qt.Gui; +using Qt.Gui.Qt; using Mono.Cxxi; @@ -12,6 +13,7 @@ namespace QtTest { using (QPushButton hello = new QPushButton ("Hello world!")) { hello.Resize (200, 30); + QObject.Connect (hello, "2clicked()", app, "1aboutQt()", ConnectionType.AutoConnection); hello.SetVisible (true); QApplication.Exec (); diff --git a/qt/qt-gui-filters.xml b/qt/qt-gui-filters.xml index c0e32252..48866a5d 100644 --- a/qt/qt-gui-filters.xml +++ b/qt/qt-gui-filters.xml @@ -8,7 +8,7 @@ The type of external implementation can be specified: class (default) -> this type is implemented as a managed reference type struct -> this type is implemented as a managed value type. when passed as pointer or reference, the managed "ref" prefix will be used - + Rename -> include this type in the generated output, but rename to the specified managed type (specified in "to" attribute, "implementation" attribute also allowed) The default behavior is Include. Change the default by specifying the default attribute on the top-level Filter tag. Specify exceptions to the default behavior with child nodes named after one of the modes above… @@ -16,12 +16,26 @@ QObject + Qt + Qt::ConnectionType + Qt::KeyboardModifier + Qt::MouseButton + Qt::ButtonState + QApplication QCoreApplication QWidget QAbstractButton QPushButton QPaintDevice + + QEvent + QInputEvent + QMouseEvent + QTimerEvent + QString QSize + QPoint + QFlags<Qt::KeyboardModifier> diff --git a/qt/qt-gui.h b/qt/qt-gui.h index 98ccd6e6..958db03b 100644 --- a/qt/qt-gui.h +++ b/qt/qt-gui.h @@ -1,2 +1,3 @@ #include "QApplication" +#include "qevent.h" #include "QPushButton" diff --git a/qt/src/QFlags.cs b/qt/src/QFlags.cs new file mode 100644 index 00000000..eb796ded --- /dev/null +++ b/qt/src/QFlags.cs @@ -0,0 +1,13 @@ +using System; +using System.Runtime.InteropServices; +using Mono.Cxxi; + +namespace Qt.Gui { + + [StructLayout (LayoutKind.Sequential)] + public struct QFlags where T : struct { + + public T Value; + } +} + diff --git a/qt/src/QPoint.cs b/qt/src/QPoint.cs new file mode 100644 index 00000000..2cba62b2 --- /dev/null +++ b/qt/src/QPoint.cs @@ -0,0 +1,20 @@ +using System; +using System.Runtime.InteropServices; +using Mono.Cxxi; + +namespace Qt.Gui { + + [StructLayout (LayoutKind.Sequential)] + public struct QPoint { + + private int xy, yx; //Wtf.. on Mac the order is y, x; elsewhere x, y + + public QPoint (int x, int y) + { + //FIXME: do some snazzy stuff to get this right.. for now, I'm a mac user :P + this.yx = x; + this.xy = y; + } + } +} +