Browse Source

Reorganize Qt bindings

pull/1/head
Alexander Corrado 14 years ago
parent
commit
bdd77ead03
  1. 29
      qt/Makefile.am
  2. 23
      qt/demos/hello.cs
  3. 0
      qt/qt-gui-filters.txt
  4. 4
      qt/qt-gui.cpp
  5. 2
      qt/qt-gui.h
  6. 17
      qt/src/QApplication.cs
  7. 46
      qt/src/QCoreApplication.cs
  8. 27
      qt/src/QSize.cs
  9. 5
      qt/src/QString.cs
  10. 29
      src/QtBindings/AssemblyInfo.cs
  11. 85
      src/QtBindings/Core/QCoreApplication.cs
  12. 10
      src/QtBindings/Core/QGlobal.cs
  13. 63
      src/QtBindings/Core/QObject.cs
  14. 18
      src/QtBindings/Core/QSize.cs
  15. 67
      src/QtBindings/Core/QString.cs
  16. 35
      src/QtBindings/Gui/QAbstractButton.cs
  17. 63
      src/QtBindings/Gui/QApplication.cs
  18. 40
      src/QtBindings/Gui/QPaintDevice.cs
  19. 51
      src/QtBindings/Gui/QPushButton.cs
  20. 116
      src/QtBindings/Gui/QWidget.cs
  21. 34
      src/QtBindings/Libs.cs
  22. 110
      src/QtBindings/Makefile.am
  23. 103
      src/QtBindings/QtBindings.csproj
  24. 5
      src/QtBindings/QtBindings.dll.config
  25. 6
      src/QtBindings/qtbindings.pc.in
  26. 29
      src/qt/Makefile.am
  27. 20
      src/qt/hello.cs
  28. 2
      src/qt/qt-gui.h

29
qt/Makefile.am

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
top_srcdir = ../..
INTEROP_DLL = \
$(top_srcdir)/bin/Debug/Mono.Cxxi.dll
all: hello.exe
qt-gui.xml: qt-gui.h
$(GCCXML) -fxml=$@ --gccxml-cxxflags "-m32 -I." /Library/Frameworks/QtGui.framework/Versions/Current/Headers/QtGui
generated: qt-gui.xml
$(RM) -r generated
$(MONO) --debug $(top_srcdir)/bin/Debug/generator.exe -o=generated -ns=Qt.Gui -lib=QtGui --filters=qt-gui-filters.txt qt-gui.xml
#libQtGui-inline.so: qt-gui.cpp
# $(CXX) -m32 -I. -framework QtGui -framework QtCore -DQ_WS_MAC --shared -fPIC -o $@ -fkeep-inline-functions qt-gui.cpp
Qt.Gui-binding.dll: generated QString.cs QSize.cs QApplication.cs QCoreApplication.cs
$(RM) -f generated/QString.cs generated/QSize.cs
$(GMCS) -debug -out:$@ -target:library -unsafe -r:$(INTEROP_DLL) generated/*.cs QString.cs QApplication.cs QCoreApplication.cs QSize.cs
hello.exe: Qt.Gui-binding.dll hello.cs #libQtGui-inline.so
$(GMCS) -debug -out:$@ -target:exe -r:$(INTEROP_DLL) -r:Qt.Gui-binding.dll hello.cs
clean:
$(RM) -rf generated hello.exe* qt-gui.xml Qt.Gui-binding.dll* libQtGui-inline.so
run: hello.exe
MONO_PATH=.:$(top_srcdir)/bin/Debug $(MONO) --debug --trace=__CppLibraryImplAssembly hello.exe

23
qt/demos/hello.cs

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
using System;
using System.Diagnostics;
using Qt.Gui;
using Mono.Cxxi;
namespace QtTest {
class MainClass {
public static void Main (string[] args)
{
using (QApplication app = new QApplication ()) {
using (QPushButton hello = new QPushButton ("Hello world!", null)) {
hello.Resize (new QSize (100, 30));
hello.SetVisible (true);
QApplication.Exec ();
}
}
}
}
}

0
src/qt/qt-gui-filters.txt → qt/qt-gui-filters.txt

4
src/qt/qt-gui.cpp → qt/qt-gui.cpp

@ -13,8 +13,8 @@ @@ -13,8 +13,8 @@
// this one was annoying to track down!
#define QT_NO_TRANSLATION
#include <QtCore>
#include <QtGui>
#include "QtGui/QApplication"
#include "QtGui/QPushButton"
int main ()
{

2
qt/qt-gui.h

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
#include "QApplication"
#include "QPushButton"

17
qt/src/QApplication.cs

@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
using System;
using System.Runtime.InteropServices;
using Mono.Cxxi;
namespace Qt.Gui {
public partial class QApplication {
public QApplication () : base (impl.TypeInfo)
{
InitArgcAndArgv ();
Native = impl.QApplication (impl.Alloc (this), argc, argv, 0x040602);
}
}
}

46
qt/src/QCoreApplication.cs

@ -0,0 +1,46 @@ @@ -0,0 +1,46 @@
using System;
using System.Runtime.InteropServices;
using Mono.Cxxi;
namespace Qt.Gui {
public partial class QCoreApplication {
protected IntPtr argc, argv;
public QCoreApplication () : base (impl.TypeInfo)
{
InitArgcAndArgv ();
Native = impl.QCoreApplication (impl.Alloc (this), argc, argv);
}
partial void AfterDestruct ()
{
FreeArgcAndArgv ();
}
protected void InitArgcAndArgv ()
{
var args = Environment.GetCommandLineArgs ();
var argCount = args.Length;
argc = Marshal.AllocHGlobal (sizeof(int));
Marshal.WriteInt32 (argc, argCount);
argv = Marshal.AllocHGlobal (Marshal.SizeOf (typeof(IntPtr)) * argCount);
for (var i = 0; i < argCount; i++) {
IntPtr arg = Marshal.StringToHGlobalAnsi (args [i]);
Marshal.WriteIntPtr (argv, i * Marshal.SizeOf (typeof(IntPtr)), arg);
}
}
protected void FreeArgcAndArgv ()
{
Marshal.FreeHGlobal (argc);
for (var i = 0; i < Environment.GetCommandLineArgs ().Length; i++)
Marshal.FreeHGlobal (Marshal.ReadIntPtr (argv, i * Marshal.SizeOf (typeof(IntPtr))));
Marshal.FreeHGlobal (argv);
}
}
}

27
qt/src/QSize.cs

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
// -------------------------------------------------------------------------
// Managed wrapper for QSize
// Generated from qt-gui.xml on 07/24/2011 11:57:03
//
// This file was auto generated. Do not edit.
// -------------------------------------------------------------------------
using System;
using System.Runtime.InteropServices;
using Mono.Cxxi;
namespace Qt.Gui {
[StructLayout (LayoutKind.Sequential)]
public struct QSize {
public int wd;
public int ht;
public QSize (int w, int h)
{
wd = w;
ht = h;
}
}
}

5
src/qt/QString.cs → qt/src/QString.cs

@ -50,6 +50,11 @@ namespace Qt.Gui { @@ -50,6 +50,11 @@ namespace Qt.Gui {
return new QString (str);
}
public override string ToString ()
{
return Marshal.PtrToStringUni (d->data, d->size);
}
public QString AddRef ()
{
d->@ref++;

29
src/QtBindings/AssemblyInfo.cs

@ -1,29 +0,0 @@ @@ -1,29 +0,0 @@
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("QtBindings")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
[assembly: CLSCompliant(true)]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

85
src/QtBindings/Core/QCoreApplication.cs

@ -1,85 +0,0 @@ @@ -1,85 +0,0 @@
using System;
using System.Runtime.InteropServices;
using Mono.VisualC.Interop;
namespace Qt.Core {
public class QCoreApplication : QObject {
#region Sync with qcoreapplication.h
// C++ interface
public interface IQCoreApplication : ICppClassOverridable<QCoreApplication> {
// ...
[Constructor] void QCoreApplication (CppInstancePtr @this, [MangleAs ("int&")] IntPtr argc,
[MangleAs ("char**")] IntPtr argv);
// ...
[Static] int exec ();
// ...
[Virtual] bool notify (CppInstancePtr @this, IntPtr qObject, IntPtr qEvent);
[Virtual] bool compressEvent (CppInstancePtr @this, IntPtr qEvent, IntPtr qObject, IntPtr qPostEventList);
[Virtual, Destructor] void Destruct (CppInstancePtr @this);
}
// C++ fields
private struct _QCoreApplication {
}
#endregion
private static IQCoreApplication impl = Qt.Libs.QtCore.GetClass<IQCoreApplication,_QCoreApplication,QCoreApplication> ("QCoreApplication");
protected IntPtr argc;
protected IntPtr argv;
public QCoreApplication () : base (impl.TypeInfo)
{
Native = impl.Alloc (this);
InitArgcAndArgv ();
impl.QCoreApplication (Native, argc, argv);
}
public QCoreApplication (IntPtr native) : base (impl.TypeInfo)
{
Native = native;
}
internal QCoreApplication (CppTypeInfo subClass) : base (impl.TypeInfo)
{
subClass.AddBase (impl.TypeInfo);
}
public virtual int Exec ()
{
return impl.exec ();
}
public override void Dispose ()
{
impl.Destruct (Native);
FreeArgcAndArgv ();
Native.Dispose ();
}
protected void InitArgcAndArgv ()
{
// for some reason, this includes arg0, but the args passed to Main (string[]) do not!
string[] args = Environment.GetCommandLineArgs ();
int argCount = args.Length;
argc = Marshal.AllocHGlobal (sizeof (int));
Marshal.WriteInt32 (argc, argCount);
argv = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (IntPtr)) * argCount);
for (var i = 0; i < argCount; i++) {
IntPtr arg = Marshal.StringToHGlobalAnsi (args [i]);
Marshal.WriteIntPtr (argv, i * Marshal.SizeOf (typeof (IntPtr)), arg);
}
}
protected void FreeArgcAndArgv ()
{
Marshal.FreeHGlobal (argc);
for (var i = 0; i < Environment.GetCommandLineArgs ().Length; i++)
Marshal.FreeHGlobal (Marshal.ReadIntPtr (argv, i * Marshal.SizeOf (typeof (IntPtr))));
Marshal.FreeHGlobal (argv);
}
}
}

10
src/QtBindings/Core/QGlobal.cs

@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
using System;
namespace Qt.Core {
public static class QGlobal {
public const string QT_VERSION_STR = "4.6.2";
public const int QT_VERSION = 0x040602;
}
}

63
src/QtBindings/Core/QObject.cs

@ -1,63 +0,0 @@ @@ -1,63 +0,0 @@
using System;
using System.Runtime.InteropServices;
using Mono.VisualC.Interop;
namespace Qt.Core {
public class QObject : ICppObject {
#region Sync with qobject.h
// C++ interface
public interface IQObject : ICppClassOverridable<QObject> {
// ...
[Virtual] /*QMetaObject */ IntPtr metaObject(CppInstancePtr @this);
[Virtual] /*void */ IntPtr qt_metacast(CppInstancePtr @this, string s);
[Virtual] int qt_metacall(CppInstancePtr @this, /*QMetaObject::Call */ int qMetaObjectCall, int x, /*void **/ IntPtr p);
// ...
[Constructor] void QObject (CppInstancePtr @this, QObject parent);
[Virtual, Destructor] void Destruct (CppInstancePtr @this);
// ...
[Virtual] bool @event (CppInstancePtr @this, IntPtr qEvent);
[Virtual] bool eventFilter (CppInstancePtr @this, IntPtr qObject, IntPtr qEvent);
[Virtual] void timerEvent (CppInstancePtr @this, IntPtr qTimerEvent);
[Virtual] void childEvent (CppInstancePtr @this, IntPtr qChildEvent);
[Virtual] void customEvent (CppInstancePtr @this, IntPtr qEvent);
[Virtual] void connectNotify (CppInstancePtr @this, string signal);
[Virtual] void disconnectNotify (CppInstancePtr @this, string signal);
}
// C++ fields
private struct _QObject {
public IntPtr d_ptr;
}
#endregion
private static IQObject impl = Qt.Libs.QtCore.GetClass<IQObject,_QObject,QObject> ("QObject");
public CppInstancePtr Native { get; protected set; }
public QObject (QObject parent)
{
Native = impl.Alloc (this);
impl.QObject (Native, parent);
}
public QObject () : this ((QObject)null)
{
}
public QObject (IntPtr native)
{
Native = native;
}
internal QObject (CppTypeInfo subClass)
{
subClass.AddBase (impl.TypeInfo);
}
public virtual void Dispose ()
{
impl.Destruct (Native);
Native.Dispose ();
}
}
}

18
src/QtBindings/Core/QSize.cs

@ -1,18 +0,0 @@ @@ -1,18 +0,0 @@
using System;
using System.Runtime.InteropServices;
using Mono.VisualC.Interop;
namespace Qt.Core {
[StructLayout (LayoutKind.Sequential)]
public struct QSize {
public int wd;
public int ht;
public QSize (int w, int h)
{
this.wd = w;
this.ht = h;
}
}
}

67
src/QtBindings/Core/QString.cs

@ -1,67 +0,0 @@ @@ -1,67 +0,0 @@
using System;
using System.Text;
using System.Runtime.InteropServices;
using Mono.VisualC.Interop;
using Mono.VisualC.Interop.ABI;
namespace Qt.Core {
//TODO: Will this leak?
[StructLayout (LayoutKind.Sequential)]
public unsafe struct QString {
#region Sync with qstring.h
public interface IQString : ICppClass {
[Constructor] void QString(ref QString @this, [MangleAs ("const QChar*")] IntPtr unicode, int size);
}
[StructLayout (LayoutKind.Sequential)]
public struct Data {
public int @ref;
public int alloc, size;
public IntPtr data;
public ushort clean;
public ushort simpletext;
public ushort righttoleft;
public ushort asciiCache;
public ushort capacity;
public ushort reserved;
public IntPtr array;
}
public Data* d;
#endregion
private static IQString impl = Qt.Libs.QtCore.GetClass<IQString> ("QString");
public QString (string str) : this ()
{
IntPtr strPtr = Marshal.StringToHGlobalUni (str);
impl.QString (ref this, strPtr, str.Length);
Marshal.FreeHGlobal (strPtr);
// TODO: I deref this on construction to let Qt free it when it's done with it.
// My assumption is that this struct will only be used to interop with Qt and
// no managed class is going to hold on to it.
this.DeRef ();
}
public static implicit operator QString (string str)
{
return new QString (str);
}
public QString AddRef ()
{
d->@ref++;
return this;
}
public QString DeRef ()
{
d->@ref--;
return this;
}
}
}

35
src/QtBindings/Gui/QAbstractButton.cs

@ -1,35 +0,0 @@ @@ -1,35 +0,0 @@
using System;
using Mono.VisualC.Interop;
namespace Qt.Gui {
public class QAbstractButton : QWidget {
#region Sync with qabstractbutton.h
// C++ interface
public interface IQAbstractButton : ICppClassOverridable<QAbstractButton> {
[Virtual] void paintEvent (CppInstancePtr @this, /*QPaintEvent */ IntPtr e); // abstract
[Virtual] bool hitButton (CppInstancePtr @this, /*const QPoint &*/ IntPtr pos);
[Virtual] void checkStateSet (CppInstancePtr @this);
[Virtual] void nextCheckState (CppInstancePtr @this);
}
private struct _QAbstractButton {
}
#endregion
private static IQAbstractButton impl = Qt.Libs.QtGui.GetClass<IQAbstractButton, _QAbstractButton, QAbstractButton> ("QAbstractButton");
public QAbstractButton (IntPtr native) : base (impl.TypeInfo)
{
Native = native;
}
internal QAbstractButton (CppTypeInfo subClass) : base (impl.TypeInfo)
{
subClass.AddBase (impl.TypeInfo);
}
public override void Dispose ()
{
}
}
}

63
src/QtBindings/Gui/QApplication.cs

@ -1,63 +0,0 @@ @@ -1,63 +0,0 @@
using System;
using System.Runtime.InteropServices;
using Mono.VisualC.Interop;
using Qt.Core;
namespace Qt.Gui {
public class QApplication : QCoreApplication {
#region Sync with qapplication.h
// C++ interface
public interface IQApplication : ICppClassOverridable<QApplication> {
// ...
[Constructor] void QApplication (CppInstancePtr @this, [MangleAs ("int&")] IntPtr argc,
[MangleAs ("char**")] IntPtr argv, int version);
// ...
[Virtual] bool macEventFilter(CppInstancePtr @this, IntPtr eventHandlerCallRef, IntPtr eventRef);
// ...
[Virtual] void commitData(CppInstancePtr @this, IntPtr qSessionManager); // was QSessionManager&
[Virtual] void saveState(CppInstancePtr @this, IntPtr qSessionManager); // was QSessionManager&
// ...
[Static] int exec ();
[Virtual, Destructor] void Destruct (CppInstancePtr @this);
}
// C++ fields
private struct _QApplication {
}
#endregion
private static IQApplication impl = Qt.Libs.QtGui.GetClass<IQApplication,_QApplication,QApplication> ("QApplication");
public QApplication () : base (impl.TypeInfo)
{
Native = impl.Alloc (this);
InitArgcAndArgv ();
impl.QApplication (Native, argc, argv, QGlobal.QT_VERSION);
}
public QApplication (IntPtr native) : base (impl.TypeInfo)
{
Native = native;
}
internal QApplication (CppTypeInfo subClass) : base (impl.TypeInfo)
{
subClass.AddBase (impl.TypeInfo);
}
public override int Exec ()
{
return impl.exec ();
}
public override void Dispose ()
{
impl.Destruct (Native);
FreeArgcAndArgv ();
Native.Dispose ();
}
}
}

40
src/QtBindings/Gui/QPaintDevice.cs

@ -1,40 +0,0 @@ @@ -1,40 +0,0 @@
using System;
using Mono.VisualC.Interop;
using Mono.VisualC.Interop.ABI;
namespace Qt.Gui {
public class QPaintDevice : ICppObject {
#region Sync with qpaintdevice.h
// C++ interface
public interface IQPaintDevice : ICppClassOverridable<QPaintDevice> {
[Virtual] int devType (CppInstancePtr @this);
[Virtual] /*QPaintEngine */ IntPtr paintEngine (CppInstancePtr @this); // abstract
//...
void QPaintDevice (CppInstancePtr @this);
[Virtual] int metric (CppInstancePtr @this, /*PaintDeviceMetric*/ IntPtr metric);
}
// C++ fields
private struct _QPaintDevice {
public ushort painters;
}
#endregion
private static IQPaintDevice impl = Qt.Libs.QtGui.GetClass<IQPaintDevice,_QPaintDevice,QPaintDevice> ("QPaintDevice");
public CppInstancePtr Native { get; protected set; }
public QPaintDevice (IntPtr native)
{
Native = native;
}
internal QPaintDevice (CppTypeInfo subClass)
{
subClass.AddBase (impl.TypeInfo);
}
public void Dispose ()
{
}
}
}

51
src/QtBindings/Gui/QPushButton.cs

@ -1,51 +0,0 @@ @@ -1,51 +0,0 @@
using System;
using Mono.VisualC.Interop;
using Qt.Core;
namespace Qt.Gui {
public class QPushButton : QAbstractButton {
#region Sync with qpushbutton.h
// C++ interface
public interface IQPushButton : ICppClassOverridable<QPushButton> {
// ...
[Constructor] void QPushButton (CppInstancePtr @this, [MangleAs ("const QString &")] ref QString text, QWidget parent);
// ...
[Virtual, Destructor] void Destruct (CppInstancePtr @this);
}
// C++ fields
private struct _QPushButton {
}
#endregion
private static IQPushButton impl = Qt.Libs.QtGui.GetClass<IQPushButton,_QPushButton,QPushButton> ("QPushButton");
public QPushButton (string btnText, QWidget parent) : base (impl.TypeInfo)
{
Native = impl.Alloc (this);
QString text = btnText;
impl.QPushButton (Native, ref text, parent);
}
public QPushButton (string text) : this (text, (QWidget)null)
{
}
public QPushButton (IntPtr native) : base (impl.TypeInfo)
{
Native = native;
}
internal QPushButton (CppTypeInfo subClass) : base (impl.TypeInfo)
{
subClass.AddBase (impl.TypeInfo);
}
public override void Dispose ()
{
impl.Destruct (Native);
Native.Dispose ();
}
}
}

116
src/QtBindings/Gui/QWidget.cs

@ -1,116 +0,0 @@ @@ -1,116 +0,0 @@
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using Mono.VisualC.Interop;
using Qt.Core;
namespace Qt.Gui {
public class QWidget : QObject {
#region Sync with qwidget.h
// C++ interface
public interface IQWidget : ICppClassOverridable<QWidget> {
// ...
[Constructor] void QWidget (CppInstancePtr @this, QWidget parent, /*Qt::WindowFlags */ int f);
// ...
[Virtual] void setVisible (CppInstancePtr @this, bool visible);
// ...
void resize (CppInstancePtr @this, [MangleAs ("const QSize &")] ref QSize size);
// ...
[Virtual] /*QSize*/ int sizeHint (CppInstancePtr @this);
[Virtual] /*QSize*/ int minimumSizeHint (CppInstancePtr @this);
// ...
[Virtual] int heightForWidth (CppInstancePtr @this, int width);
// ... protected:
[Virtual] void mousePressEvent (CppInstancePtr @this, /*QMouseEvent */ IntPtr p);
[Virtual] void mouseReleaseEvent (CppInstancePtr @this, /*QMouseEvent */ IntPtr p);
[Virtual] void mouseDoubleClickEvent (CppInstancePtr @this, /*QMouseEvent */ IntPtr p);
[Virtual] void mouseMoveEvent (CppInstancePtr @this, /*QMouseEvent */ IntPtr p);
[Virtual] void wheelEvent (CppInstancePtr @this, /*QWheelEvent */ IntPtr p);
[Virtual] void keyPressEvent (CppInstancePtr @this, /*QKeyEvent */ IntPtr p);
[Virtual] void keyReleaseEvent (CppInstancePtr @this, /*QKeyEvent */ IntPtr p);
[Virtual] void focusInEvent (CppInstancePtr @this, /*QFocusEvent */ IntPtr p);
[Virtual] void focusOutEvent (CppInstancePtr @this, /*QFocusEvent */ IntPtr p);
[Virtual] void enterEvent (CppInstancePtr @this, /*QEvent */ IntPtr p);
[Virtual] void leaveEvent (CppInstancePtr @this, /*QEvent */ IntPtr p);
[Virtual] void paintEvent (CppInstancePtr @this, /*QPaintEvent */ IntPtr p);
[Virtual] void moveEvent (CppInstancePtr @this, /*QMoveEvent */ IntPtr p);
[Virtual] void resizeEvent (CppInstancePtr @this, /*QResizeEvent */ IntPtr p);
[Virtual] void closeEvent (CppInstancePtr @this, /*QCloseEvent */ IntPtr p);
[Virtual] void contextMenuEvent (CppInstancePtr @this, /*QContextMenuEvent */ IntPtr p);
[Virtual] void tabletEvent (CppInstancePtr @this, /*QTabletEvent */ IntPtr p);
[Virtual] void actionEvent (CppInstancePtr @this, /*QActionEvent */ IntPtr p);
[Virtual] void dragEnterEvent (CppInstancePtr @this, /*QDragEnterEvent */ IntPtr p);
[Virtual] void dragMoveEvent (CppInstancePtr @this, /*QDragMoveEvent */ IntPtr p);
[Virtual] void dragLeaveEvent (CppInstancePtr @this, /*QDragLeaveEvent */ IntPtr p);
[Virtual] void dropEvent (CppInstancePtr @this, /*QDropEvent */ IntPtr p);
[Virtual] void showEvent (CppInstancePtr @this, /*QShowEvent */ IntPtr p);
[Virtual] void hideEvent (CppInstancePtr @this, /*QHideEvent */ IntPtr p);
[Virtual] bool macEvent (CppInstancePtr @this, /*EventHandlerCallRef */ IntPtr p1, /*EventRef */ IntPtr p2);
[Virtual] void changeEvent (CppInstancePtr @this, /*QEvent */ IntPtr p);
// ...
[Virtual] void inputMethodEvent (CppInstancePtr @this, /*QInputMethodEvent */ IntPtr p);
//public:
[Virtual] /*QVariant*/ IntPtr inputMethodQuery (CppInstancePtr @this, /*Qt::InputMethodQuery */ int x);
// ... protected:
[Virtual] bool focusNextPrevChild (CppInstancePtr @this, bool next);
[Virtual] void styleChange (CppInstancePtr @this, IntPtr qStyle); // compat
[Virtual] void enabledChange (CppInstancePtr @this, bool arg); // compat
[Virtual] void paletteChange (CppInstancePtr @this, /*const QPalette &*/ IntPtr qPalette); // compat
[Virtual] void fontChange (CppInstancePtr @this, /*const QFont &*/ IntPtr qFont); // compat
[Virtual] void windowActivationChange (CppInstancePtr @this, bool arg); // compat
[Virtual] void languageChange(CppInstancePtr @this); // compat
}
// C++ fields
private struct _QWidget {
public IntPtr data;
}
#endregion
private static IQWidget impl = Qt.Libs.QtGui.GetClass<IQWidget,_QWidget,QWidget> ("QWidget");
// TODO: ctor ...
public QWidget (IntPtr native) : this ()
{
Native = native;
}
internal QWidget (CppTypeInfo subClass) : this ()
{
subClass.AddBase (impl.TypeInfo);
}
private QWidget ()
: base (impl.TypeInfo) // Add QObject as base class
{
// FIXME: Hold on to this object and create methods for it on this class?
new QPaintDevice (impl.TypeInfo); // Add QPaintDevice as base class
}
public bool Visible {
get {
throw new NotImplementedException ();
}
set {
//Debug.Assert (false, "Attach debugger now.");
impl.setVisible (Native, value);
}
}
public void Resize (int width, int height)
{
QSize s = new QSize (width, height);
impl.resize (Native, ref s);
}
public override void Dispose ()
{
throw new NotImplementedException ();
}
}
}

34
src/QtBindings/Libs.cs

@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
using System;
using Mono.VisualC.Interop;
using Mono.VisualC.Interop.ABI;
namespace Qt {
// Will be internal; public for testing
public static class Libs {
public static CppLibrary QtCore = null;
public static CppLibrary QtGui = null;
static Libs ()
{
string lib;
CppAbi abi;
if (Environment.OSVersion.Platform == PlatformID.Unix) {
lib = "{0}.so";
abi = new ItaniumAbi ();
} else if (Environment.OSVersion.Platform == PlatformID.Win32NT)
{ // for Windows...
lib = "{0}d4.dll";
abi = new MsvcAbi ();
} else { // for Mac...
lib = "/Library/Frameworks/{0}.framework/Versions/Current/{0}";
abi = new ItaniumAbi ();
}
QtCore = new CppLibrary (string.Format(lib, "QtCore"), abi);
QtGui = new CppLibrary (string.Format(lib, "QtGui"), abi);
}
}
}

110
src/QtBindings/Makefile.am

@ -1,110 +0,0 @@ @@ -1,110 +0,0 @@
EXTRA_DIST =
# Warning: This is an automatically generated file, do not edit!
if ENABLE_DEBUG
ASSEMBLY_COMPILER_COMMAND = gmcs
ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -unsafe -warn:4 -optimize- -debug "-define:DEBUG"
ASSEMBLY = bin/Debug/QtBindings.dll
ASSEMBLY_MDB = $(ASSEMBLY).mdb
COMPILE_TARGET = library
PROJECT_REFERENCES = \
../Mono.VisualC.Interop/bin/Debug/Mono.VisualC.Interop.dll
BUILD_DIR = bin/Debug
QTBINDINGS_DLL_CONFIG_SOURCE=QtBindings.dll.config
MONO_VISUALC_INTEROP_DLL_SOURCE=../Mono.VisualC.Interop/bin/Debug/Mono.VisualC.Interop.dll
MONO_VISUALC_INTEROP_DLL=$(BUILD_DIR)/Mono.VisualC.Interop.dll
QTBINDINGS_DLL_MDB_SOURCE=bin/Debug/QtBindings.dll.mdb
QTBINDINGS_DLL_MDB=$(BUILD_DIR)/QtBindings.dll.mdb
CPPINTEROP_DLL=
endif
if ENABLE_RELEASE
ASSEMBLY_COMPILER_COMMAND = gmcs
ASSEMBLY_COMPILER_FLAGS = -noconfig -codepage:utf8 -unsafe -warn:4 -optimize-
ASSEMBLY = bin/Release/QtBindings.dll
ASSEMBLY_MDB =
COMPILE_TARGET = library
PROJECT_REFERENCES = \
../Mono.VisualC.Interop/bin/Release/CPPInterop.dll
BUILD_DIR = bin/Release
QTBINDINGS_DLL_CONFIG_SOURCE=QtBindings.dll.config
MONO_VISUALC_INTEROP_DLL=
QTBINDINGS_DLL_MDB=
CPPINTEROP_DLL_SOURCE=../Mono.VisualC.Interop/bin/Release/CPPInterop.dll
CPPINTEROP_DLL=$(BUILD_DIR)/CPPInterop.dll
endif
AL=al2
SATELLITE_ASSEMBLY_NAME=$(notdir $(basename $(ASSEMBLY))).resources.dll
PROGRAMFILES = \
$(QTBINDINGS_DLL_CONFIG) \
$(MONO_VISUALC_INTEROP_DLL) \
$(QTBINDINGS_DLL_MDB) \
$(CPPINTEROP_DLL)
LINUX_PKGCONFIG = \
$(QTBINDINGS_PC)
RESGEN=resgen2
all: $(ASSEMBLY) $(PROGRAMFILES) $(LINUX_PKGCONFIG)
FILES = \
AssemblyInfo.cs \
Libs.cs \
Gui/QApplication.cs \
Core/QGlobal.cs \
Core/QCoreApplication.cs \
Core/QObject.cs \
Gui/QPushButton.cs \
Gui/QPaintDevice.cs \
Gui/QWidget.cs \
Gui/QAbstractButton.cs \
Core/QString.cs \
Core/QSize.cs
DATA_FILES =
RESOURCES =
EXTRAS = \
QtBindings.dll.config \
Gui \
Core \
qtbindings.pc.in
REFERENCES = \
System
DLL_REFERENCES =
CLEANFILES = $(PROGRAMFILES) $(LINUX_PKGCONFIG)
include $(top_srcdir)/Makefile.include
QTBINDINGS_DLL_CONFIG = $(BUILD_DIR)/QtBindings.dll.config
QTBINDINGS_PC = $(BUILD_DIR)/qtbindings.pc
$(eval $(call emit-deploy-target,QTBINDINGS_DLL_CONFIG))
$(eval $(call emit-deploy-target,MONO_VISUALC_INTEROP_DLL))
$(eval $(call emit-deploy-wrapper,QTBINDINGS_PC,qtbindings.pc))
$(eval $(call emit-deploy-target,CPPINTEROP_DLL))
$(eval $(call emit_resgen_targets))
$(build_xamlg_list): %.xaml.g.cs: %.xaml
xamlg '$<'
$(ASSEMBLY_MDB): $(ASSEMBLY)
$(ASSEMBLY): $(build_sources) $(build_resources) $(build_datafiles) $(DLL_REFERENCES) $(PROJECT_REFERENCES) $(build_xamlg_list) $(build_satellite_assembly_list)
mkdir -p $(shell dirname $(ASSEMBLY))
$(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) -out:$(ASSEMBLY) -target:$(COMPILE_TARGET) $(build_sources_embed) $(build_resources_embed) $(build_references_ref)

103
src/QtBindings/QtBindings.csproj

@ -1,103 +0,0 @@ @@ -1,103 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{66212CA6-B8C2-4307-ADDE-DAFEAAB339B9}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Qt</RootNamespace>
<AssemblyName>QtBindings</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>2.0</OldToolsVersion>
<PublishUrl>http://localhost/QtBindings/</PublishUrl>
<Install>true</Install>
<InstallFrom>Web</InstallFrom>
<UpdateEnabled>true</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>true</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="Libs.cs" />
<Compile Include="Gui\QApplication.cs" />
<Compile Include="Core\QGlobal.cs" />
<Compile Include="Core\QCoreApplication.cs" />
<Compile Include="Core\QObject.cs" />
<Compile Include="Gui\QPushButton.cs" />
<Compile Include="Gui\QPaintDevice.cs" />
<Compile Include="Gui\QWidget.cs" />
<Compile Include="Gui\QAbstractButton.cs" />
<Compile Include="Core\QString.cs" />
<Compile Include="Core\QSize.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Mono.VisualC.Interop\Mono.VisualC.Interop.csproj">
<Project>{4A864586-93C5-4DC1-8A80-F094A88506D7}</Project>
<Name>Mono.VisualC.Interop</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="QtBindings.dll.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>

5
src/QtBindings/QtBindings.dll.config

@ -1,5 +0,0 @@ @@ -1,5 +0,0 @@
<!-- The dllmap doesn't work (I think) because the assembly that actually has the DllImports is the one emitted by SRE -->
<configuration>
<dllmap dll="QtCore4" os="osx" target="/Library/Frameworks/QtCore.framework/Versions/Current/QtCore" />
<dllmap dll="QtGui4" os="osx" target="/Library/Frameworks/QtGui.framework/Versions/Current/QtGui" />
</configuration>

6
src/QtBindings/qtbindings.pc.in

@ -1,6 +0,0 @@ @@ -1,6 +0,0 @@
Name: QtBindings
Description: QtBindings
Version: 0.1
Requires:
Libs: -r:@expanded_libdir@/@PACKAGE@/QtBindings.dll

29
src/qt/Makefile.am

@ -1,29 +0,0 @@ @@ -1,29 +0,0 @@
top_srcdir = ../..
INTEROP_DLL = \
$(top_srcdir)/bin/Debug/Mono.Cxxi.dll
all: hello.exe
qt-gui.xml: qt-gui.h
$(GCCXML) -fxml=$@ --gccxml-cxxflags "`pkg-config --cflags QtCore QtGui`" qt-gui.h
generated: qt-gui.xml
$(RM) -r generated
$(MONO) --debug $(top_srcdir)/bin/Debug/generator.exe -o=generated -ns=Qt.Gui -lib=QtGui --filters=qt-gui-filters.txt qt-gui.xml
#libQtGui-inline.so: qt-gui.cpp
# $(CXX) `pkg-config --cflags QtCore QtGui` --shared -fPIC -o $@ -fkeep-inline-functions qt-gui.cpp `pkg-config --libs QtCore QtGui`
Qt.Gui-binding.dll: generated QString.cs
$(RM) -f generated/QString.cs
$(GMCS) -out:$@ -target:library -unsafe -r:$(INTEROP_DLL) generated/*.cs QString.cs
hello.exe: Qt.Gui-binding.dll hello.cs #libQtGui-inline.so
$(GMCS) -out:$@ -target:exe -r:$(INTEROP_DLL) -r:Qt.Gui-binding.dll hello.cs
clean:
$(RM) -rf generated hello.exe qt-gui.xml Qt.Gui-binding.dll libQtGui-inline.so
run: hello.exe
MONO_PATH=$(top_srcdir)/bin/Debug $(MONO) hello.exe

20
src/qt/hello.cs

@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
using System;
using Qt.Gui;
using Mono.Cxxi;
namespace QtTest {
class MainClass {
public static void Main (string[] args)
{
int argc = args.Length;
using (QApplication app = new QApplication (ref argc, args, 0x040602)) {
QPushButton hello = new QPushButton ("Hello", null);
hello.Resize (100, 30);
hello.Show ();
QApplication.Exec ();
}
}
}
}

2
src/qt/qt-gui.h

@ -1,2 +0,0 @@ @@ -1,2 +0,0 @@
#include <QtCore>
#include <QtGui>
Loading…
Cancel
Save