Mercurial > projects > qtd
changeset 312:e620836cd85a lifetime
ditched qt directory
author | maxter <spambox@d-coding.com> |
---|---|
date | Wed, 23 Dec 2009 16:44:45 +0200 |
parents | 8674fd5f34f4 |
children | cb7fb9195175 |
files | qt/CMakeLists.txt qt/QDefines.d qt/QDefines.d.inc qt/QGlobal.d qt/QObjectDefs.d qt/boost-license-1.0.txt qt/core/CMakeLists.txt qt/core/QMetaObject.d qt/core/QMetaType.d qt/core/QString.d qt/d1/qt/QtdObject.d qt/d1/qt/Signal.d qt/d1/qt/core/QLine.d qt/d1/qt/core/QLineF.d qt/d1/qt/core/QModelIndex.d qt/d1/qt/core/QPoint.d qt/d1/qt/core/QPointF.d qt/d1/qt/core/QRect.d qt/d1/qt/core/QRectF.d qt/d1/qt/core/QSize.d qt/d1/qt/core/QSizeF.d qt/d1/qt/core/QVariant.d qt/d1/qt/qtd/Str.d qt/d2/qt/QtdObject.d qt/d2/qt/Signal.d qt/d2/qt/core/QLine.d qt/d2/qt/core/QLineF.d qt/d2/qt/core/QModelIndex.d qt/d2/qt/core/QPoint.d qt/d2/qt/core/QPointF.d qt/d2/qt/core/QRect.d qt/d2/qt/core/QRectF.d qt/d2/qt/core/QSize.d qt/d2/qt/core/QSizeF.d qt/d2/qt/core/QVariant.d qt/d2/qt/qtd/Str.d qt/gui/UrlHandler.d qt/opengl/gl.d qt/opengl/glfuncs.d qt/opengl/gltypes.d qt/opengl/glu.d qt/qtd/Array.d qt/qtd/ArrayOpsPrimitive.d qt/qtd/CMakeLists.txt qt/qtd/Traits.d |
diffstat | 45 files changed, 0 insertions(+), 10176 deletions(-) [+] |
line wrap: on
line diff
--- a/qt/CMakeLists.txt Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -project (qt_d D) - -set(QT_SRCS_D -QtdObject.d -QGlobal.d - -core/QChildEvent.d -core/QCoreApplication.d -core/QEvent.d -core/QEventLoop.d -core/QObject.d -core/QTimerEvent.d -core/QTranslator.d -core/Qt.d - -qtd/Str.d -) - -#add_subdirectory(core) -#add_subdirectory(qtd) - -#add_library(qt_d STATIC ${QT_CORE_SRCS_D} ${QT_QTD_SRCS_D} ${QT_SRCS_D}) -add_library(qt_d STATIC ${QT_SRCS_D})
--- a/qt/QDefines.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -module qt.QDefines; - -const char[] QT_VERSION_STR = "4.5.1"; -const int QT_VERSION = 263425;
--- a/qt/QDefines.d.inc Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -module qt.QDefines; - -const char[] QT_VERSION_STR = "@QTD_VERSION_STR@"; -const int QT_VERSION = @QTD_VERSION@; \ No newline at end of file
--- a/qt/QGlobal.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,797 +0,0 @@ -module qt.QGlobal; - -public import qt.qtd.Str; -public import qt.QDefines; - -version (D_Version2) -{ - import std.stdio; - package import std.c.stdlib, - core.memory; -} -else -{ - import tango.io.Stdout; - import tango.core.Thread; - - void writeln(string s) - { - Stdout(s).newline; - } - package import tango.stdc.stdlib, - tango.core.Memory; -} - -private enum : size_t { stackSize = 1024 * 1024 } - -final class StackAlloc -{ - alias typeof(this) This; - private void* _data; - - private static size_t align16(size_t size) - { - return size + 16 - (size - size & ~15); - } - - this(size_t size) - { - _data = (new void[size]).ptr; - } - - void* alloc(size_t size) - { - void* res = _data; - _data += align16(size); - return res; - } - - void free(size_t size) - { - _data -= align16(size); - } -} - -version (D_Version2) -{ - StackAlloc __stackAlloc() - { - static StackAlloc instance; // thread-local instance - // COMPILER BUG: No thread-local static constructors, Using lazy construction - if (!instance) - instance = new This(stackSize); - return instance; - } -} -else -{ - private static ThreadLocal!(StackAlloc) stackAllocInst; - - static this() - { - stackAllocInst = new ThreadLocal!(StackAlloc); - } - - static StackAlloc __stackAlloc() - { - auto res = stackAllocInst.val; - if (!res) - { - res = new StackAlloc(stackSize); - stackAllocInst.val = res; - } - return res; - } -} - -T static_cast(T, U)(U obj) -{ - return cast(T)cast(void*)obj; -} - -template QT_BEGIN_NAMESPACE() { -} - -template QT_END_NAMESPACE() { -} - -template QT_BEGIN_HEADER() { -} - -template QT_END_HEADER() { -} - -mixin QT_BEGIN_HEADER; -mixin QT_BEGIN_NAMESPACE; - -extern(C) void qtd_dummy() {} -// Defined in QtdObject.d -extern(C) void qtd_delete_d_object(void* dPtr); - -version(cpp_shared) -{ - extern (C) void qtd_core_initCallBacks(void* toUtf8, void* dummy, void* del_d_obj); - static this() { - qtd_core_initCallBacks(&qtd_toUtf8, &qtd_dummy, &qtd_delete_d_object); - } -} - -string tr(string arg) { - return arg; -} - -/* - can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0)) -*/ -bool QT_VERSION_CHECK( ushort major, ushort minor, ushort patch ) -{ - return cast(bool)((major<<16)|(minor<<8)|(patch)); -} -//TODO(katrina) get this from the C++ side -const char[] QT_PACKAGEDATE_STR = "2008-09-27"; -//TODO(katrina) get this from the C++ side -const char[] QT_PACKAGE_TAG = "gc9953de622c6a0f655322e0d9f5bd6dc2803b470"; - -/* - Size-dependent types (architechture-dependent byte order) - - Make sure to update QMetaType when changing these typedefs -*/ - -alias char qint8; /* 8 bit signed */ -alias char quint8; /* 8 bit unsigned */ -alias short qint16; /* 16 bit signed */ -alias ushort quint16; /* 16 bit unsigned */ -alias int qint32; /* 32 bit signed */ -alias uint quint32; /* 32 bit unsigned */ -alias long qint64; /* 64 bit signed */ -alias ulong quint64; /* 64 bit unsigned */ - -version (X86) -{ - alias quint32 quintptr; - alias qint32 qptrdiff; -} -else version (X86_64) -{ - alias quint64 quintptr; - alias qint64 qptrdiff; -} - -const byte QT_POINTER_SIZE = 8; - -alias int QNoImplicitBoolCast; - -alias double qreal; - - -/* - Utility macros and inline functions - TODO(katrina) see if we need to do anything to make these - able to be evaluated at compile time -*/ - -T qAbs(T)(T t) { return t >= 0 ? t : -t; } - -int qRound(qreal d) -{ return d >= 0.0 ? cast(int)(d + 0.5) : cast(int)(d - cast(int)(d-1) + 0.5) + cast(int)(d-1); } - -qint64 qRound64(qreal d) -{ return d >= 0.0 ? cast(qint64)(d + 0.5) : cast(qint64)(d - cast(qint64)(d-1) + 0.5) + cast(qint64)(d-1); } - -T qMin(T)(T a,T b) { if (a < b) return a; return b; } -T qMax(T)(T a, T b) { if (a < b) return b; return a; } -T qBound(T)(T min, T val,T max) { return qMax(min, qMin(max, val)); } - -/* - Data stream functions are provided by many classes (defined in qdatastream.h) -*/ - -//class QDataStream; - -/* - System information -*/ - -class QSysInfo { -public: - enum Sizes { - WordSize = ((void *).sizeof<<3) - }; - - enum Endian { - BigEndian, - LittleEndian, - ByteOrder = BigEndian - }; - /* needed to bootstrap qmake */ - static const int ByteOrder; - - enum WinVersion { - WV_32s = 0x0001, - WV_95 = 0x0002, - WV_98 = 0x0003, - WV_Me = 0x0004, - WV_DOS_based= 0x000f, - - WV_NT = 0x0010, - WV_2000 = 0x0020, - WV_XP = 0x0030, - WV_2003 = 0x0040, - WV_VISTA = 0x0080, - WV_NT_based = 0x00f0, - - WV_CE = 0x0100, - WV_CENET = 0x0200, - WV_CE_5 = 0x0300, - WV_CE_6 = 0x0400, - WV_CE_based = 0x0f00 - }; - static const WinVersion WindowsVersion; - static WinVersion windowsVersion(); - - enum MacVersion { - MV_Unknown = 0x0000, - - /* version */ - MV_9 = 0x0001, - MV_10_0 = 0x0002, - MV_10_1 = 0x0003, - MV_10_2 = 0x0004, - MV_10_3 = 0x0005, - MV_10_4 = 0x0006, - MV_10_5 = 0x0007, - - /* codenames */ - MV_CHEETAH = MV_10_0, - MV_PUMA = MV_10_1, - MV_JAGUAR = MV_10_2, - MV_PANTHER = MV_10_3, - MV_TIGER = MV_10_4, - MV_LEOPARD = MV_10_5 - }; - static const MacVersion MacintoshVersion; -}; - - -extern(C) stringz qtd_qVersion(); -/// -string qVersion() -{ - return fromStringz(qtd_qVersion); -} - -extern(C) bool qtd_qSharedBuild(); -/// -bool qSharedBuild() -{ - return qtd_qSharedBuild; -} - -/// -int qMacVersion() { return QSysInfo.MacintoshVersion; } - -/// -void qUnused(T)(T x) { cast(void) x; } -/// -void Q_UNUSED(T)(T x) { qUnused(x); } - -/* - Debugging and error handling -*/ - -//class QString; -//char[] qPrintable(QString string) { string.toLocal8Bit().constData(); } -//TODO(katrina) These should probably actually call into the c++ functions -void qDebug(string str) /* print debug message */ -{ writeln(str); } - -extern (C) void Qt_qWarning( char * ); - -void qWarning(char[] str) /* print warning message */ -{ writeln(str); } - -//QString qt_error_string(int errorCode = -1); -void qCritical(char[] str) /* print critical message */ -{ writeln(str); } - -/* - Forward declarations only. - - In order to use the qDebug() stream, you must #include<QDebug> -*/ -//class QDebug; -//class QNoDebug; -//QDebug qDebug(); -//QDebug qWarning(); -//QDebug qCritical(); - -void qt_noop() {} -//TODO(katrina) Implement these -void qt_assert(char[] assertion, char[] file, int line); - -void qt_assert_x(char[] where, char[] what, char[] file, int line); - -void qt_check_pointer(char[], int); - -enum QtMsgType { QtDebugMsg, QtWarningMsg, QtCriticalMsg, QtFatalMsg, QtSystemMsg = QtCriticalMsg }; - -void qt_message_output(QtMsgType, char[] buf); -//class QtMsgHandler; -//QtMsgHandler qInstallMsgHandler(QtMsgHandler); - -// forward declaration, since qatomic.h needs qglobal.h -class QBasicAtomicPointer(T); - -// POD for Q_GLOBAL_STATIC -class QGlobalStatic(T) -{ -public: - QBasicAtomicPointer!(T) pointer; - bool destroyed; -}; - -// Created as a function-local static to delete a QGlobalStatic<T> -class QGlobalStaticDeleter(T) -{ -public: - QGlobalStatic!(T) globalStatic; - this(QGlobalStatic!(T) _globalStatic) { - globalStatic(_globalStatic); - } - - ~this() - { - delete globalStatic.pointer; - globalStatic.pointer = 0; - globalStatic.destroyed = true; - } -}; - -class QBool -{ - bool b; - -public: - this(bool B) { b = B; } -// void *() const -// { return b ? static_cast<const void *>(this) : static_cast<const void *>(0); } -} - -bool qFuzzyCompare(double p1, double p2) -{ - return (qAbs(p1 - p2) <= 0.000000000001 * qMin(qAbs(p1), qAbs(p2))); -} - -bool qFuzzyCompare(float p1, float p2) -{ - return (qAbs(p1 - p2) <= 0.00001f * qMin(qAbs(p1), qAbs(p2))); -} - -/* - This function tests a double for a null value. It doesn't - check whether the actual value is 0 or close to 0, but whether - it is binary 0. -*/ -bool qIsNull(double d) -{ - union U { - double d; - quint64 u; - }; - U val; - val.d = d; - return val.u == cast(quint64)(0); -} - -/* - This function tests a float for a null value. It doesn't - check whether the actual value is 0 or close to 0, but whether - it is binary 0. -*/ -bool qIsNull(float f) -{ - union U { - float f; - quint32 u; - }; - U val; - val.f = f; - return val.u == 0u; -} - -/* - Compilers which follow outdated template instantiation rules - require a class to have a comparison operator to exist when - a QList of this type is instantiated. It's not actually - used in the list, though. Hence the dummy implementation. - Just in case other code relies on it we better trigger a warning - mandating a real implementation. -*/ - - -/* - QTypeInfo - type trait functionality - qIsDetached - data sharing functionality -*/ - -/* - The catch-all template. -*/ - -bool qIsDetached(T)(T) { return true; } - -class QTypeInfossss(T) -{ -public: - enum { - isPointer = false, - isComplex = true, - isStatic = true, - isLarge = ((T).sizeof>(void*).sizeof), - isDummy = false - }; -}; - -class QTypeInfo(T) -{ -public: - enum { - isPointer = true, - isComplex = false, - isStatic = false, - isLarge = false, - isDummy = false - }; -}; - - -/* - Specialize a specific type with: - - Q_DECLARE_TYPEINFO(type, flags); - - where 'type' is the name of the type to specialize and 'flags' is - logically-OR'ed combination of the flags below. -*/ -enum { /* TYPEINFO flags */ - Q_COMPLEX_TYPE = 0, - Q_PRIMITIVE_TYPE = 0x1, - Q_STATIC_TYPE = 0, - Q_MOVABLE_TYPE = 0x2, - Q_DUMMY_TYPE = 0x4 -}; - -/* - Specialize a shared type with: - - Q_DECLARE_SHARED(type); - - where 'type' is the name of the type to specialize. NOTE: shared - types must declare a 'bool isDetached(void) const;' member for this - to work. -*/ -void qSwap_helper(T)(ref T value1, ref T value2, T*) -{ - T t = value1; - value1 = value2; - value2 = t; -} -bool qIsDetached(T)(ref T t) { return t.isDetached(); } -void qSwap_helper(T)(ref T value1, ref T value2, T*) -{ - const T.DataPtr t = value1.data_ptr(); - value1.data_ptr() = value2.data_ptr(); - value2.data_ptr() = t; -} - -void qSwap(T)(ref T value1, ref T value2) -{ - T t = value1; - value1 = value2; - value2 = t; -} - -/* - QTypeInfo primitive specializations - TODO(katrina) Find out what we need to do here -*/ -/* -Q_DECLARE_TYPEINFO(bool, Q_PRIMITIVE_TYPE); -Q_DECLARE_TYPEINFO(char, Q_PRIMITIVE_TYPE); -Q_DECLARE_TYPEINFO(signed char, Q_PRIMITIVE_TYPE); -Q_DECLARE_TYPEINFO(uchar, Q_PRIMITIVE_TYPE); -Q_DECLARE_TYPEINFO(short, Q_PRIMITIVE_TYPE); -Q_DECLARE_TYPEINFO(ushort, Q_PRIMITIVE_TYPE); -Q_DECLARE_TYPEINFO(int, Q_PRIMITIVE_TYPE); -Q_DECLARE_TYPEINFO(uint, Q_PRIMITIVE_TYPE); -Q_DECLARE_TYPEINFO(long, Q_PRIMITIVE_TYPE); -Q_DECLARE_TYPEINFO(ulong, Q_PRIMITIVE_TYPE); -Q_DECLARE_TYPEINFO(qint64, Q_PRIMITIVE_TYPE); -Q_DECLARE_TYPEINFO(quint64, Q_PRIMITIVE_TYPE); -Q_DECLARE_TYPEINFO(float, Q_PRIMITIVE_TYPE); -Q_DECLARE_TYPEINFO(double, Q_PRIMITIVE_TYPE); -#ifndef Q_OS_DARWIN -Q_DECLARE_TYPEINFO(long double, Q_PRIMITIVE_TYPE); -#endif -*/ -/* - These functions make it possible to use standard C++ functions with - a similar name from Qt header files (especially template classes). - TODO(katrina) Implement these -*/ -void * qMalloc(size_t size); -void qFree(void * ptr); -void * qRealloc(void * ptr, size_t size); -void * qMemCopy(void * dest, void * src, size_t n); -void * qMemSet(void * dest, int c, size_t n); - -struct QFlags(Enum) -{ -private: - alias void **Zero; - int i; - -public: - alias Enum enum_type; - - public static QFlags!(Enum) opCall(Enum)(QFlags f) { - QFlags!(Enum) res; - res.i = f.i; - return res; - } - - public static QFlags opCall(Enum)(Enum f) { - QFlags!(Enum) res; - res.i = f; - return res; - } - - public static QFlags opCall(Enum)(int f) { - QFlags!(Enum) res; - res.i = cast(Enum) f; - return res; - } - -// this(Zero = 0) : i(0) {} -// this(QFlag f) : i(f) {} - -// QFlags!(Enum) opAssign(QFlags f) { i = f.i; return *this; } - QFlags!(Enum) opAssign(int f) { i = f; return *this; } - QFlags!(Enum) opAndAssign(int mask) { i &= mask; return *this; } - QFlags!(Enum) opAndAssign(uint mask) { i &= mask; return *this; } - QFlags!(Enum) opOrAssign(QFlags f) { i |= f.i; return *this; } - QFlags!(Enum) opOrAssign(Enum f) { i |= f; return *this; } - QFlags!(Enum) opXorAssign(QFlags f) { i ^= f.i; return *this; } - QFlags!(Enum) opXorAssign(Enum f) { i ^= f; return *this; } - - int toInt() { return i; } - - QFlags!(Enum) opOr(QFlags f) { QFlags g; g.i = i | f.i; return g; } - QFlags!(Enum) opOr(Enum f) { QFlags g; g.i = i | f; return g; } - QFlags!(Enum) opXor(QFlags f) { QFlags g; g.i = i ^ f.i; return g; } - QFlags!(Enum) opXor(Enum f) { QFlags g; g.i = i ^ f; return g; } - QFlags!(Enum) opAnd(int mask) { QFlags g; g.i = i & mask; return g; } - QFlags!(Enum) opAnd(uint mask) { QFlags g; g.i = i & mask; return g; } - QFlags!(Enum) opAnd(Enum f) { QFlags g; g.i = i & f; return g; } - QFlags!(Enum) opCom() { QFlags g; g.i = ~i; return g; } - -// bool operator!() { return !i; } - -// bool testFlag(Enum f) { return i & f; } -} - -/* TODO typesafety -#define Q_DECLARE_FLAGS(Flags, Enum)\ -typedef QFlags<Enum> Flags; -#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags) \ -QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2) \ -{ return QFlags<Flags::enum_type>(f1) | f2; } \ -QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) \ -{ return f2 | f1; } -*/ - -char[] QT_TR_NOOP(char[] x) { return x; } -char[] QT_TRANSLATE_NOOP(char[] s, char[] x) { return x; } -char[] QT_TRANSLATE_NOOP3(char[] s, char[] x, char[] comment) { return x; } - -//class QByteArray; -//QByteArray qgetenv(char[] varName); -//bool qputenv(char[] varName, QByteArray value); - -int qIntCast(double f) { return cast(int)(f); } -int qIntCast(float f) { return cast(int)(f); } - -/* - Reentrant versions of basic rand() functions for random number generation -*/ -void qsrand(uint seed); -int qrand(); - - -/* - This gives us the possibility to check which modules the user can - use. These are purely compile time checks and will generate no code. -*/ - -/* Qt modules */ - -const ushort QT_MODULE_CORE = 0x0001; -const ushort QT_MODULE_GUI = 0x0002; -const ushort QT_MODULE_NETWORK = 0x0004; -const ushort QT_MODULE_OPENGL = 0x0008; -const ushort QT_MODULE_SQL = 0x0010; -const ushort QT_MODULE_XML = 0x0020; -const ushort QT_MODULE_QT3SUPPORTLIGHT = 0x0040; -const ushort QT_MODULE_QT3SUPPORT = 0x0080; -const ushort QT_MODULE_SVG = 0x0100; -const ushort QT_MODULE_ACTIVEQT = 0x0200; -const ushort QT_MODULE_GRAPHICSVIEW = 0x0400; -const ushort QT_MODULE_SCRIPT = 0x0800; -const ushort QT_MODULE_XMLPATTERNS = 0x1000; -const ushort QT_MODULE_HELP = 0x2000; -const ushort QT_MODULE_TEST = 0x4000; -const ushort QT_MODULE_DBUS = 0x8000; - -/* Qt editions */ - -const ushort QT_EDITION_CONSOLE = (QT_MODULE_CORE - | QT_MODULE_NETWORK - | QT_MODULE_SQL - | QT_MODULE_SCRIPT - | QT_MODULE_XML - | QT_MODULE_XMLPATTERNS - | QT_MODULE_TEST - | QT_MODULE_DBUS); -const ushort QT_EDITION_DESKTOPLIGHT = (QT_MODULE_CORE - | QT_MODULE_GUI - | QT_MODULE_QT3SUPPORTLIGHT - | QT_MODULE_TEST - | QT_MODULE_DBUS); -const ushort QT_EDITION_OPENSOURCE = (QT_MODULE_CORE - | QT_MODULE_GUI - | QT_MODULE_NETWORK - | QT_MODULE_OPENGL - | QT_MODULE_SQL - | QT_MODULE_XML - | QT_MODULE_XMLPATTERNS - | QT_MODULE_SCRIPT - | QT_MODULE_QT3SUPPORTLIGHT - | QT_MODULE_QT3SUPPORT - | QT_MODULE_SVG - | QT_MODULE_GRAPHICSVIEW - | QT_MODULE_HELP - | QT_MODULE_TEST - | QT_MODULE_DBUS); -const ushort QT_EDITION_DESKTOP = (QT_EDITION_OPENSOURCE - | QT_MODULE_ACTIVEQT); -const ushort QT_EDITION_UNIVERSAL = QT_EDITION_DESKTOP; -const ushort QT_EDITION_ACADEMIC = QT_EDITION_DESKTOP; -const ushort QT_EDITION_EDUCATIONAL = QT_EDITION_DESKTOP; -const ushort QT_EDITION_EVALUATION = QT_EDITION_DESKTOP; - -mixin QT_END_NAMESPACE; - -private -struct Align -{ - ubyte a; - void* b; -} - -private -const PTR_ALIGN = Align.tupleof[1].alignof; - -private -template AlignPad(size_t base, size_t aligned) -{ - static if( aligned == 0 ) - const AlignPad = base; - else - const AlignPad = ((base+PTR_ALIGN-1)/PTR_ALIGN)*PTR_ALIGN - + aligned; -} - -template InstanceSize(T) -{ - static if( is( T == Object ) ) - const InstanceSize = 2*(void*).sizeof; - else - const InstanceSize = Max!( - AlignPad!( - InstanceSize!(Super!(T)), - InterfaceCount!(T)*(void*).sizeof), - - AlignPad!( - InstanceSizeImpl!(T, 0), - + InterfaceCount!(T)*(void*).sizeof)); -} - -private -template Super(T) -{ - static if( is( T S == super ) ) - alias First!(S) Super; - else - static assert(false, "Can't get super of "~T.mangleof); -} - -private -template First(T) -{ - alias T First; -} - -private -template First(T, Ts...) -{ - alias T First; -} - -private -template InstanceSizeImpl(T, size_t i) -{ - static if( i < T.tupleof.length ) - const InstanceSizeImpl = Max!( - T.tupleof[i].offsetof + T.tupleof[i].sizeof, - InstanceSizeImpl!(T, i+1)); - else - // This is necessary to account for classes without member - // variables. - const InstanceSizeImpl = 2*(void*).sizeof; -} - -private -template Max(size_t a, size_t b) -{ - static if( a > b ) - const Max = a; - else - const Max = b; -} - -private -template InterfaceCount(T) -{ - static if( is( T == Object ) ) - const InterfaceCount = 0u; - else static if( is( T S == super ) ) - const InterfaceCount = InterfaceCountImpl!(S); -} - -private -template InterfaceCountImpl(TBase, TInterfaces...) -{ - const InterfaceCountImpl = TInterfaces.length; -} - -/+ -scope class StackObject(C) -{ - byte[InstanceSize!(C)] data; - bool constructed; - - C opCall(A...)(A args) - { - assert(!constructed); - - auto r = new(&data)C(args); - r.__stackAllocated = true; - constructed = true; - - return r; - } - - ~this() - { - if (constructed) - { - auto obj = cast(C)&data; - delete obj; - } - } -} -+/ - -mixin QT_END_HEADER; -
--- a/qt/QObjectDefs.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,262 +0,0 @@ -module qt.QObjectDefs; - -//import qt.core.QGlobal; -//import qt.core.Qt; -import QGlobal; - -const byte Q_MOC_OUTPUT_REVISION = 59; - -template QT_TR_FUNCTIONS_NOUTF8() -{ - static QString tr(char[] s, char[] c = null) - { return staticMetaObject.tr(s, c); } - static QString tr(char[] s, char[] c, int n) - { return staticMetaObject.tr(s, c, n); } -} - -template QT_TR_FUNCTIONS_UTF8() -{ - static QString trUtf8(char[] s, char[] c = null) - { return staticMetaObject.trUtf8(s, c); } - static QString trUtf8(char[] s, char[] c, int n) - { return staticMetaObject.trUtf8(s, c, n); } -} - -template QT_TR_FUNCTIONS() -{ - mixin QT_TR_FUNCTIONS_NOUTF8; - mixin QT_TR_FUNCTIONS_UTF8; -} - -template Q_OBJECT_CHECK() -{ - void qt_check_for_QOBJECT_macro(T)(T _q_argument) const - { int i = qYouForgotTheQ_OBJECT_Macro(this, _q_argument); i = i; } -} - -int qYouForgotTheQ_OBJECT_Macro(T)(T, T) { return 0; } - -void qYouForgotTheQ_OBJECT_Macro(T1,T2)(T1, T2) {} - -template Q_OBJECT() -{ - public mixin Q_OBJECT_CHECK; - public static const QMetaObject staticMetaObject; - public const QMetaObject *metaObject() const{} - public void *qt_metacast(const char *){} - public mixin QT_TR_FUNCTIONS; - public int qt_metacall(QMetaObject.Call, int, void **){} -} - -template Q_OBJECT_FAKE() -{ - mixin Q_OBJECT; -} - -template Q_GADGET() -{ - public static const QMetaObject staticMetaObject; -} - -char[] METHOD( char[] a ) { return "0"~a; } -char[] SLOT( char[] a ) { return "1"~a; } -char[] SIGNAL( char[] a ) { return "2"~a; } - -version(QT3_SUPPORT) { - const byte METHOD_CODE = 0; // member type codes - const byte SLOT_CODE = 1; - const byte SIGNAL_CODE = 2; -} - -const byte QMETHOD_CODE = 0; // member type codes -const byte QSLOT_CODE = 1; -const byte QSIGNAL_CODE = 2; - -QArgument!(T) Q_ARG(T)(char [] type, T data) - { return QArgument!(T)(type, data); } - -QReturnArgument!(T) Q_RETURN_ARG(T)(char [] type, T data) - { return QReturnArgument!(T)(type, data); } - -class QGenericArgument -{ -public: - this(char[] aName = null, const void *aData = null) - { _data = aData; _name = aName; } - void *data() const { return cast(void *)(_data); } - char[] name() { return _name; } - -private: - const void *_data; - char[] _name; -}; - -class QGenericReturnArgument : QGenericArgument -{ -}; - -class QArgument(T) : QGenericArgument -{ -public: - this(char[] aName, T aData) - { this(aName, cast(void *)aData); } -}; - -class QReturnArgument(T) : QGenericReturnArgument -{ -public: - this(char[] aName, T aData) - { this(aName, cast(void *)aData); } -}; - -//TODO(katrina) enable this when all the classes it uses are available -/*struct QMetaObject -{ - char[] className() const; - const QMetaObject *superClass() const; - - //TODO(katrina) enable QObject cast(QObject obj) const; - - // ### Qt 4: Merge overloads - QString tr(const char *s, const char *c) const; - QString trUtf8(const char *s, const char *c) const; - QString tr(const char *s, const char *c, int n) const; - QString trUtf8(const char *s, const char *c, int n) const; - - int methodOffset() const; - int enumeratorOffset() const; - int propertyOffset() const; - int classInfoOffset() const; - - int methodCount() const; - int enumeratorCount() const; - int propertyCount() const; - int classInfoCount() const; - - int indexOfMethod(const char *method) const; - int indexOfSignal(const char *signal) const; - int indexOfSlot(const char *slot) const; - int indexOfEnumerator(const char *name) const; - int indexOfProperty(const char *name) const; - int indexOfClassInfo(const char *name) const; - - QMetaMethod method(int index) const; - QMetaEnum enumerator(int index) const; - QMetaProperty property(int index) const; - QMetaClassInfo classInfo(int index) const; - QMetaProperty userProperty() const; - - static bool checkConnectArgs(const char *signal, const char *method); - static QByteArray normalizedSignature(const char *method); - static QByteArray normalizedType(const char *type); - - // internal index-based connect - static bool connect(const QObject *sender, int signal_index, - const QObject *receiver, int method_index, - int type = 0, int *types = 0); - // internal index-based disconnect - static bool disconnect(const QObject *sender, int signal_index, - const QObject *receiver, int method_index); - // internal slot-name based connect - static void connectSlotsByName(QObject *o); - - // internal index-based signal activation - static void activate(QObject *sender, int signal_index, void **argv); - static void activate(QObject *sender, int from_signal_index, int to_signal_index, void **argv); - static void activate(QObject *sender, const QMetaObject *, int local_signal_index, void **argv); - static void activate(QObject *sender, const QMetaObject *, int from_local_signal_index, int to_local_signal_index, void **argv); - // internal guarded pointers - static void addGuard(QObject **ptr); - static void removeGuard(QObject **ptr); - static void changeGuard(QObject **ptr, QObject *o); - - static bool invokeMethod(QObject *obj, const char *member, - qt.core.Qt.ConnectionType, - QGenericReturnArgument ret, - QGenericArgument val0 = QGenericArgument(0), - QGenericArgument val1 = QGenericArgument(), - QGenericArgument val2 = QGenericArgument(), - QGenericArgument val3 = QGenericArgument(), - QGenericArgument val4 = QGenericArgument(), - QGenericArgument val5 = QGenericArgument(), - QGenericArgument val6 = QGenericArgument(), - QGenericArgument val7 = QGenericArgument(), - QGenericArgument val8 = QGenericArgument(), - QGenericArgument val9 = QGenericArgument()); - - static bool invokeMethod(QObject *obj, const char *member, - QGenericReturnArgument ret, - QGenericArgument val0 = QGenericArgument(0), - QGenericArgument val1 = QGenericArgument(), - QGenericArgument val2 = QGenericArgument(), - QGenericArgument val3 = QGenericArgument(), - QGenericArgument val4 = QGenericArgument(), - QGenericArgument val5 = QGenericArgument(), - QGenericArgument val6 = QGenericArgument(), - QGenericArgument val7 = QGenericArgument(), - QGenericArgument val8 = QGenericArgument(), - QGenericArgument val9 = QGenericArgument()) - { - return invokeMethod(obj, member, qt.core.Qt.AutoConnection, ret, val0, val1, val2, val3, - val4, val5, val6, val7, val8, val9); - } - - static bool invokeMethod(QObject *obj, const char *member, - qt.core.Qt.ConnectionType type, - QGenericArgument val0 = QGenericArgument(0), - QGenericArgument val1 = QGenericArgument(), - QGenericArgument val2 = QGenericArgument(), - QGenericArgument val3 = QGenericArgument(), - QGenericArgument val4 = QGenericArgument(), - QGenericArgument val5 = QGenericArgument(), - QGenericArgument val6 = QGenericArgument(), - QGenericArgument val7 = QGenericArgument(), - QGenericArgument val8 = QGenericArgument(), - QGenericArgument val9 = QGenericArgument()) - { - return invokeMethod(obj, member, type, QGenericReturnArgument(), val0, val1, val2, - val3, val4, val5, val6, val7, val8, val9); - } - - - static bool invokeMethod(QObject *obj, const char *member, - QGenericArgument val0 = QGenericArgument(0), - QGenericArgument val1 = QGenericArgument(), - QGenericArgument val2 = QGenericArgument(), - QGenericArgument val3 = QGenericArgument(), - QGenericArgument val4 = QGenericArgument(), - QGenericArgument val5 = QGenericArgument(), - QGenericArgument val6 = QGenericArgument(), - QGenericArgument val7 = QGenericArgument(), - QGenericArgument val8 = QGenericArgument(), - QGenericArgument val9 = QGenericArgument()) - { - return invokeMethod(obj, member, qt.core.Qt.AutoConnection, QGenericReturnArgument(), val0, - val1, val2, val3, val4, val5, val6, val7, val8, val9); - } - - enum Call { - InvokeMetaMethod, - ReadProperty, - WriteProperty, - ResetProperty, - QueryPropertyDesignable, - QueryPropertyScriptable, - QueryPropertyStored, - QueryPropertyEditable, - QueryPropertyUser - }; - -version(QT3_SUPPORT) { - const char *superClassName() const; -} - - struct d_struct{ // private data - const QMetaObject *superdata; - const char *stringdata; - const uint *data; - const QMetaObject **extradata; - }; - d_struct d; -}; -*/
--- a/qt/boost-license-1.0.txt Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE.
--- a/qt/core/CMakeLists.txt Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -set(QT_CORE_SRCS_D -Qt.d -QChildEvent.d -QCoreApplication.d -QEvent.d -QEventLoop.d -QObject.d -QTimerEvent.d -QTranslator.d -)
--- a/qt/core/QMetaObject.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -module qt.core.QMetaObject; - -import qt.QGlobal; -import qt.core.QObject; -import qt.QtdObject; - -/++ - Meta-object for QObject classes. -+/ -final class QMetaObject : QtdMetaObjectBase -{ - alias typeof(this) This; - - private void* _nativeId; - - this(void* nativeId, QMetaObject base) - { - _nativeId = nativeId; - super(base); - } - - /++ - +/ - void* nativeId() - { - return _nativeId; - } - - private QMetaObject lookupDerived(void*[] moIds) - { - assert (moIds.length >= 1); - - for (auto mo = static_cast!(This)(firstDerived); mo !is null; mo = static_cast!(This)(mo.next)) - { - if (mo._nativeId == moIds[0]) - { - if (moIds.length == 1) // exact match found - return mo; - else // look deeper - return mo.lookupDerived(moIds[1..$]); - } - } - - // no initialized wrapper that matches the native object. - // use the base class wrapper - return this; - } - - QObject wrap(void* nativeObjId, QtdObjectFlags flags = QtdObjectFlags.none) - { - QObject result; - - if (nativeObjId) - { - result = cast(QObject)qtd_get_d_qobject(nativeObjId); - if (!result) - { - auto moId = qtd_QObject_metaObject(nativeObjId); - if (_nativeId == moId) - result = static_cast!(QObject)(_createWrapper(nativeObjId, flags)); - else - { - // get native metaobjects for the entire derivation lattice - // up to, but not including, the current metaobject. - size_t moCount = 1; - - for (void* tmp = moId;;) - { - tmp = qtd_QMetaObject_superClass(tmp); - if (!tmp) - return null; - - if (tmp == _nativeId) - break; - moCount++; - } - - void*[] moIds = (cast(void**)alloca(moCount * (void*).sizeof))[0..moCount]; - - moIds[--moCount] = moId; - while (moCount > 0) - moIds[--moCount] = moId = qtd_QMetaObject_superClass(moId); - - auto mo = lookupDerived(moIds); - result = static_cast!(QObject)(mo._createWrapper(nativeObjId, flags)); - } - } - } - - return result; - } -} - -extern(C) void* qtd_QMetaObject_superClass(void* nativeId); \ No newline at end of file
--- a/qt/core/QMetaType.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -module qt.core.QMetaType; -public import qt.core.Qt; -private import qt.core.QDataStream; - -version (Tango) -{ - import tango.core.Array; - import tango.stdc.stringz; - import tango.core.Traits; -} - -alias extern(C) void *function(void *copy) Ctor; -alias extern(C) void function(void *obj) Dtor; -alias extern(C) void function(void *stream, void * object) StreamOp; - -struct DArrayToC -{ - void[] array; -} - -public template MetaTypeOps(T) -{ - // TODO: - // static assert(typeof(new T), "Type " ~ T.stringof ~ " has no default constructor"); - // static assert(typeof(new T(T.init))), "Type " ~ T.stringof ~ " has no default copy constructor"); - - extern(C) void* ctor(void* copy) - { - static if (is(T == class) || is(T == interface)) - { - return cast(void*)(copy ? new T(cast(T)copy) : new T); - } - else static if (isDynamicArrayType!(T) || isStaticArrayType!(T) ) - { - auto darray = new DArrayToC; - if(copy) - darray.array = (cast(DArrayToC*)copy).array.dup; - return cast(void*)darray; - } - else - { - auto data = new T; - if(copy) - *data = *cast(T*)copy; - return cast(void*)data; - } - } - - - extern(C) void dtor(void* obj) - { - static if (is(T == class) || is(T == interface)) - { - auto tmp = cast(T)obj; - delete tmp; - } - else - { - auto tmp = cast(T*)obj; - delete tmp; - } - } -} - -public int qRegisterMetaType(T)(string name = null) -{ - if (!name.length) - name = typeid(T).toString; - - return qtd_registerType(toStringz(name), &MetaTypeOps!(T).ctor, &MetaTypeOps!(T).dtor); -} - -/* Not work.... -private class DataStreamPriv: QDataStream -{ - this(void * cobj) - { - super(cobj); - } -} -*/ -/* -public void qRegisterMetaTypeStreamOperators(T)(void function(ref QDataStream, T ) saveOp, void function (ref QDataStream, ref T) loadOp, string name = null) -{ - static void function(ref QDataStream, T ) SaveOp; - static void function (ref QDataStream, ref T) LoadOp; - SaveOp = saveOp; - LoadOp = loadOp; - - if (!name.length) - name = typeid(T).toString; - - extern(C) void saveOpC(void *stream, void *object) - { - QDataStream dstream = new DataStreamPriv(stream); - Stdout(object).newline; - static if (is(T == class) || is(T == interface)) - SaveOp(dstream, cast(T)object); - else - SaveOp(dstream, *cast(T*)object); - } - - extern(C) void loadOpC(void *stream, void *object) - { - //return stream; - } - - qtd_registerStreamOperators(toStringz(name), cast(StreamOp)&saveOpC, cast(StreamOp)&loadOpC); -} -*/ -private extern(C) void qtd_registerStreamOperators(char *typeName, StreamOp saveOp, StreamOp loadOp); -private extern(C) int qtd_registerType(in char* namePtr, Ctor ctor, Dtor dtor); -extern(C) int qtd_MetatypeId(in char *id); // TODO: wrap to D. \ No newline at end of file
--- a/qt/core/QString.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -module qt.core.QString; - -import qt.QGlobal; - -version (Tango) -{ - public import tango.text.convert.Utf : toUTF8 = toString; -} -else -{ - public import std.utf : toUTF8; -} - -struct QString -{ - public static QString opCall(void* ptr, bool proxy) { - QString str; - str.native_id = ptr; - return str; - } - - private void* native_id; - - public static final string toNativeString(void* qstring) { - wchar* arr = __qtd_QString_utf16(qstring); - int size = __qtd_QString_size(qstring); - return .toUTF8(arr[0..size]); - } - - public final string toNativeString() { - return toNativeString(native_id); - } - - public void assign(string text) { - __qtd_QString_operatorAssign(native_id, text); - } - - public static string fromUtf8(string source) { - return source; - } -/* - public static string fromUtf16(wstring src) { - version(Tango) - }*/ -} - -private extern (C) wchar* __qtd_QString_utf16(void* __this_nativeId); -private extern (C) int __qtd_QString_size(void* __this_nativeId); -private extern (C) void __qtd_QString_operatorAssign(void* __this_nativeId, string text); \ No newline at end of file
--- a/qt/d1/qt/QtdObject.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,324 +0,0 @@ -/** -* -* Copyright: Copyright QtD Team, 2008-2009 -* License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a> -* Authors: Max Samukha, Eldar Insafutdinov -* -* Copyright QtD Team, 2008-2009 -* Distributed under the Boost Software License, Version 1.0. -* (See accompanying file boost-license-1.0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -* -*/ - -module qt.QtdObject; - -import qt.Signal; -import tango.core.Memory; -debug (QtdVerbose) - import tango.io.Stdout; - - -enum QtdObjectFlags : ubyte -{ - none, - // The native object will not be deleted when the wrapper is deleted - skipNativeDelete = 0b0_0001, - // The wrapper will not be deleted when the native object is deleted - skipDDelete = 0b0_0010, - // D object reference is stored in the shell - hasDId = 0b0_0100, - // The wrapper is allocated on thread-local stack and destroyed at the end of the scope - stackAllocated = 0b0_1000 - // It is a QObject - isQObject = 0b1_0000 -} - -class MetaObject -{ - alias typeof(this) This; - - private - { - MetaObject _base; - ClassInfo _classInfo; - } - - //COMPILER BUG: not accessible from QMetaObject - protected - { - This _firstDerived; - This _next; - } - - private void addDerived(This mo) - { - mo._next = _firstDerived; - _firstDerived = mo; - } - - /++ - Next sibling on this derivation level - +/ - final This next() - { - return _next; - } - - /++ - Head of the linked list of derived classes - +/ - final This firstDerived() - { - return _firstDerived; - } - - // NOTE: construction is split between this non-templated constructor and 'construct' function below. - this(This base) - { - if (base) - { - base.addDerived(this); - _base = base; - } - } - - // TODO: can be removed when D acquires templated constructors - void construct(T : Object)() - { - _classInfo = T.classinfo; - } - - final This base() - { - return _base; - } - - final ClassInfo classInfo() - { - return _classInfo; - } -} - - -abstract class QtdMetaObjectBase : MetaObject -{ - QtdObjectBase function(void* nativeId, QtdObjectFlags flags) _createWrapper; - - this(QtdMetaObjectBase base) - { - super(base); - } - - void construct(T : QtdObject)() - { - super.construct!(T); - _createWrapper = &T.__createWrapper; - } -} - - -final class QtdMetaObject : QtdMetaObjectBase -{ - alias typeof(this) This; - - private void* _typeId; - - this(void* typeId, QtdMetaObject base) - { - super(base); - _typeId = typeId; - } - - QtdObject wrap(void* nativeId, void* typeId, QtdObjectFlags flags = QtdObjectFlags.skipNativeDelete) - { - if (typeId == _typeId) - { - /+ - if (auto p = nativeId in _nativeToDMap) - return *p; - +/ - } - else - { - for (auto mo = static_cast!(This)(_firstDerived); mo; mo = static_cast!(This)(mo._next)) - { - if (auto obj = mo.wrap(nativeId, typeId, flags)) - return obj; - } - } - - return static_cast!(QtdObject)(_createWrapper(nativeId, flags)); - } -} - -/* -class IdMappings -{ - private void* _data; - - this() - { - } - - void add(void* nativeId, void* dId) - { - } - - void remove(void* dId) - { - } - - void* opIndex[void* nativeId] - { - } - - ~this() - { - free(_data); - } -} -*/ - -abstract class QtdObjectBase -{ -} - -// Base class for by-reference objects -abstract class QtdObject -{ - alias typeof(this) This; - - private - { - typeof(this) __next, __prev; - static typeof(this) __root; - } - - /// Internal members. Do not change - void* __nativeId; - /// ditto - QtdObjectFlags __flags; - - new (size_t size, QtdObjectFlags flags = QtdObjectFlags.none) - { - return flags & QtdObjectFlags.stackAllocated ? __stackAlloc.alloc(size) : - GC.malloc(size, GC.BlkAttr.FINALIZE); - } - - delete (void* p) - { - if ((cast(This)p).__flags & QtdObjectFlags.stackAllocated) - __stackAlloc.free(this.classinfo.init.length); - else - GC.free(p); - } - - - mixin SignalHandlerOps; - - this(void* nativeId, QtdObjectFlags flags) - { - __nativeId = nativeId; - __flags = flags; - - debug(QtdVerbose) __print("D wrapper constructed"); - /* - if (!(flags & QtdObjectFlags.isQObject) && !(flags & QtdObjectFlags.hasDId)) - __addIdMapping; - */ - } - - debug(QtdVerbose) - { - void __print(string msg) - { - Stdout.formatln("{} (native: {}, D: {}, flags 0b{:b})", msg, __nativeId, cast(void*)this, __flags); - } - } - - protected void __deleteNative() - { - assert(false, "Cannot delete native " - ~ this.classinfo.name - ~ " because it has no public destructor"); - } - - /* - void __addIdMapping() {} - void __removeIdMapping() {} - */ - - final void __pin() - { - assert (!__prev && !__root is this); - __next = __root; - __root = this; - if (__next) - __next.__prev = this; - - debug(QtdVerbose) __print("Wrapper GC disabled"); - } - - final void __unpin() - { - assert (__prev || __root is this); - - if (__prev) - { - __prev.__next = __next; - __prev = null; - } - else - __root = __next; - - if (__next) - __next.__prev = __prev; - - debug(QtdVerbose) __print("Wrapper GC reenabled"); - } - - ~this() - { - /* - if (!(__flags & QtdObjectFlags.isQObject) && !(__flags & QtdObjectFlags.hasDId)) - __removeMapping; - */ - - debug(QtdVerbose) __print("In QtdObject destructor"); - - if (!(__flags & QtdObjectFlags.skipNativeDelete)) - { - // Avoid deleting the wrapper twice - __flags |= QtdObjectFlags.skipDDelete; - debug(QtdVerbose) __print("About to call native delete"); - __deleteNative; - } - - if (__prev || __root is this) - __unpin; - } -} - -// Called from shell destructors -extern(C) void qtd_delete_d_object(void* dId) -{ - auto obj = cast(QtdObject)dId; - debug(QtdVerbose) obj.__print("In qtd_delete_d_object"); - - if (!(obj.__flags & QtdObjectFlags.skipDDelete)) - { - // Avoid deleting native object twice - obj.__flags |= QtdObjectFlags.skipNativeDelete; - delete obj; - } -} - -extern(C) void qtd_pin(void* dId) -{ - (cast(QtdObject)dId).__pin; -} - -extern(C) void qtd_native_unpin(void* dId) -{ - (cast(QtdObject)dId).__unpin; -} \ No newline at end of file
--- a/qt/d1/qt/Signal.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,991 +0,0 @@ -/** - * - * Copyright: Copyright QtD Team, 2008-2009 - * Authors: Max Samukha, Eldar Insafutdinov - * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a> - * - * Copyright QtD Team, 2008-2009 - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file boost-license-1.0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - * - */ -module qt.Signal; - -public import qt.QGlobal; -import tango.core.Exception; -import tango.core.Traits; -import tango.core.Thread; -import tango.stdc.stdlib : crealloc = realloc, cfree = free; -import tango.stdc.string : memmove; - -private: // private by default - -alias void delegate(Object) DEvent; - -extern(C) void rt_attachDisposeEvent(Object o, DEvent e); -extern(C) void rt_detachDisposeEvent(Object o, DEvent e); -extern(C) Object _d_toObject(void* p); - -void realloc(T)(ref T[] a, size_t length) -{ - a = (cast(T*)crealloc(a.ptr, length * T.sizeof))[0..length]; - if (!a.ptr) - new OutOfMemoryException(__FILE__, __LINE__); -} - -unittest -{ - int[] a; - realloc(a, 16); - assert(a.length == 16); - foreach (i, ref e; a) - e = i; - realloc(a, 4096); - assert(a.length == 4096); - foreach (i, e; a[0..16]) - assert(e == i); - cfree(a.ptr); -} - -// TODO: This one should be replaced with an appropriate library function -char[] __toString(long v) -{ - if (v == 0) - return "0"; - - char[] ret; - - bool neg; - if (v < 0) - { - neg = true; - v = -v; - } - - while (v != 0) - { - ret = cast(char)(v % 10 + '0') ~ ret; - v = cast(long)(v / 10); - } - - if (neg) - ret = "-" ~ ret; - - return ret; -} - -template ToString(long i) -{ - const string ToString = __toString(i); -} - -//TODO: should be in the standard library -struct STuple(A...) -{ - static string genSTuple() - { - string r = ""; - foreach (i, e; A) - r ~= A[i].stringof ~ " _" ~ ToString!(i) ~ ";"; - return r; - } - - mixin (genSTuple); - template at(size_t i) { mixin("alias _" ~ ToString!(i) ~ " at;"); }; -} - -void move(T)(ref T[] a, size_t src, size_t dest, size_t length) -{ - if (a.length > 1) - memmove(a.ptr + dest, a.ptr + src, length * T.sizeof); -} - -enum SignalEventId -{ - firstSlotConnected, - lastSlotDisconnected -} - -public class SignalException : Exception -{ - this(char[] msg) - { - super(msg); - } -} - -struct Fn -{ - void* funcptr; - - static typeof(*this) opCall(R, A...)(R function(A) fn) - { - typeof(*this) r; - r.funcptr = fn; - return r; - } - - template call(R) - { - R call(A...)(A args) - { - alias R function(A) Fn; - return (cast(Fn)funcptr)(args); - } - } - - S get(S)() - { - static assert (is(typeof(*S.init) == function)); - return cast(S)funcptr; - } -} - -struct Dg -{ - void* context; - void* funcptr; - - static typeof(*this) opCall(R, A...)(R delegate(A) dg) - { - typeof(*this) r; - r.context = dg.ptr; - r.funcptr = dg.funcptr; - return r; - } - - template call(R) - { - R call(A...)(A args) - { - R delegate(A) dg; // BUG: parameter storage classes are ignored - dg.ptr = context; - dg.funcptr = cast(typeof(dg.funcptr))funcptr; - return dg(args); - } - } - - S get(S)() - { - static assert (is(S == delegate)); - S r; - r.ptr = context; - r.funcptr = cast(typeof(r.funcptr))funcptr; - return r; - } -} - -struct Slot(R) -{ - alias R Receiver; - - Receiver receiver; - Dg invoker; - - static if (is(Receiver == Dg)) - { - static const isDelegate = true; - - void onReceiverDisposed(Object o) - { - assert (lock !is null); - synchronized(lock) - { - receiver.context = null; - receiver.funcptr = null; - } - } - - // null if receiver doesn't point to a disposable object - Object lock; - - bool isDisposed() - { - return !receiver.funcptr; - } - - Object getObject() - { - return lock ? _d_toObject(receiver.context) : null; - } - } - else - static const isDelegate = false; - - static typeof(*this) opCall(Receiver r, Dg c) - { - typeof(*this) ret; - ret.receiver = r; - ret.invoker = c; - return ret; - } -} - -enum SlotListId -{ - Func, // function pointers - Weak, // object delegates stored in C heap - Strong // delegates stored in GC heap -} - -/** - Used to specify the type of a signal-to-slot connection. - - Examples: ----- -class Sender -{ - mixin Signal!("changed"); - void change() - { - changed.emit; - } -} - - -class Receiver -{ - void alarm() {} -} - -void main() -{ - auto s = new Sender; - auto r = new Receiver; - s.changed.connect(&r.alarm); // now s weakly references r - - r = null; - // collect garbage (assume there is no more reachable pointers - // to the receiver and it gets finalized) - ... - - s.change; - // weak reference to the receiving object - // has been removed from the sender's connection lists. - - r = new Receiver; - s.changed.connect(&r.alarm, ConnectionFlags.Strong); - - r = null; - // collect garbage - ... - // the receiving object has not been finalized because s strongly references it. - - s.change; // the receiver is called. - delete r; - s.change; // the receiver is disconnected from the sender. - - static void foo() - { - } - - s.changed.connect(&foo); - s.changed.emit; // foo is called. - s.changed.disconnect(&foo); // must be explicitly disconnected. - - void bar() - { - } - - // ConnectionFlags.NoObject must be specified for delegates - // to non-static local functions or struct member functions. - s.changed.connect(&bar, ConnectionFlags.NoObject); - s.changed.emit; // bar is called. - s.changed.disconnect(&bar); // must be explicitly disconnected. -} ----- -*/ -public enum ConnectionFlags -{ - /// - None, - /** - The receiver will be stored as weak reference (implied if ConnectionFlags.NoObject is not specified). - If the signal receiver is not a function pointer or a delegate referencing a D class instance. - the sender will not be notified when the receiving object is deleted and emitting the signal - connected to that receiving object will result in undefined behavior. - */ - Weak = 0x0001, - /** - The receiver is stored as strong reference (implied if ConnectionFlags.NoObject is specified). - */ - Strong = 0x0002, - /** - Must be specified if the receiver is not a function pointer or a delegate referencing a D class instance. - */ - NoObject = 0x0004 - - // Queued = 0x0004, - // BlockingQueued = 0x0008 -} - - -struct SlotList(SlotT, bool strong = false) -{ - alias SlotT SlotType; - SlotType[] data; - - void length(size_t length) - { - static if (strong) - data.length = length; - else - realloc(data, length); - } - - SlotType* add(SlotType slot) - { - auto oldLen = data.length; - length = oldLen + 1; - auto p = &data[oldLen]; - *p = slot; - return p; - } - - SlotType* get(int slotId) - { - return &data[slotId]; - } - - void remove(int slotId) - { - move(data, slotId, slotId + 1, data.length - slotId - 1); - data = data[0..$ - 1]; - } - - size_t length() - { - return data.length; - } - - void free() - { - static if (SlotType.isDelegate) - { - foreach (ref slot; data) - { - if (auto obj = slot.getObject) - rt_detachDisposeEvent(obj, &slot.onReceiverDisposed); - } - } - static if (!strong) - cfree(data.ptr); - } -} - -public alias void delegate(int signalId, SignalEventId event) SignalEvent; - -struct SignalConnections -{ - bool isInUse; - - STuple!( - SlotList!(Slot!(Fn)), - SlotList!(Slot!(Dg)), - SlotList!(Slot!(Dg), true) - ) slotLists; - - STuple!( - Fn[], - Dg[] - ) delayedDisconnects; - - void addDelayedDisconnect(Fn r) - { - delayedDisconnects.at!(0) ~= r; - } - - void addDelayedDisconnect(Dg r) - { - delayedDisconnects.at!(1) ~= r; - } - - SlotListType!(slotListId)* getSlotList(int slotListId)() - { - return &slotLists.tupleof[slotListId]; - } - - bool hasSlots() - { - foreach(i, e; slotLists.tupleof) - { - if (slotLists.tupleof[i].length) - return true; - } - return false; - } - - int slotCount() - { - int count; - foreach(i, e; slotLists.tupleof) - count += slotLists.at!(i).length; - return count; - } - - void slotListLengths(int[] lengths) - { - foreach(i, e; slotLists.tupleof) - lengths[i] = slotLists.at!(i).length; - } - - SlotType!(slotListId)* addSlot(int slotListId)(SlotType!(slotListId) slot) - { - return getSlotList!(slotListId).add(slot); - } - - void removeSlot(int slotListId)(int slotId) - { - slotLists.at!(slotListId).remove(slotId); - } - - void free() - { - foreach(i, e; slotLists.tupleof) - { - static if (is(typeof(slotLists.at!(i).free))) - slotLists.at!(i).free; - } - } - - template SlotListType(int slotListId) - { - alias typeof(slotLists.tupleof)[slotListId] SlotListType; - } - - template SlotType(int slotListId) - { - alias SlotListType!(slotListId).SlotType SlotType; - } - - template ReceiverType(int slotListId) - { - alias SlotType!(slotListId).Receiver ReceiverType; - } - - static const slotListCount = slotLists.tupleof.length; -} - - -private ThreadLocal!(Object) signalSender_; -static this() -{ - signalSender_ = new ThreadLocal!(Object); -} - -/** - If called from a slot, returns the object - that is emitting the signal. Otherwise, returns null. -*/ -public Object signalSender() { - return signalSender_.val; -} - -public class SignalHandler -{ - SignalConnections[] connections; - Object owner; - int blocked; - - SignalEvent signalEvent; - - alias SignalConnections.SlotType SlotType; - alias SignalConnections.ReceiverType ReceiverType; - - public this(Object owner_) { - owner = owner_; - } - - private SignalConnections* getConnections(int signalId) - { - if (signalId < connections.length) - return &connections[signalId]; - return null; - } - - private SlotType!(slotListId)* addSlot(int slotListId)(int signalId, ReceiverType!(slotListId) receiver, - Dg invoker) - { - if (signalId >= connections.length) - connections.length = signalId + 1; - auto slot = connections[signalId].addSlot!(slotListId)(SlotType!(slotListId)(receiver, invoker)); - - if (signalEvent && connections[signalId].slotCount == 1) - signalEvent(signalId, SignalEventId.firstSlotConnected); - - return slot; - } - - private void removeSlot(int slotListId)(int signalId, int slotId) - { - connections[signalId].removeSlot!(slotListId)(slotId); - - if (signalEvent && !connections[signalId].slotCount) - signalEvent(signalId, SignalEventId.lastSlotDisconnected); - } - - private SlotType!(slotListId)* addObjectSlot(int slotListId)(size_t signalId, Object obj, Dg receiver, - Dg invoker) - { - auto slot = addSlot!(slotListId)(signalId, receiver, invoker); - slot.lock = this; - rt_attachDisposeEvent(obj, &slot.onReceiverDisposed); - return slot; - } - - size_t slotCount(int signalId) - { - synchronized(this) - { - auto con = getConnections(signalId); - if (con) - return con.slotCount; - return 0; - } - } - - void connect(Receiver)(size_t signalId, Receiver receiver, - Dg invoker, ConnectionFlags flags) - { - synchronized(this) - { - static if (is(typeof(receiver.context))) - { - Object obj; - if ((flags & ConnectionFlags.NoObject) || (obj = _d_toObject(receiver.context)) is null) - { - // strong by default - if (flags & ConnectionFlags.Weak) - addSlot!(SlotListId.Weak)(signalId, receiver, invoker); - else - addSlot!(SlotListId.Strong)(signalId, receiver, invoker); - } - else - { - // weak by default - if (flags & ConnectionFlags.Strong) - addObjectSlot!(SlotListId.Strong)(signalId, obj, receiver, invoker); - else - addObjectSlot!(SlotListId.Weak)(signalId, obj, receiver, invoker); - } - } - else - addSlot!(SlotListId.Func)(signalId, receiver, invoker); - } - } - - void disconnect(Receiver)(int signalId, Receiver receiver) - { - synchronized(this) - { - auto cons = getConnections(signalId); - if (!cons) - return; - - // if called from a slot being executed by this signal, delay disconnection - // until all slots has been called. - if (cons.isInUse) - { - cons.addDelayedDisconnect(receiver); - return; - } - - TOP: - foreach (slotListId, e; cons.slotLists.tupleof) - { - /// COMPILER BUG: ReceiverType is evaluated to expression instead of type. - static if (is(typeof(cons.ReceiverType!(slotListId)) == Receiver)) - { - auto slotList = cons.getSlotList!(slotListId); - for (int slotId; slotId < slotList.length;) - { - auto slot = slotList.get(slotId); - static if (slot.isDelegate) - { - if (slot.isDisposed) - { - removeSlot!(slotListId)(signalId, slotId); - continue; - } - } - - if (slot.receiver == receiver) - { - static if (slot.isDelegate) - { - if (auto obj = slot.getObject) - rt_detachDisposeEvent(obj, &slot.onReceiverDisposed); - } - removeSlot!(slotListId)(signalId, slotId); - break TOP; - } - - slotId++; - } - } - } - } - } - - void emit(A...)(size_t signalId, A args) - { - synchronized(this) - { - if (signalId >= connections.length || blocked) - return; - auto cons = &connections[signalId]; - - if (cons.hasSlots) - { - { - cons.isInUse = true; - signalSender_.val = owner; - scope(exit) - { - cons.isInUse = false; - signalSender_.val = null; - } - - // Store the lengths to avoid calling new slots - // connected in the slots being called. - // dmd bug: int[cons.slotListCount] fails - static const c = cons.slotListCount; - int[c] lengths = void; - cons.slotListLengths(lengths); - - foreach (slotListId, e; cons.slotLists.tupleof) - { - auto slotList = cons.getSlotList!(slotListId); - for (size_t slotId; slotId < lengths[slotListId];) - { - auto slot = slotList.get(slotId); - static if (slot.isDelegate) - { - if (slot.isDisposed) - { - removeSlot!(slotListId)(signalId, slotId); - lengths[slotListId]--; - continue; - } - } - - slot.invoker.call!(void)(slot.receiver, args); - ++slotId; - } - } - } - - - // process delayed disconnects if any - foreach(i, e; cons.delayedDisconnects.tupleof) - { - if (cons.delayedDisconnects.at!(i).length) - { - foreach (d; cons.delayedDisconnects.at!(i)) - disconnect(signalId, d); - cons.delayedDisconnects.at!(i).length = 0; - } - } - } - } - } - - // Adjusts signal arguments and calls the slot. S - slot signature, A - signal arguments - private void invokeSlot(S, Receiver, A...)(Receiver r, A args) - { - r.get!(S)()(args[0..ParameterTupleOf!(S).length]); - } - - void blockSignals() - { - synchronized(this) - blocked++; - } - - void unblockSignals() - { - synchronized(this) - { - if(!blocked) - throw new SignalException("Signals are not blocked"); - blocked--; - } - } - - ~this() - { - foreach(ref c; connections) - c.free; - } -} - -//TODO: this could be avoided if named mixins didn't suck. -public struct SignalOps(int sigId, A...) -{ - private SignalHandler sh; - enum { signalId = sigId } - - void connect(R, B...)(R function(B) fn, ConnectionFlags flags = ConnectionFlags.None) - { - alias CheckSlot!(typeof(fn), A) check; - auto invoker = Dg(&sh.invokeSlot!(typeof(fn), Fn, A)); - sh.connect(signalId, Fn(fn), invoker, flags); - } - - void connect(R, B...)(R delegate(B) dg, ConnectionFlags flags = ConnectionFlags.None) - { - alias CheckSlot!(typeof(dg), A) check; - auto invoker = Dg(&sh.invokeSlot!(typeof(dg), Dg, A)); - sh.connect(signalId, Dg(dg), invoker, flags); - } - - void disconnect(R, B...)(R function(B) fn) - { - sh.disconnect(signalId, Fn(fn)); - } - - void disconnect(R, B...)(R delegate(B) dg) - { - sh.disconnect(signalId, Dg(dg)); - } - - void emit(A args) - { - sh.emit(signalId, args); - } - - debug size_t slotCount() - { - return sh.slotCount(signalId); - } -} - -template CheckSlot(Slot, A...) -{ - static assert(ParameterTupleOf!(Slot).length <= A.length, "Slot " ~ ParameterTypeTuple!(Slot).stringof ~ - " has more prameters than signal " ~ A.stringof); - alias CheckSlotImpl!(Slot, 0, A) check; -} - -template CheckSlotImpl(Slot, int i, A...) -{ - alias ParameterTupleOf!(Slot) SlotArgs; - static if (i < SlotArgs.length) - { - static assert (is(SlotArgs[i] : A[i]), "Argument " ~ __toString(i) ~ - ":" ~ A[i].stringof ~ " of signal " ~ A.stringof ~ " is not implicitly convertible to parameter " - ~ SlotArgs[i].stringof ~ " of slot " ~ SlotArgs.stringof); - alias CheckSlotImpl!(Slot, i + 1, A) next; - } -} - -public template SignalHandlerOps() -{ - static assert (is(typeof(this.signalHandler)), - "SignalHandlerOps is already instantiated in " ~ typeof(this).stringof ~ " or one of its base classes"); - -protected: - SignalHandler signalHandler_; // manages signal-to-slot connections - - final SignalHandler signalHandler() - { - if (!signalHandler_) - { - signalHandler_ = new SignalHandler(this); - onSignalHandlerCreated(signalHandler_); - } - return signalHandler_; - } - - void onSignalHandlerCreated(ref SignalHandler sh) - { - } - -public: - final void blockSignals() - { - signalHandler.blockSignals(); - } - - final void unblockSignals() - { - signalHandler.unblockSignals(); - } -} - -/** - Examples: ----- -struct Args -{ - bool cancel; -} - -class C -{ - private int _x; - // reference parameters are not supported yet, - // so we pass arguments by pointer. - mixin Signal!("xChanging", int, Args*); - mixin Signal!("xChanged"); - - void x(int v) - { - if (v != _x) - { - Args args; - xChanging.emit(v, &args); - if (!args.cancel) - { - _x = v; - xChanged.emit; - } - } - } -} ----- -*/ -template Signal(string name, A...) -{ - mixin SignalImpl!(0, name, A); -} - -template SignalImpl(int index, string name, A...) -{ - static if (is(typeof(mixin(typeof(this).stringof ~ ".__sig" ~ ToString!(index))))) - mixin SignalImpl!(index + 1, name, A); - else - { - // mixed-in once - static if (!is(typeof(this.signalHandler))) - { - mixin SignalHandlerOps; - } - mixin("private static const int __sig" ~ ToString!(index) ~ " = " ~ ToString!(index) ~ ";"); - mixin("SignalOps!(" ~ ToString!(index) ~ ", A) " ~ name ~ "(){ return SignalOps!(" - ~ ToString!(index) ~ ", A)(signalHandler); }"); - } -} - -extern(C) alias void function(void*) SlotConnector; - -debug (UnitTest) -{ - class A - { - mixin Signal!("scorched", int); - - int signalId1 = -1; - int signalId2 = -1; - - void onFirstConnect(int sId) - { - signalId1 = sId; - } - - void onLastDisconnect(int sId) - { - signalId2 = sId; - } - - this() - { - signalHandler.firstSlotConnected = &onFirstConnect; - signalHandler.lastSlotDisconnected = &onLastDisconnect; - } - } - - class B : A - { - mixin Signal!("booed", int); - - int bazSum; - void baz(int i) - { - bazSum += i; - } - } - - class C : A - { - mixin Signal!("cooked"); - } -} - -unittest -{ - static int fooSum; - static int barSum; - - static void foo(int i) - { - fooSum += i; - } - - void bar(long i) - { - barSum += i; - } - - auto a = new A; - auto b = new B; - auto c = new C; - assert(b.scorched.signalId == 0); - assert(b.booed.signalId == 1); - assert(c.cooked.signalId == 1); - - auto sh = b.signalHandler; - - b.scorched.connect(&foo); - assert(sh.connections.length == 1); - assert(b.signalId1 == 0); - auto scCons = &sh.connections[0]; - - assert(scCons.getSlotList!(SlotListId.Func).length == 1); - b.scorched.emit(1); - assert(fooSum == 1); - - b.scorched.connect(&bar, ConnectionFlags.NoObject); - assert(sh.connections.length == 1); - assert(scCons.getSlotList!(SlotListId.Strong).length == 1); - b.scorched.emit(1); - assert (fooSum == 2 && barSum == 1); - - b.scorched.connect(&b.baz); - assert(scCons.getSlotList!(SlotListId.Weak).length == 1); - b.scorched.emit(1); - assert (fooSum == 3 && barSum == 2 && b.bazSum == 1); - - b.scorched.disconnect(&bar); - assert(scCons.slotCount == 2); - b.scorched.disconnect(&b.baz); - assert(scCons.slotCount == 1); - b.scorched.disconnect(&foo); - assert(scCons.slotCount == 0); - assert(b.signalId2 == 0); - - fooSum = 0; - void connectFoo() - { - b.scorched.connect(&foo); - b.scorched.disconnect(&connectFoo); - } - - b.scorched.connect(&connectFoo, ConnectionFlags.NoObject); - b.scorched.emit(1); - assert(scCons.getSlotList!(SlotListId.Func).length == 1); - assert(scCons.getSlotList!(SlotListId.Strong).length == 0); - assert(!fooSum); - - auto r = new B(); - b.scorched.connect(&r.baz); - assert(scCons.getSlotList!(SlotListId.Weak).length == 1); - b.scorched.emit(1); - assert(r.bazSum == 1); - assert(fooSum == 1); - - delete(r); - assert(scCons.getSlotList!(SlotListId.Weak).length == 1); - b.scorched.emit(1); - assert(scCons.getSlotList!(SlotListId.Weak).length == 0); -} \ No newline at end of file
--- a/qt/d1/qt/core/QLine.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,400 +0,0 @@ -module qt.core.QLine; - -public import qt.QGlobal; -public import qt.core.Qt; -public import qt.core.QPoint; -public import qt.core.QDataStream; - - -public struct QLine -{ - public static QLine opCall() { - QLine ln; - ln.pt1 = QPoint(); - ln.pt2 = QPoint(); - return ln; - } - - public static QLine opCall(in QPoint pt1_, in QPoint pt2_) { - QLine ln; - ln.pt1 = pt1_; - ln.pt2 = pt2_; - return ln; - } - - public static QLine opCall(int x1pos, int y1pos, int x2pos, int y2pos) { - QLine ln; - ln.pt1 = QPoint(x1pos, y1pos); - ln.pt2 = QPoint(x2pos, y2pos); - return ln; - } - - bool isNull() // const - { - return pt1 == pt2; - } - - int x1() // const - { - return pt1.x(); - } - - int y1() // const - { - return pt1.y(); - } - - int x2() // const - { - return pt2.x(); - } - - int y2() // const - { - return pt2.y(); - } - - QPoint p1() // const - { - return pt1; - } - - QPoint p2() // const - { - return pt2; - } - - int dx() // const - { - return pt2.x() - pt1.x(); - } - - int dy() // const - { - return pt2.y() - pt1.y(); - } - - void translate(in QPoint point) - { - pt1 += point; - pt2 += point; - } - - void translate(int adx, int ady) - { - translate(QPoint(adx, ady)); - } - - QLine translated(in QPoint p) // const - { - return QLine(pt1 + p, pt2 + p); - } - - QLine translated(int adx, int ady) // const - { - return translated(QPoint(adx, ady)); - } - - void p1(in QPoint aP1) - { - pt1 = aP1; - } - - void p2(in QPoint aP2) - { - pt2 = aP2; - } - - void setP1(in QPoint aP1) // for convenience - { - pt1 = aP1; - } - - void setP2(in QPoint aP2) // for convenience - { - pt2 = aP2; - } - - void setPoints(in QPoint aP1, in QPoint aP2) - { - pt1 = aP1; - pt2 = aP2; - } - - void setLine(int aX1, int aY1, int aX2, int aY2) - { - pt1 = QPoint(aX1, aY1); - pt2 = QPoint(aX2, aY2); - } - - bool opEquals(in QLine d) // const - { - return pt1 == d.pt1 && pt2 == d.pt2; - } - - public final void writeTo(QDataStream arg__1) { - qtd_QLine_writeTo_QDataStream(this, arg__1 is null ? null : arg__1.__nativeId); - } - - public final void readFrom(QDataStream arg__1) { - qtd_QLine_readFrom_QDataStream(this, arg__1 is null ? null : arg__1.__nativeId); - } - -private: - QPoint pt1, pt2; -} - - -public enum QLineF_IntersectType { - NoIntersection = 0, - BoundedIntersection = 1, - UnboundedIntersection = 2 -} - -public struct QLineF -{ - - alias QLineF_IntersectType IntersectType; - - alias QLineF_IntersectType.NoIntersection NoIntersection; - alias QLineF_IntersectType.BoundedIntersection BoundedIntersection; - alias QLineF_IntersectType.UnboundedIntersection UnboundedIntersection; - - public static QLineF opCall() { - QLineF ln; - ln.pt1 = QPointF(); - ln.pt2 = QPointF(); - return ln; - } - - public static QLineF opCall(in QPointF apt1, in QPointF apt2) { - QLineF ln; - ln.pt1 = apt1; - ln.pt2 = apt2; - return ln; - } - - public static QLineF opCall(qreal x1pos, qreal y1pos, qreal x2pos, qreal y2pos) { - QLineF ln; - ln.pt1 = QPointF(x1pos, y1pos); - ln.pt2 = QPointF(x2pos, y2pos); - return ln; - } - - public static QLineF opCall(in QLine line){ - QLineF ln; - ln.pt1 = QPointF(line.p1()); - ln.pt2 = QPointF(line.p2()); - return ln; - } - - public final bool isNull() // const - { - return qtd_QLineF_isNull(this); - } - - qreal x1() // const - { - return pt1.x(); - } - - qreal y1() // const - { - return pt1.y(); - } - - qreal x2() // const - { - return pt2.x(); - } - - qreal y2() // const - { - return pt2.y(); - } - - QPointF p1() // const - { - return pt1; - } - - QPointF p2() // const - { - return pt2; - } - - qreal dx() // const - { - return pt2.x() - pt1.x(); - } - - qreal dy() // const - { - return pt2.y() - pt1.y(); - } - - QLineF normalVector() // const - { - return QLineF(p1(), p1() + QPointF(dy(), -dx())); - } - - void translate(in QPointF point) - { - pt1 += point; - pt2 += point; - } - - void translate(qreal adx, qreal ady) - { - this.translate(QPointF(adx, ady)); - } - - QLineF translated(in QPointF p) // const - { - return QLineF(pt1 + p, pt2 + p); - } - - QLineF translated(qreal adx, qreal ady) // const - { - return translated(QPointF(adx, ady)); - } - - void setLength(qreal len) - { - if (isNull()) - return; - QLineF v = unitVector(); - pt2 = QPointF(pt1.x() + v.dx() * len, pt1.y() + v.dy() * len); - } - - void length(qreal len) - { - if (isNull()) - return; - QLineF v = unitVector(); - pt2 = QPointF(pt1.x() + v.dx() * len, pt1.y() + v.dy() * len); - } - - QPointF pointAt(qreal t) // const - { - qreal vx = pt2.x() - pt1.x(); - qreal vy = pt2.y() - pt1.y(); - return QPointF(pt1.x() + vx * t, pt1.y() + vy * t); - } - - QLine toLine() // const - { - return QLine(pt1.toPoint(), pt2.toPoint()); - } - - void setP1(in QPointF aP1) - { - pt1 = aP1; - } - - void setP2(in QPointF aP2) - { - pt2 = aP2; - } - - void p1(in QPointF aP1) - { - pt1 = aP1; - } - - void p2(in QPointF aP2) - { - pt2 = aP2; - } - - void setPoints(in QPointF aP1, in QPointF aP2) - { - pt1 = aP1; - pt2 = aP2; - } - - void setLine(qreal aX1, qreal aY1, qreal aX2, qreal aY2) - { - pt1 = QPointF(aX1, aY1); - pt2 = QPointF(aX2, aY2); - } - - bool opEquals(in QLineF d) // const - { - return pt1 == d.pt1 && pt2 == d.pt2; - } - - public final double angle() { - return qtd_QLineF_angle(this); - } - - public final double angle(in QLineF l) { - return qtd_QLineF_angle_QLineF(this, &l); - } - - public final double angleTo(in QLineF l) { - return qtd_QLineF_angleTo_QLineF(this, &l); - } - - // ### Qt 5: rename intersects() or intersection() and rename IntersectType IntersectionType - private final QLineF_IntersectType intersect(in QLineF l, QPointF* intersectionPoint) { - return cast(QLineF_IntersectType) qtd_QLineF_intersect_QLineF_nativepointerQPointF(this, &l, intersectionPoint); - } - - public final double length() { - return qtd_QLineF_length(this); - } - - public final void writeTo(QDataStream arg__1) { - qtd_QLineF_writeTo_QDataStream(this, arg__1 is null ? null : arg__1.__nativeId); - } - - public final void readFrom(QDataStream arg__1) { - qtd_QLineF_readFrom_QDataStream(this, arg__1 is null ? null : arg__1.__nativeId); - } - - public final void setAngle(double angle) { - qtd_QLineF_setAngle_double(this, angle); - } - - public final QLineF unitVector() { - return qtd_QLineF_unitVector(this); - } - - public static QLineF fromPolar(double length, double angle) { - return qtd_QLineF_fromPolar_double_double(length, angle); - } - - private: - QPointF pt1, pt2; -} - - -// C wrappers -// QLine -private extern(C) void qtd_QLine_writeTo_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) void qtd_QLine_readFrom_QDataStream(void* __this_nativeId, - void* arg__1); - -// QLineF -private extern(C) bool qtd_QLineF_isNull(void* __this_nativeId); -private extern(C) double qtd_QLineF_angle(void* __this_nativeId); -private extern(C) double qtd_QLineF_angle_QLineF(void* __this_nativeId, - void* l0); -private extern(C) double qtd_QLineF_angleTo_QLineF(void* __this_nativeId, - void* l0); -private extern(C) int qtd_QLineF_intersect_QLineF_nativepointerQPointF(void* __this_nativeId, - void* l0, - void* intersectionPoint1); -private extern(C) double qtd_QLineF_length(void* __this_nativeId); -private extern(C) void qtd_QLineF_writeTo_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) void qtd_QLineF_readFrom_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) void qtd_QLineF_setAngle_double(void* __this_nativeId, - double angle0); - -private extern(C) QLineF qtd_QLineF_unitVector(void* __this_nativeId); -private extern(C) QLineF qtd_QLineF_fromPolar_double_double(double length0, - double angle1);
--- a/qt/d1/qt/core/QLineF.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -module qt.core.QLineF; -/* dummy */ - -public import qt.core.QLine; \ No newline at end of file
--- a/qt/d1/qt/core/QModelIndex.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -module qt.core.QModelIndex; - -public import qt.QGlobal; -private import qt.QtdObject; - -// automatic imports------------- -private import qt.core.QVariant; -private import qt.core.QAbstractItemModel; -public import qt.core.Qt; - -version (Tango) -{ - import tango.core.Array; - import tango.stdc.stringz; - import tango.text.convert.Utf; -} - - -public struct QModelIndex -{ - - public static QModelIndex opCall() { - QModelIndex mi; - mi.r = mi.c = -1; - mi.p = mi.m = null; - return mi; - } - public final QModelIndex child(int row, int column) { - return __qtd_QModelIndex_child_int_int(this, row, column); - } - - public final int column() { - return __qtd_QModelIndex_column(this); - } - - public final QVariant data(int role = 0) { - void* __qt_return_value = __qtd_QModelIndex_data_int(this, role); - return new QVariant(__qt_return_value); - } - - public final int flags() { - return __qtd_QModelIndex_flags(this); - } - - public final long internalId() { - return __qtd_QModelIndex_internalId(this); - } - - public final void* internalPointer() { - //return __qtd_QModelIndex_internalPointer(this); - return p; - } - - public final Object object() { - return cast(Object) p; - } - - public final bool isValid() { - return __qtd_QModelIndex_isValid(this); - } - - public final QAbstractItemModel model() { -// void* __qt_return_value = __qtd_QModelIndex_model(this); - void* __qt_return_value = m; - if (__qt_return_value is null) - return null; - void* d_obj = qtd_get_d_qobject(__qt_return_value); - return cast(QAbstractItemModel) d_obj; - } - - private final bool operator_less(QModelIndex other) { - return __qtd_QModelIndex_operator_less_QModelIndex(this, other); - } - - private final bool operator_equal(QModelIndex other) { - return __qtd_QModelIndex_operator_equal_QModelIndex(this, other); - } - - public final QModelIndex parent() { - return __qtd_QModelIndex_parent(this); - } - - public final int row() { - return __qtd_QModelIndex_row(this); - } - - public final QModelIndex sibling(int row, int column) { - return __qtd_QModelIndex_sibling_int_int(this, row, column); - } - -private: - int r; - int c; - void *p; - void *m; -} - -alias QModelIndex QModelIndexAccessor; - - -// C wrappers -private extern(C) void* __qtd_QModelIndex_QModelIndex_QModelIndex(QModelIndex other0); -private extern(C) QModelIndex __qtd_QModelIndex_child_int_int(void* __this_nativeId, - int row0, - int column1); -private extern(C) int __qtd_QModelIndex_column(void* __this_nativeId); -private extern(C) void* __qtd_QModelIndex_data_int(void* __this_nativeId, - int role0); -private extern(C) int __qtd_QModelIndex_flags(void* __this_nativeId); -private extern(C) long __qtd_QModelIndex_internalId(void* __this_nativeId); -private extern(C) void* __qtd_QModelIndex_internalPointer(void* __this_nativeId); -private extern(C) bool __qtd_QModelIndex_isValid(void* __this_nativeId); -private extern(C) void* __qtd_QModelIndex_model(void* __this_nativeId); -private extern(C) bool __qtd_QModelIndex_operator_less_QModelIndex(void* __this_nativeId, - QModelIndex other0); -private extern(C) bool __qtd_QModelIndex_operator_equal_QModelIndex(void* __this_nativeId, - QModelIndex other0); -private extern(C) QModelIndex __qtd_QModelIndex_parent(void* __this_nativeId); -private extern(C) int __qtd_QModelIndex_row(void* __this_nativeId); -private extern(C) QModelIndex __qtd_QModelIndex_sibling_int_int(void* __this_nativeId, - int row0, - int column1); -// Just the private functions for abstract functions implemeneted in superclasses - - - -// Virtual Dispatch functions
--- a/qt/d1/qt/core/QPoint.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,234 +0,0 @@ -module qt.core.QPoint; - -public import qt.QGlobal; -public import qt.core.Qt; -public import qt.core.QDataStream; - -public struct QPoint -{ - -// Functions - public static QPoint opCall() { - QPoint pt; - pt.xp = pt.yp = 0; - return pt; - } - - public static QPoint opCall(int xpos, int ypos) { - QPoint pt; - pt.xp = xpos; - pt.yp = ypos; - return pt; - } - - bool isNull() // const - { return xp == 0 && yp == 0; } - - int x() // const - { return xp; } - - int y() // const - { return yp; } - - void x(int xpos) - { xp = xpos; } - - void y(int ypos) - { yp = ypos; } - - void setX(int xpos) // for convenience - { xp = xpos; } - - void setY(int ypos) // for convenience - { yp = ypos; } - - public final int manhattanLength() { - return qtd_QPoint_manhattanLength(this); - } -/* -inline int &rx() -{ return xp; } - -inline int &ry() -{ return yp; } -*/ - - QPoint opAddAssign(in QPoint p) - { xp+=p.xp; yp+=p.yp; return *this; } - - QPoint opSubAssign(in QPoint p) - { xp-=p.xp; yp-=p.yp; return *this; } - - QPoint opMulAssign(qreal c) - { xp = qRound(xp*c); yp = qRound(yp*c); return *this; } - - bool opEquals(in QPoint p) - { return xp == p.xp && yp == p.yp; } - - QPoint opAdd(in QPoint p) - { return QPoint(this.xp+p.xp, this.yp+p.yp); } - - QPoint opSub(in QPoint p) - { return QPoint(this.xp-p.xp, this.yp-p.yp); } - - QPoint opMul(qreal c) - { return QPoint(qRound(this.xp*c), qRound(this.yp*c)); } - - QPoint opDivAssign(qreal c) - { - xp = qRound(xp/c); - yp = qRound(yp/c); - return *this; - } - - QPoint opDiv(qreal c) - { - return QPoint(qRound(this.xp/c), qRound(this.yp/c)); - } - - public final void writeTo(QDataStream arg__1) { - qtd_QPoint_writeTo_QDataStream(this, arg__1 is null ? null : arg__1.__nativeId); - } - - public final void readFrom(QDataStream arg__1) { - qtd_QPoint_readFrom_QDataStream(this, arg__1 is null ? null : arg__1.__nativeId); - } - -private: - // ### Qt 5; remove the ifdef and just have the same order on all platforms. - version(OSX) - { - int yp; - int xp; - } - else - { - int xp; - int yp; - } -} - - -public struct QPointF -{ - public static QPointF opCall() { - QPointF pt; - pt.xp = pt.yp = 0; - return pt; - } - - public static QPointF opCall(qreal xpos, qreal ypos) { - QPointF pt; - pt.xp = xpos; - pt.yp = ypos; - return pt; - } - - public static QPointF opCall(in QPoint p) { - QPointF pt; - pt.xp = p.x(); - pt.yp = p.y(); - return pt; - } - - bool isNull() //const - { - return qIsNull(xp) && qIsNull(yp); - } - - qreal x() //const - { - return xp; - } - - qreal y() //const - { - return yp; - } - - void x(qreal xpos) - { - xp = xpos; - } - - void y(qreal ypos) - { - yp = ypos; - } -/* -inline qreal &QPointF::rx() -{ - return xp; -} - -inline qreal &QPointF::ry() -{ - return yp; -} -*/ - - QPointF opAddAssign(in QPointF p) - { xp+=p.xp; yp+=p.yp; return *this; } - - QPointF opSubAssign(in QPointF p) - { xp-=p.xp; yp-=p.yp; return *this; } - - QPointF opMulAssign(qreal c) - { xp*=c; yp*=c; return *this; } - - bool opEquals(in QPointF p) - { return qFuzzyCompare(xp, p.xp) && qFuzzyCompare(yp, p.yp); } - - QPointF opAdd(in QPointF p) - { return QPointF(this.xp+p.xp, this.yp+p.yp); } - - QPointF opSub(in QPointF p) - { return QPointF(this.xp-p.xp, this.yp-p.yp); } - - QPointF opMul(qreal c) - { return QPointF(this.xp*c, this.yp*c); } - - QPointF opDivAssign(qreal c) - { - xp/=c; - yp/=c; - return *this; - } - - QPointF opDiv(qreal c) - { - return QPointF(xp/c, yp/c); - } - - QPoint toPoint() //const - { - return QPoint(qRound(xp), qRound(yp)); - } - - public final void writeTo(QDataStream arg__1) { - qtd_QPointF_writeTo_QDataStream(this, arg__1 is null ? null : arg__1.__nativeId); - } - - public final void readFrom(QDataStream arg__1) { - qtd_QPointF_readFrom_QDataStream(this, arg__1 is null ? null : arg__1.__nativeId); - } - -private: - qreal xp; - qreal yp; -} - - -// C wrappers -// QPoint -private extern(C) int qtd_QPoint_manhattanLength(void* __this_nativeId); -private extern(C) void qtd_QPoint_writeTo_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) void qtd_QPoint_readFrom_QDataStream(void* __this_nativeId, - void* arg__1); - -// QPointF -private extern(C) void qtd_QPointF_writeTo_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) void qtd_QPointF_readFrom_QDataStream(void* __this_nativeId, - void* arg__1); \ No newline at end of file
--- a/qt/d1/qt/core/QPointF.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -module qt.core.QPointF; -/* dummy */ - -public import qt.core.QPoint;
--- a/qt/d1/qt/core/QRect.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,382 +0,0 @@ -module qt.core.QRect; - -public import qt.QGlobal; -public import qt.core.Qt; - -public import qt.core.QDataStream; -public import qt.core.QSize; -public import qt.core.QPoint; - - -public struct QRect -{ - public static QRect opCall() { - QRect rt; - rt.x1 = rt.y1 = 0; - rt.x2 = rt.y2 = -1; - return rt; - } - - public static QRect opCall(int aleft, int atop, int awidth, int aheight) - { - QRect rt; - rt.x1 = aleft; - rt.y1 = atop; - rt.x2 = (aleft + awidth - 1); - rt.y2 = (atop + aheight - 1); - return rt; - } - - public static QRect opCall(in QPoint atopLeft, in QPoint abottomRight) - { - QRect rt; - rt.x1 = atopLeft.x(); - rt.y1 = atopLeft.y(); - rt.x2 = abottomRight.x(); - rt.y2 = abottomRight.y(); - return rt; - } - - public static QRect opCall(in QPoint atopLeft, in QSize asize) - { - QRect rt; - rt.x1 = atopLeft.x(); - rt.y1 = atopLeft.y(); - rt.x2 = (rt.x1+asize.width() - 1); - rt.y2 = (rt.y1+asize.height() - 1); - return rt; - } - - bool isNull() // const - { return x2 == x1 - 1 && y2 == y1 - 1; } - - bool isEmpty() // const - { return x1 > x2 || y1 > y2; } - - bool isValid() // const - { return x1 <= x2 && y1 <= y2; } - - int left() // const - { return x1; } - - int top() // const - { return y1; } - - int right() // const - { return x2; } - - int bottom() // const - { return y2; } - - int x() // const - { return x1; } - - int y() // const - { return y1; } - - void left(int pos) - { x1 = pos; } - - void top(int pos) - { y1 = pos; } - - void right(int pos) - { x2 = pos; } - - void bottom(int pos) - { y2 = pos; } - - void setLeft(int pos) - { x1 = pos; } - - void setTop(int pos) - { y1 = pos; } - - void setRight(int pos) - { x2 = pos; } - - void setBottom(int pos) - { y2 = pos; } - - void setTopLeft(in QPoint p) - { x1 = p.x(); y1 = p.y(); } - - void setBottomRight(in QPoint p) - { x2 = p.x(); y2 = p.y(); } - - void setTopRight(in QPoint p) - { x2 = p.x(); y1 = p.y(); } - - void setBottomLeft(in QPoint p) - { x1 = p.x(); y2 = p.y(); } - - void setX(int ax) - { x1 = ax; } - - void setY(int ay) - { y1 = ay; } - - QPoint topLeft() // const - { return QPoint(x1, y1); } - - QPoint bottomRight() // const - { return QPoint(x2, y2); } - - QPoint topRight() // const - { return QPoint(x2, y1); } - - QPoint bottomLeft() // const - { return QPoint(x1, y2); } - - QPoint center() // const - { return QPoint((x1+x2)/2, (y1+y2)/2); } - - int width() // const - { return x2 - x1 + 1; } - - int height() // const - { return y2 - y1 + 1; } - - QSize size() // const - { return QSize(width(), height()); } - - void translate(int dx, int dy) - { - x1 += dx; - y1 += dy; - x2 += dx; - y2 += dy; - } - - void translate(in QPoint p) - { - x1 += p.x(); - y1 += p.y(); - x2 += p.x(); - y2 += p.y(); - } - - QRect translated(int dx, int dy) // const - { return QRect(QPoint(x1 + dx, y1 + dy), QPoint(x2 + dx, y2 + dy)); } - - QRect translated(in QPoint p) // const - { return QRect(QPoint(x1 + p.x(), y1 + p.y()), QPoint(x2 + p.x(), y2 + p.y())); } - - void moveTo(int ax, int ay) - { - x2 += ax - x1; - y2 += ay - y1; - x1 = ax; - y1 = ay; - } - - void moveTo(in QPoint p) - { - x2 += p.x() - x1; - y2 += p.y() - y1; - x1 = p.x(); - y1 = p.y(); - } - - void moveLeft(int pos) - { x2 += (pos - x1); x1 = pos; } - - void moveTop(int pos) - { y2 += (pos - y1); y1 = pos; } - - void moveRight(int pos) - { - x1 += (pos - x2); - x2 = pos; - } - - void moveBottom(int pos) - { - y1 += (pos - y2); - y2 = pos; - } - - void moveTopLeft(in QPoint p) - { - moveLeft(p.x()); - moveTop(p.y()); - } - - void moveBottomRight(in QPoint p) - { - moveRight(p.x()); - moveBottom(p.y()); - } - - void moveTopRight(in QPoint p) - { - moveRight(p.x()); - moveTop(p.y()); - } - - void moveBottomLeft(in QPoint p) - { - moveLeft(p.x()); - moveBottom(p.y()); - } - - void getRect(int *ax, int *ay, int *aw, int *ah) // const - { - *ax = x1; - *ay = y1; - *aw = x2 - x1 + 1; - *ah = y2 - y1 + 1; - } - - void setRect(int ax, int ay, int aw, int ah) - { - x1 = ax; - y1 = ay; - x2 = (ax + aw - 1); - y2 = (ay + ah - 1); - } - - void getCoords(int *xp1, int *yp1, int *xp2, int *yp2) // const - { - *xp1 = x1; - *yp1 = y1; - *xp2 = x2; - *yp2 = y2; - } - - void setCoords(int xp1, int yp1, int xp2, int yp2) - { - x1 = xp1; - y1 = yp1; - x2 = xp2; - y2 = yp2; - } - - QRect adjusted(int xp1, int yp1, int xp2, int yp2) // const - { return QRect(QPoint(x1 + xp1, y1 + yp1), QPoint(x2 + xp2, y2 + yp2)); } - - void adjust(int dx1, int dy1, int dx2, int dy2) - { - x1 += dx1; - y1 += dy1; - x2 += dx2; - y2 += dy2; - } - - void setWidth(int w) - { x2 = (x1 + w - 1); } - - void setHeight(int h) - { y2 = (y1 + h - 1); } - - void setSize(in QSize s) - { - x2 = (s.width() + x1 - 1); - y2 = (s.height() + y1 - 1); - } - - bool contains(int ax, int ay, bool aproper) // const - { - return contains(QPoint(ax, ay), aproper); - } - - bool contains(int ax, int ay) // const - { - return contains(QPoint(ax, ay), false); - } - - QRect opOrAssign(in QRect r) - { - *this = *this | r; - return *this; - } - - QRect opAndAssign(in QRect r) - { - *this = *this & r; - return *this; - } - - QRect intersected(in QRect other) // const - { - return *this & other; - } - - QRect united(in QRect r) // const - { - return *this | r; - } - - bool opEquals(in QRect r) - { - return x1==r.x1 && x2==r.x2 && y1==r.y1 && y2==r.y2; - } - - public final void writeTo(QDataStream arg__1) { - qtd_QRect_writeTo_QDataStream(this, arg__1 is null ? null : arg__1.__nativeId); - } - - public final void readFrom(QDataStream arg__1) { - qtd_QRect_readFrom_QDataStream(this, arg__1 is null ? null : arg__1.__nativeId); - } - - public final QRect opAnd(in QRect r) { - return qtd_QRect_operator_and_QRect(this, &r); - } - - public final QRect opOr(in QRect r) { - return qtd_QRect_operator_or_QRect(this, &r); - } - - public final bool contains(QPoint p, bool proper = false) { - return qtd_QRect_contains_QPoint_bool(this, &p, proper); - } - - public final bool contains(QRect r, bool proper = false) { - return qtd_QRect_contains_QRect_bool(this, &r, proper); - } - - public final bool intersects(QRect r) { - return qtd_QRect_intersects_QRect(this, &r); - } - - public final QRect normalized() { - return qtd_QRect_normalized(this); - } - -private: - version(OSX) - { - int y1; - int x1; - int y2; - int x2; - } - else - { - int x1; - int y1; - int x2; - int y2; - } -} - - -// C wrappers -private extern(C) bool qtd_QRect_contains_QPoint_bool(void* __this_nativeId, - void* p0, - bool proper1); -private extern(C) bool qtd_QRect_contains_QRect_bool(void* __this_nativeId, - void* r0, - bool proper1); -private extern(C) bool qtd_QRect_intersects_QRect(void* __this_nativeId, - void* r0); -private extern(C) QRect qtd_QRect_normalized(void* __this_nativeId); -private extern(C) void qtd_QRect_writeTo_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) void qtd_QRect_readFrom_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) QRect qtd_QRect_operator_and_QRect(void* __this_nativeId, - void* r0); -private extern(C) QRect qtd_QRect_operator_or_QRect(void* __this_nativeId, - void* r0); \ No newline at end of file
--- a/qt/d1/qt/core/QRectF.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,338 +0,0 @@ -module qt.core.QRectF; - -public import qt.QGlobal; -public import qt.core.Qt; -public import qt.core.QPointF; -public import qt.core.QRect; -public import qt.core.QSizeF; -public import qt.core.QDataStream; - - -public struct QRectF -{ - - public static QRectF opCall() - { - QRectF rt; - rt.xp = rt.yp = 0.; - rt.w = rt.h = 0.; - return rt; - } - - public static QRectF opCall(qreal aleft, qreal atop, qreal awidth, qreal aheight) - { - QRectF rt; - rt.xp = aleft; - rt.yp = atop; - rt.w = awidth; - rt.h = aheight; - return rt; - } - - public static QRectF opCall(in QPointF atopLeft, in QSizeF asize) - { - QRectF rt; - rt.xp = atopLeft.x(); - rt.yp = atopLeft.y(); - rt.w = asize.width(); - rt.h = asize.height(); - return rt; - } - - public static QRectF opCall(in QPointF atopLeft, in QPointF abottomRight) - { - QRectF rt; - rt.xp = atopLeft.x(); - rt.yp = atopLeft.y(); - rt.w = abottomRight.x() - rt.xp; - rt.h = abottomRight.y() - rt.yp; - return rt; - } - - public static QRectF opCall(in QRect r) - { - QRectF rt; - rt.xp = r.x(); - rt.yp = r.y(); - rt.w = r.width(); - rt.h = r.height(); - return rt; - } - - bool isNull() // conts - { return qIsNull(w) && qIsNull(h); } - - bool isEmpty() // conts - { return w <= 0. || h <= 0.; } - - bool isValid() // conts - { return w > 0. && h > 0.; } - - qreal x() // conts - { return xp; } - - qreal y() // conts - { return yp; } - - qreal left() // const - { return xp; } - - qreal top() // const - { return yp; } - - qreal right() // const - { return xp + w; } - - qreal bottom() // const - { return yp + h; } - - QPointF topLeft() // const - { return QPointF(xp, yp); } - - QPointF bottomRight() // const - { return QPointF(xp+w, yp+h); } - - QPointF topRight() // const - { return QPointF(xp+w, yp); } - - QPointF bottomLeft() // const - { return QPointF(xp, yp+h); } - - void setLeft(qreal pos) { qreal diff = pos - xp; xp += diff; w -= diff; } - - void setRight(qreal pos) { w = pos - xp; } - - void setTop(qreal pos) { qreal diff = pos - yp; yp += diff; h -= diff; } - - void setBottom(qreal pos) { h = pos - yp; } - - void setTopLeft(in QPointF p) { setLeft(p.x()); setTop(p.y()); } - - void setTopRight(in QPointF p) { setRight(p.x()); setTop(p.y()); } - - void setBottomLeft(in QPointF p) { setLeft(p.x()); setBottom(p.y()); } - - void setBottomRight(in QPointF p) { setRight(p.x()); setBottom(p.y()); } - - QPointF center() // conts - { return QPointF(xp + w/2, yp + h/2); } - - void moveLeft(qreal pos) { xp = pos; } - - void moveTop(qreal pos) { yp = pos; } - - void moveRight(qreal pos) { xp = pos - w; } - - void moveBottom(qreal pos) { yp = pos - h; } - - void moveTopLeft(in QPointF p) { moveLeft(p.x()); moveTop(p.y()); } - - void moveTopRight(in QPointF p) { moveRight(p.x()); moveTop(p.y()); } - - void moveBottomLeft(in QPointF p) { moveLeft(p.x()); moveBottom(p.y()); } - - void moveBottomRight(in QPointF p) { moveRight(p.x()); moveBottom(p.y()); } - - void moveCenter(in QPointF p) { xp = p.x() - w/2; yp = p.y() - h/2; } - - qreal width() // conts - { return w; } - - qreal height() // conts - { return h; } - - QSizeF size() // conts - { return QSizeF(w, h); } - - void translate(qreal dx, qreal dy) - { - xp += dx; - yp += dy; - } - - void translate(in QPointF p) - { - xp += p.x(); - yp += p.y(); - } - - void moveTo(qreal ax, qreal ay) - { - xp = ax; - yp = ay; - } - - void moveTo(in QPointF p) - { - xp = p.x(); - yp = p.y(); - } - - QRectF translated(qreal dx, qreal dy) // conts - { return QRectF(xp + dx, yp + dy, w, h); } - - QRectF translated(in QPointF p) // conts - { return QRectF(xp + p.x(), yp + p.y(), w, h); } - - void getRect(qreal *ax, qreal *ay, qreal *aaw, qreal *aah) // conts - { - *ax = this.xp; - *ay = this.yp; - *aaw = this.w; - *aah = this.h; - } - - void setRect(qreal ax, qreal ay, qreal aaw, qreal aah) - { - this.xp = ax; - this.yp = ay; - this.w = aaw; - this.h = aah; - } - - void getCoords(qreal *xp1, qreal *yp1, qreal *xp2, qreal *yp2) // conts - { - *xp1 = xp; - *yp1 = yp; - *xp2 = xp + w; - *yp2 = yp + h; - } - - void setCoords(qreal xp1, qreal yp1, qreal xp2, qreal yp2) - { - xp = xp1; - yp = yp1; - w = xp2 - xp1; - h = yp2 - yp1; - } - - void adjust(qreal xp1, qreal yp1, qreal xp2, qreal yp2) - { xp += xp1; yp += yp1; w += xp2 - xp1; h += yp2 - yp1; } - - QRectF adjusted(qreal xp1, qreal yp1, qreal xp2, qreal yp2) // conts - { return QRectF(xp + xp1, yp + yp1, w + xp2 - xp1, h + yp2 - yp1); } - - void setWidth(qreal aw) // for convenience - { this.w = aw; } - - void setHeight(qreal ah) // for convenience - { this.h = ah; } - - void setSize(in QSizeF s) // for convenience - { - w = s.width(); - h = s.height(); - } - - void width(qreal aw) - { this.w = aw; } - - void height(qreal ah) - { this.h = ah; } - - void size(in QSizeF s) - { - w = s.width(); - h = s.height(); - } - - bool contains(qreal ax, qreal ay) // conts - { - return contains(QPointF(ax, ay)); - } - - QRectF opOrAssign(in QRectF r) - { - *this = *this | r; - return *this; - } - - QRectF opAndAssign(in QRectF r) - { - *this = *this & r; - return *this; - } - - QRectF intersected(in QRectF r) // conts - { - return *this & r; - } - - QRectF united(in QRectF r) // conts - { - return *this | r; - } - - bool opEquals(in QRectF r) - { - return qFuzzyCompare(xp, r.xp) && qFuzzyCompare(yp, r.yp) - && qFuzzyCompare(w, r.w) && qFuzzyCompare(h, r.h); - } - - QRect toRect() // conts - { - return QRect(qRound(xp), qRound(yp), qRound(w), qRound(h)); - } - - public final bool contains(QPointF p) { - return qtd_QRectF_contains_QPointF(this, &p); - } - - public final bool contains(QRectF r) { - return qtd_QRectF_contains_QRectF(this, &r); - } - - public final bool intersects(QRectF r) { - return qtd_QRectF_intersects_QRectF(this, &r); - } - - public final QRectF normalized() { - return qtd_QRectF_normalized(this); - } - - public final QRectF opAnd(in QRectF r) { - return qtd_QRectF_operator_and_QRectF(this, &r); - } - - public final void writeTo(QDataStream arg__1) { - qtd_QRectF_writeTo_QDataStream(this, arg__1 is null ? null : arg__1.__nativeId); - } - - public final void readFrom(QDataStream arg__1) { - qtd_QRectF_readFrom_QDataStream(this, arg__1 is null ? null : arg__1.__nativeId); - } - - public final QRectF opOr(in QRectF r) { - return qtd_QRectF_operator_or_QRectF(this, &r); - } - - public final QRect toAlignedRect() // const - { - return qtd_QRectF_toAlignedRect(this); - } - -private: - qreal xp; - qreal yp; - qreal w; - qreal h; -} - - -// C wrappers -private extern(C) bool qtd_QRectF_contains_QPointF(void* __this_nativeId, - void* p0); -private extern(C) bool qtd_QRectF_contains_QRectF(void* __this_nativeId, - void* r0); -private extern(C) bool qtd_QRectF_intersects_QRectF(void* __this_nativeId, - void* r0); -private extern(C) QRectF qtd_QRectF_normalized(void* __this_nativeId); -private extern(C) QRectF qtd_QRectF_operator_and_QRectF(void* __this_nativeId, - void* r0); -private extern(C) void qtd_QRectF_writeTo_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) void qtd_QRectF_readFrom_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) QRectF qtd_QRectF_operator_or_QRectF(void* __this_nativeId, - void* r0); -private extern(C) QRect qtd_QRectF_toAlignedRect(void* __this_nativeId); \ No newline at end of file
--- a/qt/d1/qt/core/QSize.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,276 +0,0 @@ -module qt.core.QSize; - -public import qt.QGlobal; -public import qt.core.Qt; - - -public struct QSize -{ -/* ctors, reserved for D2 - public this() - { wd = ht = -1; } - - public this(int w, int h) - { wd = w; ht = h; } -*/ - - public static QSize opCall() { - QSize sz; - sz.wd = sz.ht = -1; - return sz; - } - - public static QSize opCall(int w, int h) { - QSize sz; - sz.wd = w; - sz.ht = h; - return sz; - } - - final bool isNull() - { return wd==0 && ht==0; } - - final bool isEmpty() - { return wd<1 || ht<1; } - - final bool isValid() - { return wd>=0 && ht>=0; } - - final int width() - { return wd; } - - final int height() - { return ht; } - - final void width(int w) - { wd = w; } - - final void height(int h) - { ht = h; } - - final void setWidth(int w) // for convenience - { wd = w; } - - final void setHeight(int h) // for convenience - { ht = h; } - - void transpose() { - int tmp = wd; - wd = ht; - ht = tmp; - } - - void scale(int w, int h, Qt.AspectRatioMode mode) { - scale(QSize(w, h), mode); - } - - void scale(in QSize s, Qt.AspectRatioMode mode) { - __qtd_QSize_scale_QSize_AspectRatioMode(this, &s, mode); - } - - QSize expandedTo(in QSize otherSize) { - return QSize(qMax(wd,otherSize.wd), qMax(ht,otherSize.ht)); - } - - QSize boundedTo(in QSize otherSize) { - return QSize(qMin(wd,otherSize.wd), qMin(ht,otherSize.ht)); - } -/* - public final void writeTo(QDataStream arg__1) { - __qtd_QSize_writeTo_QDataStream(this, arg__1 is null ? null : arg__1.nativeId); - } - - public final void readFrom(QDataStream arg__1) { - __qtd_QSize_readFrom_QDataStream(this, arg__1 is null ? null : arg__1.nativeId); - } -*/ - QSize opAddAssign(in QSize s) - { wd+=s.wd; ht+=s.ht; return *this; } - - QSize opSubAssign(in QSize s) - { wd-=s.wd; ht-=s.ht; return *this; } - - QSize opMulAssign(qreal c) - { wd = qRound(wd*c); ht = qRound(ht*c); return *this; } - - bool opEquals(in QSize s) - { return wd == s.wd && ht == s.ht; } - - QSize opAdd(in QSize s) - { return QSize(this.wd+s.wd, this.ht+s.ht); } - - QSize opSub(in QSize s) - { return QSize(this.wd-s.wd, this.ht-s.ht); } - - QSize opMul(qreal c) - { return QSize(qRound(this.wd*c), qRound(this.ht*c)); } - - QSize opDivAssign(qreal c) { - assert(!qFuzzyCompare(c + 1, 1.)); - wd = qRound(wd/c); ht = qRound(ht/c); - return *this; - } - - QSize opDiv(qreal c) { - assert(!qFuzzyCompare(c + 1, 1.)); - return QSize(qRound(this.wd/c), qRound(this.ht/c)); - } - -private: - int wd; - int ht; -} - - -public struct QSizeF -{ -/* ctors, reserved for D2 - this() - { wd = ht = -1.; } - - this(ref QSize sz) - { wd = sz.width(); ht = sz.height(); } - - this(qreal w, qreal h) - { wd = w; ht = h; } -*/ - public static QSizeF opCall() { - QSizeF sz; - sz.wd = sz.ht = -1.; - return sz; - } - - public static QSizeF opCall(in QSizeF s) { - QSizeF sz; - sz.wd = s.width(); sz.ht = s.height(); - return sz; - } - - public static QSizeF opCall(qreal w, qreal h) { - QSizeF sz; - sz.wd = w; sz.ht = h; - return sz; - } - - bool isNull() - { return qIsNull(wd) && qIsNull(ht); } - - bool isEmpty() - { return wd <= 0. || ht <= 0.; } - - bool isValid() - { return wd >= 0. && ht >= 0.; } - - qreal width() - { return wd; } - - qreal height() - { return ht; } - - void width(qreal w) - { wd = w; } - - void height(qreal h) - { ht = h; } - - void setWidth(qreal w) - { wd = w; } - - void setHeight(qreal h) - { ht = h; } - - void scale(qreal w, qreal h, Qt.AspectRatioMode mode) - { scale(QSizeF(w, h), mode); } - - public final void scale(QSizeF s, Qt.AspectRatioMode mode) - { __qtd_QSizeF_scale_QSizeF_AspectRatioMode(this, &s, mode); } - - void transpose() { - qreal tmp = wd; - wd = ht; - ht = tmp; - } - - QSizeF expandedTo(in QSizeF otherSize) - { return QSizeF(qMax(wd,otherSize.wd), qMax(ht,otherSize.ht)); } - - QSizeF boundedTo(in QSizeF otherSize) - { return QSizeF(qMin(wd,otherSize.wd), qMin(ht,otherSize.ht)); } - - QSize toSize() - { return QSize(qRound(wd), qRound(ht)); } -/* - public final void writeTo(QDataStream arg__1) { - __qtd_QSizeF_writeTo_QDataStream(this, arg__1 is null ? null : arg__1.nativeId); - } - - public final void readFrom(QDataStream arg__1) { - __qtd_QSizeF_readFrom_QDataStream(this, arg__1 is null ? null : arg__1.nativeId); -*/ - QSizeF opAddAssign(in QSizeF s) - { wd += s.wd; ht += s.ht; return *this; } - - QSizeF opSubAssign(in QSizeF s) - { wd -= s.wd; ht -= s.ht; return *this; } - - QSizeF opMulAssign(qreal c) - { wd *= c; ht *= c; return *this; } - - bool opEquals(in QSizeF s) - { return qFuzzyCompare(wd, s.wd) && qFuzzyCompare(ht, s.ht); } - - QSizeF opAdd(in QSizeF s) - { return QSizeF(this.wd+s.wd, this.ht+s.ht); } - - QSizeF opSub(in QSizeF s) - { return QSizeF(this.wd-s.wd, this.ht-s.ht); } - - QSizeF opMul(qreal c) - { return QSizeF(this.wd*c, this.ht*c); } - - QSizeF opDivAssign(qreal c) - { - assert(!qFuzzyCompare(c + 1, 1.)); - wd = wd/c; ht = ht/c; - return *this; - } - - QSizeF opDiv(qreal c) - { - assert(!qFuzzyCompare(c + 1, 1.)); - return QSizeF(this.wd/c, this.ht/c); - } - -private: - qreal wd; - qreal ht; -} - -extern (C) void qtd_append_array_QSize(QSize[]* arr, QSize arg) -{ - *arr ~= arg; -} - -extern (C) void qtd_append_array_QSizeF(QSizeF[]* arr, QSizeF arg) -{ - *arr ~= arg; -} - -// C wrappers -// QSize -private extern(C) void __qtd_QSize_scale_QSize_AspectRatioMode(void* __this_nativeId, - void* s0, - int mode1); -private extern(C) void __qtd_QSize_writeTo_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) void __qtd_QSize_readFrom_QDataStream(void* __this_nativeId, - void* arg__1); - -// QSizeF -private extern(C) void __qtd_QSizeF_writeTo_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) void __qtd_QSizeF_readFrom_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) void __qtd_QSizeF_scale_QSizeF_AspectRatioMode(void* __this_nativeId, - void* s0, - int mode1); \ No newline at end of file
--- a/qt/d1/qt/core/QSizeF.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -module qt.core.QSizeF; -/* dummy */ - -public import qt.core.QSize;
--- a/qt/d1/qt/core/QVariant.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,715 +0,0 @@ -module qt.core.QVariant; - -public import qt.QGlobal; -private import qt.QtdObject; -private import qt.core.QMetaType; - -// automatic imports------------- -private import qt.core.QSizeF; -private import qt.core.QPoint; -private import qt.core.QRectF; -public import qt.core.Qt; -private import qt.core.QDateTime; -private import qt.core.QDataStream; -private import qt.core.QTime; -private import qt.core.QUrl; -private import qt.core.QRegExp; -private import qt.core.QBitArray; -private import qt.core.QLine; -private import qt.core.QByteArray; -private import qt.core.QSize; -private import qt.core.QDate; -private import qt.core.QPointF; -private import qt.core.QLineF; -private import qt.core.QRect; -private import qt.core.QLocale; - -version (Tango) -{ - import tango.core.Array; - import tango.stdc.stringz; - import tango.text.convert.Utf; - import tango.core.Traits; -} - - -public class QVariant : QtdObjectBase -{ - enum Type { - Invalid = 0, - - Bool = 1, - Int = 2, - UInt = 3, - LongLong = 4, - ULongLong = 5, - Double = 6, - Char = 7, - Map = 8, - List = 9, - String = 10, - StringList = 11, - ByteArray = 12, - BitArray = 13, - Date = 14, - Time = 15, - DateTime = 16, - Url = 17, - Locale = 18, - Rect = 19, - RectF = 20, - Size = 21, - SizeF = 22, - Line = 23, - LineF = 24, - Point = 25, - PointF = 26, - RegExp = 27, - LastCoreType = RegExp, - - // value 62 is internally reserved - - Font = 64, - Pixmap = 65, - Brush = 66, - Color = 67, - Palette = 68, - Icon = 69, - Image = 70, - Polygon = 71, - Region = 72, - Bitmap = 73, - Cursor = 74, - SizePolicy = 75, - KeySequence = 76, - Pen = 77, - TextLength = 78, - TextFormat = 79, - Matrix = 80, - Transform = 81, - LastGuiType = Transform, - - UserType = 127, - - LastType = 0xffffffff // need this so that gcc >= 3.4 allocates 32 bits for Type - } - -// Functions - - private template getMetaId() - { - const char[] getMetaId = " - int i = qtd_MetatypeId(toStringz(name)); - if(i <= 0) - i = qRegisterMetaType!(T)(name);"; - } - - static public QVariant fromValue(T)(T obj) - { - QVariant var; - static if (is(T == class) || is(T == interface)) - { - string name = obj.classinfo.name; - mixin(getMetaId!()); - var = new QVariant(i, cast(void*)(obj)); - } - else static if (isDynamicArrayType!(T) || isStaticArrayType!(T) ) - { - string name = typeid(ElementTypeOfArray!(T)).toString ~ "[]"; - mixin(getMetaId!()); - auto darray = new DArrayToC; - darray.array = obj.dup; - var = new QVariant(i, cast(void*)(darray)); - } - else - { - string name = typeid(T).toString; - mixin(getMetaId!()); - auto data = new T; - *data = obj; - var = new QVariant(i, cast(void*)(data)); - } - return var; - } - - static public QVariant opCall(T)(T obj) - { - return fromValue(obj); - } - - public this() { - void* __qt_return_value = qtd_QVariant_QVariant(); - super(__qt_return_value); - } - - - public this(QDataStream s) { - void* __qt_return_value = qtd_QVariant_QVariant_QDataStream(s is null ? null : s.__nativeId); - super(__qt_return_value); - } - - - public this(Qt.GlobalColor color) { - void* __qt_return_value = qtd_QVariant_QVariant_GlobalColor(color); - super(__qt_return_value); - } - - - public this(bool b) { - void* __qt_return_value = qtd_QVariant_QVariant_bool(b); - super(__qt_return_value); - } - - - public this(QBitArray bitarray) { - void* __qt_return_value = qtd_QVariant_QVariant_QBitArray(bitarray is null ? null : bitarray.__nativeId); - super(__qt_return_value); - } - - - public this(QByteArray bytearray) { - void* __qt_return_value = qtd_QVariant_QVariant_QByteArray(bytearray is null ? null : bytearray.__nativeId); - super(__qt_return_value); - } - - - public this(QDate date) { - void* __qt_return_value = qtd_QVariant_QVariant_QDate(date is null ? null : date.__nativeId); - super(__qt_return_value); - } - - - public this(QDateTime datetime) { - void* __qt_return_value = qtd_QVariant_QVariant_QDateTime(datetime is null ? null : datetime.__nativeId); - super(__qt_return_value); - } - - - public this(string str) { - void* __qt_return_value = qtd_QVariant_QVariant_String(str); - super(__qt_return_value); - } - - - public this(QLine line) { - void* __qt_return_value = qtd_QVariant_QVariant_QLine(&line); - super(__qt_return_value); - } - - - public this(QLineF line) { - void* __qt_return_value = qtd_QVariant_QVariant_QLineF(&line); - super(__qt_return_value); - } - - - public this(QLocale locale) { - void* __qt_return_value = qtd_QVariant_QVariant_QLocale(locale is null ? null : locale.__nativeId); - super(__qt_return_value); - } - - - public this(QPoint pt) { - void* __qt_return_value = qtd_QVariant_QVariant_QPoint(&pt); - super(__qt_return_value); - } - - - public this(QPointF pt) { - void* __qt_return_value = qtd_QVariant_QVariant_QPointF(&pt); - super(__qt_return_value); - } - - - public this(QRect rect) { - void* __qt_return_value = qtd_QVariant_QVariant_QRect(&rect); - super(__qt_return_value); - } - - - public this(QRectF rect) { - void* __qt_return_value = qtd_QVariant_QVariant_QRectF(&rect); - super(__qt_return_value); - } - - - public this(QRegExp regExp) { - void* __qt_return_value = qtd_QVariant_QVariant_QRegExp(regExp is null ? null : regExp.__nativeId); - super(__qt_return_value); - } - - - public this(QSize size) { - void* __qt_return_value = qtd_QVariant_QVariant_QSize(&size); - super(__qt_return_value); - } - - - public this(QSizeF size) { - void* __qt_return_value = qtd_QVariant_QVariant_QSizeF(&size); - super(__qt_return_value); - } - - - public this(QTime time) { - void* __qt_return_value = qtd_QVariant_QVariant_QTime(time is null ? null : time.__nativeId); - super(__qt_return_value); - } - - - public this(QUrl url) { - void* __qt_return_value = qtd_QVariant_QVariant_QUrl(url is null ? null : url.__nativeId); - super(__qt_return_value); - } - - - public this(QVariant other) { - void* __qt_return_value = qtd_QVariant_QVariant_QVariant(other is null ? null : other.__nativeId); - super(__qt_return_value); - } - -/* - public this(char* str) { - void* __qt_return_value = qtd_QVariant_QVariant_nativepointerchar(str); - super(__qt_return_value); - } -*/ - - public this(double d) { - void* __qt_return_value = qtd_QVariant_QVariant_double(d); - super(__qt_return_value); - } - - - public this(int i) { - void* __qt_return_value = qtd_QVariant_QVariant_int(i); - super(__qt_return_value); - } - - - public this(int typeOrUserType, void* copy) { - void* __qt_return_value = qtd_QVariant_QVariant_int_nativepointervoid(typeOrUserType, copy); - super(__qt_return_value); - } - - - public this(long ll) { - void* __qt_return_value = qtd_QVariant_QVariant_long(ll); - super(__qt_return_value); - } - - - public this(uint ui) { - void* __qt_return_value = qtd_QVariant_QVariant_uint(ui); - super(__qt_return_value); - } - - - public this(ulong ull) { - void* __qt_return_value = qtd_QVariant_QVariant_ulong(ull); - super(__qt_return_value); - } - - private final bool canConvertImpl(string name) - { - int i = qtd_MetatypeId(toStringz(name)); - assert(i > 0); - return qtd_QVariant_canConvert(__nativeId, i); - } - - public final bool canConvert(Type)() { - static if ( is(Type == QBitArray) ) - return canConvertImpl("QBitArray"); - else static if ( is(Type == bool) ) - return canConvertImpl("bool"); - else static if ( is(Type == QByteArray) ) - return canConvertImpl("QByteArray"); - else static if ( is(Type == QDate) ) - return canConvertImpl("QDate"); - else static if ( is(Type == QDateTime) ) - return canConvertImpl("QDateTime"); - else static if ( is(Type == double) ) - return canConvertImpl("double"); - else static if ( is(Type == int) ) - return canConvertImpl("int"); - else static if ( is(Type == QLine) ) - return canConvertImpl("QLine"); - else static if ( is(Type == QLineF) ) - return canConvertImpl("QLineF"); - else static if ( is(Type == QLocale) ) - return canConvertImpl("QLocale"); - else static if ( is(Type == long) ) - return canConvertImpl("long"); - else static if ( is(Type == QPoint) ) - return canConvertImpl("QPoint"); - else static if ( is(Type == QPointF) ) - return canConvertImpl("QPointF"); - else static if ( is(Type == QRect) ) - return canConvertImpl("QRect"); - else static if ( is(Type == QRectF) ) - return canConvertImpl("QRectF"); - else static if ( is(Type == QRegExp) ) - return canConvertImpl("QRegExp"); - else static if ( is(Type == QSize) ) - return canConvertImpl("QSize"); - else static if ( is(Type == QSizeF) ) - return canConvertImpl("QSizeF"); - else static if ( is(Type == string) ) - return canConvertImpl("QString"); - else static if ( is(Type == QTime) ) - return canConvertImpl("QTime"); - else static if ( is(Type == uint) ) - return canConvertImpl("unsigned int"); // TODO: - else static if ( is(Type == ulong) ) - return canConvertImpl("unsigned long long"); // TODO: - else static if ( is(Type == QUrl) ) - return canConvertImpl("QUrl"); - else - { - static if( is( Type == class ) || is( Type == interface ) ) - { - Object object = cast(Object)qtd_QVariant_data(__nativeId); - if(object) - return cast(Type)(object) !is null; - return false; - } - else static if (isDynamicArrayType!(Type) || isStaticArrayType!(Type) ) - { - auto array = cast(DArrayToC*)qtd_QVariant_data(__nativeId); - return cast(Type)(array.array) !is null; - } - else - { - int i = qtd_MetatypeId(toStringz(typeid(Type).toString)); - return qtd_QVariant_canConvert(__nativeId, i); - } - } - } - - public final Type value(Type)() { - static if ( is(Type == QBitArray) ) - return toBitArra; - else static if ( is(Type == bool) ) - return toBool; - else static if ( is(Type == QByteArray) ) - return toByteArray; - else static if ( is(Type == QDate) ) - return toDate; - else static if ( is(Type == QDateTime) ) - return toDateTime; - else static if ( is(Type == double) ) - return toDouble; - else static if ( is(Type == int) ) - return toInt; - else static if ( is(Type == QLine) ) - return toLine; - else static if ( is(Type == QLineF) ) - return toLineF; - else static if ( is(Type == QLocale) ) - return toLocale; - else static if ( is(Type == long) ) - return toLongLong; - else static if ( is(Type == QPoint) ) - return toPoint; - else static if ( is(Type == QPointF) ) - return toPointF; - else static if ( is(Type == QRect) ) - return toRect; - else static if ( is(Type == QRectF) ) - return toRectF; - else static if ( is(Type == QRegExp) ) - return toRegExp; - else static if ( is(Type == QSize) ) - return toSize; - else static if ( is(Type == QSizeF) ) - return toSizeF; - else static if ( is(Type == string) ) - return toString; - else static if ( is(Type == QTime) ) - return toTime; - else static if ( is(Type == uint) ) - return toUInt; - else static if ( is(Type == ulong) ) - return toULongLong; - else static if ( is(Type == QUrl) ) - return toUrl; - else static if( is( Type == class ) || is( Type == interface ) ) - { - Object object = cast(Object)qtd_QVariant_data(__nativeId); - if(object) - return cast(Type)(object); - return null; - } - else static if (isDynamicArrayType!(Type) || isStaticArrayType!(Type) ) - { - auto array = cast(DArrayToC*)qtd_QVariant_data(__nativeId); - return cast(Type)(array.array); - } - else - { - return *cast(Type*)qtd_QVariant_data(__nativeId); - } - } - - public final void clear() { - qtd_QVariant_clear(__nativeId); - } - - protected final bool cmp(QVariant other) { - return qtd_QVariant_cmp_QVariant(__nativeId, other is null ? null : other.__nativeId); - } - - protected final void create(int type, void* copy) { - qtd_QVariant_create_int_nativepointervoid(__nativeId, type, copy); - } - - public final bool isNull() { - return qtd_QVariant_isNull(__nativeId); - } - - public final bool isValid() { - return qtd_QVariant_isValid(__nativeId); - } - - public final void load(QDataStream ds) { - qtd_QVariant_load_QDataStream(__nativeId, ds is null ? null : ds.__nativeId); - } - - public final void writeTo(QDataStream s) { - qtd_QVariant_writeTo_QDataStream(__nativeId, s is null ? null : s.__nativeId); - } - - public final QVariant operator_assign(QVariant other) { - void* __qt_return_value = qtd_QVariant_operator_assign_QVariant(__nativeId, other is null ? null : other.__nativeId); - return new QVariant(__qt_return_value, QtdObjectFlags.skipNativeDelete); - } - - private final bool operator_equal(QVariant v) { - return qtd_QVariant_operator_equal_QVariant(__nativeId, v is null ? null : v.__nativeId); - } - - public final void readFrom(QDataStream s) { - qtd_QVariant_readFrom_QDataStream(__nativeId, s is null ? null : s.__nativeId); - } - - public final void save(QDataStream ds) { - qtd_QVariant_save_QDataStream(__nativeId, ds is null ? null : ds.__nativeId); - } - - public final QBitArray toBitArray() { - void* __qt_return_value = qtd_QVariant_toBitArray(__nativeId); - return new QBitArray(__qt_return_value); - } - - public final bool toBool() { - return qtd_QVariant_toBool(__nativeId); - } - - public final QByteArray toByteArray() { - void* __qt_return_value = qtd_QVariant_toByteArray(__nativeId); - return new QByteArray(__qt_return_value); - } - - public final QDate toDate() { - void* __qt_return_value = qtd_QVariant_toDate(__nativeId); - return new QDate(__qt_return_value); - } - - public final QDateTime toDateTime() { - void* __qt_return_value = qtd_QVariant_toDateTime(__nativeId); - return new QDateTime(__qt_return_value); - } - - public final double toDouble(bool* ok = null) { - return qtd_QVariant_toDouble_nativepointerbool(__nativeId, ok); - } - - public final int toInt(bool* ok = null) { - return qtd_QVariant_toInt_nativepointerbool(__nativeId, ok); - } - - public final QLine toLine() { - return qtd_QVariant_toLine(__nativeId); - } - - public final QLineF toLineF() { - return qtd_QVariant_toLineF(__nativeId); - } - - public final QLocale toLocale() { - void* __qt_return_value = qtd_QVariant_toLocale(__nativeId); - return new QLocale(__qt_return_value); - } - - public final long toLongLong(bool* ok = null) { - return qtd_QVariant_toLongLong_nativepointerbool(__nativeId, ok); - } - - public final QPoint toPoint() { - return qtd_QVariant_toPoint(__nativeId); - } - - public final QPointF toPointF() { - return qtd_QVariant_toPointF(__nativeId); - } - - public final QRect toRect() { - return qtd_QVariant_toRect(__nativeId); - } - - public final QRectF toRectF() { - return qtd_QVariant_toRectF(__nativeId); - } - - public final QRegExp toRegExp() { - void* __qt_return_value = qtd_QVariant_toRegExp(__nativeId); - return new QRegExp(__qt_return_value); - } - - public final QSize toSize() { - return qtd_QVariant_toSize(__nativeId); - } - - public final QSizeF toSizeF() { - return qtd_QVariant_toSizeF(__nativeId); - } - - public final string toString() { - string res; - qtd_QVariant_toString(__nativeId, &res); - return res; - } - - public final QTime toTime() { - void* __qt_return_value = qtd_QVariant_toTime(__nativeId); - return new QTime(__qt_return_value); - } - - public final uint toUInt(bool* ok = null) { - return qtd_QVariant_toUInt_nativepointerbool(__nativeId, ok); - } - - public final ulong toULongLong(bool* ok = null) { - return qtd_QVariant_toULongLong_nativepointerbool(__nativeId, ok); - } - - public final QUrl toUrl() { - void* __qt_return_value = qtd_QVariant_toUrl(__nativeId); - return new QUrl(__qt_return_value); - } - - public final char* typeName() { - return qtd_QVariant_typeName(__nativeId); - } - - public final Type type() { - return cast(Type)qtd_QVariant_type(__nativeId); - } - - public final int userType() { - return qtd_QVariant_userType(__nativeId); - } -// Field accessors - - public this(void* native_id, QtdObjectFlags flags = QtdObjectFlags.none) { - super(native_id, flags); - } - - protected override void __deleteNative() { - qtd_QVariant_destructor(__nativeId); - } - -// Injected code in class -} -extern (C) void qtd_QVariant_destructor(void *ptr); - - -// C wrappers -private extern(C) void* qtd_QVariant_QVariant(); -private extern(C) void* qtd_QVariant_QVariant_QDataStream(void* s0); -private extern(C) void* qtd_QVariant_QVariant_GlobalColor(int color0); -private extern(C) void* qtd_QVariant_QVariant_bool(bool b0); -private extern(C) void* qtd_QVariant_QVariant_QBitArray(void* bitarray0); -private extern(C) void* qtd_QVariant_QVariant_QByteArray(void* bytearray0); -private extern(C) void* qtd_QVariant_QVariant_QDate(void* date0); -private extern(C) void* qtd_QVariant_QVariant_QDateTime(void* datetime0); -private extern(C) void* qtd_QVariant_QVariant_String(string string0); -private extern(C) void* qtd_QVariant_QVariant_QLine(void* line0); -private extern(C) void* qtd_QVariant_QVariant_QLineF(void* line0); -private extern(C) void* qtd_QVariant_QVariant_QLocale(void* locale0); -private extern(C) void* qtd_QVariant_QVariant_QPoint(void* pt0); -private extern(C) void* qtd_QVariant_QVariant_QPointF(void* pt0); -private extern(C) void* qtd_QVariant_QVariant_QRect(void* rect0); -private extern(C) void* qtd_QVariant_QVariant_QRectF(void* rect0); -private extern(C) void* qtd_QVariant_QVariant_QRegExp(void* regExp0); -private extern(C) void* qtd_QVariant_QVariant_QSize(void* size0); -private extern(C) void* qtd_QVariant_QVariant_QSizeF(void* size0); -private extern(C) void* qtd_QVariant_QVariant_QTime(void* time0); -private extern(C) void* qtd_QVariant_QVariant_QUrl(void* url0); -private extern(C) void* qtd_QVariant_QVariant_QVariant(void* other0); -private extern(C) void* qtd_QVariant_QVariant_nativepointerchar(char* str0); -private extern(C) void* qtd_QVariant_QVariant_double(double d0); -private extern(C) void* qtd_QVariant_QVariant_int(int i0); -private extern(C) void* qtd_QVariant_QVariant_int_nativepointervoid(int typeOrUserType0, - void* copy1); -private extern(C) void* qtd_QVariant_QVariant_long(long ll0); -private extern(C) void* qtd_QVariant_QVariant_uint(uint ui0); -private extern(C) void* qtd_QVariant_QVariant_ulong(ulong ull0); -private extern(C) bool qtd_QVariant_canConvert(void* __this_nativeId, int); -private extern(C) void qtd_QVariant_clear(void* __this_nativeId); -private extern(C) bool qtd_QVariant_cmp_QVariant(void* __this_nativeId, - void* other0); -private extern(C) void qtd_QVariant_create_int_nativepointervoid(void* __this_nativeId, - int type0, - void* copy1); -private extern(C) bool qtd_QVariant_isNull(void* __this_nativeId); -private extern(C) bool qtd_QVariant_isValid(void* __this_nativeId); -private extern(C) void qtd_QVariant_load_QDataStream(void* __this_nativeId, - void* ds0); -private extern(C) void qtd_QVariant_writeTo_QDataStream(void* __this_nativeId, - void* s0); -private extern(C) void* qtd_QVariant_operator_assign_QVariant(void* __this_nativeId, - void* other0); -private extern(C) bool qtd_QVariant_operator_equal_QVariant(void* __this_nativeId, - void* v0); -private extern(C) void qtd_QVariant_readFrom_QDataStream(void* __this_nativeId, - void* s0); -private extern(C) void qtd_QVariant_save_QDataStream(void* __this_nativeId, - void* ds0); -private extern(C) void* qtd_QVariant_toBitArray(void* __this_nativeId); -private extern(C) bool qtd_QVariant_toBool(void* __this_nativeId); -private extern(C) void* qtd_QVariant_toByteArray(void* __this_nativeId); -private extern(C) void* qtd_QVariant_toDate(void* __this_nativeId); -private extern(C) void* qtd_QVariant_toDateTime(void* __this_nativeId); -private extern(C) double qtd_QVariant_toDouble_nativepointerbool(void* __this_nativeId, - bool* ok0); -private extern(C) int qtd_QVariant_toInt_nativepointerbool(void* __this_nativeId, - bool* ok0); -private extern(C) QLine qtd_QVariant_toLine(void* __this_nativeId); -private extern(C) QLineF qtd_QVariant_toLineF(void* __this_nativeId); -private extern(C) void* qtd_QVariant_toLocale(void* __this_nativeId); -private extern(C) long qtd_QVariant_toLongLong_nativepointerbool(void* __this_nativeId, - bool* ok0); -private extern(C) QPoint qtd_QVariant_toPoint(void* __this_nativeId); -private extern(C) QPointF qtd_QVariant_toPointF(void* __this_nativeId); -private extern(C) QRect qtd_QVariant_toRect(void* __this_nativeId); -private extern(C) QRectF qtd_QVariant_toRectF(void* __this_nativeId); -private extern(C) void* qtd_QVariant_toRegExp(void* __this_nativeId); -private extern(C) QSize qtd_QVariant_toSize(void* __this_nativeId); -private extern(C) QSizeF qtd_QVariant_toSizeF(void* __this_nativeId); -private extern(C) void qtd_QVariant_toString(void* __this_nativeId, - void* __java_return_value); -private extern(C) void* qtd_QVariant_toTime(void* __this_nativeId); -private extern(C) uint qtd_QVariant_toUInt_nativepointerbool(void* __this_nativeId, - bool* ok0); -private extern(C) ulong qtd_QVariant_toULongLong_nativepointerbool(void* __this_nativeId, - bool* ok0); -private extern(C) void* qtd_QVariant_toUrl(void* __this_nativeId); -private extern(C) char* qtd_QVariant_typeName(void* __this_nativeId); -private extern(C) int qtd_QVariant_type(void* __this_nativeId); -private extern(C) int qtd_QVariant_userType(void* __this_nativeId); -private extern(C) void *qtd_QVariant_data(void* __this_nativeId); - -// Just the private functions for abstract functions implemeneted in superclasses - -// Virtual Dispatch functions
--- a/qt/d1/qt/qtd/Str.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/** - * - * Copyright: Copyright QtD Team, 2008-2009 - * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a> - * - * Copyright QtD Team, 2008-2009 - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file boost-license-1.0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - * - */ - -module qt.qtd.Str; - - import tango.text.convert.Utf : toString; -public import tango.stdc.stringz : fromStringz; - - alias char[] string; - alias wchar[] wstring; - -alias char* stringz; -alias char* cstringz; - -public static char** toStringzArray(char[][] args) -{ - if ( args is null ) - { - return null; - } - char** argv = (new char*[args.length]).ptr; - int argc = 0; - foreach (char[] p; args) - { - argv[argc++] = cast(char*)(p.dup~'\0'); - } - argv[argc] = null; - - return argv; -} -extern(C) void qtd_toUtf8(wchar* arr, uint size, string* str){ - *str = toString(arr[0..size]); -} - -
--- a/qt/d2/qt/QtdObject.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/** -* -* Copyright: Copyright QtD Team, 2008-2009 -* License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a> -* -* Copyright QtD Team, 2008-2009 -* Distributed under the Boost Software License, Version 1.0. -* (See accompanying file boost-license-1.0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -* -*/ - -module qt.QtdObject; - -import qt.Signal; - -enum QtdObjectFlags : ubyte -{ - none, - nativeOwnership = 0x1, - dOwnership = 0x2, - dynamicEntity = 0x4 - //gcManaged = 0x4 -} - -package abstract class QtdObject -{ - protected QtdObjectFlags __flags_; - void* __nativeId; - - mixin SignalHandlerOps; - - this(void* nativeId, QtdObjectFlags flags = QtdObjectFlags.none) - { - __nativeId = nativeId; - __flags_ = flags; - } - - final QtdObjectFlags __flags() - { - return __flags_; - } - - /+ final +/ void __setFlags(QtdObjectFlags flags, bool value) - { - if (value) - __flags_ |= flags; - else - __flags_ &= ~flags; - } - - // COMPILER BUG: 3206 - protected void __deleteNative() - { - assert(false); - } - - ~this() - { - if (!(__flags_ & QtdObjectFlags.nativeOwnership)) - { - // avoid deleting D object twice. - __flags_ |= QtdObjectFlags.dOwnership; - __deleteNative; - } - } -}
--- a/qt/d2/qt/Signal.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,958 +0,0 @@ -/** - * - * Copyright: Copyright QtD Team, 2008-2009 - * Authors: Max Samukha, Eldar Insafutdinov - * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a> - * - * Copyright QtD Team, 2008-2009 - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file boost-license-1.0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - * - */ -module qt.Signal; - -public import qt.QGlobal; -public import std.metastrings; -import core.stdc.stdlib : crealloc = realloc, cfree = free; -import core.stdc.string : memmove; -import - std.traits, - core.thread, - core.exception; - -private: // private by default - -alias void delegate(Object) DEvent; - -extern(C) void rt_attachDisposeEvent(Object o, DEvent e); -extern(C) void rt_detachDisposeEvent(Object o, DEvent e); -extern(C) Object _d_toObject(void* p); - -void realloc(T)(ref T[] a, size_t length) -{ - a = (cast(T*)crealloc(a.ptr, length * T.sizeof))[0..length]; - if (!a.ptr) - new OutOfMemoryError(__FILE__, __LINE__); -} - -unittest -{ - int[] a; - realloc(a, 16); - assert(a.length == 16); - foreach (i, ref e; a) - e = i; - realloc(a, 4096); - assert(a.length == 4096); - foreach (i, e; a[0..16]) - assert(e == i); - cfree(a.ptr); -} - - -//TODO: should be in the standard library -struct STuple(A...) -{ - static string genSTuple() - { - string r = ""; - foreach (i, e; A) - r ~= A[i].stringof ~ " _" ~ ToString!(i) ~ ";"; - return r; - } - - mixin (genSTuple); - template at(size_t i) { mixin("alias _" ~ ToString!(i) ~ " at;"); }; -} - -void move(T)(ref T[] a, size_t src, size_t dest, size_t length) -{ - if (a.length > 1) - memmove(a.ptr + dest, a.ptr + src, length * T.sizeof); -} - -enum SignalEventId -{ - firstSlotConnected, - lastSlotDisconnected -} - -public class SignalException : Exception -{ - this(string msg) - { - super(msg); - } -} - -struct Fn -{ - void* funcptr; - - static typeof(this) opCall(R, A...)(R function(A) fn) - { - typeof(this) r; - r.funcptr = fn; - return r; - } - - template call(R) - { - R call(A...)(A args) - { - alias R function(A) Fn; - return (cast(Fn)funcptr)(args); - } - } - - S get(S)() - { - static assert (is(typeof(*S.init) == function)); - return cast(S)funcptr; - } -} - -struct Dg -{ - void* context; - void* funcptr; - - static typeof(this) opCall(R, A...)(R delegate(A) dg) - { - typeof(this) r; - r.context = dg.ptr; - r.funcptr = dg.funcptr; - return r; - } - - template call(R) - { - R call(A...)(A args) - { - R delegate(A) dg; // BUG: parameter storage classes are ignored - dg.ptr = context; - dg.funcptr = cast(typeof(dg.funcptr))funcptr; - return dg(args); - } - } - - S get(S)() - { - static assert (is(S == delegate)); - S r; - r.ptr = context; - r.funcptr = cast(typeof(r.funcptr))funcptr; - return r; - } -} - -struct Slot(R) -{ - alias R Receiver; - - Receiver receiver; - Dg invoker; - - static if (is(Receiver == Dg)) - { - static const isDelegate = true; - - void onReceiverDisposed(Object o) - { - assert (lock !is null); - synchronized(lock) - { - receiver.context = null; - receiver.funcptr = null; - } - } - - // null if receiver doesn't point to a disposable object - Object lock; - - bool isDisposed() - { - return !receiver.funcptr; - } - - Object getObject() - { - return lock ? _d_toObject(receiver.context) : null; - } - } - else - static const isDelegate = false; -} - -enum SlotListId -{ - Func, // function pointers - Weak, // object delegates stored in C heap - Strong // delegates stored in GC heap -} - -/** - Used to specify the type of a signal-to-slot connection. - - Examples: ----- -class Sender -{ - mixin Signal!("changed"); - void change() - { - changed.emit; - } -} - - -class Receiver -{ - void alarm() {} -} - -void main() -{ - auto s = new Sender; - auto r = new Receiver; - s.changed.connect(&r.alarm); // now s weakly references r - - r = null; - // collect garbage (assume there is no more reachable pointers - // to the receiver and it gets finalized) - ... - - s.change; - // weak reference to the receiving object - // has been removed from the sender's connection lists. - - r = new Receiver; - s.changed.connect(&r.alarm, ConnectionFlags.Strong); - - r = null; - // collect garbage - ... - // the receiving object has not been finalized because s strongly references it. - - s.change; // the receiver is called. - delete r; - s.change; // the receiver is disconnected from the sender. - - static void foo() - { - } - - s.changed.connect(&foo); - s.changed.emit; // foo is called. - s.changed.disconnect(&foo); // must be explicitly disconnected. - - void bar() - { - } - - // ConnectionFlags.NoObject must be specified for delegates - // to non-static local functions or struct member functions. - s.changed.connect(&bar, ConnectionFlags.NoObject); - s.changed.emit; // bar is called. - s.changed.disconnect(&bar); // must be explicitly disconnected. -} ----- -*/ -public enum ConnectionFlags -{ - /// - None, - /** - The receiver will be stored as weak reference (implied if ConnectionFlags.NoObject is not specified). - If the signal receiver is not a function pointer or a delegate referencing a D class instance. - the sender will not be notified when the receiving object is deleted and emitting the signal - connected to that receiving object will result in undefined behavior. - */ - Weak = 0x0001, - /** - The receiver is stored as strong reference (implied if ConnectionFlags.NoObject is specified). - */ - Strong = 0x0002, - /** - Must be specified if the receiver is not a function pointer or a delegate referencing a D class instance. - */ - NoObject = 0x0004 - - // Queued = 0x0004, - // BlockingQueued = 0x0008 -} - - -struct SlotList(SlotT, bool strong = false) -{ - alias SlotT SlotType; - SlotType[] data; - - void length(size_t length) - { - static if (strong) - data.length = length; - else - realloc(data, length); - } - - SlotType* add(SlotType slot) - { - auto oldLen = data.length; - length = oldLen + 1; - auto p = &data[oldLen]; - *p = slot; - return p; - } - - SlotType* get(int slotId) - { - return &data[slotId]; - } - - void remove(int slotId) - { - move(data, slotId, slotId + 1, data.length - slotId - 1); - data = data[0..$ - 1]; - } - - size_t length() - { - return data.length; - } - - void free() - { - static if (SlotType.isDelegate) - { - foreach (ref slot; data) - { - if (auto obj = slot.getObject) - rt_detachDisposeEvent(obj, &slot.onReceiverDisposed); - } - } - static if (!strong) - cfree(data.ptr); - } -} - -public alias void delegate(int signalId, SignalEventId event) SignalEvent; - -struct SignalConnections -{ - bool isInUse; - - STuple!( - SlotList!(Slot!(Fn)), - SlotList!(Slot!(Dg)), - SlotList!(Slot!(Dg), true) - ) slotLists; - - STuple!( - Fn[], - Dg[] - ) delayedDisconnects; - - void addDelayedDisconnect(Fn r) - { - delayedDisconnects.at!(0) ~= r; - } - - void addDelayedDisconnect(Dg r) - { - delayedDisconnects.at!(1) ~= r; - } - - SlotListType!(slotListId)* getSlotList(int slotListId)() - { - return &slotLists.tupleof[slotListId]; - } - - bool hasSlots() - { - foreach(i, e; slotLists.tupleof) - { - if (slotLists.tupleof[i].length) - return true; - } - return false; - } - - int slotCount() - { - int count; - foreach(i, e; slotLists.tupleof) - count += slotLists.at!(i).length; - return count; - } - - void slotListLengths(int[] lengths) - { - foreach(i, e; slotLists.tupleof) - lengths[i] = slotLists.at!(i).length; - } - - SlotType!(slotListId)* addSlot(int slotListId)(SlotType!(slotListId) slot) - { - return getSlotList!(slotListId).add(slot); - } - - void removeSlot(int slotListId)(int slotId) - { - slotLists.at!(slotListId).remove(slotId); - } - - void free() - { - foreach(i, e; slotLists.tupleof) - { - static if (is(typeof(slotLists.at!(i).free))) - slotLists.at!(i).free; - } - } - - template SlotListType(int slotListId) - { - alias typeof(slotLists.tupleof)[slotListId] SlotListType; - } - - template SlotType(int slotListId) - { - alias SlotListType!(slotListId).SlotType SlotType; - } - - template ReceiverType(int slotListId) - { - alias SlotType!(slotListId).Receiver ReceiverType; - } - - static const slotListCount = slotLists.tupleof.length; -} - - -private ThreadLocal!(Object) signalSender_; -static this() -{ - signalSender_ = new ThreadLocal!(Object); -} - -/** - If called from a slot, returns the object - that is emitting the signal. Otherwise, returns null. -*/ -public Object signalSender() { - return signalSender_.val; -} - -public class SignalHandler -{ - SignalConnections[] connections; - Object owner; - int blocked; - - SignalEvent signalEvent; - - alias SignalConnections.SlotType SlotType; - alias SignalConnections.ReceiverType ReceiverType; - - public this(Object owner_) { - owner = owner_; - } - - private SignalConnections* getConnections(int signalId) - { - if (signalId < connections.length) - return &connections[signalId]; - return null; - } - - private SlotType!(slotListId)* addSlot(int slotListId)(int signalId, ReceiverType!(slotListId) receiver, - Dg invoker) - { - if (signalId >= connections.length) - connections.length = signalId + 1; - auto slot = connections[signalId].addSlot!(slotListId)(SlotType!(slotListId)(receiver, invoker)); - - if (signalEvent && connections[signalId].slotCount == 1) - signalEvent(signalId, SignalEventId.firstSlotConnected); - - return slot; - } - - private void removeSlot(int slotListId)(int signalId, int slotId) - { - connections[signalId].removeSlot!(slotListId)(slotId); - - if (signalEvent && !connections[signalId].slotCount) - signalEvent(signalId, SignalEventId.lastSlotDisconnected); - } - - private SlotType!(slotListId)* addObjectSlot(int slotListId)(size_t signalId, Object obj, Dg receiver, - Dg invoker) - { - auto slot = addSlot!(slotListId)(signalId, receiver, invoker); - slot.lock = this; - rt_attachDisposeEvent(obj, &slot.onReceiverDisposed); - return slot; - } - - size_t slotCount(int signalId) - { - synchronized(this) - { - auto con = getConnections(signalId); - if (con) - return con.slotCount; - return 0; - } - } - - void connect(Receiver)(size_t signalId, Receiver receiver, - Dg invoker, ConnectionFlags flags) - { - synchronized(this) - { - static if (is(typeof(receiver.context))) - { - Object obj; - if ((flags & ConnectionFlags.NoObject) || (obj = _d_toObject(receiver.context)) is null) - { - // strong by default - if (flags & ConnectionFlags.Weak) - addSlot!(SlotListId.Weak)(signalId, receiver, invoker); - else - addSlot!(SlotListId.Strong)(signalId, receiver, invoker); - } - else - { - // weak by default - if (flags & ConnectionFlags.Strong) - addObjectSlot!(SlotListId.Strong)(signalId, obj, receiver, invoker); - else - addObjectSlot!(SlotListId.Weak)(signalId, obj, receiver, invoker); - } - } - else - addSlot!(SlotListId.Func)(signalId, receiver, invoker); - } - } - - void disconnect(Receiver)(int signalId, Receiver receiver) - { - synchronized(this) - { - auto cons = getConnections(signalId); - if (!cons) - return; - - // if called from a slot being executed by this signal, delay disconnection - // until all slots has been called. - if (cons.isInUse) - { - cons.addDelayedDisconnect(receiver); - return; - } - - TOP: - foreach (slotListId, e; cons.slotLists.tupleof) - { - /// COMPILER BUG: ReceiverType is evaluated to expression instead of type. - static if (is(typeof(cons.ReceiverType!(slotListId)) == Receiver)) - { - auto slotList = cons.getSlotList!(slotListId); - for (int slotId; slotId < slotList.length;) - { - auto slot = slotList.get(slotId); - static if (slot.isDelegate) - { - if (slot.isDisposed) - { - removeSlot!(slotListId)(signalId, slotId); - continue; - } - } - - if (slot.receiver == receiver) - { - static if (slot.isDelegate) - { - if (auto obj = slot.getObject) - rt_detachDisposeEvent(obj, &slot.onReceiverDisposed); - } - removeSlot!(slotListId)(signalId, slotId); - break TOP; - } - - slotId++; - } - } - } - } - } - - void emit(A...)(size_t signalId, A args) - { - synchronized(this) - { - if (signalId >= connections.length || blocked) - return; - auto cons = &connections[signalId]; - - if (cons.hasSlots) - { - { - cons.isInUse = true; - signalSender_.val = owner; - scope(exit) - { - cons.isInUse = false; - signalSender_.val = null; - } - - // Store the lengths to avoid calling new slots - // connected in the slots being called. - // dmd bug: int[cons.slotListCount] fails - static const c = cons.slotListCount; - int[c] lengths = void; - cons.slotListLengths(lengths); - - foreach (slotListId, e; cons.slotLists.tupleof) - { - auto slotList = cons.getSlotList!(slotListId); - for (size_t slotId; slotId < lengths[slotListId];) - { - auto slot = slotList.get(slotId); - static if (slot.isDelegate) - { - if (slot.isDisposed) - { - removeSlot!(slotListId)(signalId, slotId); - lengths[slotListId]--; - continue; - } - } - - slot.invoker.call!(void)(slot.receiver, args); - ++slotId; - } - } - } - - - // process delayed disconnects if any - foreach(i, e; cons.delayedDisconnects.tupleof) - { - if (cons.delayedDisconnects.at!(i).length) - { - foreach (d; cons.delayedDisconnects.at!(i)) - disconnect(signalId, d); - cons.delayedDisconnects.at!(i).length = 0; - } - } - } - } - } - - // Adjusts signal arguments and calls the slot. S - slot signature, A - signal arguments - private void invokeSlot(S, Receiver, A...)(Receiver r, A args) - { - r.get!(S)()(args[0..ParameterTypeTuple!(S).length]); - } - - void blockSignals() - { - synchronized(this) - blocked++; - } - - void unblockSignals() - { - synchronized(this) - { - if(!blocked) - throw new SignalException("Signals are not blocked"); - blocked--; - } - } - - ~this() - { - foreach(ref c; connections) - c.free; - } -} - -//TODO: this could be avoided if named mixins didn't suck. -public struct SignalOps(int sigId, A...) -{ - private SignalHandler sh; - enum { signalId = sigId } - - void connect(R, B...)(R function(B) fn, ConnectionFlags flags = ConnectionFlags.None) - { - alias CheckSlot!(typeof(fn), A) check; - auto invoker = Dg(&sh.invokeSlot!(typeof(fn), Fn, A)); - sh.connect(signalId, Fn(fn), invoker, flags); - } - - void connect(R, B...)(R delegate(B) dg, ConnectionFlags flags = ConnectionFlags.None) - { - alias CheckSlot!(typeof(dg), A) check; - auto invoker = Dg(&sh.invokeSlot!(typeof(dg), Dg, A)); - sh.connect(signalId, Dg(dg), invoker, flags); - } - - void disconnect(R, B...)(R function(B) fn) - { - sh.disconnect(signalId, Fn(fn)); - } - - void disconnect(R, B...)(R delegate(B) dg) - { - sh.disconnect(signalId, Dg(dg)); - } - - void emit(A args) - { - sh.emit(signalId, args); - } - - debug size_t slotCount() - { - return sh.slotCount(signalId); - } -} - -template CheckSlot(Slot, A...) -{ - static assert(ParameterTypeTuple!(Slot).length <= A.length, "Slot " ~ ParameterTypeTuple!(Slot).stringof ~ - " has more prameters than signal " ~ A.stringof); - alias CheckSlotImpl!(Slot, 0, A) check; -} - -template CheckSlotImpl(Slot, int i, A...) -{ - alias ParameterTypeTuple!(Slot) SlotArgs; - static if (i < SlotArgs.length) - { - static assert (is(SlotArgs[i] : A[i]), "Argument " ~ ToString!(i) ~ - ":" ~ A[i].stringof ~ " of signal " ~ A.stringof ~ " is not implicitly convertible to parameter " - - - - - ~ SlotArgs[i].stringof ~ " of slot " ~ SlotArgs.stringof); - alias CheckSlotImpl!(Slot, i + 1, A) next; - } -} - -public template SignalHandlerOps() -{ - static assert (is(typeof(this.signalHandler)), - "SignalHandlerOps is already instantiated in " ~ typeof(this).stringof ~ " or one of its base classes"); - -protected: - SignalHandler signalHandler_; // manages signal-to-slot connections - - final SignalHandler signalHandler() - { - if (!signalHandler_) - { - signalHandler_ = new SignalHandler(this); - onSignalHandlerCreated(signalHandler_); - } - return signalHandler_; - } - - void onSignalHandlerCreated(ref SignalHandler sh) - { - } - -public: - final void blockSignals() - { - signalHandler.blockSignals(); - } - - final void unblockSignals() - { - signalHandler.unblockSignals(); - } -} - -/** - Examples: ----- -struct Args -{ - bool cancel; -} - -class C -{ - private int _x; - // reference parameters are not supported yet, - // so we pass arguments by pointer. - mixin Signal!("xChanging", int, Args*); - mixin Signal!("xChanged"); - - void x(int v) - { - if (v != _x) - { - Args args; - xChanging.emit(v, &args); - if (!args.cancel) - { - _x = v; - xChanged.emit; - } - } - } -} ----- -*/ -template Signal(string name, A...) -{ - mixin SignalImpl!(0, name, A); -} - -template SignalImpl(int index, string name, A...) -{ - static if (is(typeof(mixin(typeof(this).stringof ~ ".__sig" ~ ToString!(index))))) - mixin SignalImpl!(index + 1, name, A); - else - { - // mixed-in once - static if (!is(typeof(this.signalHandler))) - { - mixin SignalHandlerOps; - } - mixin("private static const int __sig" ~ ToString!(index) ~ " = " ~ ToString!(index) ~ ";"); - mixin("SignalOps!(" ~ ToString!(index) ~ ", A) " ~ name ~ "(){ return SignalOps!(" - ~ ToString!(index) ~ ", A)(signalHandler); }"); - } -} - -extern(C) alias void function(void*) SlotConnector; - -debug (UnitTest) -{ - class A - { - mixin Signal!("scorched", int); - - int signalId1 = -1; - int signalId2 = -1; - - void onFirstConnect(int sId) - { - signalId1 = sId; - } - - void onLastDisconnect(int sId) - { - signalId2 = sId; - } - - this() - { - signalHandler.firstSlotConnected = &onFirstConnect; - signalHandler.lastSlotDisconnected = &onLastDisconnect; - } - } - - class B : A - { - mixin Signal!("booed", int); - - int bazSum; - void baz(int i) - { - bazSum += i; - } - } - - class C : A - { - mixin Signal!("cooked"); - } -} - -unittest -{ - static int fooSum; - static int barSum; - - static void foo(int i) - { - fooSum += i; - } - - void bar(long i) - { - barSum += i; - } - - auto a = new A; - auto b = new B; - auto c = new C; - assert(b.scorched.signalId == 0); - assert(b.booed.signalId == 1); - assert(c.cooked.signalId == 1); - - auto sh = b.signalHandler; - - b.scorched.connect(&foo); - assert(sh.connections.length == 1); - assert(b.signalId1 == 0); - auto scCons = &sh.connections[0]; - - assert(scCons.getSlotList!(SlotListId.Func).length == 1); - b.scorched.emit(1); - assert(fooSum == 1); - - b.scorched.connect(&bar, ConnectionFlags.NoObject); - assert(sh.connections.length == 1); - assert(scCons.getSlotList!(SlotListId.Strong).length == 1); - b.scorched.emit(1); - assert (fooSum == 2 && barSum == 1); - - b.scorched.connect(&b.baz); - assert(scCons.getSlotList!(SlotListId.Weak).length == 1); - b.scorched.emit(1); - assert (fooSum == 3 && barSum == 2 && b.bazSum == 1); - - b.scorched.disconnect(&bar); - assert(scCons.slotCount == 2); - b.scorched.disconnect(&b.baz); - assert(scCons.slotCount == 1); - b.scorched.disconnect(&foo); - assert(scCons.slotCount == 0); - assert(b.signalId2 == 0); - - fooSum = 0; - void connectFoo() - { - b.scorched.connect(&foo); - b.scorched.disconnect(&connectFoo); - } - - b.scorched.connect(&connectFoo, ConnectionFlags.NoObject); - b.scorched.emit(1); - assert(scCons.getSlotList!(SlotListId.Func).length == 1); - assert(scCons.getSlotList!(SlotListId.Strong).length == 0); - assert(!fooSum); - - auto r = new B(); - b.scorched.connect(&r.baz); - assert(scCons.getSlotList!(SlotListId.Weak).length == 1); - b.scorched.emit(1); - assert(r.bazSum == 1); - assert(fooSum == 1); - - delete(r); - assert(scCons.getSlotList!(SlotListId.Weak).length == 1); - b.scorched.emit(1); - assert(scCons.getSlotList!(SlotListId.Weak).length == 0); -}
--- a/qt/d2/qt/core/QLine.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,390 +0,0 @@ -module qt.core.QLine; - -public import qt.QGlobal; -public import qt.core.Qt; -public import qt.core.QPoint; -public import qt.core.QDataStream; - - -public struct QLine -{ - public static QLine opCall() { - QLine ln; - ln.pt1 = QPoint(); - ln.pt2 = QPoint(); - return ln; - } - - public this(QPoint pt1_, QPoint pt2_) { - pt1 = pt1_; - pt2 = pt2_; - } - - public this(int x1pos, int y1pos, int x2pos, int y2pos) { - pt1 = QPoint(x1pos, y1pos); - pt2 = QPoint(x2pos, y2pos); - } - - bool isNull() // const - { - return pt1 == pt2; - } - - int x1() // const - { - return pt1.x(); - } - - int y1() // const - { - return pt1.y(); - } - - int x2() // const - { - return pt2.x(); - } - - int y2() // const - { - return pt2.y(); - } - - QPoint p1() // const - { - return pt1; - } - - QPoint p2() // const - { - return pt2; - } - - int dx() // const - { - return pt2.x() - pt1.x(); - } - - int dy() // const - { - return pt2.y() - pt1.y(); - } - - void translate(ref QPoint point) - { - pt1 += point; - pt2 += point; - } - - void translate(int adx, int ady) - { - translate(QPoint(adx, ady)); - } - - QLine translated(ref QPoint p) // const - { - return QLine(pt1 + p, pt2 + p); - } - - QLine translated(int adx, int ady) // const - { - return translated(QPoint(adx, ady)); - } - - void p1(ref QPoint aP1) - { - pt1 = aP1; - } - - void p2(ref QPoint aP2) - { - pt2 = aP2; - } - - void setP1(ref QPoint aP1) // for convenience - { - pt1 = aP1; - } - - void setP2(ref QPoint aP2) // for convenience - { - pt2 = aP2; - } - - void setPoints(ref QPoint aP1, ref QPoint aP2) - { - pt1 = aP1; - pt2 = aP2; - } - - void setLine(int aX1, int aY1, int aX2, int aY2) - { - pt1 = QPoint(aX1, aY1); - pt2 = QPoint(aX2, aY2); - } - - bool opEquals(ref QLine d) // const - { - return pt1 == d.pt1 && pt2 == d.pt2; - } - - public final void writeTo(QDataStream arg__1) { - qtd_QLine_writeTo_QDataStream(&this, arg__1 is null ? null : arg__1.__nativeId); - } - - public final void readFrom(QDataStream arg__1) { - qtd_QLine_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.__nativeId); - } - -private: - QPoint pt1, pt2; -} - - -public enum QLineF_IntersectType { - NoIntersection = 0, - BoundedIntersection = 1, - UnboundedIntersection = 2 -} - -public struct QLineF -{ - - alias QLineF_IntersectType IntersectType; - - alias QLineF_IntersectType.NoIntersection NoIntersection; - alias QLineF_IntersectType.BoundedIntersection BoundedIntersection; - alias QLineF_IntersectType.UnboundedIntersection UnboundedIntersection; - - public static QLineF opCall() { - QLineF ln; - ln.pt1 = QPointF(); - ln.pt2 = QPointF(); - return ln; - } - - public this(QPointF apt1, QPointF apt2) { - pt1 = apt1; - pt2 = apt2; - } - - public this(qreal x1pos, qreal y1pos, qreal x2pos, qreal y2pos) { - pt1 = QPointF(x1pos, y1pos); - pt2 = QPointF(x2pos, y2pos); - } - - public this(QLine line){ - pt1 = QPointF(line.p1()); - pt2 = QPointF(line.p2()); - } - - public final bool isNull() // const - { - return qtd_QLineF_isNull(&this); - } - - qreal x1() // const - { - return pt1.x(); - } - - qreal y1() // const - { - return pt1.y(); - } - - qreal x2() // const - { - return pt2.x(); - } - - qreal y2() // const - { - return pt2.y(); - } - - QPointF p1() // const - { - return pt1; - } - - QPointF p2() // const - { - return pt2; - } - - qreal dx() // const - { - return pt2.x() - pt1.x(); - } - - qreal dy() // const - { - return pt2.y() - pt1.y(); - } - - QLineF normalVector() // const - { - return QLineF(p1(), p1() + QPointF(dy(), -dx())); - } - - void translate(ref QPointF point) - { - pt1 += point; - pt2 += point; - } - - void translate(qreal adx, qreal ady) - { - this.translate(QPointF(adx, ady)); - } - - QLineF translated(ref QPointF p) // const - { - return QLineF(pt1 + p, pt2 + p); - } - - QLineF translated(qreal adx, qreal ady) // const - { - return translated(QPointF(adx, ady)); - } - - void setLength(qreal len) - { - if (isNull()) - return; - QLineF v = unitVector(); - pt2 = QPointF(pt1.x() + v.dx() * len, pt1.y() + v.dy() * len); - } - - void length(qreal len) - { - if (isNull()) - return; - QLineF v = unitVector(); - pt2 = QPointF(pt1.x() + v.dx() * len, pt1.y() + v.dy() * len); - } - - QPointF pointAt(qreal t) // const - { - qreal vx = pt2.x() - pt1.x(); - qreal vy = pt2.y() - pt1.y(); - return QPointF(pt1.x() + vx * t, pt1.y() + vy * t); - } - - QLine toLine() // const - { - return QLine(pt1.toPoint(), pt2.toPoint()); - } - - void setP1(ref QPointF aP1) - { - pt1 = aP1; - } - - void setP2(ref QPointF aP2) - { - pt2 = aP2; - } - - void p1(ref QPointF aP1) - { - pt1 = aP1; - } - - void p2(ref QPointF aP2) - { - pt2 = aP2; - } - - void setPoints(ref QPointF aP1, ref QPointF aP2) - { - pt1 = aP1; - pt2 = aP2; - } - - void setLine(qreal aX1, qreal aY1, qreal aX2, qreal aY2) - { - pt1 = QPointF(aX1, aY1); - pt2 = QPointF(aX2, aY2); - } - - bool opEquals(ref QLineF d) // const - { - return pt1 == d.pt1 && pt2 == d.pt2; - } - - public final double angle() { - return qtd_QLineF_angle(&this); - } - - public final double angle(ref QLineF l) { - return qtd_QLineF_angle_QLineF(&this, &l); - } - - public final double angleTo(ref QLineF l) { - return qtd_QLineF_angleTo_QLineF(&this, &l); - } - - // ### Qt 5: rename intersects() or intersection() and rename IntersectType IntersectionType - private final QLineF_IntersectType intersect(ref QLineF l, QPointF* intersectionPoint) { - return cast(QLineF_IntersectType) qtd_QLineF_intersect_QLineF_nativepointerQPointF(&this, &l, intersectionPoint); - } - - public final double length() { - return qtd_QLineF_length(&this); - } - - public final void writeTo(QDataStream arg__1) { - qtd_QLineF_writeTo_QDataStream(&this, arg__1 is null ? null : arg__1.__nativeId); - } - - public final void readFrom(QDataStream arg__1) { - qtd_QLineF_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.__nativeId); - } - - public final void setAngle(double angle) { - qtd_QLineF_setAngle_double(&this, angle); - } - - public final QLineF unitVector() { - return qtd_QLineF_unitVector(&this); - } - - public static QLineF fromPolar(double length, double angle) { - return qtd_QLineF_fromPolar_double_double(length, angle); - } - - private: - QPointF pt1, pt2; -} - - -// C wrappers -// QLine -private extern(C) void qtd_QLine_writeTo_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) void qtd_QLine_readFrom_QDataStream(void* __this_nativeId, - void* arg__1); - -// QLineF -private extern(C) bool qtd_QLineF_isNull(void* __this_nativeId); -private extern(C) double qtd_QLineF_angle(void* __this_nativeId); -private extern(C) double qtd_QLineF_angle_QLineF(void* __this_nativeId, - void* l0); -private extern(C) double qtd_QLineF_angleTo_QLineF(void* __this_nativeId, - void* l0); -private extern(C) int qtd_QLineF_intersect_QLineF_nativepointerQPointF(void* __this_nativeId, - void* l0, - void* intersectionPoint1); -private extern(C) double qtd_QLineF_length(void* __this_nativeId); -private extern(C) void qtd_QLineF_writeTo_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) void qtd_QLineF_readFrom_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) void qtd_QLineF_setAngle_double(void* __this_nativeId, - double angle0); - -private extern(C) QLineF qtd_QLineF_unitVector(void* __this_nativeId); -private extern(C) QLineF qtd_QLineF_fromPolar_double_double(double length0, - double angle1);
--- a/qt/d2/qt/core/QLineF.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -module qt.core.QLineF; -/* dummy */ - -public import qt.core.QLine; \ No newline at end of file
--- a/qt/d2/qt/core/QModelIndex.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -module qt.core.QModelIndex; - -public import qt.QGlobal; -private import qt.core.QObject; - -// automatic imports------------- -private import qt.core.QVariant; -private import qt.core.QAbstractItemModel; -public import qt.core.Qt; - - -public struct QModelIndex -{ - public static QModelIndex opCall() { - QModelIndex mi; - mi.r = mi.c = -1; - mi.p = mi.m = null; - return mi; - } - - public final QModelIndex child(int row, int column) { - return __qtd_QModelIndex_child_int_int(&this, row, column); - } - - public final int column() const { - return __qtd_QModelIndex_column(cast(void*)&this); - } - - public final QVariant data(int role = 0) { - void* __qt_return_value = __qtd_QModelIndex_data_int(&this, role); - return new QVariant(__qt_return_value); - } - - public final int flags() { - return __qtd_QModelIndex_flags(&this); - } - - public final long internalId() { - return __qtd_QModelIndex_internalId(&this); - } - - public final void* internalPointer() const { - //return __qtd_QModelIndex_internalPointer(&this); - return cast(void*)p; - } - - public final Object object() { - return cast(Object) p; - } - - public final bool isValid() const { - return __qtd_QModelIndex_isValid(cast(void*)&this); - } - - public final QAbstractItemModel model() { -// void* __qt_return_value = __qtd_QModelIndex_model(&this); - void* __qt_return_value = m; - if (__qt_return_value is null) - return null; - void* d_obj = qtd_get_d_qobject(__qt_return_value); - return cast(QAbstractItemModel) d_obj; - } - - private final bool operator_less(QModelIndex other) { - return __qtd_QModelIndex_operator_less_QModelIndex(&this, other); - } - - private final bool operator_equal(QModelIndex other) { - return __qtd_QModelIndex_operator_equal_QModelIndex(&this, other); - } - - public final QModelIndex parent() { - return __qtd_QModelIndex_parent(&this); - } - - public final int row() const { - return __qtd_QModelIndex_row(cast(void*)&this); - } - - public final QModelIndex sibling(int row, int column) { - return __qtd_QModelIndex_sibling_int_int(&this, row, column); - } - -private: - int r; - int c; - void *p; - void *m; -} - - -alias QModelIndex QModelIndexAccessor; - - -// C wrappers -private extern(C) void* __qtd_QModelIndex_QModelIndex_QModelIndex(QModelIndex other0); -private extern(C) QModelIndex __qtd_QModelIndex_child_int_int(void* __this_nativeId, - int row0, - int column1); -private extern(C) int __qtd_QModelIndex_column(void* __this_nativeId); -private extern(C) void* __qtd_QModelIndex_data_int(void* __this_nativeId, - int role0); -private extern(C) int __qtd_QModelIndex_flags(void* __this_nativeId); -private extern(C) long __qtd_QModelIndex_internalId(void* __this_nativeId); -private extern(C) void* __qtd_QModelIndex_internalPointer(void* __this_nativeId); -private extern(C) bool __qtd_QModelIndex_isValid(void* __this_nativeId); -private extern(C) void* __qtd_QModelIndex_model(void* __this_nativeId); -private extern(C) bool __qtd_QModelIndex_operator_less_QModelIndex(void* __this_nativeId, - QModelIndex other0); -private extern(C) bool __qtd_QModelIndex_operator_equal_QModelIndex(void* __this_nativeId, - QModelIndex other0); -private extern(C) QModelIndex __qtd_QModelIndex_parent(void* __this_nativeId); -private extern(C) int __qtd_QModelIndex_row(void* __this_nativeId); -private extern(C) QModelIndex __qtd_QModelIndex_sibling_int_int(void* __this_nativeId, - int row0, - int column1); -// Just the private functions for abstract functions implemeneted in superclasses - - - -// Virtual Dispatch functions
--- a/qt/d2/qt/core/QPoint.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,229 +0,0 @@ -module qt.core.QPoint; - -public import qt.QGlobal; -public import qt.core.Qt; -public import qt.core.QDataStream; - - -public struct QPoint -{ - -// Functions - public static QPoint opCall() { - QPoint pt; - pt.xp = pt.yp = 0; - return pt; - } - - public this(int xpos, int ypos) { - xp = xpos; - yp = ypos; - } - - bool isNull() // const - { return xp == 0 && yp == 0; } - - int x() const - { return xp; } - - int y() const - { return yp; } - - void x(int xpos) - { xp = xpos; } - - void y(int ypos) - { yp = ypos; } - - void setX(int xpos) // for convenience - { xp = xpos; } - - void setY(int ypos) // for convenience - { yp = ypos; } - - public final int manhattanLength() { - return qtd_QPoint_manhattanLength(&this); - } -/* -inline int &rx() -{ return xp; } - -inline int &ry() -{ return yp; } -*/ - - QPoint opAddAssign(ref QPoint p) - { xp+=p.xp; yp+=p.yp; return this; } - - QPoint opSubAssign(ref QPoint p) - { xp-=p.xp; yp-=p.yp; return this; } - - QPoint opMulAssign(qreal c) - { xp = qRound(xp*c); yp = qRound(yp*c); return this; } - - bool opEquals(ref QPoint p) - { return xp == p.xp && yp == p.yp; } - - QPoint opAdd(ref QPoint p) - { return QPoint(this.xp+p.xp, this.yp+p.yp); } - - QPoint opSub(ref QPoint p) - { return QPoint(this.xp-p.xp, this.yp-p.yp); } - - QPoint opMul(qreal c) - { return QPoint(qRound(this.xp*c), qRound(this.yp*c)); } - - QPoint opDivAssign(qreal c) - { - xp = qRound(xp/c); - yp = qRound(yp/c); - return this; - } - - QPoint opDiv(qreal c) - { - return QPoint(qRound(this.xp/c), qRound(this.yp/c)); - } - - public final void writeTo(QDataStream arg__1) { - qtd_QPoint_writeTo_QDataStream(&this, arg__1 is null ? null : arg__1.__nativeId); - } - - public final void readFrom(QDataStream arg__1) { - qtd_QPoint_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.__nativeId); - } - -private: - // ### Qt 5; remove the ifdef and just have the same order on all platforms. - version(OSX) - { - int yp; - int xp; - } - else - { - int xp; - int yp; - } -} - - -public struct QPointF -{ - public static QPointF opCall() { - QPointF pt; - pt.xp = pt.yp = 0; - return pt; - } - - public this(qreal xpos, qreal ypos) { - xp = xpos; - yp = ypos; - } - - public this(QPoint p) { - xp = p.x(); - yp = p.y(); - } - - bool isNull() //const - { - return qIsNull(xp) && qIsNull(yp); - } - - qreal x() //const - { - return xp; - } - - qreal y() //const - { - return yp; - } - - void x(qreal xpos) - { - xp = xpos; - } - - void y(qreal ypos) - { - yp = ypos; - } -/* -inline qreal &QPointF::rx() -{ - return xp; -} - -inline qreal &QPointF::ry() -{ - return yp; -} -*/ - - QPointF opAddAssign(ref QPointF p) - { xp+=p.xp; yp+=p.yp; return this; } - - QPointF opSubAssign(ref QPointF p) - { xp-=p.xp; yp-=p.yp; return this; } - - QPointF opMulAssign(qreal c) - { xp*=c; yp*=c; return this; } - - bool opEquals(ref QPointF p) - { return qFuzzyCompare(xp, p.xp) && qFuzzyCompare(yp, p.yp); } - - QPointF opAdd(ref QPointF p) - { return QPointF(this.xp+p.xp, this.yp+p.yp); } - - QPointF opSub(ref QPointF p) - { return QPointF(this.xp-p.xp, this.yp-p.yp); } - - QPointF opMul(qreal c) - { return QPointF(this.xp*c, this.yp*c); } - - QPointF opDivAssign(qreal c) - { - xp/=c; - yp/=c; - return this; - } - - QPointF opDiv(qreal c) - { - return QPointF(xp/c, yp/c); - } - - QPoint toPoint() //const - { - return QPoint(qRound(xp), qRound(yp)); - } - - public final void writeTo(QDataStream arg__1) { - qtd_QPointF_writeTo_QDataStream(&this, arg__1 is null ? null : arg__1.__nativeId); - } - - public final void readFrom(QDataStream arg__1) { - qtd_QPointF_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.__nativeId); - } - -private: - qreal xp; - qreal yp; -} - - -// C wrappers -// QPoint -private extern(C) int qtd_QPoint_manhattanLength(void* __this_nativeId); -private extern(C) void qtd_QPoint_writeTo_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) void qtd_QPoint_readFrom_QDataStream(void* __this_nativeId, - void* arg__1); - -// QPointF -private extern(C) void qtd_QPointF_writeTo_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) void qtd_QPointF_readFrom_QDataStream(void* __this_nativeId, - void* arg__1); \ No newline at end of file
--- a/qt/d2/qt/core/QPointF.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -module qt.core.QPointF; -/* dummy */ - -public import qt.core.QPoint;
--- a/qt/d2/qt/core/QRect.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,375 +0,0 @@ -module qt.core.QRect; - -public import qt.QGlobal; -public import qt.core.Qt; -public import qt.core.QDataStream; -public import qt.core.QSize; -public import qt.core.QPoint; - - -public struct QRect -{ - public static QRect opCall() { - QRect rt; - rt.x1 = rt.y1 = 0; - rt.x2 = rt.y2 = -1; - return rt; - } - - public this(int aleft, int atop, int awidth, int aheight) - { - x1 = aleft; - y1 = atop; - x2 = (aleft + awidth - 1); - y2 = (atop + aheight - 1); - } - - public this(QPoint atopLeft, QPoint abottomRight) - { - x1 = atopLeft.x(); - y1 = atopLeft.y(); - x2 = abottomRight.x(); - y2 = abottomRight.y(); - } - - public this(ref QPoint atopLeft, ref QSize asize) - { - x1 = atopLeft.x(); - y1 = atopLeft.y(); - x2 = (x1+asize.width() - 1); - y2 = (y1+asize.height() - 1); - } - - bool isNull() const - { return x2 == x1 - 1 && y2 == y1 - 1; } - - bool isEmpty() const - { return x1 > x2 || y1 > y2; } - - bool isValid() const - { return x1 <= x2 && y1 <= y2; } - - int left() const - { return x1; } - - int top() const - { return y1; } - - int right() const - { return x2; } - - int bottom() const - { return y2; } - - int x() const - { return x1; } - - int y() const - { return y1; } - - void left(int pos) - { x1 = pos; } - - void top(int pos) - { y1 = pos; } - - void right(int pos) - { x2 = pos; } - - void bottom(int pos) - { y2 = pos; } - - void setLeft(int pos) - { x1 = pos; } - - void setTop(int pos) - { y1 = pos; } - - void setRight(int pos) - { x2 = pos; } - - void setBottom(int pos) - { y2 = pos; } - - void setTopLeft(const QPoint p) - { x1 = p.x(); y1 = p.y(); } - - void setBottomRight(const QPoint p) - { x2 = p.x(); y2 = p.y(); } - - void setTopRight(const QPoint p) - { x2 = p.x(); y1 = p.y(); } - - void setBottomLeft(const QPoint p) - { x1 = p.x(); y2 = p.y(); } - - void setX(int ax) - { x1 = ax; } - - void setY(int ay) - { y1 = ay; } - - QPoint topLeft() const - { return QPoint(x1, y1); } - - QPoint bottomRight() const - { return QPoint(x2, y2); } - - QPoint topRight() const - { return QPoint(x2, y1); } - - QPoint bottomLeft() const - { return QPoint(x1, y2); } - - QPoint center() const - { return QPoint((x1+x2)/2, (y1+y2)/2); } - - int width() const - { return x2 - x1 + 1; } - - int height() const - { return y2 - y1 + 1; } - - QSize size() const - { return QSize(width(), height()); } - - void translate(int dx, int dy) - { - x1 += dx; - y1 += dy; - x2 += dx; - y2 += dy; - } - - void translate(const QPoint p) - { - x1 += p.x(); - y1 += p.y(); - x2 += p.x(); - y2 += p.y(); - } - - QRect translated(int dx, int dy) const - { return QRect(QPoint(x1 + dx, y1 + dy), QPoint(x2 + dx, y2 + dy)); } - - QRect translated(const QPoint p) const - { return QRect(QPoint(x1 + p.x(), y1 + p.y()), QPoint(x2 + p.x(), y2 + p.y())); } - - void moveTo(int ax, int ay) - { - x2 += ax - x1; - y2 += ay - y1; - x1 = ax; - y1 = ay; - } - - void moveTo(const QPoint p) - { - x2 += p.x() - x1; - y2 += p.y() - y1; - x1 = p.x(); - y1 = p.y(); - } - - void moveLeft(int pos) - { x2 += (pos - x1); x1 = pos; } - - void moveTop(int pos) - { y2 += (pos - y1); y1 = pos; } - - void moveRight(int pos) - { - x1 += (pos - x2); - x2 = pos; - } - - void moveBottom(int pos) - { - y1 += (pos - y2); - y2 = pos; - } - - void moveTopLeft(const QPoint p) - { - moveLeft(p.x()); - moveTop(p.y()); - } - - void moveBottomRight(const QPoint p) - { - moveRight(p.x()); - moveBottom(p.y()); - } - - void moveTopRight(const QPoint p) - { - moveRight(p.x()); - moveTop(p.y()); - } - - void moveBottomLeft(const QPoint p) - { - moveLeft(p.x()); - moveBottom(p.y()); - } - - void getRect(int *ax, int *ay, int *aw, int *ah) const - { - *ax = x1; - *ay = y1; - *aw = x2 - x1 + 1; - *ah = y2 - y1 + 1; - } - - void setRect(int ax, int ay, int aw, int ah) - { - x1 = ax; - y1 = ay; - x2 = (ax + aw - 1); - y2 = (ay + ah - 1); - } - - void getCoords(int *xp1, int *yp1, int *xp2, int *yp2) const - { - *xp1 = x1; - *yp1 = y1; - *xp2 = x2; - *yp2 = y2; - } - - void setCoords(int xp1, int yp1, int xp2, int yp2) - { - x1 = xp1; - y1 = yp1; - x2 = xp2; - y2 = yp2; - } - - QRect adjusted(int xp1, int yp1, int xp2, int yp2) const - { return QRect(QPoint(x1 + xp1, y1 + yp1), QPoint(x2 + xp2, y2 + yp2)); } - - void adjust(int dx1, int dy1, int dx2, int dy2) - { - x1 += dx1; - y1 += dy1; - x2 += dx2; - y2 += dy2; - } - - void setWidth(int w) - { x2 = (x1 + w - 1); } - - void setHeight(int h) - { y2 = (y1 + h - 1); } - - void setSize(const QSize s) - { - x2 = (s.width() + x1 - 1); - y2 = (s.height() + y1 - 1); - } - - bool contains(int ax, int ay, bool aproper) const - { - return contains(QPoint(ax, ay), aproper); - } - - bool contains(int ax, int ay) const - { - return contains(QPoint(ax, ay), false); - } - - QRect opOrAssign(const QRect r) - { - this = this | r; - return this; - } - - QRect opAndAssign(const QRect r) - { - this = this & r; - return this; - } - - QRect intersected(const QRect other) const - { - return this & other; - } - - QRect united(const QRect r) const - { - return this | r; - } - - bool opEquals(const QRect r) - { - return x1==r.x1 && x2==r.x2 && y1==r.y1 && y2==r.y2; - } - - public final void writeTo(QDataStream arg__1) { - qtd_QRect_writeTo_QDataStream(&this, arg__1 is null ? null : arg__1.__nativeId); - } - - public final void readFrom(QDataStream arg__1) { - qtd_QRect_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.__nativeId); - } - - public final QRect opAnd(const QRect r) const { - return qtd_QRect_operator_and_QRect(&this, &r); - } - - public final QRect opOr(const QRect r) const { - return qtd_QRect_operator_or_QRect(&this, &r); - } - - public final bool contains(const QPoint p, bool proper = false) const { - return qtd_QRect_contains_QPoint_bool(&this, &p, proper); - } - - public final bool contains(const QRect r, bool proper = false) const { - return qtd_QRect_contains_QRect_bool(&this, &r, proper); - } - - public final bool intersects(const QRect r) const { - return qtd_QRect_intersects_QRect(&this, &r); - } - - public final QRect normalized() const { - return qtd_QRect_normalized(&this); - } - -private: - version(OSX) - { - int y1; - int x1; - int y2; - int x2; - } - else - { - int x1; - int y1; - int x2; - int y2; - } -} - - -// C wrappers -private extern(C) bool qtd_QRect_contains_QPoint_bool(const void* __this_nativeId, - const void* p0, - bool proper1); -private extern(C) bool qtd_QRect_contains_QRect_bool(const void* __this_nativeId, - const void* r0, - bool proper1); -private extern(C) bool qtd_QRect_intersects_QRect(const void* __this_nativeId, - const void* r0); -private extern(C) QRect qtd_QRect_normalized(const void* __this_nativeId); -private extern(C) void qtd_QRect_writeTo_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) void qtd_QRect_readFrom_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) QRect qtd_QRect_operator_and_QRect(const void* __this_nativeId, - const void* r0); -private extern(C) QRect qtd_QRect_operator_or_QRect(const void* __this_nativeId, - const void* r0); \ No newline at end of file
--- a/qt/d2/qt/core/QRectF.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,329 +0,0 @@ -module qt.core.QRectF; - -public import qt.QGlobal; -public import qt.core.Qt; -public import qt.core.QPointF; -public import qt.core.QRect; -public import qt.core.QSizeF; -public import qt.core.QDataStream; - - -public struct QRectF -{ - public static QRectF opCall() - { - QRectF rt; - rt.xp = rt.yp = 0.; - rt.w = rt.h = 0.; - return rt; - } - - public this(qreal aleft, qreal atop, qreal awidth, qreal aheight) - { - xp = aleft; - yp = atop; - w = awidth; - h = aheight; - } - - public this(QPointF atopLeft, QSizeF asize) - { - xp = atopLeft.x(); - yp = atopLeft.y(); - w = asize.width(); - h = asize.height(); - } - - public this(QPointF atopLeft, QPointF abottomRight) - { - xp = atopLeft.x(); - yp = atopLeft.y(); - w = abottomRight.x() - xp; - h = abottomRight.y() - yp; - } - - public this(QRect r) - { - xp = r.x(); - yp = r.y(); - w = r.width(); - h = r.height(); - } - - bool isNull() const - { return qIsNull(w) && qIsNull(h); } - - bool isEmpty() const - { return w <= 0. || h <= 0.; } - - bool isValid() const - { return w > 0. && h > 0.; } - - qreal x() const - { return xp; } - - qreal y() const - { return yp; } - - qreal left() const - { return xp; } - - qreal top() const - { return yp; } - - qreal right() const - { return xp + w; } - - qreal bottom() const - { return yp + h; } - - QPointF topLeft() const - { return QPointF(xp, yp); } - - QPointF bottomRight() const - { return QPointF(xp+w, yp+h); } - - QPointF topRight() const - { return QPointF(xp+w, yp); } - - QPointF bottomLeft() const - { return QPointF(xp, yp+h); } - - void setLeft(qreal pos) { qreal diff = pos - xp; xp += diff; w -= diff; } - - void setRight(qreal pos) { w = pos - xp; } - - void setTop(qreal pos) { qreal diff = pos - yp; yp += diff; h -= diff; } - - void setBottom(qreal pos) { h = pos - yp; } - - void setTopLeft(ref QPointF p) { setLeft(p.x()); setTop(p.y()); } - - void setTopRight(ref QPointF p) { setRight(p.x()); setTop(p.y()); } - - void setBottomLeft(ref QPointF p) { setLeft(p.x()); setBottom(p.y()); } - - void setBottomRight(ref QPointF p) { setRight(p.x()); setBottom(p.y()); } - - QPointF center() const - { return QPointF(xp + w/2, yp + h/2); } - - void moveLeft(qreal pos) { xp = pos; } - - void moveTop(qreal pos) { yp = pos; } - - void moveRight(qreal pos) { xp = pos - w; } - - void moveBottom(qreal pos) { yp = pos - h; } - - void moveTopLeft(ref QPointF p) { moveLeft(p.x()); moveTop(p.y()); } - - void moveTopRight(ref QPointF p) { moveRight(p.x()); moveTop(p.y()); } - - void moveBottomLeft(ref QPointF p) { moveLeft(p.x()); moveBottom(p.y()); } - - void moveBottomRight(ref QPointF p) { moveRight(p.x()); moveBottom(p.y()); } - - void moveCenter(ref QPointF p) { xp = p.x() - w/2; yp = p.y() - h/2; } - - qreal width() const - { return w; } - - qreal height() const - { return h; } - - QSizeF size() const - { return QSizeF(w, h); } - - void translate(qreal dx, qreal dy) - { - xp += dx; - yp += dy; - } - - void translate(ref QPointF p) - { - xp += p.x(); - yp += p.y(); - } - - void moveTo(qreal ax, qreal ay) - { - xp = ax; - yp = ay; - } - - void moveTo(ref QPointF p) - { - xp = p.x(); - yp = p.y(); - } - - QRectF translated(qreal dx, qreal dy) const - { return QRectF(xp + dx, yp + dy, w, h); } - - QRectF translated(ref QPointF p) const - { return QRectF(xp + p.x(), yp + p.y(), w, h); } - - void getRect(qreal *ax, qreal *ay, qreal *aaw, qreal *aah) const - { - *ax = this.xp; - *ay = this.yp; - *aaw = this.w; - *aah = this.h; - } - - void setRect(qreal ax, qreal ay, qreal aaw, qreal aah) - { - this.xp = ax; - this.yp = ay; - this.w = aaw; - this.h = aah; - } - - void getCoords(qreal *xp1, qreal *yp1, qreal *xp2, qreal *yp2) const - { - *xp1 = xp; - *yp1 = yp; - *xp2 = xp + w; - *yp2 = yp + h; - } - - void setCoords(qreal xp1, qreal yp1, qreal xp2, qreal yp2) - { - xp = xp1; - yp = yp1; - w = xp2 - xp1; - h = yp2 - yp1; - } - - void adjust(qreal xp1, qreal yp1, qreal xp2, qreal yp2) - { xp += xp1; yp += yp1; w += xp2 - xp1; h += yp2 - yp1; } - - QRectF adjusted(qreal xp1, qreal yp1, qreal xp2, qreal yp2) const - { return QRectF(xp + xp1, yp + yp1, w + xp2 - xp1, h + yp2 - yp1); } - - void setWidth(qreal aw) // for convenience - { this.w = aw; } - - void setHeight(qreal ah) // for convenience - { this.h = ah; } - - void setSize(ref QSizeF s) // for convenience - { - w = s.width(); - h = s.height(); - } - - void width(qreal aw) - { this.w = aw; } - - void height(qreal ah) - { this.h = ah; } - - void size(ref QSizeF s) - { - w = s.width(); - h = s.height(); - } - - bool contains(qreal ax, qreal ay) const - { - return contains(QPointF(ax, ay)); - } - - QRectF opOrAssign(ref QRectF r) - { - this = this | r; - return this; - } - - QRectF opAndAssign(ref QRectF r) - { - this = this & r; - return this; - } - - QRectF intersected(ref QRectF r) const - { - return this & r; - } - - QRectF united(ref QRectF r) const - { - return this | r; - } - - bool opEquals(ref QRectF r) - { - return qFuzzyCompare(xp, r.xp) && qFuzzyCompare(yp, r.yp) - && qFuzzyCompare(w, r.w) && qFuzzyCompare(h, r.h); - } - - QRect toRect() const - { - return QRect(qRound(xp), qRound(yp), qRound(w), qRound(h)); - } - - public final bool contains(QPointF p) const { - return qtd_QRectF_contains_QPointF(cast(void*)&this, &p); - } - - public final bool contains(QRectF r) const { - return qtd_QRectF_contains_QRectF(cast(void*)&this, &r); - } - - public final bool intersects(QRectF r) const { - return qtd_QRectF_intersects_QRectF(cast(void*)&this, &r); - } - - public final QRectF normalized() const { - return qtd_QRectF_normalized(cast(void*)&this); - } - - public final QRectF opAnd(ref QRectF r) const { - return qtd_QRectF_operator_and_QRectF(cast(void*)&this, &r); - } - - public final void writeTo(QDataStream arg__1) { - qtd_QRectF_writeTo_QDataStream(&this, arg__1 is null ? null : arg__1.__nativeId); - } - - public final void readFrom(QDataStream arg__1) { - qtd_QRectF_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.__nativeId); - } - - public final QRectF opOr(ref QRectF r) const { - return qtd_QRectF_operator_or_QRectF(cast(void*)&this, &r); - } - - public final QRect toAlignedRect() const - { - return qtd_QRectF_toAlignedRect(cast(void*)&this); - } - -private: - qreal xp; - qreal yp; - qreal w; - qreal h; -} - - -// C wrappers -private extern(C) bool qtd_QRectF_contains_QPointF(void* __this_nativeId, - void* p0); -private extern(C) bool qtd_QRectF_contains_QRectF(void* __this_nativeId, - void* r0); -private extern(C) bool qtd_QRectF_intersects_QRectF(void* __this_nativeId, - void* r0); -private extern(C) QRectF qtd_QRectF_normalized(void* __this_nativeId); -private extern(C) QRectF qtd_QRectF_operator_and_QRectF(void* __this_nativeId, - void* r0); -private extern(C) void qtd_QRectF_writeTo_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) void qtd_QRectF_readFrom_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) QRectF qtd_QRectF_operator_or_QRectF(void* __this_nativeId, - void* r0); -private extern(C) QRect qtd_QRectF_toAlignedRect(void* __this_nativeId); \ No newline at end of file
--- a/qt/d2/qt/core/QSize.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,275 +0,0 @@ -module qt.core.QSize; - -public import qt.QGlobal; -public import qt.core.Qt; - - -public struct QSize -{ -/* ctors, reserved for D2 - public this() - { wd = ht = -1; } - - public this(int w, int h) - { wd = w; ht = h; } -*/ - - public static QSize opCall() { - QSize sz; - sz.wd = sz.ht = -1; - return sz; - } - - public this(int w, int h) { - wd = w; - ht = h; - } - - final bool isNull() - { return wd==0 && ht==0; } - - final bool isEmpty() - { return wd<1 || ht<1; } - - final bool isValid() - { return wd>=0 && ht>=0; } - - final int width() const - { return wd; } - - final int height() const - { return ht; } - - final void width(int w) - { wd = w; } - - final void height(int h) - { ht = h; } - - final void setWidth(int w) // for convenience - { wd = w; } - - final void setHeight(int h) // for convenience - { ht = h; } - - void transpose() { - int tmp = wd; - wd = ht; - ht = tmp; - } - - void scale(int w, int h, Qt.AspectRatioMode mode) { - scale(QSize(w, h), mode); - } - - void scale(ref QSize s, Qt.AspectRatioMode mode) { - __qtd_QSize_scale_QSize_AspectRatioMode(&this, &s, mode); - } - - QSize expandedTo(ref QSize otherSize) { - return QSize(qMax(wd,otherSize.wd), qMax(ht,otherSize.ht)); - } - - QSize boundedTo(ref QSize otherSize) { - return QSize(qMin(wd,otherSize.wd), qMin(ht,otherSize.ht)); - } -/* - public final void writeTo(QDataStream arg__1) { - __qtd_QSize_writeTo_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); - } - - public final void readFrom(QDataStream arg__1) { - __qtd_QSize_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); - } -*/ - QSize opAddAssign(ref QSize s) - { wd+=s.wd; ht+=s.ht; return this; } - - QSize opSubAssign(ref QSize s) - { wd-=s.wd; ht-=s.ht; return this; } - - QSize opMulAssign(qreal c) - { wd = qRound(wd*c); ht = qRound(ht*c); return this; } - - bool opEquals(ref QSize s) - { return wd == s.wd && ht == s.ht; } - - QSize opAdd(ref QSize s) - { return QSize(this.wd+s.wd, this.ht+s.ht); } - - QSize opSub(ref QSize s) - { return QSize(this.wd-s.wd, this.ht-s.ht); } - - QSize opMul(qreal c) - { return QSize(qRound(this.wd*c), qRound(this.ht*c)); } - - QSize opDivAssign(qreal c) { - assert(!qFuzzyCompare(c + 1, 1.)); - wd = qRound(wd/c); ht = qRound(ht/c); - return this; - } - - QSize opDiv(qreal c) { - assert(!qFuzzyCompare(c + 1, 1.)); - return QSize(qRound(this.wd/c), qRound(this.ht/c)); - } - -private: - int wd; - int ht; -} - - -public struct QSizeF -{ -/* ctors, reserved for D2 - this() - { wd = ht = -1.; } - - this(ref QSize sz) - { wd = sz.width(); ht = sz.height(); } - - this(qreal w, qreal h) - { wd = w; ht = h; } -*/ - public static QSizeF opCall() { - QSizeF sz; - sz.wd = sz.ht = -1.; - return sz; - } - - public static QSizeF opCall(ref QSizeF s) { - QSizeF sz; - sz.wd = s.width(); sz.ht = s.height(); - return sz; - } - - public static QSizeF opCall(qreal w, qreal h) { - QSizeF sz; - sz.wd = w; sz.ht = h; - return sz; - } - - bool isNull() - { return qIsNull(wd) && qIsNull(ht); } - - bool isEmpty() - { return wd <= 0. || ht <= 0.; } - - bool isValid() - { return wd >= 0. && ht >= 0.; } - - qreal width() - { return wd; } - - qreal height() - { return ht; } - - void width(qreal w) - { wd = w; } - - void height(qreal h) - { ht = h; } - - void setWidth(qreal w) - { wd = w; } - - void setHeight(qreal h) - { ht = h; } - - void scale(qreal w, qreal h, Qt.AspectRatioMode mode) - { scale(QSizeF(w, h), mode); } - - public final void scale(QSizeF s, Qt.AspectRatioMode mode) - { __qtd_QSizeF_scale_QSizeF_AspectRatioMode(&this, &s, mode); } - - void transpose() { - qreal tmp = wd; - wd = ht; - ht = tmp; - } - - QSizeF expandedTo(ref QSizeF otherSize) - { return QSizeF(qMax(wd,otherSize.wd), qMax(ht,otherSize.ht)); } - - QSizeF boundedTo(ref QSizeF otherSize) - { return QSizeF(qMin(wd,otherSize.wd), qMin(ht,otherSize.ht)); } - - QSize toSize() - { return QSize(qRound(wd), qRound(ht)); } -/* - public final void writeTo(QDataStream arg__1) { - __qtd_QSizeF_writeTo_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); - } - - public final void readFrom(QDataStream arg__1) { - __qtd_QSizeF_readFrom_QDataStream(&this, arg__1 is null ? null : arg__1.nativeId); -*/ - QSizeF opAddAssign(ref QSizeF s) - { wd += s.wd; ht += s.ht; return this; } - - QSizeF opSubAssign(ref QSizeF s) - { wd -= s.wd; ht -= s.ht; return this; } - - QSizeF opMulAssign(qreal c) - { wd *= c; ht *= c; return this; } - - bool opEquals(ref QSizeF s) - { return qFuzzyCompare(wd, s.wd) && qFuzzyCompare(ht, s.ht); } - - QSizeF opAdd(ref QSizeF s) - { return QSizeF(this.wd+s.wd, this.ht+s.ht); } - - QSizeF opSub(ref QSizeF s) - { return QSizeF(this.wd-s.wd, this.ht-s.ht); } - - QSizeF opMul(qreal c) - { return QSizeF(this.wd*c, this.ht*c); } - - QSizeF opDivAssign(qreal c) - { - assert(!qFuzzyCompare(c + 1, 1.)); - wd = wd/c; ht = ht/c; - return this; - } - - QSizeF opDiv(qreal c) - { - assert(!qFuzzyCompare(c + 1, 1.)); - return QSizeF(this.wd/c, this.ht/c); - } - -private: - qreal wd; - qreal ht; -} - - -extern (C) void qtd_append_array_QSize(QSize[]* arr, QSize arg) -{ - *arr ~= arg; -} - -extern (C) void qtd_append_array_QSizeF(QSizeF[]* arr, QSizeF arg) -{ - *arr ~= arg; -} - -// C wrappers -// QSize -private extern(C) void __qtd_QSize_scale_QSize_AspectRatioMode(void* __this_nativeId, - void* s0, - int mode1); -private extern(C) void __qtd_QSize_writeTo_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) void __qtd_QSize_readFrom_QDataStream(void* __this_nativeId, - void* arg__1); - -// QSizeF -private extern(C) void __qtd_QSizeF_writeTo_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) void __qtd_QSizeF_readFrom_QDataStream(void* __this_nativeId, - void* arg__1); -private extern(C) void __qtd_QSizeF_scale_QSizeF_AspectRatioMode(void* __this_nativeId, - void* s0, - int mode1); \ No newline at end of file
--- a/qt/d2/qt/core/QSizeF.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -module qt.core.QSizeF; -/* dummy */ - -public import qt.core.QSize;
--- a/qt/d2/qt/core/QVariant.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,709 +0,0 @@ -module qt.core.QVariant; - -public import qt.QGlobal; -private import qt.QtdObject; -private import qt.core.QMetaType; - -// automatic imports------------- -private import qt.core.QSizeF; -private import qt.core.QPoint; -private import qt.core.QRectF; -public import qt.core.Qt; -private import qt.core.QDateTime; -private import qt.core.QDataStream; -private import qt.core.QTime; -private import qt.core.QUrl; -private import qt.core.QRegExp; -private import qt.core.QBitArray; -private import qt.core.QLine; -private import qt.core.QByteArray; -private import qt.core.QSize; -private import qt.core.QDate; -private import qt.core.QPointF; -private import qt.core.QLineF; -private import qt.core.QRect; -private import qt.core.QLocale; - -import std.string; - - -public class QVariant : QtdObject -{ - enum Type { - Invalid = 0, - - Bool = 1, - Int = 2, - UInt = 3, - LongLong = 4, - ULongLong = 5, - Double = 6, - Char = 7, - Map = 8, - List = 9, - String = 10, - StringList = 11, - ByteArray = 12, - BitArray = 13, - Date = 14, - Time = 15, - DateTime = 16, - Url = 17, - Locale = 18, - Rect = 19, - RectF = 20, - Size = 21, - SizeF = 22, - Line = 23, - LineF = 24, - Point = 25, - PointF = 26, - RegExp = 27, - LastCoreType = RegExp, - - // value 62 is internally reserved - - Font = 64, - Pixmap = 65, - Brush = 66, - Color = 67, - Palette = 68, - Icon = 69, - Image = 70, - Polygon = 71, - Region = 72, - Bitmap = 73, - Cursor = 74, - SizePolicy = 75, - KeySequence = 76, - Pen = 77, - TextLength = 78, - TextFormat = 79, - Matrix = 80, - Transform = 81, - LastGuiType = Transform, - - UserType = 127, - - LastType = 0xffffffff // need this so that gcc >= 3.4 allocates 32 bits for Type - } - -// Functions - - private template getMetaId() - { - const char[] getMetaId = " - int i = qtd_MetatypeId(toStringz(name)); - if(i <= 0) - i = qRegisterMetaType!(T)(name);"; - } - - static public QVariant fromValue(T)(T obj) - { - QVariant var; - static if (is(T == class) || is(T == interface)) - { - string name = obj.classinfo.name; - mixin(getMetaId!()); - var = new QVariant(i, cast(void*)(obj)); - } - else static if (isDynamicArrayType!(T) || isStaticArrayType!(T) ) - { - string name = typeid(ElementTypeOfArray!(T)).toString ~ "[]"; - mixin(getMetaId!()); - auto darray = new DArrayToC; - darray.array = obj.dup; - var = new QVariant(i, cast(void*)(darray)); - } - else - { - string name = typeid(T).toString; - mixin(getMetaId!()); - auto data = new T; - *data = obj; - var = new QVariant(i, cast(void*)(data)); - } - return var; - } - - static public QVariant opCall(T)(T obj) - { - return fromValue(obj); - } - - public this() { - void* __qt_return_value = qtd_QVariant_QVariant(); - super(__qt_return_value); - } - - - public this(QDataStream s) { - void* __qt_return_value = qtd_QVariant_QVariant_QDataStream(s is null ? null : s.__nativeId); - super(__qt_return_value); - } - - - public this(Qt.GlobalColor color) { - void* __qt_return_value = qtd_QVariant_QVariant_GlobalColor(color); - super(__qt_return_value); - } - - - public this(bool b) { - void* __qt_return_value = qtd_QVariant_QVariant_bool(b); - super(__qt_return_value); - } - - - public this(QBitArray bitarray) { - void* __qt_return_value = qtd_QVariant_QVariant_QBitArray(bitarray is null ? null : bitarray.__nativeId); - super(__qt_return_value); - } - - - public this(QByteArray bytearray) { - void* __qt_return_value = qtd_QVariant_QVariant_QByteArray(bytearray is null ? null : bytearray.__nativeId); - super(__qt_return_value); - } - - - public this(QDate date) { - void* __qt_return_value = qtd_QVariant_QVariant_QDate(date is null ? null : date.__nativeId); - super(__qt_return_value); - } - - - public this(QDateTime datetime) { - void* __qt_return_value = qtd_QVariant_QVariant_QDateTime(datetime is null ? null : datetime.__nativeId); - super(__qt_return_value); - } - - - public this(string str) { - void* __qt_return_value = qtd_QVariant_QVariant_String(str); - super(__qt_return_value); - } - - - public this(QLine line) { - void* __qt_return_value = qtd_QVariant_QVariant_QLine(&line); - super(__qt_return_value); - } - - - public this(QLineF line) { - void* __qt_return_value = qtd_QVariant_QVariant_QLineF(&line); - super(__qt_return_value); - } - - - public this(QLocale locale) { - void* __qt_return_value = qtd_QVariant_QVariant_QLocale(locale is null ? null : locale.__nativeId); - super(__qt_return_value); - } - - - public this(QPoint pt) { - void* __qt_return_value = qtd_QVariant_QVariant_QPoint(&pt); - super(__qt_return_value); - } - - - public this(QPointF pt) { - void* __qt_return_value = qtd_QVariant_QVariant_QPointF(&pt); - super(__qt_return_value); - } - - - public this(QRect rect) { - void* __qt_return_value = qtd_QVariant_QVariant_QRect(&rect); - super(__qt_return_value); - } - - - public this(QRectF rect) { - void* __qt_return_value = qtd_QVariant_QVariant_QRectF(&rect); - super(__qt_return_value); - } - - - public this(QRegExp regExp) { - void* __qt_return_value = qtd_QVariant_QVariant_QRegExp(regExp is null ? null : regExp.__nativeId); - super(__qt_return_value); - } - - - public this(QSize size) { - void* __qt_return_value = qtd_QVariant_QVariant_QSize(&size); - super(__qt_return_value); - } - - - public this(QSizeF size) { - void* __qt_return_value = qtd_QVariant_QVariant_QSizeF(&size); - super(__qt_return_value); - } - - - public this(QTime time) { - void* __qt_return_value = qtd_QVariant_QVariant_QTime(time is null ? null : time.__nativeId); - super(__qt_return_value); - } - - - public this(QUrl url) { - void* __qt_return_value = qtd_QVariant_QVariant_QUrl(url is null ? null : url.__nativeId); - super(__qt_return_value); - } - - - public this(QVariant other) { - void* __qt_return_value = qtd_QVariant_QVariant_QVariant(other is null ? null : other.__nativeId); - super(__qt_return_value); - } - -/* - public this(char* str) { - void* __qt_return_value = qtd_QVariant_QVariant_nativepointerchar(str); - super(__qt_return_value); - } -*/ - - public this(double d) { - void* __qt_return_value = qtd_QVariant_QVariant_double(d); - super(__qt_return_value); - } - - - public this(int i) { - void* __qt_return_value = qtd_QVariant_QVariant_int(i); - super(__qt_return_value); - } - - - public this(int typeOrUserType, void* copy) { - void* __qt_return_value = qtd_QVariant_QVariant_int_nativepointervoid(typeOrUserType, copy); - super(__qt_return_value); - } - - - public this(long ll) { - void* __qt_return_value = qtd_QVariant_QVariant_long(ll); - super(__qt_return_value); - } - - - public this(uint ui) { - void* __qt_return_value = qtd_QVariant_QVariant_uint(ui); - super(__qt_return_value); - } - - - public this(ulong ull) { - void* __qt_return_value = qtd_QVariant_QVariant_ulong(ull); - super(__qt_return_value); - } - - private final bool canConvertImpl(string name) - { - int i = qtd_MetatypeId(toStringz(name)); - assert(i > 0); - return qtd_QVariant_canConvert(__nativeId, i); - } - - public final bool canConvert(Type)() { - static if ( is(Type == QBitArray) ) - return canConvertImpl("QBitArray"); - else static if ( is(Type == bool) ) - return canConvertImpl("bool"); - else static if ( is(Type == QByteArray) ) - return canConvertImpl("QByteArray"); - else static if ( is(Type == QDate) ) - return canConvertImpl("QDate"); - else static if ( is(Type == QDateTime) ) - return canConvertImpl("QDateTime"); - else static if ( is(Type == double) ) - return canConvertImpl("double"); - else static if ( is(Type == int) ) - return canConvertImpl("int"); - else static if ( is(Type == QLine) ) - return canConvertImpl("QLine"); - else static if ( is(Type == QLineF) ) - return canConvertImpl("QLineF"); - else static if ( is(Type == QLocale) ) - return canConvertImpl("QLocale"); - else static if ( is(Type == long) ) - return canConvertImpl("long"); - else static if ( is(Type == QPoint) ) - return canConvertImpl("QPoint"); - else static if ( is(Type == QPointF) ) - return canConvertImpl("QPointF"); - else static if ( is(Type == QRect) ) - return canConvertImpl("QRect"); - else static if ( is(Type == QRectF) ) - return canConvertImpl("QRectF"); - else static if ( is(Type == QRegExp) ) - return canConvertImpl("QRegExp"); - else static if ( is(Type == QSize) ) - return canConvertImpl("QSize"); - else static if ( is(Type == QSizeF) ) - return canConvertImpl("QSizeF"); - else static if ( is(Type == string) ) - return canConvertImpl("QString"); - else static if ( is(Type == QTime) ) - return canConvertImpl("QTime"); - else static if ( is(Type == uint) ) - return canConvertImpl("unsigned int"); // TODO: - else static if ( is(Type == ulong) ) - return canConvertImpl("unsigned long long"); // TODO: - else static if ( is(Type == QUrl) ) - return canConvertImpl("QUrl"); - else - { - static if( is( Type == class ) || is( Type == interface ) ) - { - Object object = cast(Object)qtd_QVariant_data(__nativeId); - if(object) - return cast(Type)(object) !is null; - return false; - } - else static if (isDynamicArrayType!(Type) || isStaticArrayType!(Type) ) - { - auto array = cast(DArrayToC*)qtd_QVariant_data(__nativeId); - return cast(Type)(array.array) !is null; - } - else - { - int i = qtd_MetatypeId(toStringz(typeid(Type).toString)); - return qtd_QVariant_canConvert(__nativeId, i); - } - } - } - - public final Type value(Type)() { - static if ( is(Type == QBitArray) ) - return toBitArra; - else static if ( is(Type == bool) ) - return toBool; - else static if ( is(Type == QByteArray) ) - return toByteArray; - else static if ( is(Type == QDate) ) - return toDate; - else static if ( is(Type == QDateTime) ) - return toDateTime; - else static if ( is(Type == double) ) - return toDouble; - else static if ( is(Type == int) ) - return toInt; - else static if ( is(Type == QLine) ) - return toLine; - else static if ( is(Type == QLineF) ) - return toLineF; - else static if ( is(Type == QLocale) ) - return toLocale; - else static if ( is(Type == long) ) - return toLongLong; - else static if ( is(Type == QPoint) ) - return toPoint; - else static if ( is(Type == QPointF) ) - return toPointF; - else static if ( is(Type == QRect) ) - return toRect; - else static if ( is(Type == QRectF) ) - return toRectF; - else static if ( is(Type == QRegExp) ) - return toRegExp; - else static if ( is(Type == QSize) ) - return toSize; - else static if ( is(Type == QSizeF) ) - return toSizeF; - else static if ( is(Type == string) ) - return toString; - else static if ( is(Type == QTime) ) - return toTime; - else static if ( is(Type == uint) ) - return toUInt; - else static if ( is(Type == ulong) ) - return toULongLong; - else static if ( is(Type == QUrl) ) - return toUrl; - else static if( is( Type == class ) || is( Type == interface ) ) - { - Object object = cast(Object)qtd_QVariant_data(__nativeId); - if(object) - return cast(Type)(object); - return null; - } - else static if (isDynamicArrayType!(Type) || isStaticArrayType!(Type) ) - { - auto array = cast(DArrayToC*)qtd_QVariant_data(__nativeId); - return cast(Type)(array.array); - } - else - { - return *cast(Type*)qtd_QVariant_data(__nativeId); - } - } - - public final void clear() { - qtd_QVariant_clear(__nativeId); - } - - protected final bool cmp(QVariant other) { - return qtd_QVariant_cmp_QVariant(__nativeId, other is null ? null : other.__nativeId); - } - - protected final void create(int type, void* copy) { - qtd_QVariant_create_int_nativepointervoid(__nativeId, type, copy); - } - - public final bool isNull() { - return qtd_QVariant_isNull(__nativeId); - } - - public final bool isValid() { - return qtd_QVariant_isValid(__nativeId); - } - - public final void load(QDataStream ds) { - qtd_QVariant_load_QDataStream(__nativeId, ds is null ? null : ds.__nativeId); - } - - public final void writeTo(QDataStream s) { - qtd_QVariant_writeTo_QDataStream(__nativeId, s is null ? null : s.__nativeId); - } - - public final QVariant operator_assign(QVariant other) { - void* __qt_return_value = qtd_QVariant_operator_assign_QVariant(__nativeId, other is null ? null : other.__nativeId); - return new QVariant(__qt_return_value, QtdObjectFlags.nativeOwnership); - } - - private final bool operator_equal(QVariant v) { - return qtd_QVariant_operator_equal_QVariant(__nativeId, v is null ? null : v.__nativeId); - } - - public final void readFrom(QDataStream s) { - qtd_QVariant_readFrom_QDataStream(__nativeId, s is null ? null : s.__nativeId); - } - - public final void save(QDataStream ds) { - qtd_QVariant_save_QDataStream(__nativeId, ds is null ? null : ds.__nativeId); - } - - public final QBitArray toBitArray() { - void* __qt_return_value = qtd_QVariant_toBitArray(__nativeId); - return new QBitArray(__qt_return_value); - } - - public final bool toBool() { - return qtd_QVariant_toBool(__nativeId); - } - - public final QByteArray toByteArray() { - void* __qt_return_value = qtd_QVariant_toByteArray(__nativeId); - return new QByteArray(__qt_return_value); - } - - public final QDate toDate() { - void* __qt_return_value = qtd_QVariant_toDate(__nativeId); - return new QDate(__qt_return_value); - } - - public final QDateTime toDateTime() { - void* __qt_return_value = qtd_QVariant_toDateTime(__nativeId); - return new QDateTime(__qt_return_value); - } - - public final double toDouble(bool* ok = null) { - return qtd_QVariant_toDouble_nativepointerbool(__nativeId, ok); - } - - public final int toInt(bool* ok = null) { - return qtd_QVariant_toInt_nativepointerbool(__nativeId, ok); - } - - public final QLine toLine() { - return qtd_QVariant_toLine(__nativeId); - } - - public final QLineF toLineF() { - return qtd_QVariant_toLineF(__nativeId); - } - - public final QLocale toLocale() { - void* __qt_return_value = qtd_QVariant_toLocale(__nativeId); - return new QLocale(__qt_return_value); - } - - public final long toLongLong(bool* ok = null) { - return qtd_QVariant_toLongLong_nativepointerbool(__nativeId, ok); - } - - public final QPoint toPoint() { - return qtd_QVariant_toPoint(__nativeId); - } - - public final QPointF toPointF() { - return qtd_QVariant_toPointF(__nativeId); - } - - public final QRect toRect() { - return qtd_QVariant_toRect(__nativeId); - } - - public final QRectF toRectF() { - return qtd_QVariant_toRectF(__nativeId); - } - - public final QRegExp toRegExp() { - void* __qt_return_value = qtd_QVariant_toRegExp(__nativeId); - return new QRegExp(__qt_return_value); - } - - public final QSize toSize() { - return qtd_QVariant_toSize(__nativeId); - } - - public final QSizeF toSizeF() { - return qtd_QVariant_toSizeF(__nativeId); - } - - public final string toString() { - string res; - qtd_QVariant_toString(__nativeId, &res); - return res; - } - - public final QTime toTime() { - void* __qt_return_value = qtd_QVariant_toTime(__nativeId); - return new QTime(__qt_return_value); - } - - public final uint toUInt(bool* ok = null) { - return qtd_QVariant_toUInt_nativepointerbool(__nativeId, ok); - } - - public final ulong toULongLong(bool* ok = null) { - return qtd_QVariant_toULongLong_nativepointerbool(__nativeId, ok); - } - - public final QUrl toUrl() { - void* __qt_return_value = qtd_QVariant_toUrl(__nativeId); - return new QUrl(__qt_return_value); - } - - public final char* typeName() { - return qtd_QVariant_typeName(__nativeId); - } - - public final Type type() { - return cast(Type)qtd_QVariant_type(__nativeId); - } - - public final int userType() { - return qtd_QVariant_userType(__nativeId); - } -// Field accessors - - public this(void* native_id, QtdObjectFlags flags = QtdObjectFlags.none) { - super(native_id, flags); - } - - protected override void __deleteNative() { - qtd_QVariant_destructor(__nativeId); - } - -// Injected code in class -} -extern (C) void qtd_QVariant_destructor(void *ptr); - - -// C wrappers -private extern(C) void* qtd_QVariant_QVariant(); -private extern(C) void* qtd_QVariant_QVariant_QDataStream(void* s0); -private extern(C) void* qtd_QVariant_QVariant_GlobalColor(int color0); -private extern(C) void* qtd_QVariant_QVariant_bool(bool b0); -private extern(C) void* qtd_QVariant_QVariant_QBitArray(void* bitarray0); -private extern(C) void* qtd_QVariant_QVariant_QByteArray(void* bytearray0); -private extern(C) void* qtd_QVariant_QVariant_QDate(void* date0); -private extern(C) void* qtd_QVariant_QVariant_QDateTime(void* datetime0); -private extern(C) void* qtd_QVariant_QVariant_String(string string0); -private extern(C) void* qtd_QVariant_QVariant_QLine(void* line0); -private extern(C) void* qtd_QVariant_QVariant_QLineF(void* line0); -private extern(C) void* qtd_QVariant_QVariant_QLocale(void* locale0); -private extern(C) void* qtd_QVariant_QVariant_QPoint(void* pt0); -private extern(C) void* qtd_QVariant_QVariant_QPointF(void* pt0); -private extern(C) void* qtd_QVariant_QVariant_QRect(void* rect0); -private extern(C) void* qtd_QVariant_QVariant_QRectF(void* rect0); -private extern(C) void* qtd_QVariant_QVariant_QRegExp(void* regExp0); -private extern(C) void* qtd_QVariant_QVariant_QSize(void* size0); -private extern(C) void* qtd_QVariant_QVariant_QSizeF(void* size0); -private extern(C) void* qtd_QVariant_QVariant_QTime(void* time0); -private extern(C) void* qtd_QVariant_QVariant_QUrl(void* url0); -private extern(C) void* qtd_QVariant_QVariant_QVariant(void* other0); -private extern(C) void* qtd_QVariant_QVariant_nativepointerchar(char* str0); -private extern(C) void* qtd_QVariant_QVariant_double(double d0); -private extern(C) void* qtd_QVariant_QVariant_int(int i0); -private extern(C) void* qtd_QVariant_QVariant_int_nativepointervoid(int typeOrUserType0, - void* copy1); -private extern(C) void* qtd_QVariant_QVariant_long(long ll0); -private extern(C) void* qtd_QVariant_QVariant_uint(uint ui0); -private extern(C) void* qtd_QVariant_QVariant_ulong(ulong ull0); -private extern(C) bool qtd_QVariant_canConvert(void* __this_nativeId, int); -private extern(C) void qtd_QVariant_clear(void* __this_nativeId); -private extern(C) bool qtd_QVariant_cmp_QVariant(void* __this_nativeId, - void* other0); -private extern(C) void qtd_QVariant_create_int_nativepointervoid(void* __this_nativeId, - int type0, - void* copy1); -private extern(C) bool qtd_QVariant_isNull(void* __this_nativeId); -private extern(C) bool qtd_QVariant_isValid(void* __this_nativeId); -private extern(C) void qtd_QVariant_load_QDataStream(void* __this_nativeId, - void* ds0); -private extern(C) void qtd_QVariant_writeTo_QDataStream(void* __this_nativeId, - void* s0); -private extern(C) void* qtd_QVariant_operator_assign_QVariant(void* __this_nativeId, - void* other0); -private extern(C) bool qtd_QVariant_operator_equal_QVariant(void* __this_nativeId, - void* v0); -private extern(C) void qtd_QVariant_readFrom_QDataStream(void* __this_nativeId, - void* s0); -private extern(C) void qtd_QVariant_save_QDataStream(void* __this_nativeId, - void* ds0); -private extern(C) void* qtd_QVariant_toBitArray(void* __this_nativeId); -private extern(C) bool qtd_QVariant_toBool(void* __this_nativeId); -private extern(C) void* qtd_QVariant_toByteArray(void* __this_nativeId); -private extern(C) void* qtd_QVariant_toDate(void* __this_nativeId); -private extern(C) void* qtd_QVariant_toDateTime(void* __this_nativeId); -private extern(C) double qtd_QVariant_toDouble_nativepointerbool(void* __this_nativeId, - bool* ok0); -private extern(C) int qtd_QVariant_toInt_nativepointerbool(void* __this_nativeId, - bool* ok0); -private extern(C) QLine qtd_QVariant_toLine(void* __this_nativeId); -private extern(C) QLineF qtd_QVariant_toLineF(void* __this_nativeId); -private extern(C) void* qtd_QVariant_toLocale(void* __this_nativeId); -private extern(C) long qtd_QVariant_toLongLong_nativepointerbool(void* __this_nativeId, - bool* ok0); -private extern(C) QPoint qtd_QVariant_toPoint(void* __this_nativeId); -private extern(C) QPointF qtd_QVariant_toPointF(void* __this_nativeId); -private extern(C) QRect qtd_QVariant_toRect(void* __this_nativeId); -private extern(C) QRectF qtd_QVariant_toRectF(void* __this_nativeId); -private extern(C) void* qtd_QVariant_toRegExp(void* __this_nativeId); -private extern(C) QSize qtd_QVariant_toSize(void* __this_nativeId); -private extern(C) QSizeF qtd_QVariant_toSizeF(void* __this_nativeId); -private extern(C) void qtd_QVariant_toString(void* __this_nativeId, - void* __java_return_value); -private extern(C) void* qtd_QVariant_toTime(void* __this_nativeId); -private extern(C) uint qtd_QVariant_toUInt_nativepointerbool(void* __this_nativeId, - bool* ok0); -private extern(C) ulong qtd_QVariant_toULongLong_nativepointerbool(void* __this_nativeId, - bool* ok0); -private extern(C) void* qtd_QVariant_toUrl(void* __this_nativeId); -private extern(C) char* qtd_QVariant_typeName(void* __this_nativeId); -private extern(C) int qtd_QVariant_type(void* __this_nativeId); -private extern(C) int qtd_QVariant_userType(void* __this_nativeId); -private extern(C) void *qtd_QVariant_data(void* __this_nativeId); - -// Just the private functions for abstract functions implemeneted in superclasses - -// Virtual Dispatch functions
--- a/qt/d2/qt/qtd/Str.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/** - * - * Copyright: Copyright QtD Team, 2008-2009 - * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a> - * - * Copyright QtD Team, 2008-2009 - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file boost-license-1.0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - * - */ - -module qt.qtd.Str; - -import std.utf : toUTF8; - -version(D_Version2) { -// private import core.sys.posix.stdio; - private import core.stdc.string; - - version = druntime; -} - -alias immutable(char)* stringz; -alias const(char)* cstringz; - -public static char** toStringzArray(string[] args) -{ - if ( args is null ) - { - return null; - } - char** argv = (new char*[args.length]).ptr; - int argc = 0; - foreach (string p; args) - { - argv[argc++] = cast(char*)(p.dup~'\0'); - } - argv[argc] = null; - - return argv; -} - -public string fromStringz(const (char) *s) -{ - return s ? s[0 .. strlen(s)].idup : cast(string)null; -} - - -extern(C) void qtd_toUtf8(wchar* arr, uint size, string* str) -{ - *str = toUTF8(arr[0..size]); -} - - -
--- a/qt/gui/UrlHandler.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -module qt.gui.UrlHandler; - -import qt.core.QUrl; - -alias void delegate(QUrl) UrlHandlerDg; - -package class UrlHandler : QObject { - public this(UrlHandlerDg dg) { - if (!init_flag_UrlHandler) - static_init_UrlHandler(); - - _dg = dg; - void* __qt_return_value = qtd_UrlHandler_UrlHandler_QObject(cast(void*) this, null); - this(__qt_return_value, true); - } - - void handleUrl(QUrl url) { - _dg(url); - } - - private UrlHandlerDg _dg; - - public this(void* native_id, bool gc_managed) { - super(native_id, gc_managed); - } - - - protected void __free_native_resources() { - qtd_UrlHandler_destructor(nativeId()); - } - - void __set_native_ownership(bool ownership_) { - __no_real_delete = ownership_; - } -} -extern (C) void qtd_UrlHandler_destructor(void *ptr); - -private extern(C) void* qtd_UrlHandler_UrlHandler_QObject(void *d_ptr, - void* parent0); - -private extern(C) void qtd_UrlHandler_handleUrl_QUrl_dispatch(void *d_entity, void* name1) -{ - auto d_object = cast(UrlHandler) d_entity; - scope name1_d_ref = new QUrl(name1, true); - d_object.handleUrl(name1_d_ref); -} - -private extern (C) void qtd_UrlHandler_initCallBacks(void* virtuals, void* qobj_del); - -private bool init_flag_UrlHandler = false; -void static_init_UrlHandler() { - init_flag_UrlHandler = true; - - void*[1] virt_arr; - virt_arr[0] = &qtd_UrlHandler_handleUrl_QUrl_dispatch; - -// void *qobj_del; -// qobj_del = &qtd_D_QWidget_delete; - qtd_UrlHandler_initCallBacks(virt_arr.ptr, null); -}
--- a/qt/opengl/gl.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -module qt.opengl.gl; - -public -{ - import qt.opengl.gltypes; - import qt.opengl.glfuncs; -}
--- a/qt/opengl/glfuncs.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,375 +0,0 @@ -module qt.opengl.glfuncs; - -private import qt.opengl.gltypes; - -/* -extern (C) -{ - void glEnable(GLenum); - void glEnableClientState(GLenum); - void glDisableClientState(GLenum); - void glClear(GLbitfield); - void glLoadIdentity(); - void glBegin(GLenum); - void glColor3f(GLfloat,GLfloat,GLfloat); - void glVertex3f(GLfloat,GLfloat,GLfloat); - void glEnd(); - void glViewport(GLint,GLint,GLsizei,GLsizei); - void glMatrixMode(GLenum); - void glGetDoublev(GLenum,GLdouble*); - void glGetFloatv(GLenum,GLfloat*); - void glGetIntegerv(GLenum,GLint*); - void glScalef(GLfloat,GLfloat,GLfloat); - void glDeleteLists(GLuint, GLsizei); - void glShadeModel(GLenum); - void glTranslated(GLdouble, GLdouble, GLdouble); - void glTranslatef(GLfloat, GLfloat, GLfloat); - void glRotated(GLdouble, GLdouble, GLdouble, GLdouble); - void glCallList(GLuint); - void glOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); - GLuint glGenLists (GLsizei range); -} -alias ptrdiff_t GLintptrARB; -alias ptrdiff_t GLsizeiptrARB; - -*/ - -extern (System) -{ - void glAccum (GLenum op, GLfloat value); - void glAlphaFunc (GLenum func, GLclampf ref_); - GLboolean glAreTexturesResident (GLsizei n, GLuint *textures, GLboolean *residences); - void glArrayElement (GLint i); - void glBegin (GLenum mode); - void glBindTexture (GLenum target, GLuint texture); - void glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, GLubyte *bitmap); - void glBlendFunc (GLenum sfactor, GLenum dfactor); - void glCallList (GLuint list); - void glCallLists (GLsizei n, GLenum type, GLvoid *lists); - void glClear (GLbitfield mask); - void glClearAccum (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); - void glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); - void glClearDepth (GLclampd depth); - void glClearIndex (GLfloat c); - void glClearStencil (GLint s); - void glClipPlane (GLenum plane, GLdouble *equation); - void glColor3b (GLbyte red, GLbyte green, GLbyte blue); - void glColor3bv (GLbyte *v); - void glColor3d (GLdouble red, GLdouble green, GLdouble blue); - void glColor3dv (GLdouble *v); - void glColor3f (GLfloat red, GLfloat green, GLfloat blue); - void glColor3fv (GLfloat *v); - void glColor3i (GLint red, GLint green, GLint blue); - void glColor3iv (GLint *v); - void glColor3s (GLshort red, GLshort green, GLshort blue); - void glColor3sv (GLshort *v); - void glColor3ub (GLubyte red, GLubyte green, GLubyte blue); - void glColor3ubv (GLubyte *v); - void glColor3ui (GLuint red, GLuint green, GLuint blue); - void glColor3uiv (GLuint *v); - void glColor3us (GLushort red, GLushort green, GLushort blue); - void glColor3usv (GLushort *v); - void glColor4b (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); - void glColor4bv (GLbyte *v); - void glColor4d (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); - void glColor4dv (GLdouble *v); - void glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); - void glColor4fv (GLfloat *v); - void glColor4i (GLint red, GLint green, GLint blue, GLint alpha); - void glColor4iv (GLint *v); - void glColor4s (GLshort red, GLshort green, GLshort blue, GLshort alpha); - void glColor4sv (GLshort *v); - void glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); - void glColor4ubv (GLubyte *v); - void glColor4ui (GLuint red, GLuint green, GLuint blue, GLuint alpha); - void glColor4uiv (GLuint *v); - void glColor4us (GLushort red, GLushort green, GLushort blue, GLushort alpha); - void glColor4usv (GLushort *v); - void glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); - void glColorMaterial (GLenum face, GLenum mode); - void glColorPointer (GLint size, GLenum type, GLsizei stride, GLvoid *pointer); - void glCopyPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); - void glCopyTexImage1D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border); - void glCopyTexImage2D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); - void glCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); - void glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); - void glCullFace (GLenum mode); - void glDeleteLists (GLuint list, GLsizei range); - void glDeleteTextures (GLsizei n, GLuint *textures); - void glDepthFunc (GLenum func); - void glDepthMask (GLboolean flag); - void glDepthRange (GLclampd zNear, GLclampd zFar); - void glDisable (GLenum cap); - void glDisableClientState (GLenum array); - void glDrawArrays (GLenum mode, GLint first, GLsizei count); - void glDrawBuffer (GLenum mode); - void glDrawElements (GLenum mode, GLsizei count, GLenum type, GLvoid *indices); - void glDrawPixels (GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); - void glEdgeFlag (GLboolean flag); - void glEdgeFlagPointer (GLsizei stride, GLvoid *pointer); - void glEdgeFlagv (GLboolean *flag); - void glEnable (GLenum cap); - void glEnableClientState (GLenum array); - void glEnd (); - void glEndList (); - void glEvalCoord1d (GLdouble u); - void glEvalCoord1dv (GLdouble *u); - void glEvalCoord1f (GLfloat u); - void glEvalCoord1fv (GLfloat *u); - void glEvalCoord2d (GLdouble u, GLdouble v); - void glEvalCoord2dv (GLdouble *u); - void glEvalCoord2f (GLfloat u, GLfloat v); - void glEvalCoord2fv (GLfloat *u); - void glEvalMesh1 (GLenum mode, GLint i1, GLint i2); - void glEvalMesh2 (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); - void glEvalPoint1 (GLint i); - void glEvalPoint2 (GLint i, GLint j); - void glFeedbackBuffer (GLsizei size, GLenum type, GLfloat *buffer); - void glFinish (); - void glFlush (); - void glFogf (GLenum pname, GLfloat param); - void glFogfv (GLenum pname, GLfloat *params); - void glFogi (GLenum pname, GLint param); - void glFogiv (GLenum pname, GLint *params); - void glFrontFace (GLenum mode); - void glFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); - GLuint glGenLists (GLsizei range); - void glGenTextures (GLsizei n, GLuint *textures); - void glGetBooleanv (GLenum pname, GLboolean *params); - void glGetClipPlane (GLenum plane, GLdouble *equation); - void glGetDoublev (GLenum pname, GLdouble *params); - GLenum glGetError (); - void glGetFloatv (GLenum pname, GLfloat *params); - void glGetIntegerv (GLenum pname, GLint *params); - void glGetLightfv (GLenum light, GLenum pname, GLfloat *params); - void glGetLightiv (GLenum light, GLenum pname, GLint *params); - void glGetMapdv (GLenum target, GLenum query, GLdouble *v); - void glGetMapfv (GLenum target, GLenum query, GLfloat *v); - void glGetMapiv (GLenum target, GLenum query, GLint *v); - void glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params); - void glGetMaterialiv (GLenum face, GLenum pname, GLint *params); - void glGetPixelMapfv (GLenum map, GLfloat *values); - void glGetPixelMapuiv (GLenum map, GLuint *values); - void glGetPixelMapusv (GLenum map, GLushort *values); - void glGetPointerv (GLenum pname, GLvoid* *params); - void glGetPolygonStipple (GLubyte *mask); - GLubyte * glGetString (GLenum name); - void glGetTexEnvfv (GLenum target, GLenum pname, GLfloat *params); - void glGetTexEnviv (GLenum target, GLenum pname, GLint *params); - void glGetTexGendv (GLenum coord, GLenum pname, GLdouble *params); - void glGetTexGenfv (GLenum coord, GLenum pname, GLfloat *params); - void glGetTexGeniv (GLenum coord, GLenum pname, GLint *params); - void glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); - void glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params); - void glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params); - void glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); - void glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); - void glHint (GLenum target, GLenum mode); - void glIndexMask (GLuint mask); - void glIndexPointer (GLenum type, GLsizei stride, GLvoid *pointer); - void glIndexd (GLdouble c); - void glIndexdv (GLdouble *c); - void glIndexf (GLfloat c); - void glIndexfv (GLfloat *c); - void glIndexi (GLint c); - void glIndexiv (GLint *c); - void glIndexs (GLshort c); - void glIndexsv (GLshort *c); - void glIndexub (GLubyte c); - void glIndexubv (GLubyte *c); - void glInitNames (); - void glInterleavedArrays (GLenum format, GLsizei stride, GLvoid *pointer); - GLboolean glIsEnabled (GLenum cap); - GLboolean glIsList (GLuint list); - GLboolean glIsTexture (GLuint texture); - void glLightModelf (GLenum pname, GLfloat param); - void glLightModelfv (GLenum pname, GLfloat *params); - void glLightModeli (GLenum pname, GLint param); - void glLightModeliv (GLenum pname, GLint *params); - void glLightf (GLenum light, GLenum pname, GLfloat param); - void glLightfv (GLenum light, GLenum pname, GLfloat *params); - void glLighti (GLenum light, GLenum pname, GLint param); - void glLightiv (GLenum light, GLenum pname, GLint *params); - void glLineStipple (GLint factor, GLushort pattern); - void glLineWidth (GLfloat width); - void glListBase (GLuint base); - void glLoadIdentity (); - void glLoadMatrixd (GLdouble *m); - void glLoadMatrixf (GLfloat *m); - void glLoadName (GLuint name); - void glLogicOp (GLenum opcode); - void glMap1d (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, GLdouble *points); - void glMap1f (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, GLfloat *points); - void glMap2d (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble *points); - void glMap2f (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat *points); - void glMapGrid1d (GLint un, GLdouble u1, GLdouble u2); - void glMapGrid1f (GLint un, GLfloat u1, GLfloat u2); - void glMapGrid2d (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); - void glMapGrid2f (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); - void glMaterialf (GLenum face, GLenum pname, GLfloat param); - void glMaterialfv (GLenum face, GLenum pname, GLfloat *params); - void glMateriali (GLenum face, GLenum pname, GLint param); - void glMaterialiv (GLenum face, GLenum pname, GLint *params); - void glMatrixMode (GLenum mode); - void glMultMatrixd (GLdouble *m); - void glMultMatrixf (GLfloat *m); - void glNewList (GLuint list, GLenum mode); - void glNormal3b (GLbyte nx, GLbyte ny, GLbyte nz); - void glNormal3bv (GLbyte *v); - void glNormal3d (GLdouble nx, GLdouble ny, GLdouble nz); - void glNormal3dv (GLdouble *v); - void glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz); - void glNormal3fv (GLfloat *v); - void glNormal3i (GLint nx, GLint ny, GLint nz); - void glNormal3iv (GLint *v); - void glNormal3s (GLshort nx, GLshort ny, GLshort nz); - void glNormal3sv (GLshort *v); - void glNormalPointer (GLenum type, GLsizei stride, GLvoid *pointer); - void glOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); - void glPassThrough (GLfloat token); - void glPixelMapfv (GLenum map, GLsizei mapsize, GLfloat *values); - void glPixelMapuiv (GLenum map, GLsizei mapsize, GLuint *values); - void glPixelMapusv (GLenum map, GLsizei mapsize, GLushort *values); - void glPixelStoref (GLenum pname, GLfloat param); - void glPixelStorei (GLenum pname, GLint param); - void glPixelTransferf (GLenum pname, GLfloat param); - void glPixelTransferi (GLenum pname, GLint param); - void glPixelZoom (GLfloat xfactor, GLfloat yfactor); - void glPointSize (GLfloat size); - void glPolygonMode (GLenum face, GLenum mode); - void glPolygonOffset (GLfloat factor, GLfloat units); - void glPolygonStipple (GLubyte *mask); - void glPopAttrib (); - void glPopClientAttrib (); - void glPopMatrix (); - void glPopName (); - void glPrioritizeTextures (GLsizei n, GLuint *textures, GLclampf *priorities); - void glPushAttrib (GLbitfield mask); - void glPushClientAttrib (GLbitfield mask); - void glPushMatrix (); - void glPushName (GLuint name); - void glRasterPos2d (GLdouble x, GLdouble y); - void glRasterPos2dv (GLdouble *v); - void glRasterPos2f (GLfloat x, GLfloat y); - void glRasterPos2fv (GLfloat *v); - void glRasterPos2i (GLint x, GLint y); - void glRasterPos2iv (GLint *v); - void glRasterPos2s (GLshort x, GLshort y); - void glRasterPos2sv (GLshort *v); - void glRasterPos3d (GLdouble x, GLdouble y, GLdouble z); - void glRasterPos3dv (GLdouble *v); - void glRasterPos3f (GLfloat x, GLfloat y, GLfloat z); - void glRasterPos3fv (GLfloat *v); - void glRasterPos3i (GLint x, GLint y, GLint z); - void glRasterPos3iv (GLint *v); - void glRasterPos3s (GLshort x, GLshort y, GLshort z); - void glRasterPos3sv (GLshort *v); - void glRasterPos4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w); - void glRasterPos4dv (GLdouble *v); - void glRasterPos4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void glRasterPos4fv (GLfloat *v); - void glRasterPos4i (GLint x, GLint y, GLint z, GLint w); - void glRasterPos4iv (GLint *v); - void glRasterPos4s (GLshort x, GLshort y, GLshort z, GLshort w); - void glRasterPos4sv (GLshort *v); - void glReadBuffer (GLenum mode); - void glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); - void glRectd (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); - void glRectdv (GLdouble *v1, GLdouble *v2); - void glRectf (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); - void glRectfv (GLfloat *v1, GLfloat *v2); - void glRecti (GLint x1, GLint y1, GLint x2, GLint y2); - void glRectiv (GLint *v1, GLint *v2); - void glRects (GLshort x1, GLshort y1, GLshort x2, GLshort y2); - void glRectsv (GLshort *v1, GLshort *v2); - GLint glRenderMode (GLenum mode); - void glRotated (GLdouble angle, GLdouble x, GLdouble y, GLdouble z); - void glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z); - void glScaled (GLdouble x, GLdouble y, GLdouble z); - void glScalef (GLfloat x, GLfloat y, GLfloat z); - void glScissor (GLint x, GLint y, GLsizei width, GLsizei height); - void glSelectBuffer (GLsizei size, GLuint *buffer); - void glShadeModel (GLenum mode); - void glStencilFunc (GLenum func, GLint ref_, GLuint mask); - void glStencilMask (GLuint mask); - void glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); - void glTexCoord1d (GLdouble s); - void glTexCoord1dv (GLdouble *v); - void glTexCoord1f (GLfloat s); - void glTexCoord1fv (GLfloat *v); - void glTexCoord1i (GLint s); - void glTexCoord1iv (GLint *v); - void glTexCoord1s (GLshort s); - void glTexCoord1sv (GLshort *v); - void glTexCoord2d (GLdouble s, GLdouble t); - void glTexCoord2dv (GLdouble *v); - void glTexCoord2f (GLfloat s, GLfloat t); - void glTexCoord2fv (GLfloat *v); - void glTexCoord2i (GLint s, GLint t); - void glTexCoord2iv (GLint *v); - void glTexCoord2s (GLshort s, GLshort t); - void glTexCoord2sv (GLshort *v); - void glTexCoord3d (GLdouble s, GLdouble t, GLdouble r); - void glTexCoord3dv (GLdouble *v); - void glTexCoord3f (GLfloat s, GLfloat t, GLfloat r); - void glTexCoord3fv (GLfloat *v); - void glTexCoord3i (GLint s, GLint t, GLint r); - void glTexCoord3iv (GLint *v); - void glTexCoord3s (GLshort s, GLshort t, GLshort r); - void glTexCoord3sv (GLshort *v); - void glTexCoord4d (GLdouble s, GLdouble t, GLdouble r, GLdouble q); - void glTexCoord4dv (GLdouble *v); - void glTexCoord4f (GLfloat s, GLfloat t, GLfloat r, GLfloat q); - void glTexCoord4fv (GLfloat *v); - void glTexCoord4i (GLint s, GLint t, GLint r, GLint q); - void glTexCoord4iv (GLint *v); - void glTexCoord4s (GLshort s, GLshort t, GLshort r, GLshort q); - void glTexCoord4sv (GLshort *v); - void glTexCoordPointer (GLint size, GLenum type, GLsizei stride, GLvoid *pointer); - void glTexEnvf (GLenum target, GLenum pname, GLfloat param); - void glTexEnvfv (GLenum target, GLenum pname, GLfloat *params); - void glTexEnvi (GLenum target, GLenum pname, GLint param); - void glTexEnviv (GLenum target, GLenum pname, GLint *params); - void glTexGend (GLenum coord, GLenum pname, GLdouble param); - void glTexGendv (GLenum coord, GLenum pname, GLdouble *params); - void glTexGenf (GLenum coord, GLenum pname, GLfloat param); - void glTexGenfv (GLenum coord, GLenum pname, GLfloat *params); - void glTexGeni (GLenum coord, GLenum pname, GLint param); - void glTexGeniv (GLenum coord, GLenum pname, GLint *params); - void glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, GLvoid *pixels); - void glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLvoid *pixels); - void glTexParameterf (GLenum target, GLenum pname, GLfloat param); - void glTexParameterfv (GLenum target, GLenum pname, GLfloat *params); - void glTexParameteri (GLenum target, GLenum pname, GLint param); - void glTexParameteriv (GLenum target, GLenum pname, GLint *params); - void glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, GLvoid *pixels); - void glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); - void glTranslated (GLdouble x, GLdouble y, GLdouble z); - void glTranslatef (GLfloat x, GLfloat y, GLfloat z); - void glVertex2d (GLdouble x, GLdouble y); - void glVertex2dv (GLdouble *v); - void glVertex2f (GLfloat x, GLfloat y); - void glVertex2fv (GLfloat *v); - void glVertex2i (GLint x, GLint y); - void glVertex2iv (GLint *v); - void glVertex2s (GLshort x, GLshort y); - void glVertex2sv (GLshort *v); - void glVertex3d (GLdouble x, GLdouble y, GLdouble z); - void glVertex3dv (GLdouble *v); - void glVertex3f (GLfloat x, GLfloat y, GLfloat z); - void glVertex3fv (GLfloat *v); - void glVertex3i (GLint x, GLint y, GLint z); - void glVertex3iv (GLint *v); - void glVertex3s (GLshort x, GLshort y, GLshort z); - void glVertex3sv (GLshort *v); - void glVertex4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w); - void glVertex4dv (GLdouble *v); - void glVertex4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w); - void glVertex4fv (GLfloat *v); - void glVertex4i (GLint x, GLint y, GLint z, GLint w); - void glVertex4iv (GLint *v); - void glVertex4s (GLshort x, GLshort y, GLshort z, GLshort w); - void glVertex4sv (GLshort *v); - void glVertexPointer (GLint size, GLenum type, GLsizei stride, GLvoid *pointer); - void glViewport (GLint x, GLint y, GLsizei width, GLsizei height); -} \ No newline at end of file
--- a/qt/opengl/gltypes.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,631 +0,0 @@ -module qt.opengl.gltypes; - -alias uint GLenum; -alias ubyte GLboolean; -alias uint GLbitfield; -alias void GLvoid; -alias byte GLbyte; -alias short GLshort; -alias int GLint; -alias ubyte GLubyte; -alias ushort GLushort; -alias uint GLuint; -alias int GLsizei; -alias float GLfloat; -alias float GLclampf; -alias double GLdouble; -alias double GLclampd; -alias char GLchar; -alias ptrdiff_t GLintptr; -alias ptrdiff_t GLsizeiptr; - -// Boolean values -enum : GLboolean -{ - GL_FALSE = 0x0, - GL_TRUE = 0x1, -} - -enum : GLenum -{ - // Data types - GL_BYTE = 0x1400, - GL_UNSIGNED_BYTE = 0x1401, - GL_SHORT = 0x1402, - GL_UNSIGNED_SHORT = 0x1403, - GL_INT = 0x1404, - GL_UNSIGNED_INT = 0x1405, - GL_FLOAT = 0x1406, - GL_DOUBLE = 0x140A, - GL_2_BYTES = 0x1407, - GL_3_BYTES = 0x1408, - GL_4_BYTES = 0x1409, - - // Primitives - GL_POINTS = 0x0000, - GL_LINES = 0x0001, - GL_LINE_LOOP = 0x0002, - GL_LINE_STRIP = 0x0003, - GL_TRIANGLES = 0x0004, - GL_TRIANGLE_STRIP = 0x0005, - GL_TRIANGLE_FAN = 0x0006, - GL_QUADS = 0x0007, - GL_QUAD_STRIP = 0x0008, - GL_POLYGON = 0x0009, - - // Vertex Arrays - GL_VERTEX_ARRAY = 0x8074, - GL_NORMAL_ARRAY = 0x8075, - GL_COLOR_ARRAY = 0x8076, - GL_INDEX_ARRAY = 0x8077, - GL_TEXTURE_COORD_ARRAY = 0x8078, - GL_EDGE_FLAG_ARRAY = 0x8079, - GL_VERTEX_ARRAY_SIZE = 0x807A, - GL_VERTEX_ARRAY_TYPE = 0x807B, - GL_VERTEX_ARRAY_STRIDE = 0x807C, - GL_NORMAL_ARRAY_TYPE = 0x807E, - GL_NORMAL_ARRAY_STRIDE = 0x807F, - GL_COLOR_ARRAY_SIZE = 0x8081, - GL_COLOR_ARRAY_TYPE = 0x8082, - GL_COLOR_ARRAY_STRIDE = 0x8083, - GL_INDEX_ARRAY_TYPE = 0x8085, - GL_INDEX_ARRAY_STRIDE = 0x8086, - GL_TEXTURE_COORD_ARRAY_SIZE = 0x8088, - GL_TEXTURE_COORD_ARRAY_TYPE = 0x8089, - GL_TEXTURE_COORD_ARRAY_STRIDE = 0x808A, - GL_EDGE_FLAG_ARRAY_STRIDE = 0x808C, - GL_VERTEX_ARRAY_POINTER = 0x808E, - GL_NORMAL_ARRAY_POINTER = 0x808F, - GL_COLOR_ARRAY_POINTER = 0x8090, - GL_INDEX_ARRAY_POINTER = 0x8091, - GL_TEXTURE_COORD_ARRAY_POINTER = 0x8092, - GL_EDGE_FLAG_ARRAY_POINTER = 0x8093, - GL_V2F = 0x2A20, - GL_V3F = 0x2A21, - GL_C4UB_V2F = 0x2A22, - GL_C4UB_V3F = 0x2A23, - GL_C3F_V3F = 0x2A24, - GL_N3F_V3F = 0x2A25, - GL_C4F_N3F_V3F = 0x2A26, - GL_T2F_V3F = 0x2A27, - GL_T4F_V4F = 0x2A28, - GL_T2F_C4UB_V3F = 0x2A29, - GL_T2F_C3F_V3F = 0x2A2A, - GL_T2F_N3F_V3F = 0x2A2B, - GL_T2F_C4F_N3F_V3F = 0x2A2C, - GL_T4F_C4F_N3F_V4F = 0x2A2D, - - // Matrix Mode - GL_MATRIX_MODE = 0x0BA0, - GL_MODELVIEW = 0x1700, - GL_PROJECTION = 0x1701, - GL_TEXTURE = 0x1702, - - // Points - GL_POINT_SMOOTH = 0x0B10, - GL_POINT_SIZE = 0x0B11, - GL_POINT_SIZE_GRANULARITY = 0x0B13, - GL_POINT_SIZE_RANGE = 0x0B12, - - // Lines - GL_LINE_SMOOTH = 0x0B20, - GL_LINE_STIPPLE = 0x0B24, - GL_LINE_STIPPLE_PATTERN = 0x0B25, - GL_LINE_STIPPLE_REPEAT = 0x0B26, - GL_LINE_WIDTH = 0x0B21, - GL_LINE_WIDTH_GRANULARITY = 0x0B23, - GL_LINE_WIDTH_RANGE = 0x0B22, - - // Polygons - GL_POINT = 0x1B00, - GL_LINE = 0x1B01, - GL_FILL = 0x1B02, - GL_CW = 0x0900, - GL_CCW = 0x0901, - GL_FRONT = 0x0404, - GL_BACK = 0x0405, - GL_POLYGON_MODE = 0x0B40, - GL_POLYGON_SMOOTH = 0x0B41, - GL_POLYGON_STIPPLE = 0x0B42, - GL_EDGE_FLAG = 0x0B43, - GL_CULL_FACE = 0x0B44, - GL_CULL_FACE_MODE = 0x0B45, - GL_FRONT_FACE = 0x0B46, - GL_POLYGON_OFFSET_FACTOR = 0x8038, - GL_POLYGON_OFFSET_UNITS = 0x2A00, - GL_POLYGON_OFFSET_POINT = 0x2A01, - GL_POLYGON_OFFSET_LINE = 0x2A02, - GL_POLYGON_OFFSET_FILL = 0x8037, - - // Display Lists - GL_COMPILE = 0x1300, - GL_COMPILE_AND_EXECUTE = 0x1301, - GL_LIST_BASE = 0x0B32, - GL_LIST_INDEX = 0x0B33, - GL_LIST_MODE = 0x0B30, - - // Depth buffer - GL_NEVER = 0x0200, - GL_LESS = 0x0201, - GL_EQUAL = 0x0202, - GL_LEQUAL = 0x0203, - GL_GREATER = 0x0204, - GL_NOTEQUAL = 0x0205, - GL_GEQUAL = 0x0206, - GL_ALWAYS = 0x0207, - GL_DEPTH_TEST = 0x0B71, - GL_DEPTH_BITS = 0x0D56, - GL_DEPTH_CLEAR_VALUE = 0x0B73, - GL_DEPTH_FUNC = 0x0B74, - GL_DEPTH_RANGE = 0x0B70, - GL_DEPTH_WRITEMASK = 0x0B72, - GL_DEPTH_COMPONENT = 0x1902, - - // Lighting - GL_LIGHTING = 0x0B50, - GL_LIGHT0 = 0x4000, - GL_LIGHT1 = 0x4001, - GL_LIGHT2 = 0x4002, - GL_LIGHT3 = 0x4003, - GL_LIGHT4 = 0x4004, - GL_LIGHT5 = 0x4005, - GL_LIGHT6 = 0x4006, - GL_LIGHT7 = 0x4007, - GL_SPOT_EXPONENT = 0x1205, - GL_SPOT_CUTOFF = 0x1206, - GL_CONSTANT_ATTENUATION = 0x1207, - GL_LINEAR_ATTENUATION = 0x1208, - GL_QUADRATIC_ATTENUATION = 0x1209, - GL_AMBIENT = 0x1200, - GL_DIFFUSE = 0x1201, - GL_SPECULAR = 0x1202, - GL_SHININESS = 0x1601, - GL_EMISSION = 0x1600, - GL_POSITION = 0x1203, - GL_SPOT_DIRECTION = 0x1204, - GL_AMBIENT_AND_DIFFUSE = 0x1602, - GL_COLOR_INDEXES = 0x1603, - GL_LIGHT_MODEL_TWO_SIDE = 0x0B52, - GL_LIGHT_MODEL_LOCAL_VIEWER = 0x0B51, - GL_LIGHT_MODEL_AMBIENT = 0x0B53, - GL_FRONT_AND_BACK = 0x0408, - GL_SHADE_MODEL = 0x0B54, - GL_FLAT = 0x1D00, - GL_SMOOTH = 0x1D01, - GL_COLOR_MATERIAL = 0x0B57, - GL_COLOR_MATERIAL_FACE = 0x0B55, - GL_COLOR_MATERIAL_PARAMETER = 0x0B56, - GL_NORMALIZE = 0x0BA1, - - // User clipping planes - GL_CLIP_PLANE0 = 0x3000, - GL_CLIP_PLANE1 = 0x3001, - GL_CLIP_PLANE2 = 0x3002, - GL_CLIP_PLANE3 = 0x3003, - GL_CLIP_PLANE4 = 0x3004, - GL_CLIP_PLANE5 = 0x3005, - - // Accumulation buffer - GL_ACCUM_RED_BITS = 0x0D58, - GL_ACCUM_GREEN_BITS = 0x0D59, - GL_ACCUM_BLUE_BITS = 0x0D5A, - GL_ACCUM_ALPHA_BITS = 0x0D5B, - GL_ACCUM_CLEAR_VALUE = 0x0B80, - GL_ACCUM = 0x0100, - GL_ADD = 0x0104, - GL_LOAD = 0x0101, - GL_MULT = 0x0103, - GL_RETURN = 0x0102, - - // Alpha testing - GL_ALPHA_TEST = 0x0BC0, - GL_ALPHA_TEST_REF = 0x0BC2, - GL_ALPHA_TEST_FUNC = 0x0BC1, - - // Blending - GL_BLEND = 0x0BE2, - GL_BLEND_SRC = 0x0BE1, - GL_BLEND_DST = 0x0BE0, - GL_ZERO = 0x0, - GL_ONE = 0x1, - GL_SRC_COLOR = 0x0300, - GL_ONE_MINUS_SRC_COLOR = 0x0301, - GL_SRC_ALPHA = 0x0302, - GL_ONE_MINUS_SRC_ALPHA = 0x0303, - GL_DST_ALPHA = 0x0304, - GL_ONE_MINUS_DST_ALPHA = 0x0305, - GL_DST_COLOR = 0x0306, - GL_ONE_MINUS_DST_COLOR = 0x0307, - GL_SRC_ALPHA_SATURATE = 0x0308, - - // Render Mode - GL_FEEDBACK = 0x1C01, - GL_RENDER = 0x1C00, - GL_SELECT = 0x1C02, - - // Feedback - GL_2D = 0x0600, - GL_3D = 0x0601, - GL_3D_COLOR = 0x0602, - GL_3D_COLOR_TEXTURE = 0x0603, - GL_4D_COLOR_TEXTURE = 0x0604, - GL_POINT_TOKEN = 0x0701, - GL_LINE_TOKEN = 0x0702, - GL_LINE_RESET_TOKEN = 0x0707, - GL_POLYGON_TOKEN = 0x0703, - GL_BITMAP_TOKEN = 0x0704, - GL_DRAW_PIXEL_TOKEN = 0x0705, - GL_COPY_PIXEL_TOKEN = 0x0706, - GL_PASS_THROUGH_TOKEN = 0x0700, - GL_FEEDBACK_BUFFER_POINTER = 0x0DF0, - GL_FEEDBACK_BUFFER_SIZE = 0x0DF1, - GL_FEEDBACK_BUFFER_TYPE = 0x0DF2, - - // Selection - GL_SELECTION_BUFFER_POINTER = 0x0DF3, - GL_SELECTION_BUFFER_SIZE = 0x0DF4, - - // Fog - GL_FOG = 0x0B60, - GL_FOG_MODE = 0x0B65, - GL_FOG_DENSITY = 0x0B62, - GL_FOG_COLOR = 0x0B66, - GL_FOG_INDEX = 0x0B61, - GL_FOG_START = 0x0B63, - GL_FOG_END = 0x0B64, - GL_LINEAR = 0x2601, - GL_EXP = 0x0800, - GL_EXP2 = 0x0801, - - // Logic Ops - GL_LOGIC_OP = 0x0BF1, - GL_INDEX_LOGIC_OP = 0x0BF1, - GL_COLOR_LOGIC_OP = 0x0BF2, - GL_LOGIC_OP_MODE = 0x0BF0, - GL_CLEAR = 0x1500, - GL_SET = 0x150F, - GL_COPY = 0x1503, - GL_COPY_INVERTED = 0x150C, - GL_NOOP = 0x1505, - GL_INVERT = 0x150A, - GL_AND = 0x1501, - GL_NAND = 0x150E, - GL_OR = 0x1507, - GL_NOR = 0x1508, - GL_XOR = 0x1506, - GL_EQUIV = 0x1509, - GL_AND_REVERSE = 0x1502, - GL_AND_INVERTED = 0x1504, - GL_OR_REVERSE = 0x150B, - GL_OR_INVERTED = 0x150D, - - // Stencil - GL_STENCIL_TEST = 0x0B90, - GL_STENCIL_WRITEMASK = 0x0B98, - GL_STENCIL_BITS = 0x0D57, - GL_STENCIL_FUNC = 0x0B92, - GL_STENCIL_VALUE_MASK = 0x0B93, - GL_STENCIL_REF = 0x0B97, - GL_STENCIL_FAIL = 0x0B94, - GL_STENCIL_PASS_DEPTH_PASS = 0x0B96, - GL_STENCIL_PASS_DEPTH_FAIL = 0x0B95, - GL_STENCIL_CLEAR_VALUE = 0x0B91, - GL_STENCIL_INDEX = 0x1901, - GL_KEEP = 0x1E00, - GL_REPLACE = 0x1E01, - GL_INCR = 0x1E02, - GL_DECR = 0x1E03, - - // Buffers, Pixel Drawing/Reading - GL_NONE = 0x0, - GL_LEFT = 0x0406, - GL_RIGHT = 0x0407, - GL_FRONT_LEFT = 0x0400, - GL_FRONT_RIGHT = 0x0401, - GL_BACK_LEFT = 0x0402, - GL_BACK_RIGHT = 0x0403, - GL_AUX0 = 0x0409, - GL_AUX1 = 0x040A, - GL_AUX2 = 0x040B, - GL_AUX3 = 0x040C, - GL_COLOR_INDEX = 0x1900, - GL_RED = 0x1903, - GL_GREEN = 0x1904, - GL_BLUE = 0x1905, - GL_ALPHA = 0x1906, - GL_LUMINANCE = 0x1909, - GL_LUMINANCE_ALPHA = 0x190A, - GL_ALPHA_BITS = 0x0D55, - GL_RED_BITS = 0x0D52, - GL_GREEN_BITS = 0x0D53, - GL_BLUE_BITS = 0x0D54, - GL_INDEX_BITS = 0x0D51, - GL_SUBPIXEL_BITS = 0x0D50, - GL_AUX_BUFFERS = 0x0C00, - GL_READ_BUFFER = 0x0C02, - GL_DRAW_BUFFER = 0x0C01, - GL_DOUBLEBUFFER = 0x0C32, - GL_STEREO = 0x0C33, - GL_BITMAP = 0x1A00, - GL_COLOR = 0x1800, - GL_DEPTH = 0x1801, - GL_STENCIL = 0x1802, - GL_DITHER = 0x0BD0, - GL_RGB = 0x1907, - GL_RGBA = 0x1908, - - // Implementation limits - GL_MAX_LIST_NESTING = 0x0B31, - GL_MAX_ATTRIB_STACK_DEPTH = 0x0D35, - GL_MAX_MODELVIEW_STACK_DEPTH = 0x0D36, - GL_MAX_NAME_STACK_DEPTH = 0x0D37, - GL_MAX_PROJECTION_STACK_DEPTH = 0x0D38, - GL_MAX_TEXTURE_STACK_DEPTH = 0x0D39, - GL_MAX_EVAL_ORDER = 0x0D30, - GL_MAX_LIGHTS = 0x0D31, - GL_MAX_CLIP_PLANES = 0x0D32, - GL_MAX_TEXTURE_SIZE = 0x0D33, - GL_MAX_PIXEL_MAP_TABLE = 0x0D34, - GL_MAX_VIEWPORT_DIMS = 0x0D3A, - GL_MAX_CLIENT_ATTRIB_STACK_DEPTH = 0x0D3B, - - // Gets - GL_ATTRIB_STACK_DEPTH = 0x0BB0, - GL_CLIENT_ATTRIB_STACK_DEPTH = 0x0BB1, - GL_COLOR_CLEAR_VALUE = 0x0C22, - GL_COLOR_WRITEMASK = 0x0C23, - GL_CURRENT_INDEX = 0x0B01, - GL_CURRENT_COLOR = 0x0B00, - GL_CURRENT_NORMAL = 0x0B02, - GL_CURRENT_RASTER_COLOR = 0x0B04, - GL_CURRENT_RASTER_DISTANCE = 0x0B09, - GL_CURRENT_RASTER_INDEX = 0x0B05, - GL_CURRENT_RASTER_POSITION = 0x0B07, - GL_CURRENT_RASTER_TEXTURE_COORDS = 0x0B06, - GL_CURRENT_RASTER_POSITION_VALID = 0x0B08, - GL_CURRENT_TEXTURE_COORDS = 0x0B03, - GL_INDEX_CLEAR_VALUE = 0x0C20, - GL_INDEX_MODE = 0x0C30, - GL_INDEX_WRITEMASK = 0x0C21, - GL_MODELVIEW_MATRIX = 0x0BA6, - GL_MODELVIEW_STACK_DEPTH = 0x0BA3, - GL_NAME_STACK_DEPTH = 0x0D70, - GL_PROJECTION_MATRIX = 0x0BA7, - GL_PROJECTION_STACK_DEPTH = 0x0BA4, - GL_RENDER_MODE = 0x0C40, - GL_RGBA_MODE = 0x0C31, - GL_TEXTURE_MATRIX = 0x0BA8, - GL_TEXTURE_STACK_DEPTH = 0x0BA5, - GL_VIEWPORT = 0x0BA2, - - // Evaluators - GL_AUTO_NORMAL = 0x0D80, - GL_MAP1_COLOR_4 = 0x0D90, - GL_MAP1_GRID_DOMAIN = 0x0DD0, - GL_MAP1_GRID_SEGMENTS = 0x0DD1, - GL_MAP1_INDEX = 0x0D91, - GL_MAP1_NORMAL = 0x0D92, - GL_MAP1_TEXTURE_COORD_1 = 0x0D93, - GL_MAP1_TEXTURE_COORD_2 = 0x0D94, - GL_MAP1_TEXTURE_COORD_3 = 0x0D95, - GL_MAP1_TEXTURE_COORD_4 = 0x0D96, - GL_MAP1_VERTEX_3 = 0x0D97, - GL_MAP1_VERTEX_4 = 0x0D98, - GL_MAP2_COLOR_4 = 0x0DB0, - GL_MAP2_GRID_DOMAIN = 0x0DD2, - GL_MAP2_GRID_SEGMENTS = 0x0DD3, - GL_MAP2_INDEX = 0x0DB1, - GL_MAP2_NORMAL = 0x0DB2, - GL_MAP2_TEXTURE_COORD_1 = 0x0DB3, - GL_MAP2_TEXTURE_COORD_2 = 0x0DB4, - GL_MAP2_TEXTURE_COORD_3 = 0x0DB5, - GL_MAP2_TEXTURE_COORD_4 = 0x0DB6, - GL_MAP2_VERTEX_3 = 0x0DB7, - GL_MAP2_VERTEX_4 = 0x0DB8, - GL_COEFF = 0x0A00, - GL_DOMAIN = 0x0A02, - GL_ORDER = 0x0A01, - - // Hints - GL_FOG_HINT = 0x0C54, - GL_LINE_SMOOTH_HINT = 0x0C52, - GL_PERSPECTIVE_CORRECTION_HINT = 0x0C50, - GL_POINT_SMOOTH_HINT = 0x0C51, - GL_POLYGON_SMOOTH_HINT = 0x0C53, - GL_DONT_CARE = 0x1100, - GL_FASTEST = 0x1101, - GL_NICEST = 0x1102, - - // Scissor box - GL_SCISSOR_TEST = 0x0C11, - GL_SCISSOR_BOX = 0x0C10, - - // Pixel Mode / Transfer - GL_MAP_COLOR = 0x0D10, - GL_MAP_STENCIL = 0x0D11, - GL_INDEX_SHIFT = 0x0D12, - GL_INDEX_OFFSET = 0x0D13, - GL_RED_SCALE = 0x0D14, - GL_RED_BIAS = 0x0D15, - GL_GREEN_SCALE = 0x0D18, - GL_GREEN_BIAS = 0x0D19, - GL_BLUE_SCALE = 0x0D1A, - GL_BLUE_BIAS = 0x0D1B, - GL_ALPHA_SCALE = 0x0D1C, - GL_ALPHA_BIAS = 0x0D1D, - GL_DEPTH_SCALE = 0x0D1E, - GL_DEPTH_BIAS = 0x0D1F, - GL_PIXEL_MAP_S_TO_S_SIZE = 0x0CB1, - GL_PIXEL_MAP_I_TO_I_SIZE = 0x0CB0, - GL_PIXEL_MAP_I_TO_R_SIZE = 0x0CB2, - GL_PIXEL_MAP_I_TO_G_SIZE = 0x0CB3, - GL_PIXEL_MAP_I_TO_B_SIZE = 0x0CB4, - GL_PIXEL_MAP_I_TO_A_SIZE = 0x0CB5, - GL_PIXEL_MAP_R_TO_R_SIZE = 0x0CB6, - GL_PIXEL_MAP_G_TO_G_SIZE = 0x0CB7, - GL_PIXEL_MAP_B_TO_B_SIZE = 0x0CB8, - GL_PIXEL_MAP_A_TO_A_SIZE = 0x0CB9, - GL_PIXEL_MAP_S_TO_S = 0x0C71, - GL_PIXEL_MAP_I_TO_I = 0x0C70, - GL_PIXEL_MAP_I_TO_R = 0x0C72, - GL_PIXEL_MAP_I_TO_G = 0x0C73, - GL_PIXEL_MAP_I_TO_B = 0x0C74, - GL_PIXEL_MAP_I_TO_A = 0x0C75, - GL_PIXEL_MAP_R_TO_R = 0x0C76, - GL_PIXEL_MAP_G_TO_G = 0x0C77, - GL_PIXEL_MAP_B_TO_B = 0x0C78, - GL_PIXEL_MAP_A_TO_A = 0x0C79, - GL_PACK_ALIGNMENT = 0x0D05, - GL_PACK_LSB_FIRST = 0x0D01, - GL_PACK_ROW_LENGTH = 0x0D02, - GL_PACK_SKIP_PIXELS = 0x0D04, - GL_PACK_SKIP_ROWS = 0x0D03, - GL_PACK_SWAP_BYTES = 0x0D00, - GL_UNPACK_ALIGNMENT = 0x0CF5, - GL_UNPACK_LSB_FIRST = 0x0CF1, - GL_UNPACK_ROW_LENGTH = 0x0CF2, - GL_UNPACK_SKIP_PIXELS = 0x0CF4, - GL_UNPACK_SKIP_ROWS = 0x0CF3, - GL_UNPACK_SWAP_BYTES = 0x0CF0, - GL_ZOOM_X = 0x0D16, - GL_ZOOM_Y = 0x0D17, - - // Texture mapping - GL_TEXTURE_ENV = 0x2300, - GL_TEXTURE_ENV_MODE = 0x2200, - GL_TEXTURE_1D = 0x0DE0, - GL_TEXTURE_2D = 0x0DE1, - GL_TEXTURE_WRAP_S = 0x2802, - GL_TEXTURE_WRAP_T = 0x2803, - GL_TEXTURE_MAG_FILTER = 0x2800, - GL_TEXTURE_MIN_FILTER = 0x2801, - GL_TEXTURE_ENV_COLOR = 0x2201, - GL_TEXTURE_GEN_S = 0x0C60, - GL_TEXTURE_GEN_T = 0x0C61, - GL_TEXTURE_GEN_MODE = 0x2500, - GL_TEXTURE_BORDER_COLOR = 0x1004, - GL_TEXTURE_WIDTH = 0x1000, - GL_TEXTURE_HEIGHT = 0x1001, - GL_TEXTURE_BORDER = 0x1005, - GL_TEXTURE_COMPONENTS = 0x1003, - GL_TEXTURE_RED_SIZE = 0x805C, - GL_TEXTURE_GREEN_SIZE = 0x805D, - GL_TEXTURE_BLUE_SIZE = 0x805E, - GL_TEXTURE_ALPHA_SIZE = 0x805F, - GL_TEXTURE_LUMINANCE_SIZE = 0x8060, - GL_TEXTURE_INTENSITY_SIZE = 0x8061, - GL_NEAREST_MIPMAP_NEAREST = 0x2700, - GL_NEAREST_MIPMAP_LINEAR = 0x2702, - GL_LINEAR_MIPMAP_NEAREST = 0x2701, - GL_LINEAR_MIPMAP_LINEAR = 0x2703, - GL_OBJECT_LINEAR = 0x2401, - GL_OBJECT_PLANE = 0x2501, - GL_EYE_LINEAR = 0x2400, - GL_EYE_PLANE = 0x2502, - GL_SPHERE_MAP = 0x2402, - GL_DECAL = 0x2101, - GL_MODULATE = 0x2100, - GL_NEAREST = 0x2600, - GL_REPEAT = 0x2901, - GL_CLAMP = 0x2900, - GL_S = 0x2000, - GL_T = 0x2001, - GL_R = 0x2002, - GL_Q = 0x2003, - GL_TEXTURE_GEN_R = 0x0C62, - GL_TEXTURE_GEN_Q = 0x0C63, - - // Utility - GL_VENDOR = 0x1F00, - GL_RENDERER = 0x1F01, - GL_VERSION = 0x1F02, - GL_EXTENSIONS = 0x1F03, - - // Errors - GL_NO_ERROR = 0x0, - GL_INVALID_VALUE = 0x0501, - GL_INVALID_ENUM = 0x0500, - GL_INVALID_OPERATION = 0x0502, - GL_STACK_OVERFLOW = 0x0503, - GL_STACK_UNDERFLOW = 0x0504, - GL_OUT_OF_MEMORY = 0x0505, -} - -// glPush/PopAttrib bits -enum : GLuint -{ - GL_CURRENT_BIT = 0x00000001, - GL_POINT_BIT = 0x00000002, - GL_LINE_BIT = 0x00000004, - GL_POLYGON_BIT = 0x00000008, - GL_POLYGON_STIPPLE_BIT = 0x00000010, - GL_PIXEL_MODE_BIT = 0x00000020, - GL_LIGHTING_BIT = 0x00000040, - GL_FOG_BIT = 0x00000080, - GL_DEPTH_BUFFER_BIT = 0x00000100, - GL_ACCUM_BUFFER_BIT = 0x00000200, - GL_STENCIL_BUFFER_BIT = 0x00000400, - GL_VIEWPORT_BIT = 0x00000800, - GL_TRANSFORM_BIT = 0x00001000, - GL_ENABLE_BIT = 0x00002000, - GL_COLOR_BUFFER_BIT = 0x00004000, - GL_HINT_BIT = 0x00008000, - GL_EVAL_BIT = 0x00010000, - GL_LIST_BIT = 0x00020000, - GL_TEXTURE_BIT = 0x00040000, - GL_SCISSOR_BIT = 0x00080000, - GL_ALL_ATTRIB_BITS = 0x000FFFFF, -} - -// gl 1.1 -enum : GLenum -{ -GL_PROXY_TEXTURE_1D = 0x8063, -GL_PROXY_TEXTURE_2D = 0x8064, -GL_TEXTURE_PRIORITY = 0x8066, -GL_TEXTURE_RESIDENT = 0x8067, -GL_TEXTURE_BINDING_1D = 0x8068, -GL_TEXTURE_BINDING_2D = 0x8069, -GL_TEXTURE_INTERNAL_FORMAT = 0x1003, -GL_ALPHA4 = 0x803B, -GL_ALPHA8 = 0x803C, -GL_ALPHA12 = 0x803D, -GL_ALPHA16 = 0x803E, -GL_LUMINANCE4 = 0x803F, -GL_LUMINANCE8 = 0x8040, -GL_LUMINANCE12 = 0x8041, -GL_LUMINANCE16 = 0x8042, -GL_LUMINANCE4_ALPHA4 = 0x8043, -GL_LUMINANCE6_ALPHA2 = 0x8044, -GL_LUMINANCE8_ALPHA8 = 0x8045, -GL_LUMINANCE12_ALPHA4 = 0x8046, -GL_LUMINANCE12_ALPHA12 = 0x8047, -GL_LUMINANCE16_ALPHA16 = 0x8048, -GL_INTENSITY = 0x8049, -GL_INTENSITY4 = 0x804A, -GL_INTENSITY8 = 0x804B, -GL_INTENSITY12 = 0x804C, -GL_INTENSITY16 = 0x804D, -GL_R3_G3_B2 = 0x2A10, -GL_RGB4 = 0x804F, -GL_RGB5 = 0x8050, -GL_RGB8 = 0x8051, -GL_RGB10 = 0x8052, -GL_RGB12 = 0x8053, -GL_RGB16 = 0x8054, -GL_RGBA2 = 0x8055, -GL_RGBA4 = 0x8056, -GL_RGB5_A1 = 0x8057, -GL_RGBA8 = 0x8058, -GL_RGB10_A2 = 0x8059, -GL_RGBA12 = 0x805A, -GL_RGBA16 = 0x805B, -} - -enum : GLuint -{ - GL_CLIENT_PIXEL_STORE_BIT = 0x00000001, - GL_CLIENT_VERTEX_ARRAY_BIT = 0x00000002, - GL_ALL_CLIENT_ATTRIB_BITS = 0xFFFFFFFF, - GL_CLIENT_ALL_ATTRIB_BITS = 0xFFFFFFFF, -}
--- a/qt/opengl/glu.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,196 +0,0 @@ -module qt.opengl.glu; - -private import qt.opengl.gltypes; - -//============================================================================== -// CONSTANTS -//============================================================================== -enum : GLenum -{ - // StringName - GLU_VERSION = 100800, - GLU_EXTENSIONS = 100801, - // ErrorCode - GLU_INVALID_ENUM = 100900, - GLU_INVALID_VALUE = 100901, - GLU_OUT_OF_MEMORY = 100902, - GLU_INVALID_OPERATION = 100904, - // NurbsDisplay - GLU_OUTLINE_POLYGON = 100240, - GLU_OUTLINE_PATCH = 100241, - // NurbsCallback - GLU_NURBS_ERROR = 100103, - GLU_ERROR = 100103, - GLU_NURBS_BEGIN = 100164, - GLU_NURBS_BEGIN_EXT = 100164, - GLU_NURBS_VERTEX = 100165, - GLU_NURBS_VERTEX_EXT = 100165, - GLU_NURBS_NORMAL = 100166, - GLU_NURBS_NORMAL_EXT = 100166, - GLU_NURBS_COLOR = 100167, - GLU_NURBS_COLOR_EXT = 100167, - GLU_NURBS_TEXTURE_COORD = 100168, - GLU_NURBS_TEX_COORD_EXT = 100168, - GLU_NURBS_END = 100169, - GLU_NURBS_END_EXT = 100169, - GLU_NURBS_BEGIN_DATA = 100170, - GLU_NURBS_BEGIN_DATA_EXT = 100170, - GLU_NURBS_VERTEX_DATA = 100171, - GLU_NURBS_VERTEX_DATA_EXT = 100171, - GLU_NURBS_NORMAL_DATA = 100172, - GLU_NURBS_NORMAL_DATA_EXT = 100172, - GLU_NURBS_COLOR_DATA = 100173, - GLU_NURBS_COLOR_DATA_EXT = 100173, - GLU_NURBS_TEXTURE_COORD_DATA = 100174, - GLU_NURBS_TEX_COORD_DATA_EXT = 100174, - GLU_NURBS_END_DATA = 100175, - GLU_NURBS_END_DATA_EXT = 100175, - // NurbsError - GLU_NURBS_ERROR1 = 100251, - GLU_NURBS_ERROR2 = 100252, - GLU_NURBS_ERROR3 = 100253, - GLU_NURBS_ERROR4 = 100254, - GLU_NURBS_ERROR5 = 100255, - GLU_NURBS_ERROR6 = 100256, - GLU_NURBS_ERROR7 = 100257, - GLU_NURBS_ERROR8 = 100258, - GLU_NURBS_ERROR9 = 100259, - GLU_NURBS_ERROR10 = 100260, - GLU_NURBS_ERROR11 = 100261, - GLU_NURBS_ERROR12 = 100262, - GLU_NURBS_ERROR13 = 100263, - GLU_NURBS_ERROR14 = 100264, - GLU_NURBS_ERROR15 = 100265, - GLU_NURBS_ERROR16 = 100266, - GLU_NURBS_ERROR17 = 100267, - GLU_NURBS_ERROR18 = 100268, - GLU_NURBS_ERROR19 = 100269, - GLU_NURBS_ERROR20 = 100270, - GLU_NURBS_ERROR21 = 100271, - GLU_NURBS_ERROR22 = 100272, - GLU_NURBS_ERROR23 = 100273, - GLU_NURBS_ERROR24 = 100274, - GLU_NURBS_ERROR25 = 100275, - GLU_NURBS_ERROR26 = 100276, - GLU_NURBS_ERROR27 = 100277, - GLU_NURBS_ERROR28 = 100278, - GLU_NURBS_ERROR29 = 100279, - GLU_NURBS_ERROR30 = 100280, - GLU_NURBS_ERROR31 = 100281, - GLU_NURBS_ERROR32 = 100282, - GLU_NURBS_ERROR33 = 100283, - GLU_NURBS_ERROR34 = 100284, - GLU_NURBS_ERROR35 = 100285, - GLU_NURBS_ERROR36 = 100286, - GLU_NURBS_ERROR37 = 100287, - // NurbsProperty - GLU_AUTO_LOAD_MATRIX = 100200, - GLU_CULLING = 100201, - GLU_SAMPLING_TOLERANCE = 100203, - GLU_DISPLAY_MODE = 100204, - GLU_PARAMETRIC_TOLERANCE = 100202, - GLU_SAMPLING_METHOD = 100205, - GLU_U_STEP = 100206, - GLU_V_STEP = 100207, - GLU_NURBS_MODE = 100160, - GLU_NURBS_MODE_EXT = 100160, - GLU_NURBS_TESSELLATOR = 100161, - GLU_NURBS_TESSELLATOR_EXT = 100161, - GLU_NURBS_RENDERER = 100162, - GLU_NURBS_RENDERER_EXT = 100162, - // NurbsSampling - GLU_OBJECT_PARAMETRIC_ERROR = 100208, - GLU_OBJECT_PARAMETRIC_ERROR_EXT = 100208, - GLU_OBJECT_PATH_LENGTH = 100209, - GLU_OBJECT_PATH_LENGTH_EXT = 100209, - GLU_PATH_LENGTH = 100215, - GLU_PARAMETRIC_ERROR = 100216, - GLU_DOMAIN_DISTANCE = 100217, - // NurbsTrim - GLU_MAP1_TRIM_2 = 100210, - GLU_MAP2_TRIM_3 = 100211, - // QuadricDrawStyle - GLU_POINT = 100010, - GLU_LINE = 100011, - GLU_FILL = 100012, - GLU_SILHOUETTE = 100013, - // QuadricNormal - GLU_SMOOTH = 100000, - GLU_FLAT = 100001, - GLU_NONE = 100002, - // QuadricOrientation - GLU_OUTSIDE = 100020, - GLU_INSIDE = 100021, - // TessCallback - GLU_TESS_BEGIN = 100100, - GLU_BEGIN = 100100, - GLU_TESS_VERTEX = 100101, - GLU_VERTEX = 100101, - GLU_TESS_END = 100102, - GLU_END = 100102, - GLU_TESS_ERROR = 100103, - GLU_TESS_EDGE_FLAG = 100104, - GLU_EDGE_FLAG = 100104, - GLU_TESS_COMBINE = 100105, - GLU_TESS_BEGIN_DATA = 100106, - GLU_TESS_VERTEX_DATA = 100107, - GLU_TESS_END_DATA = 100108, - GLU_TESS_ERROR_DATA = 100109, - GLU_TESS_EDGE_FLAG_DATA = 100110, - GLU_TESS_COMBINE_DATA = 100111, - // TessContour - GLU_CW = 100120, - GLU_CCW = 100121, - GLU_INTERIOR = 100122, - GLU_EXTERIOR = 100123, - GLU_UNKNOWN = 100124, - // TessProperty - GLU_TESS_WINDING_RULE = 100140, - GLU_TESS_BOUNDARY_ONLY = 100141, - GLU_TESS_TOLERANCE = 100142, - // TessError - GLU_TESS_ERROR1 = 100151, - GLU_TESS_ERROR2 = 100152, - GLU_TESS_ERROR3 = 100153, - GLU_TESS_ERROR4 = 100154, - GLU_TESS_ERROR5 = 100155, - GLU_TESS_ERROR6 = 100156, - GLU_TESS_ERROR7 = 100157, - GLU_TESS_ERROR8 = 100158, - GLU_TESS_MISSING_BEGIN_POLYGON = 100151, - GLU_TESS_MISSING_BEGIN_COUNTER = 100152, - GLU_TESS_MISSING_END_POLYGON = 100153, - GLU_TESS_MISSING_END_COUNTER = 100154, - GLU_TESS_COORD_TOO_LARGE = 100155, - GLU_TESS_NEED_COMBINE_CALLBACK = 100156, - // TessWinding - GLU_TESS_WINDING_ODD = 100130, - GLU_TESS_WINDING_NONZERO = 100131, - GLU_TESS_WINDING_POSITIVE = 100132, - GLU_TESS_WINDING_NEGATIVE = 100133, - GLU_TESS_WINDING_ABS_GEQ_TWO = 100134, -} - -const GLdouble GLU_TESS_MAX_COORD = 1.0e150; - -//============================================================================== -// TYPES -//============================================================================== -struct GLUnurbs {} -struct GLUquadric {} -struct GLUtesselator {} - -typedef GLUnurbs GLUnurbsObj; -typedef GLUquadric GLUquadricObj; -typedef GLUtesselator GLUtesselatorObj; -typedef GLUtesselator GLUtriangulatorObj; - -extern(System) -{ - void gluOrtho2D(GLdouble,GLdouble,GLdouble,GLdouble); - void gluPerspective(GLdouble,GLdouble,GLdouble,GLdouble); - void gluLookAt(GLdouble,GLdouble,GLdouble,GLdouble,GLdouble,GLdouble,GLdouble,GLdouble,GLdouble); - GLint gluProject(GLdouble,GLdouble,GLdouble,GLdouble*,GLdouble*,GLint*,GLdouble*,GLdouble*,GLdouble*); - GLint gluUnProject(GLdouble,GLdouble,GLdouble,GLdouble*,GLdouble*,GLint*,GLdouble*,GLdouble*,GLdouble*); -} -
--- a/qt/qtd/Array.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/** - * - * Copyright: Copyright QtD Team, 2008-2009 - * Authors: Max Samukha - * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a> - * - * Copyright QtD Team, 2008-2009 - * Distributed under the Boost Software License, Version 1.0. - * (See accompanying file boost-license-1.0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - * - */ -module qt.qtd.Array; - -version (Tango) - import tango.stdc.string; -else - import core.stdc.string; - -void remove(T)(ref T[] haystack, T needle) -{ - foreach (i, e; haystack) - { - if (e == needle) - { - if (haystack.length > 1) - { - i++; - memmove(haystack.ptr + i - 1, haystack.ptr + i, (haystack.length - i) * T.sizeof); - haystack.length = haystack.length - 1; - } - else - haystack.length = 0; - - break; - } - } -} \ No newline at end of file
--- a/qt/qtd/ArrayOpsPrimitive.d Wed Dec 23 16:17:22 2009 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/** -* -* Copyright: Copyright QtD Team, 2008-2009 -* License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a> -* -* Copyright QtD Team, 2008-2009 -* Distributed under the Boost Software License, Version 1.0. -* (See accompanying file boost-license-1.0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -* -*/ - -module qt.qtd.ArrayOpsPrimitive; - -import qt.QGlobal; - -// int -private extern(C) void qtd_allocate_int_array(int[]* arr, size_t len) -{ - *arr = new int[len]; -} - -private extern(C) void qtd_assign_int_array_element(int[]* arr, size_t pos, int elem) -{ - (*arr)[pos] = elem; -} - -private extern(C) void qtd_get_int_from_array(int* arr, size_t pos, int* elem) -{ - *elem = arr[pos]; -} - -// uint -private extern(C) void qtd_allocate_uint_array(int[]* arr, size_t len) -{ - *arr = new int[len]; -} - -private extern(C) void qtd_assign_uint_array_element(int[]* arr, size_t pos, uint elem) -{ - (*arr)[pos] = elem; -} - -private extern(C) void qtd_get_uint_from_array(uint* arr, size_t pos, uint* elem) -{ - *elem = arr[pos]; -} - -// double -private extern(C) void qtd_allocate_double_array(double[]* arr, size_t len) -{ - *arr = new double[len]; -} - -private extern(C) void qtd_assign_double_array_element(double[]* arr, size_t pos, double elem) -{ - (*arr)[pos] = elem; -} - -private extern(C) void qtd_get_double_from_array(double* arr, size_t pos, double* elem) -{ - *elem = arr[pos]; -} - -// string -private extern(C) void qtd_allocate_string_array(string[]* arr, size_t len) -{ - *arr = new string[len]; -} - -private extern(C) void qtd_assign_string_array_element(string[]* arr, size_t pos, string* elem) -{ -} - -private extern(C) void* qtd_string_from_array(string[]* arr, size_t pos) -{ - return &((*arr)[pos]); -} -/* -private extern(C) void qtd_get_string_from_array(string* arr, size_t pos, char** elem, size_t* elem_size) -{ - *elem = arr[pos].ptr; - *elem_size = arr[pos].length; -} -*/ - -private extern(C) void qtd_get_string_from_array(string* arr, size_t pos, string* elem) -{ - *elem = arr[pos]; -} - -version(cpp_shared) -{ - extern (C) void qtd_core_ArrayOps_initCallBacks(void* callbacks); - - static this() { - void*[13] callbacks; - - callbacks[0] = &qtd_allocate_int_array; - callbacks[1] = &qtd_assign_int_array_element; - callbacks[2] = &qtd_get_int_from_array; - - callbacks[3] = &qtd_allocate_uint_array; - callbacks[4] = &qtd_assign_uint_array_element; - callbacks[5] = &qtd_get_uint_from_array; - - callbacks[6] = &qtd_allocate_double_array; - callbacks[7] = &qtd_assign_double_array_element; - callbacks[8] = &qtd_get_double_from_array; - - callbacks[9] = &qtd_allocate_string_array; - callbacks[10] = &qtd_assign_string_array_element; - callbacks[11] = &qtd_string_from_array; - callbacks[12] = &qtd_get_string_from_array; - - qtd_core_ArrayOps_initCallBacks(callbacks.ptr); - } -} \ No newline at end of file