diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a6f6f5..e3e1a8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,9 +5,10 @@ project(pysidebindings) cmake_minimum_required(VERSION 2.6) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Macros/ ${CMAKE_MODULE_PATH}) -find_package(GeneratorRunner 0.6.3 REQUIRED) -find_package(Shiboken 1.0.0 REQUIRED) +find_package(GeneratorRunner 0.6.11 REQUIRED) +find_package(Shiboken 1.0.4 REQUIRED) find_package(Qt4 4.5.0 REQUIRED) +find_file(GL_H "gl.h" PATH_SUFFIXES "GL") include(FindQt4Extra) set(XVFB_EXEC "") @@ -15,11 +16,12 @@ option(USE_XVFB "Uses xvfb-run with the unit tests to avoid QtGui tests popping if(USE_XVFB) find_program(XVFB_RUN NAMES xvfb-run) if (NOT ${XVFB_RUN} MATCHES "XVFB_RUN-NOTFOUND") - set(XVFB_EXEC ${XVFB_RUN}) + set(XVFB_EXEC ${XVFB_RUN} -a) message(STATUS "Using xvfb-run to perform QtGui tests.") endif() endif() +option(BUILD_TESTS "Build tests." TRUE) option(ENABLE_VERSION_SUFFIX "Used to use current version in suffix to generated files. This is used to allow multiples versions installed simultaneous." FALSE) set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" ) set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE) @@ -55,14 +57,23 @@ else() endif() if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) + set(CMAKE_BUILD_TYPE ${SHIBOKEN_BUILD_TYPE}) endif() set(BINDING_NAME PySide) set(BINDING_API_MAJOR_VERSION "1") set(BINDING_API_MINOR_VERSION "0") -set(BINDING_API_MICRO_VERSION "0") +set(BINDING_API_MICRO_VERSION "4") +set(BINDING_API_RELEASE_LEVEL "final") # alpha, beta, rc, or final +set(BINDING_API_SERIAL 1) # leave as 0 when release level is final set(BINDING_API_VERSION "${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}.${BINDING_API_MICRO_VERSION}" CACHE STRING "PySide version" FORCE) +if (BINDING_API_RELEASE_LEVEL STREQUAL "final") + set(BINDING_API_VERSION_FULL "${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}.${BINDING_API_MICRO_VERSION}" + CACHE STRING "PySide version [full]" FORCE) +else() + set(BINDING_API_VERSION_FULL "${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}.${BINDING_API_MICRO_VERSION}~${BINDING_API_RELEASE_LEVEL}${BINDING_API_SERIAL}" + CACHE STRING "PySide version [full]" FORCE) +endif() set(PYSIDE_QT_VERSION "${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}" CACHE STRING "Qt version used to compile PySide" FORCE) if(ENABLE_VERSION_SUFFIX) set(pyside_SUFFIX "-${BINDING_API_MAJOR_VERSION}.${BINDING_API_MINOR_VERSION}") @@ -106,11 +117,7 @@ else() endif() # Define supported Qt Version -if(${QT_VERSION_MAJOR} EQUAL 4 AND ${QT_VERSION_MINOR} GREATER 6) - set(SUPPORTED_QT_VERSION 4.7) -else() - set(SUPPORTED_QT_VERSION 4.6) -endif() +set(SUPPORTED_QT_VERSION "${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}") set(BINDING_VERSION ${BINDING_API_VERSION}.${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}) @@ -122,7 +129,7 @@ add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") -set(ARCHIVE_NAME pyside-qt${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}+${BINDING_API_VERSION}) +set(ARCHIVE_NAME pyside-qt${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}+${BINDING_API_VERSION_FULL}) add_custom_target(dist COMMAND mkdir -p "${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}" && git log > "${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}/ChangeLog" && @@ -145,9 +152,14 @@ if (NOT SITE_PACKAGE) endif() endif() -set(GENERATOR_EXTRA_FLAGS --generatorSet=shiboken --enable-parent-ctor-heuristic --enable-pyside-extensions --enable-return-value-heuristic) - -enable_testing() +set(GENERATOR_EXTRA_FLAGS --generator-set=shiboken --enable-parent-ctor-heuristic --enable-pyside-extensions --enable-return-value-heuristic --use-isnull-as-nb_nonzero) +if(WIN32 OR DEFINED AVOID_PROTECTED_HACK) + message(STATUS "PySide will be generated avoiding the protected hack!") + set(GENERATOR_EXTRA_FLAGS ${GENERATOR_EXTRA_FLAGS} --avoid-protected-hack) + add_definitions(-DAVOID_PROTECTED_HACK) +else() + message(STATUS "PySide will be generated using the protected hack!") +endif() add_subdirectory(libpyside) if(QT_QTUITOOLS_FOUND AND QT_QTDESIGNER_FOUND) @@ -155,7 +167,10 @@ if(QT_QTUITOOLS_FOUND AND QT_QTDESIGNER_FOUND) endif() # project directories add_subdirectory(PySide) -add_subdirectory(tests) +if (BUILD_TESTS) + enable_testing() + add_subdirectory(tests) +endif () find_program(DOT_EXEC dot) if (QT_SRC_DIR AND DOT_EXEC) diff --git a/PySide/CMakeLists.txt b/PySide/CMakeLists.txt index 3b85e3d..62c8068 100644 --- a/PySide/CMakeLists.txt +++ b/PySide/CMakeLists.txt @@ -1,12 +1,10 @@ project(pyside) -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/__init__.py" "${CMAKE_CURRENT_BINARY_DIR}/private.py" - DESTINATION "${SITE_PACKAGE}/${BINDING_NAME}${pyside_SUFFIX}") include(PySideModules) # Configure include based on platform configure_file("${CMAKE_CURRENT_SOURCE_DIR}/global.h.in" - "${CMAKE_CURRENT_BINARY_DIR}/global.h" @ONLY) + "${CMAKE_CURRENT_BINARY_DIR}/pyside_global.h" @ONLY) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/__init__.py.in" "${CMAKE_CURRENT_BINARY_DIR}/__init__.py" @ONLY) @@ -23,7 +21,9 @@ HAS_QT_MODULE(QT_QTXML_FOUND QtXml) HAS_QT_MODULE(QT_QTTEST_FOUND QtTest) HAS_QT_MODULE(QT_QTOPENGL_FOUND QtOpenGL) HAS_QT_MODULE(QT_QTSQL_FOUND QtSql) -HAS_QT_MODULE(QT_QTUITOOLS_FOUND QtUiTools) +if(QT_QTDESIGNER_FOUND) + HAS_QT_MODULE(QT_QTUITOOLS_FOUND QtUiTools) +endif() HAS_QT_MODULE(QT_QTHELP_FOUND QtHelp) HAS_QT_MODULE(QT_QTXMLPATTERNS_FOUND QtXmlPatterns) HAS_QT_MODULE(QT_QTMAEMO5_FOUND QtMaemo5) @@ -34,6 +34,10 @@ HAS_QT_MODULE(QT_PHONON_FOUND phonon) HAS_QT_MODULE(QT_QTDECLARATIVE_FOUND QtDeclarative) # install +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/__init__.py" "${CMAKE_CURRENT_BINARY_DIR}/private.py" + DESTINATION "${SITE_PACKAGE}/${BINDING_NAME}${pyside_SUFFIX}") install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/typesystem_templates.xml DESTINATION share/PySide${pyside_SUFFIX}/typesystems) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pyside_global.h + DESTINATION include/${BINDING_NAME}${pyside_SUFFIX}) diff --git a/PySide/QtCore/CMakeLists.txt b/PySide/QtCore/CMakeLists.txt index 056597c..86df1d1 100644 --- a/PySide/QtCore/CMakeLists.txt +++ b/PySide/QtCore/CMakeLists.txt @@ -1,5 +1,7 @@ project(QtCore) +set(QtCore_gluecode "${CMAKE_CURRENT_SOURCE_DIR}/glue/qeasingcurve_glue.cpp") + if (${QT_VERSION_MAJOR} EQUAL 4 AND ${QT_VERSION_MINOR} LESS 6) set (QtCore_46_SRC ) else() @@ -34,7 +36,16 @@ else() ) endif() - +if(ENABLE_WIN) + set(QtCore_typesystem "typesystem_core_win.xml") + set(QtCore_extra_SRC + ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtCore/msg_wrapper.cpp + ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtCore/point_wrapper.cpp + ) +else() + set(QtCore_typesystem "typesystem_core.xml") + set(QtCore_extra_SRC "") +endif() set(QtCore_SRC ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtCore/qabstracteventdispatcher_wrapper.cpp @@ -60,7 +71,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtCore/qdiriterator_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtCore/qdynamicpropertychangeevent_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtCore/qevent_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtCore/qeventloop_wrapper.cpp -${CMAKE_CURRENT_BINARY_DIR}/${BINDING_NAME}/QtCore/qfactoryinterface_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/PySide/QtCore/qfactoryinterface_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtCore/qfile_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtCore/qfileinfo_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtCore/qfilesystemwatcher_wrapper.cpp @@ -135,6 +146,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtCore/qxmlstreamreader_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtCore/qxmlstreamwriter_wrapper.cpp ${QtCore_46_SRC} ${QtCore_47_SRC} +${QtCore_extra_SRC} ) set(QtCore_typesystem_path "") @@ -155,4 +167,5 @@ create_pyside_module(QtCore "" QtCore_typesystem_path QtCore_SRC - "") + QtCore_gluecode + ${CMAKE_CURRENT_SOURCE_DIR}/${QtCore_typesystem}) diff --git a/PySide/QtCore/glue/hwnd_conversions.h b/PySide/QtCore/glue/hwnd_conversions.h new file mode 100644 index 0000000..bf2de4d --- /dev/null +++ b/PySide/QtCore/glue/hwnd_conversions.h @@ -0,0 +1,32 @@ +namespace Shiboken { +template <> +struct Converter +{ + static bool checkType(PyObject* pyObj) + { + return false; + } + + static bool isConvertible(PyObject* pyobj) + { + return PyCObject_Check(pyobj); + } + + static inline PyObject* toPython(void* cppobj) + { + // not supported + Q_ASSERT(true); + return 0; + } + + static PyObject* toPython(HWND__ cppobj) + { + return PyCObject_FromVoidPtr(&cppobj, 0); + } + + static HWND__ toCpp(PyObject* pyobj) + { + return *((HWND__*) PyCObject_AsVoidPtr(pyobj)); + } +}; +} diff --git a/PySide/QtCore/glue/qcoreapplication_init.cpp b/PySide/QtCore/glue/qcoreapplication_init.cpp index 0c0e1f8..c92f03e 100644 --- a/PySide/QtCore/glue/qcoreapplication_init.cpp +++ b/PySide/QtCore/glue/qcoreapplication_init.cpp @@ -2,43 +2,23 @@ static int QCoreApplicationArgCount; static char** QCoreApplicationArgValues; -int Sbk_QCoreApplication_Init(PyObject* self, PyObject* args, PyObject*) +void QCoreApplication_constructor(PyObject* self, PyObject* args, QCoreApplicationWrapper** cptr) { - if (Shiboken::Object::isUserType(self) && !Shiboken::ObjectType::canCallConstructor(self->ob_type, Shiboken::SbkType())) - return -1; - - if (QCoreApplication::instance()) { PyErr_SetString(PyExc_RuntimeError, "A QCoreApplication instance already exists."); - return -1; + return; } int numArgs = PyTuple_GET_SIZE(args); - if (numArgs != 1) { + if (numArgs != 1 + || !Shiboken::sequenceToArgcArgv(PyTuple_GET_ITEM(args, 0), &QCoreApplicationArgCount, &QCoreApplicationArgValues, "PySideApp")) { PyErr_BadArgument(); - return -1; + return; } - if (!Shiboken::sequenceToArgcArgv(PyTuple_GET_ITEM(args, 0), &QCoreApplicationArgCount, &QCoreApplicationArgValues, "PySideApp")) { - PyErr_BadArgument(); - return -1; - } - - SbkObject* sbkSelf = reinterpret_cast(self); - QCoreApplicationWrapper* cptr = new QCoreApplicationWrapper(QCoreApplicationArgCount, QCoreApplicationArgValues); - Shiboken::Object::setCppPointer(sbkSelf, - Shiboken::SbkType(), - cptr); - - Shiboken::Object::setValidCpp(sbkSelf, true); - Shiboken::Object::setHasCppWrapper(sbkSelf, true); - Shiboken::Object::releaseOwnership(sbkSelf); - - Shiboken::BindingManager::instance().registerWrapper(sbkSelf, cptr); - PySide::Signal::updateSourceObject(self); - cptr->metaObject(); + *cptr = new QCoreApplicationWrapper(QCoreApplicationArgCount, QCoreApplicationArgValues); + Shiboken::Object::releaseOwnership(reinterpret_cast(self)); PySide::registerCleanupFunction(&PySide::destroyQCoreApplication); Py_INCREF(self); - return 1; } diff --git a/PySide/QtCore/glue/qeasingcurve_glue.cpp b/PySide/QtCore/glue/qeasingcurve_glue.cpp new file mode 100644 index 0000000..fd2dee0 --- /dev/null +++ b/PySide/QtCore/glue/qeasingcurve_glue.cpp @@ -0,0 +1,120 @@ +#include +#include +#include +#include + +#include "glue/qeasingcurve_glue.h" + +#define __ECF_ATT_NAME__ "__ecf__" +#define MAX_CUSTOM_FUNCTIONS 10 + +static void deleteData(void* data); + +struct CustomFunctionsData +{ + static CustomFunctionsData m_list[MAX_CUSTOM_FUNCTIONS]; + + PySideEasingCurveFunctor* m_obj; + QEasingCurve::EasingFunction m_func; +}; + +CustomFunctionsData CustomFunctionsData::m_list[MAX_CUSTOM_FUNCTIONS]; + +template +struct CustomFunctions +{ + static void init() + { + CustomFunctionsData data; + data.m_obj = 0; + data.m_func = &CustomFunctions::callback; + CustomFunctionsData::m_list[N] = data; + + CustomFunctions::init(); + } + + static qreal callback(qreal v) + { + return (*CustomFunctionsData::m_list[N].m_obj)(v); + } +}; + +template<> +struct CustomFunctions<0> +{ + static void init() + { + CustomFunctionsData data; + data.m_obj = 0; + data.m_func = &CustomFunctions<0>::callback; + CustomFunctionsData::m_list[0] = data; + } + + static qreal callback(qreal v) + { + return (*CustomFunctionsData::m_list[0].m_obj)(v); + } +}; + +void deleteData(void* data) +{ + delete (PySideEasingCurveFunctor*)(data); +} + +void PySideEasingCurveFunctor::init() +{ + CustomFunctions::init(); +} + +QEasingCurve::EasingFunction PySideEasingCurveFunctor::createCustomFuntion(PyObject* parent, PyObject* pyFunc) +{ + for(int i=0; i < MAX_CUSTOM_FUNCTIONS; i++) { + CustomFunctionsData& data = CustomFunctionsData::m_list[i]; + if (data.m_obj == 0) { + data.m_obj = new PySideEasingCurveFunctor(i, parent, pyFunc); + return data.m_func; + } + } + //PyErr_Format(PyExc_RuntimeError, "PySide only supports %d custom functions simultaneously.", MAX_CUSTOM_FUNCTIONS); + return 0; +} + +PySideEasingCurveFunctor::~PySideEasingCurveFunctor() +{ + + CustomFunctionsData::m_list[m_index].m_obj = 0; + PyObject_SetAttrString(m_parent, __ECF_ATT_NAME__, Py_None); +} + +qreal PySideEasingCurveFunctor::operator()(qreal progress) +{ + Shiboken::GilState state; + PyObject* args = Py_BuildValue("(f)", progress); + PyObject* result = PyObject_CallObject(m_func, args); + qreal cppResult = 0.0; + if (result) { + cppResult = Shiboken::Converter::toCpp(result); + Py_DECREF(result); + } + Py_DECREF(args); + return cppResult; +} + +PyObject* PySideEasingCurveFunctor::callable() +{ + Py_INCREF(m_func); + return m_func; +} + +PyObject* PySideEasingCurveFunctor::callable(PyObject* parent) +{ + return PyObject_GetAttrString(parent, __ECF_ATT_NAME__); +} + +PySideEasingCurveFunctor::PySideEasingCurveFunctor(int index, PyObject* parent, PyObject* pyFunc) + : m_parent(parent), m_func(pyFunc), m_index(index) +{ + PyObject_SetAttrString(m_parent, __ECF_ATT_NAME__, m_func); + PySide::WeakRef::create(m_parent, deleteData, this); +} + diff --git a/PySide/QtCore/glue/qeasingcurve_glue.h b/PySide/QtCore/glue/qeasingcurve_glue.h new file mode 100644 index 0000000..282e439 --- /dev/null +++ b/PySide/QtCore/glue/qeasingcurve_glue.h @@ -0,0 +1,27 @@ +#ifndef __QEASINGCURVE_GLUE__ +#define __QEASINGCURVE_GLUE__ + +#include +#include + +class PySideEasingCurveFunctor +{ + public: + static void init(); + static QEasingCurve::EasingFunction createCustomFuntion(PyObject* parent, PyObject* pyFunc); + + qreal operator()(qreal progress); + + PyObject* callable(); //Return New reference + static PyObject* callable(PyObject* parent); //Return New reference + + ~PySideEasingCurveFunctor(); + private: + PyObject* m_parent; + PyObject* m_func; + int m_index; + + PySideEasingCurveFunctor(int index, PyObject* parent, PyObject *pyFunc); +}; + +#endif diff --git a/PySide/QtCore/glue/qobject_connect.cpp b/PySide/QtCore/glue/qobject_connect.cpp index 91c830a..91a272c 100644 --- a/PySide/QtCore/glue/qobject_connect.cpp +++ b/PySide/QtCore/glue/qobject_connect.cpp @@ -1,9 +1,21 @@ +static bool isDecorator(PyObject* method, PyObject* self) +{ + Shiboken::AutoDecRef methodName(PyObject_GetAttrString(method, "__name__")); + if (!PyObject_HasAttr(self, methodName)) + return true; + Shiboken::AutoDecRef otherMethod(PyObject_GetAttr(self, methodName)); + return reinterpret_cast(otherMethod.object())->im_func != \ + reinterpret_cast(method)->im_func; +} + static bool getReceiver(PyObject* callback, QObject** receiver, PyObject** self) { + bool forceGlobalReceiver = false; if (PyMethod_Check(callback)) { *self = PyMethod_GET_SELF(callback); if (Shiboken::Converter::checkType(*self)) *receiver = Shiboken::Converter::toCpp(*self); + forceGlobalReceiver = isDecorator(callback, *self); } else if (PyCFunction_Check(callback)) { *self = PyCFunction_GET_SELF(callback); if (*self && Shiboken::Converter::checkType(*self)) @@ -14,7 +26,7 @@ static bool getReceiver(PyObject* callback, QObject** receiver, PyObject** self) *self = 0; } - bool usingGlobalReceiver = !*receiver; + bool usingGlobalReceiver = !*receiver || forceGlobalReceiver; if (usingGlobalReceiver) { PySide::SignalManager& signalManager = PySide::SignalManager::instance(); *receiver = signalManager.globalReceiver(); diff --git a/PySide/QtCore/glue/qobject_findchild.cpp b/PySide/QtCore/glue/qobject_findchild.cpp index 351aa69..669beac 100644 --- a/PySide/QtCore/glue/qobject_findchild.cpp +++ b/PySide/QtCore/glue/qobject_findchild.cpp @@ -17,14 +17,23 @@ static QObject* _findChildHelper(const QObject* parent, const QString& name, PyT return 0; } -static void _findChildrenHelper(const QObject* parent, const QString& name, PyTypeObject* desiredType, PyObject* result) +static inline bool _findChildrenComparator(const QObject*& child, const QRegExp& name) { - foreach(QObject* child, parent->children()) { + return name.indexIn(child->objectName()) != -1; +} + +static inline bool _findChildrenComparator(const QObject*& child, const QString& name) +{ + return name.isNull() || name == child->objectName(); +} + +template +static void _findChildrenHelper(const QObject* parent, const T& name, PyTypeObject* desiredType, PyObject* result) +{ + foreach(const QObject* child, parent->children()) { Shiboken::AutoDecRef pyChild(%CONVERTTOPYTHON[QObject*](child)); - if (PyType_IsSubtype(pyChild->ob_type, desiredType) - && (name.isNull() || name == child->objectName())) { + if (PyType_IsSubtype(pyChild->ob_type, desiredType) && _findChildrenComparator(child, name)) PyList_Append(result, pyChild); - } _findChildrenHelper(child, name, desiredType, result); } -} \ No newline at end of file +} diff --git a/PySide/QtCore/qbytearray_conversions.h b/PySide/QtCore/qbytearray_conversions.h new file mode 100644 index 0000000..daa1609 --- /dev/null +++ b/PySide/QtCore/qbytearray_conversions.h @@ -0,0 +1,34 @@ +namespace Shiboken { + +inline bool Converter::checkType(PyObject* pyObj) +{ + return ValueTypeConverter::checkType(pyObj); +} + +inline bool Converter::isConvertible(PyObject* pyObj) +{ + if (ValueTypeConverter::isConvertible(pyObj)) + return true; + SbkObjectType* shiboType = reinterpret_cast(SbkType< ::QByteArray >()); + return Shiboken::Converter::checkType(pyObj) + || (ObjectType::isExternalConvertible(shiboType, pyObj)); +} + +inline QByteArray Converter::toCpp(PyObject* pyObj) +{ + if (pyObj == Py_None) + return 0; + else if (PyObject_TypeCheck(pyObj, SbkType())) + return *Converter::toCpp(pyObj); + else if (PyString_Check(pyObj)) + return QByteArray(PyString_AS_STRING(pyObj), PyString_GET_SIZE(pyObj)); + else + return ValueTypeConverter::toCpp(pyObj); +} + +inline PyObject* Converter::toPython(const ::QByteArray& cppObj) +{ + return ValueTypeConverter::toPython(cppObj); +} + +} diff --git a/PySide/QtCore/qdate_conversions.h b/PySide/QtCore/qdate_conversions.h index e0f1dd9..7c45eec 100644 --- a/PySide/QtCore/qdate_conversions.h +++ b/PySide/QtCore/qdate_conversions.h @@ -1,35 +1,45 @@ namespace Shiboken { -template <> -struct PythonConverter + +inline bool Converter::checkType(PyObject* pyObj) { - static bool isPythonConvertible(PyObject* pyObj) - { - if (!PyDateTimeAPI) - PyDateTime_IMPORT; - - return pyObj && PyDate_Check(pyObj); - } - - static QDate* transformFromPython(PyObject* obj) - { - if (isPythonConvertible(obj)) { - int day = PyDateTime_GET_DAY(obj); - int month = PyDateTime_GET_MONTH(obj); - int year = PyDateTime_GET_YEAR(obj); - return new QDate(year, month, day); - } - return 0; - } - - static PyObject* transformToPython(QDate* d) - { - if (d) { - if (!PyDateTimeAPI) - PyDateTime_IMPORT; - - return PyDate_FromDate(d->year(), d->month(), d->day()); - } - return 0; - } -}; + return ValueTypeConverter::checkType(pyObj); +} + +inline PyObject* Converter::toPython(const ::QDate& cppObj) +{ + return ValueTypeConverter::toPython(cppObj); +} + +inline bool Converter::isConvertible(PyObject* pyObj) +{ + if (ValueTypeConverter::isConvertible(pyObj)) + return true; + + if (!PyDateTimeAPI) + PyDateTime_IMPORT; + + SbkObjectType* shiboType = reinterpret_cast(SbkType< ::QDate >()); + return PyDate_Check(pyObj) || ObjectType::isExternalConvertible(shiboType, pyObj); +} + +inline QDate Converter::toCpp(PyObject* pyObj) +{ + if (!PyDateTimeAPI) + PyDateTime_IMPORT; + + if (pyObj == Py_None) { + return QDate(); + } else if (PyObject_TypeCheck(pyObj, SbkType())) { + return *Converter::toCpp(pyObj); + } else if (PyDate_Check(pyObj)) { + int day = PyDateTime_GET_DAY(pyObj); + int month = PyDateTime_GET_MONTH(pyObj); + int year = PyDateTime_GET_YEAR(pyObj); + return QDate(year, month, day); + } else { + return ValueTypeConverter::toCpp(pyObj); + } +} + + } diff --git a/PySide/QtCore/qdatetime_conversions.h b/PySide/QtCore/qdatetime_conversions.h index a3cdf09..38c0336 100644 --- a/PySide/QtCore/qdatetime_conversions.h +++ b/PySide/QtCore/qdatetime_conversions.h @@ -1,41 +1,49 @@ namespace Shiboken { -template <> -struct PythonConverter + +inline bool Converter::checkType(PyObject* pyObj) { - static bool isPythonConvertible(PyObject* pyObj) - { - if (!PyDateTimeAPI) - PyDateTime_IMPORT; - - return pyObj && PyDateTime_Check(pyObj); - } - - static QDateTime* transformFromPython(PyObject* obj) - { - if (isPythonConvertible(obj)) { - int day = PyDateTime_GET_DAY(obj); - int month = PyDateTime_GET_MONTH(obj); - int year = PyDateTime_GET_YEAR(obj); - int hour = PyDateTime_DATE_GET_HOUR(obj); - int min = PyDateTime_DATE_GET_MINUTE(obj); - int sec = PyDateTime_DATE_GET_SECOND(obj); - int msec = PyDateTime_DATE_GET_MICROSECOND(obj); - return new QDateTime(QDate(year, month, day), QTime(hour, min, sec, msec)); - } - return 0; - } - - static PyObject* transformToPython(QDateTime* d) - { - if (d) { - if (!PyDateTimeAPI) - PyDateTime_IMPORT; - - QDate date = d->date(); - QTime time = d->time(); - return PyDateTime_FromDateAndTime(date.year(), date.month(), date.day(), time.hour(), time.minute(), time.second(), time.msec()); - } - return 0; - } -}; + return ValueTypeConverter::checkType(pyObj); +} + +inline PyObject* Converter::toPython(const ::QDateTime& cppObj) +{ + return ValueTypeConverter::toPython(cppObj); +} + +inline bool Converter::isConvertible(PyObject* pyObj) +{ + if (ValueTypeConverter::isConvertible(pyObj)) + return true; + + if (!PyDateTimeAPI) + PyDateTime_IMPORT; + + SbkObjectType* shiboType = reinterpret_cast(SbkType< ::QDateTime >()); + return PyDateTime_Check(pyObj) || ObjectType::isExternalConvertible(shiboType, pyObj); +} + + +inline QDateTime Converter::toCpp(PyObject* pyObj) +{ + if (!PyDateTimeAPI) + PyDateTime_IMPORT; + + if (pyObj == Py_None) { + return QDateTime(); + } else if (PyObject_TypeCheck(pyObj, SbkType())) { + return *Converter::toCpp(pyObj); + } else if (PyDateTime_Check(pyObj)) { + int day = PyDateTime_GET_DAY(pyObj); + int month = PyDateTime_GET_MONTH(pyObj); + int year = PyDateTime_GET_YEAR(pyObj); + int hour = PyDateTime_DATE_GET_HOUR(pyObj); + int min = PyDateTime_DATE_GET_MINUTE(pyObj); + int sec = PyDateTime_DATE_GET_SECOND(pyObj); + int usec = PyDateTime_DATE_GET_MICROSECOND(pyObj); + return QDateTime(QDate(year, month, day), QTime(hour, min, sec, usec/1000)); + } else { + return ValueTypeConverter::toCpp(pyObj); + } +} + } diff --git a/PySide/QtCore/qtime_conversions.h b/PySide/QtCore/qtime_conversions.h index 5e172fa..4600ef7 100644 --- a/PySide/QtCore/qtime_conversions.h +++ b/PySide/QtCore/qtime_conversions.h @@ -1,36 +1,45 @@ namespace Shiboken { -template <> -struct PythonConverter + +inline bool Converter::checkType(PyObject* pyObj) { - static bool isPythonConvertible(PyObject* pyObj) - { - if (!PyDateTimeAPI) - PyDateTime_IMPORT; - - return pyObj && PyTime_Check(pyObj); - } - - static QTime* transformFromPython(PyObject* obj) - { - if (isPythonConvertible(obj)) { - int hour = PyDateTime_TIME_GET_HOUR(obj); - int min = PyDateTime_TIME_GET_MINUTE(obj); - int sec = PyDateTime_TIME_GET_SECOND(obj); - int msec = PyDateTime_TIME_GET_MICROSECOND(obj); - return new QTime(hour, min, sec, msec); - } - return 0; - } - - static PyObject* transformToPython(QTime* d) - { - if (d) { - if (!PyDateTimeAPI) - PyDateTime_IMPORT; - - return PyTime_FromTime(d->hour(), d->minute(), d->second(), d->msec()); - } - return 0; - } -}; + return ValueTypeConverter::checkType(pyObj); +} + +inline PyObject* Converter::toPython(const ::QTime& cppObj) +{ + return ValueTypeConverter::toPython(cppObj); +} + +inline bool Converter::isConvertible(PyObject* pyObj) +{ + if (ValueTypeConverter::isConvertible(pyObj)) + return true; + + if (!PyDateTimeAPI) + PyDateTime_IMPORT; + + SbkObjectType* shiboType = reinterpret_cast(SbkType< ::QTime >()); + return PyTime_Check(pyObj) || ObjectType::isExternalConvertible(shiboType, pyObj); +} + +inline QTime Converter::toCpp(PyObject* pyObj) +{ + if (!PyDateTimeAPI) + PyDateTime_IMPORT; + + if (pyObj == Py_None) { + return QTime(); + } else if (PyObject_TypeCheck(pyObj, SbkType())) { + return *Converter::toCpp(pyObj); + } else if (PyTime_Check(pyObj)) { + int hour = PyDateTime_TIME_GET_HOUR(pyObj); + int min = PyDateTime_TIME_GET_MINUTE(pyObj); + int sec = PyDateTime_TIME_GET_SECOND(pyObj); + int usec = PyDateTime_TIME_GET_MICROSECOND(pyObj); + return QTime(hour, min, sec, usec/1000); + } else { + return ValueTypeConverter::toCpp(pyObj); + } +} + } diff --git a/PySide/QtCore/qvariant_conversions.h b/PySide/QtCore/qvariant_conversions.h index 68b6e8f..354955b 100644 --- a/PySide/QtCore/qvariant_conversions.h +++ b/PySide/QtCore/qvariant_conversions.h @@ -14,26 +14,28 @@ struct Converter return true; } - static QByteArray resolveMetaType(PyTypeObject* type, int &typeId) + static const char* resolveMetaType(PyTypeObject* type, int* typeId) { if (PyObject_TypeCheck(type, &SbkObjectType_Type)) { SbkObjectType* sbkType = reinterpret_cast(type); - QByteArray typeName(Shiboken::ObjectType::getOriginalName(sbkType)); - bool valueType = !typeName.endsWith("*"); + const char* typeName = Shiboken::ObjectType::getOriginalName(sbkType); + if (!typeName) + return 0; + bool valueType = '*' != typeName[qstrlen(typeName) - 1]; // Do not convert user type of value if (valueType && Shiboken::ObjectType::isUserType(type)) - return QByteArray(); + return 0; int obTypeId = QMetaType::type(typeName); if (obTypeId) { - typeId = obTypeId; - return QByteArray(typeName); + *typeId = obTypeId; + return typeName; } // Do not resolve types to value type if (valueType) - return QByteArray(); + return 0; // find in base types if (type->tp_base) { @@ -41,14 +43,14 @@ struct Converter } else if (type->tp_bases) { int size = PyTuple_GET_SIZE(type->tp_bases); for(int i=0; i < size; i++){ - QByteArray derivedName = resolveMetaType(reinterpret_cast(PyTuple_GET_ITEM(type->tp_bases, i)), typeId); - if (!derivedName.isEmpty()) + const char* derivedName = resolveMetaType(reinterpret_cast(PyTuple_GET_ITEM(type->tp_bases, i)), typeId); + if (derivedName) return derivedName; } } } - typeId = 0; - return QByteArray(); + *typeId = 0; + return 0; } static QVariant toCpp(PyObject* pyObj) @@ -80,34 +82,30 @@ struct Converter } else if (Shiboken::isShibokenEnum(pyObj)) { // QVariant(enum) return QVariant(Converter::toCpp(pyObj)); - } else if (PyDict_Check(pyObj)) { - return convertToVariantMap(pyObj); + } else if (Shiboken::Object::checkType(pyObj)) { + // a class supported by QVariant? + int typeCode; + const char* typeName = resolveMetaType(pyObj->ob_type, &typeCode); + if (typeCode && typeName) { + Shiboken::TypeResolver* tr = Shiboken::TypeResolver::get(typeName); + QVariant var(typeCode, (void*)0); + void* args[] = { var.data() }; + tr->toCpp(pyObj, args); + return var; + } + } + + //sequence and dictornay + if (PyDict_Check(pyObj)) { + QVariant ret = convertToVariantMap(pyObj); + if (ret.isValid()) + return ret; } else if (PySequence_Check(pyObj)) { return convertToVariantList(pyObj); - } else { - // a class supported by QVariant? - if (Shiboken::Object::checkType(pyObj)) { - SbkObjectType* objType = reinterpret_cast(pyObj->ob_type); - int typeCode = 0; - QByteArray typeName = resolveMetaType(reinterpret_cast(objType), typeCode); - if (typeCode) { - Shiboken::TypeResolver* tr = Shiboken::TypeResolver::get(typeName); - void* data = 0; - data = tr->toCpp(pyObj, &data, true); - if (typeName.endsWith("*")) { - QVariant var(typeCode, &data); - tr->deleteObject(data); - return var; - } else { - QVariant var(typeCode, data); - tr->deleteObject(data); - return var; - } - } - } - // Is a shiboken type not known by Qt - return QVariant::fromValue(pyObj); } + + // Is a shiboken type not known by Qt + return QVariant::fromValue(pyObj); } static PyObject* toPython(void* cppObj) @@ -140,28 +138,25 @@ struct Converter return QVariant(); Shiboken::AutoDecRef element(PySequence_GetItem(list, 0)); - int typeId = 0; - QByteArray typeName = resolveMetaType(element.cast(), typeId); - if (!typeName.isEmpty()) { - QByteArray listTypeName = QByteArray("QList<"+typeName+">"); + int typeId; + const char* typeName = resolveMetaType(element.cast(), &typeId); + if (typeName) { + QByteArray listTypeName("QList<"); + listTypeName += typeName; + listTypeName += '>'; typeId = QMetaType::type(listTypeName); if (typeId > 0) { Shiboken::TypeResolver* tr = Shiboken::TypeResolver::get(listTypeName); if (!tr) { qWarning() << "TypeResolver for :" << listTypeName << "not registered."; - return QVariant(); } else { - void *data = 0; - data = tr->toCpp(list, &data, true); - QVariant var(typeId, data); - tr->deleteObject(data); + QVariant var(typeId, (void*)0); + void* args[] = { var.data(), 0 }; + tr->toCpp(list, args); return var; } - } else { - return QVariant(); } } - return QVariant(); } @@ -177,7 +172,7 @@ struct Converter ret.insert(Converter::toCpp(key), toCpp(value)); return QVariant(ret); } else { - return toCpp(map); + return QVariant(); } } diff --git a/PySide/QtCore/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index 6da4f64..1185542 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -22,26 +22,26 @@ - - - + + + - - - - + + + + - + - - + + @@ -56,17 +56,6 @@ - - - - - - - - - - - @@ -88,11 +77,14 @@ + + + @@ -149,6 +141,7 @@ + @@ -182,26 +175,6 @@ - - - - - - - - - - - - - - - - - - - - @@ -256,245 +229,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - @@ -506,11 +245,10 @@ - - + - + @@ -522,38 +260,38 @@ - + - + - + - - - + + + - - + + - + - + - + - - - + + + @@ -565,26 +303,28 @@ - - + + - + - + - - + + + + @@ -596,6 +336,37 @@ + + namespace PySide { + static QStack<PyObject*> globalPostRoutineFunctions; + void globalPostRoutineCallback() + { + foreach(PyObject* callback, globalPostRoutineFunctions) { + Shiboken::AutoDecRef result(PyObject_CallObject(callback, NULL)); + Py_DECREF(callback); + } + globalPostRoutineFunctions.clear(); + } + void addPostRoutine(PyObject* callback) + { + if (PyCallable_Check(callback)) { + globalPostRoutineFunctions << callback; + Py_INCREF(callback); + } else { + PyErr_SetString(PyExc_TypeError, "qAddPostRoutine: The argument must be a callable object."); + } + } + } // namespace + + + + PySide::addPostRoutine(%1); + + + + qAddPostRoutine(PySide::globalPostRoutineCallback); + + @@ -619,13 +390,13 @@ // Define a global variable to handle qInstallMsgHandler callback static PyObject* qtmsghandler = 0; - void - msghandlercallback(QtMsgType type, const char* msg) + static void msgHandlerCallback(QtMsgType type, const char* msg) { + Shiboken::GilState state; Shiboken::AutoDecRef arglist(Shiboken::makeTuple(type, msg)); Shiboken::AutoDecRef ret(PyObject_CallObject(qtmsghandler, arglist)); } - void QtCoreModuleExit() + static void QtCoreModuleExit() { PySide::SignalManager::instance().clear(); } @@ -642,7 +413,7 @@ %PYARG_0 = qtmsghandler ? qtmsghandler : Py_None; Py_INCREF(%PYARG_1); qtmsghandler = %PYARG_1; - qInstallMsgHandler(msghandlercallback); + qInstallMsgHandler(msgHandlerCallback); } if (%PYARG_0 == Py_None) @@ -662,10 +433,19 @@ + + + + + + + + + - + @@ -677,17 +457,44 @@ } }; + + + + + + + + + + + + + + + + + + - + + + + + + + + + + @@ -703,44 +510,77 @@ - - - - - - - + + + + - + + + + + + + + + + - + + + + if (!PyDateTimeAPI) PyDateTime_IMPORT; + %PYARG_0 = PyDate_FromDate(%CPPSELF.year(), %CPPSELF.month(), %CPPSELF.day()); + + @@ -773,10 +613,11 @@ %PYARG_0 = Shiboken::makeTuple(week, yearNumber); + - + @@ -791,34 +632,66 @@ %0 = new %TYPE(date, time, Qt::TimeSpec(%8)); + + + QDate date(%1, %2, %3); + QTime time(%4, %5, %6); + %0 = new %TYPE(date, time); + + + + + + + + + + + - + + + + QDate date = %CPPSELF.date(); + QTime time = %CPPSELF.time(); + if (!PyDateTimeAPI) PyDateTime_IMPORT; + %PYARG_0 = PyDateTime_FromDateAndTime(date.year(), date.month(), date.day(), time.hour(), time.minute(), time.second(), time.msec()*1000); + + - - + + - + - + + + + + + + + + - + @@ -830,26 +703,67 @@ } }; + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + - + @@ -862,13 +776,60 @@ }; - + + + + + + + + + + + + + + + + + int a, b, c, d; + %CPPSELF.%FUNCTION_NAME(&a, &b, &c, &d); + %PYARG_0 = Shiboken::makeTuple(a, b, c, d); + - + + + + + + + + + + + + + + + + + int a, b, c, d; + %CPPSELF.%FUNCTION_NAME(&a, &b, &c, &d); + %PYARG_0 = Shiboken::makeTuple(a, b, c, d); + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + + if (!PyDateTimeAPI) PyDateTime_IMPORT; + %PYARG_0 = PyTime_FromTime(%CPPSELF.hour(), %CPPSELF.minute(), %CPPSELF.second(), %CPPSELF.msec()*1000); + + - - + + + + + + + + + + + + + + + + + + - + - @@ -953,10 +1028,12 @@ - + + + @@ -975,6 +1052,9 @@ + + + @@ -984,6 +1064,9 @@ + + + @@ -993,6 +1076,9 @@ + + + @@ -1002,6 +1088,9 @@ + + + @@ -1010,6 +1099,9 @@ + + + @@ -1018,6 +1110,9 @@ + + + @@ -1026,6 +1121,9 @@ + + + @@ -1034,13 +1132,15 @@ + + + - return %CPPSELF.size(); @@ -1074,13 +1174,35 @@ + + + + + + + + + %CPPSELF.unlock(); + + + + + + + + + + + %CPPSELF.unlock(); + + - + @@ -1099,21 +1221,45 @@ + - - + + + - + + + + + + + + + + %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%CPPSELF.%FUNCTION_NAME(%1, %2, %PYARG_3)); + + Creates a model index for the given row and column with the internal pointer ptr. + When using a QSortFilterProxyModel, its indexes have their own internal pointer. It is not advisable to access this internal pointer outside of the model. Use the data() function instead. + This function provides a consistent interface that model subclasses must use to create model indexes. + + .. warning:: Because of some Qt/Python itegration rules, the ptr argument do not get the reference incremented during the QModelIndex life time. So it is necessary to keep the object used on ptr argument alive during the whole process. Do not destroy the object if you are not sure about that. + - + + + + + + + @@ -1129,7 +1275,7 @@ %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%CPPSELF.%FUNCTION_NAME()); - + @@ -1137,6 +1283,16 @@ + + + Shiboken::Object::keepReference((SbkObject*)%PYARG_1, "eventFilter", %PYSELF, true); + + + + + Shiboken::Object::removeReference((SbkObject*)%PYARG_1, "eventFilter", %PYSELF); + + @@ -1234,31 +1390,6 @@ %PYARG_0 = %CONVERTTOPYTHON[bool](qobjectDisconnectCallback(%1, %2, %3)); - - static bool - qobjectInheritsInternal(PyTypeObject *objType, const char *class_name) - { - if (strcmp(objType->tp_name, class_name) == 0) - return true; - - PyTypeObject* base = (objType)->tp_base; - if (base == 0) - return false; - return qobjectInheritsInternal(base, class_name); - } - - - - bool retval = qobjectInheritsInternal(self->ob_type, %1) ? true : %CPPSELF.%FUNCTION_NAME(%1); - %PYARG_0 = %CONVERTTOPYTHON[bool](retval); - - - - - - @@ -1279,6 +1410,18 @@ + + + + + + + %PYARG_0 = PyList_New(0); + _findChildrenHelper(%CPPSELF, %2, (PyTypeObject*)%PYARG_1, %PYARG_0); + + + + @@ -1313,21 +1456,40 @@ - QString result; if (QCoreApplication::instance()) { - PyObject *klass = PyObject_GetAttrString(%PYSELF, "__class__"); - PyObject *cname = PyObject_GetAttrString(klass, "__name__"); - result = QString(QCoreApplication::instance()->translate(PyString_AsString(cname), %1, %2, QCoreApplication::UnicodeUTF8, %3)); - - Py_DECREF(klass); - Py_DECREF(cname); + Shiboken::AutoDecRef klass(PyObject_GetAttrString(%PYSELF, "__class__")); + Shiboken::AutoDecRef cname(PyObject_GetAttrString(klass, "__name__")); + QString result = QCoreApplication::instance()->translate(PyString_AS_STRING(cname.object()), %1, %2, QCoreApplication::UnicodeUTF8, %3); + %PYARG_0 = %CONVERTTOPYTHON[QString](result); } else { - result = QString(QString::fromLatin1(%1)); + Py_INCREF(%PYARG_1); + %PYARG_0 = %PYARG_1; } - %PYARG_0 = %CONVERTTOPYTHON[QString](result); + + + + + + + + + if (QCoreApplication::instance()) { + Shiboken::AutoDecRef klass(PyObject_GetAttrString(%PYSELF, "__class__")); + Shiboken::AutoDecRef cname(PyObject_GetAttrString(klass, "__name__")); + Shiboken::AutoDecRef str(PyUnicode_AsUTF8String(%1)); + QString result = QCoreApplication::instance()->translate(PyString_AS_STRING(cname.object()), PyString_AS_STRING(str.object()), %2, QCoreApplication::UnicodeUTF8, %3); + %PYARG_0 = %CONVERTTOPYTHON[QString](result); + } else { + Py_INCREF(%PYARG_1); + %PYARG_0 = %PYARG_1; + } + + + + // Avoid return +1 because SignalManager connect to "destroyed()" signal to control object timelife @@ -1348,7 +1510,7 @@ - + @@ -1359,7 +1521,7 @@ - + <para>URLs can be represented in two forms: encoded or unencoded. The unencoded representation is suitable for showing to users, but the encoded representation is typically what you would send to a web server. For example, the unencoded URL "http://bühler.example.com" would be sent to the server as "http://xn--bhler-kva.example.com/List%20of%20applicants.xml".</para> @@ -1367,10 +1529,19 @@ + + + + + + + + + - + @@ -1382,14 +1553,58 @@ + + + + + + + + + - + + + + + + + + + + Replaces every occurrence of the regular expression in *sourceString* with *after*. + Returns a new Python string with the modified contents. For example: + + :: + + s = "Banana" + re = QRegExp("a[mn]") + s = re.replace(s, "ox") + # s == "Boxoxa" + + + For regular expressions containing capturing parentheses, occurrences of \1, \2, ..., in *after* + are replaced with rx.cap(1), cap(2), ... + + :: + + t = "A <i>bon mot</i>." + re = QRegExp("<i>([^<]*)</i>") + t = re.replace(t, "\\emph{\\1}") + # t == "A \\emph{bon mot}." + + + + %1.replace(*%CPPSELF, %2); + %PYARG_0 = %CONVERTTOPYTHON[QString](%1); + + @@ -1399,28 +1614,123 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Shiboken::AutoDecRef str(PyUnicode_AsASCIIString(arg)); + if (!str.isNull()) { + QByteArray b(PyString_AS_STRING(str.object()), PyString_GET_SIZE(str.object())); + b.prepend(*%CPPSELF); + %PYARG_0 = %CONVERTTOPYTHON[QByteArray](b); + } + + + + + Shiboken::AutoDecRef str(PyUnicode_AsASCIIString(arg)); + if (!str.isNull()) { + QByteArray b(PyString_AS_STRING(str.object()), PyString_GET_SIZE(str.object())); + b.append(*%CPPSELF); + %PYARG_0 = %CONVERTTOPYTHON[QByteArray](b); + } + + + + + QByteArray b(PyString_AS_STRING(arg), PyString_GET_SIZE(arg)); + %PYARG_0 = %CONVERTTOPYTHON[QByteArray](b + *%CPPSELF); + + + + + + + QByteArray b(((PyObject*)%PYSELF)->ob_type->tp_name); + b += '('; + Shiboken::AutoDecRef contents(PyObject_Repr(PyString_FromStringAndSize(%CPPSELF.constData(), %CPPSELF.size()))); + b += PyString_AS_STRING(contents.object()); + b += ")"; + %PYARG_0 = PyString_FromStringAndSize(b.constData(), b.size()); + + + - - + + - int size = PyString_Size(pyargs[0]); + int size = PyString_GET_SIZE(pyargs[0]); %0 = new QByteArray(%1, size); @@ -1433,13 +1743,14 @@ #endif - + %PYARG_0 = PyString_FromStringAndSize(%CPPSELF.%FUNCTION_NAME(), %CPPSELF.size()); + @@ -1447,33 +1758,41 @@ + + + - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - char c = PyString_AS_STRING(%PYARG_1)[0]; - if (c) { - %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%CPPSELF.%FUNCTION_NAME(c)); - } - - + + @@ -1538,126 +1857,15 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + %PYARG_0 = %CONVERTTOPYTHON[QByteArray](%CPPSELF.%FUNCTION_NAME(PyString_AS_STRING(%PYARG_1), PyString_GET_SIZE(%PYARG_1))); + @@ -1675,9 +1883,9 @@ - + - %PYARG_0 = PyString_FromString(%CPPSELF.data()); + %PYARG_0 = PyString_FromStringAndSize(%CPPSELF.constData(), %CPPSELF.size()); @@ -1708,10 +1916,22 @@ return !result ? -1 : 0; + + + Py_ssize_t max = %CPPSELF.count(); + _i1 = qBound(Py_ssize_t(0), _i1, max); + _i2 = qBound(Py_ssize_t(0), _i2, max); + + if (_i1 >= _i2) + return %CONVERTTOPYTHON[QByteArray](QByteArray()); + return %CONVERTTOPYTHON[QByteArray](%CPPSELF.mid(_i1, _i2 - _i1)); + + - + + @@ -1722,7 +1942,7 @@ - + @@ -1730,17 +1950,24 @@ - + - - - - - - - + + + + + + uchar* ptr = (uchar*) Shiboken::Buffer::getPointer(%PYARG_1); + %PYARG_0 = %CONVERTTOPYTHON[bool](%CPPSELF.%FUNCTION_NAME(ptr)); + + + + + %PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(%1, %2, %3), %2, Shiboken::Buffer::ReadWrite); + + @@ -1752,7 +1979,7 @@ - + @@ -1761,9 +1988,13 @@ + + + + @@ -1785,11 +2016,15 @@ - + - const QByteArray ba(%CONVERTTOCPP[QByteArray](%PYARG_0)); - memcpy(%1, ba.data(), ba.size()); - long long %out = ba.size(); + %RETURN_TYPE %out; + if (!PyString_Check(%PYARG_0)) { + %out = -1; + } else { + %out = PyString_GET_SIZE((PyObject*)%PYARG_0); + qstrncpy(%1, PyString_AS_STRING((PyObject*)%PYARG_0), %out + 1); + } @@ -1804,30 +2039,51 @@ - + - const QByteArray ba(%CONVERTTOCPP[QByteArray](%PYARG_0)); - memcpy(data, ba.data(), ba.size()); - long long %out = ba.size(); + %RETURN_TYPE %out; + if (!PyString_Check(%PYARG_0)) { + %out = -1; + } else { + %out = PyString_GET_SIZE((PyObject*)%PYARG_0); + qstrncpy(%1, PyString_AS_STRING((PyObject*)%PYARG_0), %out + 1); + } - + + + + + + %CPPSELF.%FUNCTION_NAME(PyString_AS_STRING(%PYARG_1), PyString_GET_SIZE(%PYARG_1)); + + - + + + + + - + + + + + %CPPSELF.unlock(); + + @@ -1842,6 +2098,20 @@ + + + + + + + Shiboken::AutoDecRef fileNo(PyObject_GetAttrString(%PYARG_1, "fileno")); + if (!fileNo.isNull()) { + Shiboken::AutoDecRef fileNoValue(PyObject_CallObject(fileNo, 0)); + if (%CHECKTYPE[int](fileNoValue)) + %0 = new %TYPE(%CONVERTTOCPP[int](fileNoValue), %2, %3); + } + + @@ -1863,7 +2133,7 @@ - + @@ -1891,11 +2161,13 @@ + - + + @@ -1904,8 +2176,19 @@ - - + + + + + + + + + Py_ssize_t size; + uchar* ptr = (uchar*) Shiboken::Buffer::getPointer(%PYARG_1, &size); + %PYARG_0 = %CONVERTTOPYTHON[bool](%CPPSELF.%FUNCTION_NAME(const_cast<const uchar*>(ptr), size)); + + @@ -1916,10 +2199,8 @@ - - - + @@ -1941,7 +2222,8 @@ %PYARG_2, %3) ); - Shiboken::Object::invalidate((SbkObject*)pyTimer); + Shiboken::Object::releaseOwnership((SbkObject*)pyTimer); + Py_XDECREF(pyTimer); timer->setSingleShot(true); timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater())); timer->start(%1); @@ -1955,7 +2237,6 @@ Shiboken::SbkType<QTimer>()->tp_init(pyTimer, emptyTuple, 0); QTimer* timer = %CONVERTTOCPP[QTimer*](pyTimer); timer->setSingleShot(true); - timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater())); if (PyObject_TypeCheck(%2, &PySideSignalInstanceType)) { PySideSignalInstance* signalInstance = reinterpret_cast<PySideSignalInstance*>(%2); @@ -1979,25 +2260,34 @@ pyargs[1]) ); } - Shiboken::Object::invalidate((SbkObject*)pyTimer); + + timer->connect(timer, SIGNAL(timeout()), timer, SLOT(deleteLater()), Qt::DirectConnection); + Shiboken::Object::releaseOwnership((SbkObject*)pyTimer); + Py_XDECREF(pyTimer); timer->start(%1); - + + + + + + + - + - + @@ -2009,8 +2299,74 @@ - - + + + + + + + + + + + + + uchar* ptr = (uchar*)Shiboken::Buffer::getPointer(%PYARG_1); + %PYARG_0 = %CONVERTTOPYTHON[bool](%CPPSELF.%FUNCTION_NAME(ptr)); + + + + + %PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(%1, %2, %3), %2, Shiboken::Buffer::ReadWrite); + + + + + + QByteArray ba; + ba.resize(%2); + %CPPSELF.%FUNCTION_NAME(ba.data(), ba.size()); + %PYARG_0 = PyString_FromStringAndSize(ba.constData(), ba.size()); + + + + + + + + %RETURN_TYPE %out; + if (!PyString_Check(%PYARG_0)) { + %out = -1; + } else { + %out = PyString_GET_SIZE((PyObject*)%PYARG_0); + qstrncpy(%1, PyString_AS_STRING((PyObject*)%PYARG_0), %out + 1); + } + + + + + + QByteArray ba; + ba.resize(%2); + %CPPSELF.%FUNCTION_NAME(ba.data(), ba.size()); + %PYARG_0 = PyString_FromStringAndSize(ba.constData(), ba.size()); + + + + + + + + %RETURN_TYPE %out; + if (!PyString_Check(%PYARG_0)) { + %out = -1; + } else { + %out = PyString_GET_SIZE((PyObject*)%PYARG_0); + qstrncpy(%1, PyString_AS_STRING((PyObject*)%PYARG_0), %out + 1); + } + + + @@ -2018,7 +2374,7 @@ - + @@ -2026,8 +2382,6 @@ - - @@ -2041,6 +2395,10 @@ %PYARG_0 = Shiboken::makeTuple(retval, pid); + + + + @@ -2062,6 +2420,11 @@ in a more convenient form by the :meth:`~QCoreApplication.arguments()` method. + + + QCoreApplication_constructor(%PYSELF, args, &%0); + + @@ -2070,16 +2433,24 @@ - - - + + QCoreApplication* app = QCoreApplication::instance(); + PyObject* pyApp = Py_None; + if (app) { + pyApp = reinterpret_cast<PyObject*>(Shiboken::BindingManager::instance().retrieveWrapper(app)); + if (!pyApp) + pyApp = %CONVERTTOPYTHON[QCoreApplication*](app); // this will keep app live after python exit (extra ref) + } + %PYARG_0 = pyApp; + Py_XINCREF(%PYARG_0); + - - + - + + @@ -2095,6 +2466,29 @@ + + + + + long *%out = new long; + %out = 0; + + + + + + %RETURN_TYPE %out = false; + if (PySequence_Check(%PYARG_0) && (PySequence_Size(%PYARG_0) == 2)) { + Shiboken::AutoDecRef pyResult(PySequence_GetItem(%PYARG_0, 0)); + %out = %CONVERTTOCPP[bool](pyResult); + } + + + + %PYARG_0 = Shiboken::makeTuple(%0, *result_out); + delete result_out; + + @@ -2103,12 +2497,15 @@ - + - - + + + + + @@ -2117,7 +2514,7 @@ - + @@ -2135,9 +2532,10 @@ - + + @@ -2148,6 +2546,7 @@ + @@ -2160,7 +2559,9 @@ + + @@ -2173,6 +2574,7 @@ + *(%CPPSELF) << %1; @@ -2229,26 +2631,26 @@ QByteArray data; data.resize(%2); - %CPPSELF.%FUNCTION_NAME(data.data(), data.size()); - %PYARG_0 = PyString_FromStringAndSize(data.constData(), data.size()); + int result = %CPPSELF.%FUNCTION_NAME(data.data(), data.size()); + if (result == -1) { + Py_INCREF(Py_None); + %PYARG_0 = Py_None; + } else { + %PYARG_0 = PyString_FromStringAndSize(data.data(), result); + } - - - int r = %CPPSELF.%FUNCTION_NAME(%1, PyString_Size(%PYARG_1)); + int r = %CPPSELF.%FUNCTION_NAME(%1, PyString_GET_SIZE(%PYARG_1)); %PYARG_0 = %CONVERTTOPYTHON[int](r); - - - @@ -2371,7 +2773,9 @@ - + + + @@ -2383,11 +2787,12 @@ - + + @@ -2425,7 +2830,7 @@ - + @@ -2438,12 +2843,9 @@ - - - - + @@ -2451,22 +2853,21 @@ - - - + - + + + + + - %PYARG_0 = (PyObject*)%CPPSELF.%FUNCTION_NAME(); - if (!%PYARG_0) - %PYARG_0 = Py_None; - Py_XINCREF(%PYARG_0); + @@ -2487,31 +2888,37 @@ + + + + + + - + - + - + @@ -2532,33 +2939,33 @@ - + - + - + - + - + @@ -2595,18 +3002,34 @@ - - - - - - - + + + + + + + + + + PySideEasingCurveFunctor::init(); + + + + + QEasingCurve::EasingFunction func = PySideEasingCurveFunctor::createCustomFuntion(%PYSELF, %PYARG_1); + if (func) + %CPPSELF.%FUNCTION_NAME(func); + + + + + //%FUNCTION_NAME() + %PYARG_0 = PySideEasingCurveFunctor::callable(%PYSELF); + + - + @@ -2621,27 +3044,25 @@ - + - + - + - + - + - + - + - + - - - + @@ -2661,7 +3082,7 @@ - + @@ -2678,6 +3099,7 @@ if (PySide::SignalManager::registerMetaMethod(%1, signalName.mid(1).toAscii().data(), QMetaMethod::Signal)) { %PYARG_0 = %CONVERTTOPYTHON[QSignalTransition*](%CPPSELF->addTransition(%1, %2, %3)); } else { + Py_INCREF(Py_None); %PYARG_0 = Py_None; } @@ -2715,13 +3137,13 @@ - + - - + + @@ -2734,8 +3156,6 @@ - - %PYARG_0 = PySet_New(0); @@ -2747,6 +3167,8 @@ + + %PYARG_0 = PyList_New(0); @@ -2759,7 +3181,7 @@ - + @@ -2775,20 +3197,30 @@ - - (void)%1;%PYARG_0 = %PYARG_1; + + + + - - (void)%1;%PYARG_0 = %PYARG_1; + + + + - - (void)%1;(void)%2;%PYARG_0 = %PYARG_2; + + + + - - (void)%1;(void)%2;(void)%3;%PYARG_0 = %PYARG_2; + + + + - - (void)%1;%PYARG_0 = %PYARG_1; + + + + @@ -2823,11 +3255,6 @@ - - - - - @@ -2842,8 +3269,6 @@ - - @@ -2851,10 +3276,23 @@ + + + + + + + + + + + + + diff --git a/PySide/QtCore/typesystem_core_win.xml b/PySide/QtCore/typesystem_core_win.xml new file mode 100644 index 0000000..c4150cd --- /dev/null +++ b/PySide/QtCore/typesystem_core_win.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + diff --git a/PySide/QtDeclarative/CMakeLists.txt b/PySide/QtDeclarative/CMakeLists.txt index 1788adc..01cf877 100644 --- a/PySide/QtDeclarative/CMakeLists.txt +++ b/PySide/QtDeclarative/CMakeLists.txt @@ -1,5 +1,7 @@ project(QtDeclarative) +set(QtDeclarative_registerType "${CMAKE_CURRENT_SOURCE_DIR}/pysideqmlregistertype.cpp") + set(QtDeclarative_SRC ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtDeclarative/qdeclarativecomponent_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtDeclarative/qdeclarativecontext_wrapper.cpp @@ -56,5 +58,5 @@ create_pyside_module(QtDeclarative QtDeclarative_deps QtDeclarative_typesystem_path QtDeclarative_SRC - "") + QtDeclarative_registerType) diff --git a/PySide/QtDeclarative/pysideqmlregistertype.cpp b/PySide/QtDeclarative/pysideqmlregistertype.cpp new file mode 100644 index 0000000..f5b878b --- /dev/null +++ b/PySide/QtDeclarative/pysideqmlregistertype.cpp @@ -0,0 +1,339 @@ +/* + * This file is part of the Shiboken Python Bindings Generator project. + * + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * Contact: PySide team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "pysideqmlregistertype.h" +// Qt +#include +#include +#include +// shiboken +#include +#include +#include +// pyside +#include +#include +#include + +// auto generated headers +#include "qdeclarativeitem_wrapper.h" +#include "pyside_qtcore_python.h" +#include "pyside_qtdeclarative_python.h" + +#ifndef PYSIDE_MAX_QML_TYPES +// Maximum number of different types the user cna export to QML using qmlRegisterType. +#define PYSIDE_MAX_QML_TYPES 50 +#endif + +// Forward declarations +static void propListMetaCall(PySideProperty* pp, PyObject* self, QMetaObject::Call call, void** args); + + +// All registered python types +static PyObject* pyTypes[PYSIDE_MAX_QML_TYPES]; +static void (*createFuncs[PYSIDE_MAX_QML_TYPES])(void*); + +/// QDeclarativeItem will create objects using placement new then this pointer is non-null. +void* PySide::nextQmlElementMemoryAddr = 0; +// Mutex used to avoid race condition on PySide::nextQmlElementMemoryAddr +static QMutex nextQmlElementMutex; + +template +struct ElementFactoryBase +{ + static void createInto(void* memory) + { + QMutexLocker locker(&nextQmlElementMutex); + PySide::nextQmlElementMemoryAddr = memory; + Shiboken::GilState state; + PyObject* obj = PyObject_CallObject(pyTypes[N], 0); + if (!obj || PyErr_Occurred()) + PyErr_Print(); + PySide::nextQmlElementMemoryAddr = 0; + } +}; + +template +struct ElementFactory : ElementFactoryBase +{ + static void init() + { + createFuncs[N] = &ElementFactoryBase::createInto; + ElementFactory::init(); + } +}; + +template<> +struct ElementFactory<0> : ElementFactoryBase<0> +{ + static void init() + { + createFuncs[0] = &ElementFactoryBase<0>::createInto; + } +}; + +int PySide::qmlRegisterType(PyObject* pyObj, const char* uri, int versionMajor, int versionMinor, const char* qmlName) +{ + using namespace Shiboken; + + static PyTypeObject* declarativeItemType = TypeResolver::get("QDeclarativeItem*")->pythonType(); + assert(declarativeItemType); + static int nextType = 0; + + if (nextType >= PYSIDE_MAX_QML_TYPES) { + PyErr_Format(PyExc_TypeError, "QML doesn't really like language bindings, so you can only export %d types to QML.", PYSIDE_MAX_QML_TYPES); + return -1; + } + + if (!PySequence_Contains(((PyTypeObject*)pyObj)->tp_mro, (PyObject*)declarativeItemType)) { + PyErr_Format(PyExc_TypeError, "A type inherited from %s expected, got %s.", declarativeItemType->tp_name, ((PyTypeObject*)pyObj)->tp_name); + return -1; + } + + QMetaObject* metaObject = reinterpret_cast(ObjectType::getTypeUserData(reinterpret_cast(pyObj))); + Q_ASSERT(metaObject); + + // All ready... now the ugly code begins... :-) + pyTypes[nextType] = pyObj; + + // Init proxy object static meta object + QDeclarativePrivate::RegisterType type; + type.version = 0; + type.typeId = qMetaTypeId(); + type.listId = qMetaTypeId >(); + type.objectSize = sizeof(QDeclarativeItemWrapper); + type.create = createFuncs[nextType]; + type.uri = uri; + type.versionMajor = versionMajor; + type.versionMinor = versionMinor; + type.elementName = qmlName; + type.metaObject = metaObject; + + type.attachedPropertiesFunction = QDeclarativePrivate::attachedPropertiesFunc(); + type.attachedPropertiesMetaObject = QDeclarativePrivate::attachedPropertiesMetaObject(); + + type.parserStatusCast = QDeclarativePrivate::StaticCastSelector::cast(); + type.valueSourceCast = QDeclarativePrivate::StaticCastSelector::cast(); + type.valueInterceptorCast = QDeclarativePrivate::StaticCastSelector::cast(); + + type.extensionObjectCreate = 0; + type.extensionMetaObject = 0; + type.customParser = 0; + + int qmlTypeId = QDeclarativePrivate::qmlregister(QDeclarativePrivate::TypeRegistration, &type); + ++nextType; + return qmlTypeId; +} + +extern "C" +{ + +// This is the user data we store in the property. +struct DeclarativeListProperty +{ + PyTypeObject* type; + PyObject* append; + PyObject* at; + PyObject* clear; + PyObject* count; +}; + +static int propListTpInit(PyObject* self, PyObject* args, PyObject* kwds) +{ + static const char *kwlist[] = {"type", "append", "at", "clear", "count", 0}; + PySideProperty* pySelf = reinterpret_cast(self); + DeclarativeListProperty* data = new DeclarativeListProperty; + memset(data, 0, sizeof(DeclarativeListProperty)); + + if (!PyArg_ParseTupleAndKeywords(args, kwds, + "OO|OOO:QtDeclarative.ListProperty", (char**) kwlist, + &data->type, + &data->append, + &data->at, + &data->clear, + &data->count)) { + return 0; + } + PySide::Property::setMetaCallHandler(pySelf, &propListMetaCall); + PySide::Property::setTypeName(pySelf, "QDeclarativeListProperty"); + PySide::Property::setUserData(pySelf, data); + + return 1; +} + +void propListTpFree(void* self) +{ + PySideProperty* pySelf = reinterpret_cast(self); + delete reinterpret_cast(PySide::Property::userData(pySelf)); + // calls base type constructor + pySelf->ob_type->tp_base->tp_free(self); +} + +PyTypeObject PropertyListType = { + PyObject_HEAD_INIT(0) + 0, /*ob_size*/ + "ListProperty", /*tp_name*/ + sizeof(PySideProperty), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + 0, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + 0, /*tp_doc */ + 0, /*tp_traverse */ + 0, /*tp_clear */ + 0, /*tp_richcompare */ + 0, /*tp_weaklistoffset */ + 0, /*tp_iter */ + 0, /*tp_iternext */ + 0, /*tp_methods */ + 0, /*tp_members */ + 0, /*tp_getset */ + &PySidePropertyType, /*tp_base */ + 0, /*tp_dict */ + 0, /*tp_descr_get */ + 0, /*tp_descr_set */ + 0, /*tp_dictoffset */ + propListTpInit, /*tp_init */ + 0, /*tp_alloc */ + 0, /*tp_new */ + propListTpFree, /*tp_free */ + 0, /*tp_is_gc */ + 0, /*tp_bases */ + 0, /*tp_mro */ + 0, /*tp_cache */ + 0, /*tp_subclasses */ + 0, /*tp_weaklist */ + 0, /*tp_del */ +}; + +} // extern "C" + +// Implementation of QDeclarativeListProperty::AppendFunction callback +void propListAppender(QDeclarativeListProperty* propList, QDeclarativeItem* item) +{ + Shiboken::GilState state; + Shiboken::AutoDecRef args(Shiboken::makeTuple(propList->object, item)); + + DeclarativeListProperty* data = reinterpret_cast(propList->data); + Shiboken::AutoDecRef retVal(PyObject_CallObject(data->append, args)); + + if (PyErr_Occurred()) + PyErr_Print(); +} + +// Implementation of QDeclarativeListProperty::CountFunction callback +int propListCount(QDeclarativeListProperty* propList) +{ + Shiboken::GilState state; + Shiboken::AutoDecRef args(Shiboken::makeTuple(propList->object)); + + DeclarativeListProperty* data = reinterpret_cast(propList->data); + Shiboken::AutoDecRef retVal(PyObject_CallObject(data->count, args)); + + // Check return type + if (PyErr_Occurred()) + PyErr_Print(); + else if (Shiboken::Converter::isConvertible(retVal)) + return Shiboken::Converter::toCpp(retVal); + + return 0; +} + +// Implementation of QDeclarativeListProperty::AtFunction callback +QDeclarativeItem* propListAt(QDeclarativeListProperty* propList, int index) +{ + Shiboken::GilState state; + Shiboken::AutoDecRef args(Shiboken::makeTuple(propList->object, index)); + + DeclarativeListProperty* data = reinterpret_cast(propList->data); + Shiboken::AutoDecRef retVal(PyObject_CallObject(data->at, args)); + + if (PyErr_Occurred()) + PyErr_Print(); + else if (PyType_IsSubtype(Py_TYPE(retVal), data->type)) + return Shiboken::Converter::toCpp(retVal); + + return 0; +} + +// Implementation of QDeclarativeListProperty::ClearFunction callback +void propListClear(QDeclarativeListProperty* propList) +{ + Shiboken::GilState state; + Shiboken::AutoDecRef args(Shiboken::makeTuple(propList->object)); + + DeclarativeListProperty* data = reinterpret_cast(propList->data); + Shiboken::AutoDecRef retVal(PyObject_CallObject(data->clear, args)); + + if (PyErr_Occurred()) + PyErr_Print(); +} + +// qt_metacall specialization for ListProperties +static void propListMetaCall(PySideProperty* pp, PyObject* self, QMetaObject::Call call, void** args) +{ + if (call != QMetaObject::ReadProperty) + return; + + DeclarativeListProperty* data = reinterpret_cast(PySide::Property::userData(pp)); + QDeclarativeListProperty declProp(Shiboken::Converter::toCpp(self), data, &propListAppender); + + if (data->count) + declProp.count = &propListCount; + if (data->at) + declProp.at = &propListAt; + if (data->clear) + declProp.clear = &propListClear; + + // Copy the data to the memory location requested by the meta call + void* v = args[0]; + *reinterpret_cast*>(v) = declProp; +} + + +void PySide::initQmlSupport(PyObject* module) +{ + ElementFactory::init(); + + // Export DeclarativeListProperty type + if (PyType_Ready(&PropertyListType) < 0) + return; + + Py_INCREF((PyObject*)&PropertyListType); + PyModule_AddObject(module, PropertyListType.tp_name, (PyObject*)&PropertyListType); + +} + + diff --git a/PySide/QtDeclarative/pysideqmlregistertype.h b/PySide/QtDeclarative/pysideqmlregistertype.h new file mode 100644 index 0000000..aa25200 --- /dev/null +++ b/PySide/QtDeclarative/pysideqmlregistertype.h @@ -0,0 +1,57 @@ +/* + * This file is part of the Shiboken Python Bindings Generator project. + * + * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + * + * Contact: PySide team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef PYSIDEQMLREGISTERTYPE_H +#define PYSIDEQMLREGISTERTYPE_H + +#include + +struct SbkObjectType; + +namespace PySide +{ + +extern void* nextQmlElementMemoryAddr; + +/** + * Init the QML support doign things like registering QtDeclarative.ListProperty and create the necessary stuff for + * qmlRegisterType. + * + * \param module QtDeclarative python module + */ +void initQmlSupport(PyObject* module); + +/** + * PySide implementation of qmlRegisterType function. + * + * \param pyObj Python type to be registered. + * \param uri QML element uri. + * \param versionMajor QML component major version. + * \param versionMinor QML component minor version. + * \param qmlName QML element name + * \return the metatype id of the registered type. + */ +int qmlRegisterType(PyObject* pyObj, const char* uri, int versionMajor, int versionMinor, const char* qmlName); + +} + +#endif diff --git a/PySide/QtDeclarative/typesystem_declarative.xml b/PySide/QtDeclarative/typesystem_declarative.xml index 75c63e0..bf9a575 100644 --- a/PySide/QtDeclarative/typesystem_declarative.xml +++ b/PySide/QtDeclarative/typesystem_declarative.xml @@ -23,30 +23,69 @@ + + + This function registers the Python type in the QML system with the name qmlName, in the library imported from uri having the version number composed from versionMajor and versionMinor. + Returns the QML type id. + + For example, this registers a Python class MySliderItem as a QML type named Slider for version 1.0 of a module called "com.mycompany.qmlcomponents": + + :: + + qmlRegisterType(MySliderItem, "com.mycompany.qmlcomponents", 1, 0, "Slider") + + Once this is registered, the type can be used in QML by importing the specified module name and version number: + + :: + + import com.mycompany.qmlcomponents 1.0 + + Slider { ... } + + Note that it's perfectly reasonable for a library to register types to older versions than the actual version of the library. Indeed, it is normal for the new library to allow QML written to previous versions to continue to work, even if more advanced versions of some of its types are available. + + + + %PYARG_0 = %CONVERTTOPYTHON[int](PySide::qmlRegisterType(%1, %2, %3, %4, %5)); + + + + + - + Shiboken::TypeResolver::createValueTypeResolver< QList<QObject*> >("QList<QObject*>"); + PySide::initQmlSupport(module); + + - - - + + QByteArray key("%FUNCTION_NAME_"); + key.append(%1.toLocal8Bit()); + Shiboken::Object::keepReference(reinterpret_cast<SbkObject*>(%PYSELF), key.constData(), %PYARG_2); + + + + + + @@ -59,8 +98,19 @@ - + + + + + + + if (PySide::nextQmlElementMemoryAddr) + %0 = new (PySide::nextQmlElementMemoryAddr) ::QDeclarativePrivate::QDeclarativeElement<%TYPE>(); + else + %0 = new %TYPE(%1); + + @@ -78,7 +128,20 @@ - + + <code># create our data +ownerData = QDeclarativePropertyMap() +ownerData.insert("name", "John Smith") +ownerData.insert("phone", "555-5555") + +# expose it to the UI layer +view = QDeclarativeView() +ctxt = view.rootContext() +ctxt.setContextProperty("owner", ownerData) + +view.setSource(QUrl.fromLocalFile("main.qml")) +view.show()</code> + diff --git a/PySide/QtGui/CMakeLists.txt b/PySide/QtGui/CMakeLists.txt index 7178e60..8f8ff97 100644 --- a/PySide/QtGui/CMakeLists.txt +++ b/PySide/QtGui/CMakeLists.txt @@ -5,7 +5,7 @@ if(ENABLE_X11) ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qx11info_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qx11embedcontainer_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qx11embedwidget_wrapper.cpp - ) + ) if(Q_WS_MAEMO_5) set(SPECIFIC_OS_FILES @@ -17,7 +17,7 @@ endif() if (${QT_VERSION_MAJOR} EQUAL 4 AND ${QT_VERSION_MINOR} LESS 6) - set (QtGui_46_SRC ) + set(QtGui_46_SRC "") else() set(QtGui_46_SRC ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qmatrix2x2_wrapper.cpp @@ -60,6 +60,23 @@ else() ) endif () +set(QtGui_OPTIONAL_SRC ) +set(QtGui_DROPPED_ENTRIES ) +check_qt_class(QtGui QAbstractPageSetupDialog QtGui_OPTIONAL_SRC QtGui_DROPPED_ENTRIES) +check_qt_class(QtGui QAbstractPrintDialog QtGui_OPTIONAL_SRC QtGui_DROPPED_ENTRIES) +check_qt_class(QtGui QGtkStyle QtGui_OPTIONAL_SRC QtGui_DROPPED_ENTRIES) +check_qt_class(QtGui QPageSetupDialog QtGui_OPTIONAL_SRC QtGui_DROPPED_ENTRIES) +check_qt_class(QtGui QPrintDialog QtGui_OPTIONAL_SRC QtGui_DROPPED_ENTRIES) +check_qt_class(QtGui QPrintEngine QtGui_OPTIONAL_SRC QtGui_DROPPED_ENTRIES) +check_qt_class(QtGui QPrintPreviewDialog QtGui_OPTIONAL_SRC QtGui_DROPPED_ENTRIES) +check_qt_class(QtGui QPrintPreviewWidget QtGui_OPTIONAL_SRC QtGui_DROPPED_ENTRIES) +check_qt_class(QtGui QPrinter QtGui_OPTIONAL_SRC QtGui_DROPPED_ENTRIES) +check_qt_class(QtGui QPrinterInfo QtGui_OPTIONAL_SRC QtGui_DROPPED_ENTRIES) +check_qt_class(QtGui QSessionManager QtGui_OPTIONAL_SRC QtGui_DROPPED_ENTRIES) +check_qt_class(QtGui QSizeGrip QtGui_OPTIONAL_SRC QtGui_DROPPED_ENTRIES) +check_qt_class(QtGui QSystemTrayIcon QtGui_OPTIONAL_SRC QtGui_DROPPED_ENTRIES) +check_qt_class(QtGui QMacStyle QtGui_OPTIONAL_SRC QtGui_DROPPED_ENTRIES) + qt4_wrap_cpp(QPYTEXTOBJECT_MOC "${pyside_SOURCE_DIR}/qpytextobject.h") set(QtGui_SRC @@ -225,6 +242,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qpen_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qpictureio_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qpicture_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qpixmapcache_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qpixmapcache_key_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qpixmap_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qplaintextdocumentlayout_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qplaintextedit_wrapper.cpp @@ -378,28 +396,14 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qwizard_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/qworkspace_wrapper.cpp ${SPECIFIC_OS_FILES} +${QPYTEXTOBJECT_MOC} ${QtGui_46_SRC} +${QtGui_OPTIONAL_SRC} ) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/typesystem_gui.xml.in" "${CMAKE_CURRENT_BINARY_DIR}/typesystem_gui.xml" @ONLY) -check_qt_class(QtGui QGtkStyle QtGui_SRC) -check_qt_class(QtGui QSessionManager QtGui_SRC) -check_qt_class(QtGui QSizeGrip QtGui_SRC) -check_qt_class(QtGui QSystemTrayIcon QtGui_SRC) - -check_qt_class(QtGui QAbstractPageSetupDialog QtGui_SRC) -check_qt_class(QtGui QAbstractPrintDialog QtGui_SRC) -check_qt_class(QtGui QPageSetupDialog QtGui_SRC) -check_qt_class(QtGui QPrintDialog QtGui_SRC) -check_qt_class(QtGui QPrintPreviewWidget QtGui_SRC) -check_qt_class(QtGui QPrintPreviewDialog QtGui_SRC) -check_qt_class(QtGui QPrinter QtGui_SRC) -check_qt_class(QtGui QPrinterInfo QtGui_SRC) -check_qt_class(QtGui QPrintEngine QtGui_SRC) - set(QtGui_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}") set(QtGui_include_dirs ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtGui/ @@ -421,8 +425,7 @@ create_pyside_module(QtGui QtGui_deps QtGui_typesystem_path QtGui_SRC - "${CMAKE_CURRENT_BINARY_DIR}/typesystem_gui.xml" - QPYTEXTOBJECT_MOC) - + "" + ${CMAKE_CURRENT_BINARY_DIR}/typesystem_gui.xml) install(FILES ${pyside_SOURCE_DIR}/qpytextobject.h DESTINATION include/PySide/QtGui/) diff --git a/PySide/QtGui/glue/qapplication_init.cpp b/PySide/QtGui/glue/qapplication_init.cpp index 581e4da..f2e972a 100644 --- a/PySide/QtGui/glue/qapplication_init.cpp +++ b/PySide/QtGui/glue/qapplication_init.cpp @@ -5,39 +5,18 @@ static int QApplicationArgCount; static char** QApplicationArgValues; static const char QAPP_MACRO[] = "qApp"; -int Sbk_QApplication_Init(PyObject* self, PyObject* args, PyObject*) +bool QApplicationConstructorStart(PyObject* argv) { - if (Shiboken::Object::isUserType(self) && !Shiboken::ObjectType::canCallConstructor(self->ob_type, Shiboken::SbkType())) - return -1; - if (QApplication::instance()) { PyErr_SetString(PyExc_RuntimeError, "A QApplication instance already exists."); - return -1; + return false; } - int numArgs = PyTuple_GET_SIZE(args); - if (numArgs != 1) { - PyErr_BadArgument(); - return -1; - } - - if (!Shiboken::sequenceToArgcArgv(PyTuple_GET_ITEM(args, 0), &QApplicationArgCount, &QApplicationArgValues, "PySideApp")) { - PyErr_BadArgument(); - return -1; - } - - SbkObject* sbkSelf = reinterpret_cast(self); - QApplicationWrapper* cptr = new QApplicationWrapper(QApplicationArgCount, QApplicationArgValues); - Shiboken::Object::setCppPointer(sbkSelf, - Shiboken::SbkType(), - cptr); - Shiboken::Object::setValidCpp(sbkSelf, true); - Shiboken::Object::setHasCppWrapper(sbkSelf, true); - Shiboken::Object::releaseOwnership(sbkSelf); - Shiboken::BindingManager::instance().registerWrapper(sbkSelf, cptr); - PySide::Signal::updateSourceObject(self); - cptr->metaObject(); + return Shiboken::sequenceToArgcArgv(argv, &QApplicationArgCount, &QApplicationArgValues, "PySideApp"); +} +void QApplicationConstructorEnd(PyObject* self) +{ // Verify if qApp is in main module PyObject* globalsDict = PyEval_GetGlobals(); if (globalsDict) { @@ -49,5 +28,23 @@ int Sbk_QApplication_Init(PyObject* self, PyObject* args, PyObject*) PyObject_SetAttrString(moduleQtGui, QAPP_MACRO, self); PySide::registerCleanupFunction(&PySide::destroyQCoreApplication); Py_INCREF(self); - return 1; +} + +static void QApplicationConstructor(PyObject* self, PyObject* argv, QApplicationWrapper** cptr) +{ + if (QApplicationConstructorStart(argv)) { + *cptr = new QApplicationWrapper(QApplicationArgCount, QApplicationArgValues); + Shiboken::Object::releaseOwnership(reinterpret_cast(self)); + QApplicationConstructorEnd(self); + } +} + +template +static void QApplicationConstructor(PyObject* self, PyObject* argv, T extraArg, QApplicationWrapper** cptr) +{ + if (QApplicationConstructorStart(argv)) { + *cptr = new QApplicationWrapper(QApplicationArgCount, QApplicationArgValues, extraArg); + Shiboken::Object::releaseOwnership(reinterpret_cast(self)); + QApplicationConstructorEnd(self); + } } diff --git a/PySide/QtGui/glue/qlayout_help_functions.h b/PySide/QtGui/glue/qlayout_help_functions.h index 8420cb3..90c950a 100644 --- a/PySide/QtGui/glue/qlayout_help_functions.h +++ b/PySide/QtGui/glue/qlayout_help_functions.h @@ -40,7 +40,7 @@ inline void addLayoutOwnership(QLayout* layout, QLayout* other) for (int i=0, i_max=other->count(); i < i_max; i++) { QLayoutItem* item = other->itemAt(i); - if (PyErr_Occurred()) + if (PyErr_Occurred() || !item) return; addLayoutOwnership(layout, item); diff --git a/PySide/QtGui/glue/qtgui_qapp.cpp b/PySide/QtGui/glue/qtgui_qapp.cpp index f893f8e..4c4508b 100644 --- a/PySide/QtGui/glue/qtgui_qapp.cpp +++ b/PySide/QtGui/glue/qtgui_qapp.cpp @@ -1,4 +1,10 @@ // Init qApp macro to None. -Py_INCREF(Py_None); -PyModule_AddObject(module, "qApp", Py_None); +if (qApp) { + PyObject* pyApp = Shiboken::Converter::toPython(qApp); + Py_INCREF(pyApp); + PyModule_AddObject(module, "qApp", pyApp); +} else { + Py_INCREF(Py_None); + PyModule_AddObject(module, "qApp", Py_None); +} moduleQtGui = module; diff --git a/PySide/QtGui/glue/qwidget_glue.h b/PySide/QtGui/glue/qwidget_glue.h index 9b20cb5..129a54a 100644 --- a/PySide/QtGui/glue/qwidget_glue.h +++ b/PySide/QtGui/glue/qwidget_glue.h @@ -14,7 +14,7 @@ static inline void qwidgetReparentLayout(QWidget *parent, QLayout *layout) for (int i=0; i < layout->count(); i++) { QLayoutItem* item = layout->itemAt(i); - if (PyErr_Occurred()) + if (PyErr_Occurred() || !item) return; QWidget* w = item->widget(); diff --git a/PySide/QtGui/typesystem_gui_common.xml b/PySide/QtGui/typesystem_gui_common.xml index cf4b674..d3473d4 100644 --- a/PySide/QtGui/typesystem_gui_common.xml +++ b/PySide/QtGui/typesystem_gui_common.xml @@ -71,72 +71,97 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - @@ -145,22 +170,49 @@ - + + + + + + + + + - + - + + + + + + + + + + + + + + + + + - + + @@ -172,174 +224,215 @@ + + + QTransform _result; + if (QTransform::quadToQuad(%1, %2, _result)) { + %PYARG_0 = %CONVERTTOPYTHON[QTransform](_result); + } else { + Py_INCREF(Py_None); + %PYARG_0 = Py_None; + } + + + + + QTransform _result; + if (QTransform::quadToSquare(%1, _result)) { + %PYARG_0 = %CONVERTTOPYTHON[QTransform](_result); + } else { + Py_INCREF(Py_None); + %PYARG_0 = Py_None; + } + + + + + + QTransform _result; + if (QTransform::squareToQuad(%1, _result)) { + %PYARG_0 = %CONVERTTOPYTHON[QTransform](_result); + } else { + Py_INCREF(Py_None); + %PYARG_0 = Py_None; + } + + + - + - - - + + + - - + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - - + + + - - + + - - - + + + - - + + - + - - - + + + + + + uchar* buffer = (uchar*) Shiboken::Buffer::getPointer(%PYARG_2); + %PYARG_0 = %CONVERTTOPYTHON[QBitmap](QBitmap::fromData(%1, buffer, %3)); + + - + - + @@ -348,6 +441,17 @@ + + + + + + %BEGIN_ALLOW_THREADS + %RETURN_TYPE %0 = %CPPSELF->::%TYPE::%FUNCTION_NAME(&%1, %2); + %END_ALLOW_THREADS + %PYARG_0 = Shiboken::makeTuple(%0, %1); + + @@ -365,8 +469,8 @@ - + @@ -375,25 +479,33 @@ - + - - - - + + + + + + + + + + + @@ -403,47 +515,128 @@ + + + + if (_i < 0 || _i >= %CPPSELF.count()) { + PyErr_SetString(PyExc_IndexError, "index out of bounds"); + return 0; + } + return %CONVERTTOPYTHON[int]((*%CPPSELF)[_i]); + + + + + - + + + - - - - - + + + + + + + + %PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.data(), %CPPSELF.size()); + + + + + + + PyObject* %out = Shiboken::Buffer::newObject(%in, size); + + + Py_ssize_t bufferLen; + char* %out = (char*) Shiboken::Buffer::getPointer(arg, &bufferLen); + + + + + + uint %out = bufferLen; + + + - + - - - - - - + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + const QTextDocument* doc = %CPPSELF.document(); + if (doc) { + Shiboken::AutoDecRef pyDocument(%CONVERTTOPYTHON[QTextDocument*](doc)); + Shiboken::Object::setParent(pyDocument, %PYARG_1); + } + + + + + + + + const QTextDocument* doc = %CPPSELF.document(); + if (doc) { + Shiboken::AutoDecRef pyDocument(%CONVERTTOPYTHON[QTextDocument*](doc)); + Shiboken::Object::setParent(pyDocument, %PYARG_0); + } + + @@ -451,15 +644,15 @@ + - - + - + @@ -473,39 +666,57 @@ - PyObject *points = PyList_New(%CPPSELF.count()); - for (int i = 0; i < %CPPSELF.count(); ++i){ + PyObject* points = PyList_New(%CPPSELF.count()); + for (int i = 0, max = %CPPSELF.count(); i < max; ++i){ int x, y; %CPPSELF.point(i, &x, &y); PyList_SET_ITEM(points, i, %CONVERTTOPYTHON[QPoint](QPoint(x, y))); } - + - + - - - + + + + + // %FUNCTION_NAME() + *%CPPSELF << %1; + %PYARG_0 = %CONVERTTOPYTHON[QPolygon*](%CPPSELF); + + + + + // %FUNCTION_NAME() + *%CPPSELF << %1; + %PYARG_0 = %CONVERTTOPYTHON[QPolygon*](%CPPSELF); + + + - + + + + + - + @@ -523,39 +734,81 @@ + + + + + + + + + if (**%CPPSELF) + %PYARG_0 = %CONVERTTOPYTHON[QTreeWidgetItemIterator*](new QTreeWidgetItemIterator((*%CPPSELF)++)); + + + %PYARG_0 = %CONVERTTOPYTHON[QTreeWidgetItem*](%CPPSELF.operator*()); Shiboken::Object::releaseOwnership(%PYARG_0); - + + + + + + - - - - + + + + - if (%1.type() == QVariant::Pixmap) - %0 = new %TYPE(%1.value<QPixmap>()); - else if (%1.type() == QVariant::Image) - %0 = new %TYPE(QPixmap::fromImage(%1.value<QImage>())); - else - PyErr_SetString(PyExc_TypeError, "QVariant must be holding a QPixmap"); + %0 = new %TYPE(QPixmap::fromImage(%1)); + + + + + + + + + - - + + + @@ -579,7 +832,33 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -597,17 +876,21 @@ - - - - - - - + + + + + + + + + + @@ -616,8 +899,33 @@ - - + + + + + + + + + + + + + + + + + + + + + + + @@ -663,30 +971,105 @@ - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + %PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(), %CPPSELF.byteCount()); + + + + + // byteCount() is only available on Qt4.7, so we use bytesPerLine * height + %PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(), %CPPSELF.bytesPerLine() * %CPPSELF.height(), Shiboken::Buffer::ReadWrite); + + + + + %PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(%1), %CPPSELF.bytesPerLine()); + + + + + %PYARG_0 = Shiboken::Buffer::newObject(%CPPSELF.%FUNCTION_NAME(%1), %CPPSELF.bytesPerLine(), Shiboken::Buffer::ReadWrite); + + + + + + @@ -722,14 +1105,90 @@ - - - - + PyObject *createFunction = 0; + + switch(%CPPSELF.spec()) { + case QColor::Rgb: + { + qreal r, g, b, a; + createFunction = PyObject_GetAttrString(%PYSELF, "fromRgbF"); + %CPPSELF.getRgbF(&r, &g, &b, &a); + %PYARG_0 = Py_BuildValue("(N(ffff))", createFunction, r, g, b, a); + break; + } + case QColor::Hsv: + { + qreal h, s, v, a; + createFunction = PyObject_GetAttrString(%PYSELF, "fromHsvF"); + %CPPSELF.getHsvF(&h, &s, &v, &a); + %PYARG_0 = Py_BuildValue("(N(ffff))", createFunction, h, s, v, a); + break; + } + case QColor::Cmyk: + { + qreal c, m, y, k, a; + createFunction = PyObject_GetAttrString(%PYSELF, "fromCmykF"); + %CPPSELF.getCmykF(&c, &m, &y, &k, &a); + %PYARG_0 = Py_BuildValue("(N(fffff))", createFunction, c, m, y, k, a); + break; + } + #if QT_VERSION >= 0x040600 + case QColor::Hsl: + { + qreal h, s, l, a; + createFunction = PyObject_GetAttrString(%PYSELF, "fromHslF"); + %CPPSELF.getHsvF(&h, &s, &l, &a); + %PYARG_0 = Py_BuildValue("(N(ffff))", createFunction, h, s, l, a); + break; + } + #endif + default: + %PYARG_0 = 0; + } + + + + switch(%CPPSELF.spec()) { + case QColor::Rgb: + { + int r, g, b, a; + %CPPSELF.getRgb(&r, &g, &b, &a); + %PYARG_0 = Py_BuildValue("iiii", r, g, b, a); + break; + } + case QColor::Hsv: + { + int h, s, v, a; + %CPPSELF.getHsv(&h, &s, &v, &a); + %PYARG_0 = Py_BuildValue("iiii", h, s, v, a); + break; + } + case QColor::Cmyk: + { + int c, m, y, k, a; + %CPPSELF.getCmyk(&c, &m, &y, &k, &a); + %PYARG_0 = Py_BuildValue("iiiii", c, m, y, k, a); + break; + } + case QColor::Hsl: + { + int h, s, l, a; + %CPPSELF.getHsv(&h, &s, &l, &a); + %PYARG_0 = Py_BuildValue("iiii", h, s, l, a); + break; + } + default: + %PYARG_0 = 0; + } + + + + + if (%1.type() == QVariant::Color) @@ -789,7 +1248,7 @@ - + @@ -807,10 +1266,12 @@ - + + + - + @@ -828,7 +1289,9 @@ - + + + @@ -849,7 +1312,9 @@ - + + + @@ -870,7 +1335,9 @@ - + + + @@ -891,7 +1358,9 @@ - + + + @@ -912,12 +1381,15 @@ - + + + - + + @@ -1107,7 +1579,6 @@ - @@ -1136,8 +1607,8 @@ - - + + PyObject* userTypeConstant = PyInt_FromLong(QGraphicsItem::UserType); PyDict_SetItemString(Sbk_QGraphicsItem_Type.super.ht_type.tp_dict, "UserType", userTypeConstant); @@ -1172,6 +1643,7 @@ + @@ -1212,7 +1684,7 @@ - + @@ -1256,24 +1728,24 @@ + - - - - + + + - + @@ -1281,17 +1753,22 @@ - + - + - + + + + + + @@ -1306,14 +1783,12 @@ + - - - - + @@ -1323,15 +1798,9 @@ - - - - - - @@ -1366,25 +1835,15 @@ - - - - - - - - - - - + - + @@ -1406,12 +1865,12 @@ - + - + @@ -1421,21 +1880,19 @@ - + - - - - + + - + @@ -1449,6 +1906,8 @@ + @@ -1464,7 +1923,7 @@ - + @@ -1479,7 +1938,13 @@ - + + + + + + + @@ -1488,10 +1953,10 @@ - + - + @@ -1572,6 +2037,7 @@ + @@ -1582,15 +2048,19 @@ + - - + + + + + @@ -1603,7 +2073,6 @@ - @@ -1618,7 +2087,7 @@ - + Shiboken::Object::releaseOwnership(%PYARG_2); @@ -1641,7 +2110,7 @@ - + @@ -1658,7 +2127,7 @@ - + @@ -1744,7 +2213,7 @@ - + @@ -1757,7 +2226,7 @@ - + @@ -1819,6 +2288,7 @@ + @@ -1891,40 +2361,31 @@ - + - - - - - - + + + - + - - - - - - @@ -1937,12 +2398,6 @@ - - - - - - @@ -1959,12 +2414,10 @@ - - @@ -2045,8 +2498,14 @@ - - + + + + + + + + @@ -2105,15 +2564,6 @@ - - - - - - - - - @@ -2125,13 +2575,13 @@ - + - + @@ -2196,8 +2646,8 @@ - + @@ -2256,6 +2706,43 @@ + + + @@ -2270,39 +2757,7 @@ - QValidator::State %out; - - if (PySequence_Check(%PYARG_0)) { - Shiboken::AutoDecRef seq(PySequence_Fast(%PYARG_0, 0)); - int size = PySequence_Fast_GET_SIZE(seq.object()); - - if (size > 1) { - if (Shiboken::Converter<QString>::isConvertible(PySequence_Fast_GET_ITEM(seq.object(), 1))) - %1 = %CONVERTTOCPP[QString](PySequence_Fast_GET_ITEM(seq.object(), 1)); - else - qWarning("%TYPE::%FUNCTION_NAME: Second tuple element is not convertible to unicode."); - } - - if (size > 2) { - if (Shiboken::Converter<int>::isConvertible(PySequence_Fast_GET_ITEM(seq.object(), 2))) - %2 = %CONVERTTOCPP[int](PySequence_Fast_GET_ITEM(seq.object(), 2)); - else - qWarning("%TYPE::%FUNCTION_NAME: Second tuple element is not convertible to int."); - } - %PYARG_0 = PySequence_Fast_GET_ITEM(seq.object(), 0); - Py_INCREF(%PYARG_0); // we need to incref, because "%PYARG_0 = ..." will decref the tuple and the tuple will be decrefed again at the end of this scope. - } - - // check retrun value - if (Shiboken::Converter<QValidator::State>::isConvertible(%PYARG_0)) { - %out = %CONVERTTOCPP[QValidator::State](%PYARG_0); - } else { - PyErr_Format(PyExc_TypeError, "Invalid return value in function %s, expected %s, got %s.", - "QValidator.validate", - "PySide.QtGui.QValidator.State, (PySide.QtGui.QValidator.State,), (PySide.QtGui.QValidator.State, unicode) or (PySide.QtGui.QValidator.State, unicode, int)", - pyResult->ob_type->tp_name); - return QValidator::State(); - } + @@ -2325,8 +2780,8 @@ - + @@ -2352,9 +2807,13 @@ + + + + @@ -2362,10 +2821,14 @@ + + + + @@ -2395,6 +2858,7 @@ + @@ -2409,11 +2873,17 @@ - + + + + %PYARG_0 = %CONVERTTOPYTHON[bool](!(&%CPPSELF == %1)); + + + - + @@ -2447,11 +2917,11 @@ - + - + - + @@ -2473,10 +2943,9 @@ - - + @@ -2503,6 +2972,9 @@ + + + @@ -2538,10 +3010,37 @@ - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2652,7 +3151,29 @@ addLayoutOwnership(%CPPSELF, %1); - + + + + + + + + + + + + + + + + + + + int a, b, c, d; + %CPPSELF.%FUNCTION_NAME(%1, &a, &b, &c, &d); + %PYARG_0 = Shiboken::makeTuple(a, b, c, d); + + @@ -2660,17 +3181,32 @@ - + - + - + + + + + + + + + + + + + + + + @@ -2784,8 +3320,34 @@ - + + + + + + + + + + + + + + + + + Shiboken::AutoDecRef parent(%CONVERTTOPYTHON[QGraphicsItem*](%1->parentItem())); + foreach (QGraphicsItem* item, %1->children()) + Shiboken::Object::setParent(parent, %CONVERTTOPYTHON[QGraphicsItem*](item)); + %BEGIN_ALLOW_THREADS + %CPPSELF.%FUNCTION_NAME(%1); + %END_ALLOW_THREADS + // the arg was destroyed by Qt. + Shiboken::Object::invalidate(%PYARG_1); + + + @@ -2906,9 +3468,11 @@ - - - + + + %PYARG_0 = %CONVERTTOPYTHON[%RETURN_TYPE](%CPPSELF.%FUNCTION_NAME(%1, %2)); + Shiboken::Object::keepReference((SbkObject*)%PYARG_0, "setWidget(QWidget*)1", %PYARG_1); + @@ -2918,9 +3482,21 @@ - - - + + + const QList<QGraphicsItem*> items = %CPPSELF.items(); + Shiboken::BindingManager& bm = Shiboken::BindingManager::instance(); + foreach (QGraphicsItem* item, items) { + SbkObject* obj = bm.retrieveWrapper(item); + if (obj) { + if (obj->ob_refcnt > 1) // If the refcnt is 1 the object will vannish anyway. + Shiboken::Object::invalidate(obj); + Shiboken::Object::removeParent(obj); + } + } + %CPPSELF.%FUNCTION_NAME(); + + @@ -2941,10 +3517,10 @@ + - - + @@ -2953,6 +3529,7 @@ + @@ -2990,9 +3567,20 @@ - + + + QTreeWidgetItem *rootItem = %CPPSELF.invisibleRootItem(); + Shiboken::BindingManager &bm = Shiboken::BindingManager::instance(); + for (int i = 0; i < rootItem->childCount(); ++i) { + QTreeWidgetItem *item = rootItem->child(i); + SbkObject* wrapper = bm.retrieveWrapper(item); + if (wrapper) + Shiboken::Object::setParent(0, reinterpret_cast<PyObject*>(wrapper)); + } + + - + @@ -3002,37 +3590,31 @@ - + + + + + - - - - - - - + - - - - @@ -3056,27 +3638,18 @@ - - - + - - - - - - - - + @@ -3094,7 +3667,7 @@ - + @@ -3103,24 +3676,20 @@ - - + + - - - - @@ -3186,18 +3755,35 @@ + + + + + + // Only call the parent function if this return some value + // the parent can be the TreeWidget + if (%0) + Shiboken::Object::setParent(%PYARG_0, %PYSELF); + + + + + + + + // Only call the parent function if this return some value + // the parent can be the TreeWidgetItem + if (%0) + Shiboken::Object::setParent(%PYARG_0, %PYSELF); + + + + - - - - - - - - + @@ -3215,17 +3801,18 @@ + + - @@ -3234,85 +3821,158 @@ - + + + + + + + + + + + + + + + + + + + + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + - + + + @@ -3356,17 +4016,38 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - @@ -3374,35 +4055,40 @@ // %FUNCTION_NAME() - disable generation of function call. + - - - - - - - - + + + + Returns the window system identifier of the widget. + + Portable in principle, but if you use it you are probably about to do something non-portable. Be careful. + + If a widget is non-native (alien) and winId() is invoked on it, that widget will be provided a native handle. + + On X11 the type returned is long, on other platforms it's a PyCObject. + + This value may change at run-time. An event with type PySide.QtCore.QEvent.WinIdChange will be sent to the widget following a change in window system identifier. + + - - - + @@ -3411,30 +4097,20 @@ + - - - - - - - - - - - - + @@ -3445,7 +4121,7 @@ - + @@ -3462,6 +4138,9 @@ + + + @@ -3474,27 +4153,49 @@ - - + + + + + + + + + + + + + + + + + + + + + - - + + @@ -3503,7 +4204,7 @@ - + @@ -3516,7 +4217,8 @@ - + @@ -3534,6 +4236,7 @@ + @@ -3541,11 +4244,6 @@ - - - - - @@ -3564,7 +4262,7 @@ - + @@ -3586,15 +4284,14 @@ QWidget* tab = %CPPSELF.widget(%1); if (tab) { Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](tab)); - Shiboken::Object::setParent(0, pyWidget); %CPPSELF.%FUNCTION_NAME(%1); } - for (int i=0; i < %CPPSELF.count(); i++) { - Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](%CPPSELF.widget(i))); + for (int i = 0; i < %CPPSELF.count(); i++) { + Shiboken::AutoDecRef pyWidget(%CONVERTTOPYTHON[QWidget*](%CPPSELF.widget(i))); Shiboken::Object::setParent(0, pyWidget); } %CPPSELF.%FUNCTION_NAME(); @@ -3623,7 +4320,7 @@ - + @@ -3631,7 +4328,7 @@ - + @@ -3639,6 +4336,8 @@ + @@ -3647,13 +4346,13 @@ - + + - - + @@ -3663,7 +4362,6 @@ - @@ -3700,12 +4398,6 @@ - - - - - - @@ -3713,7 +4405,7 @@ - + @@ -3726,7 +4418,7 @@ - + @@ -3734,34 +4426,37 @@ + + + + - - - + + + + - - - + + + + - - - @@ -4084,9 +4779,10 @@ + - + @@ -4094,11 +4790,10 @@ - + - @@ -4119,11 +4814,25 @@ - - + + + + + + + + + + + + + + + + @@ -4173,19 +4882,42 @@ + + + + + + + + + + + + + + + + + + + + + + + - + @@ -4249,8 +4981,30 @@ - - + + + + + + + + + %PYARG_0 = %CONVERTTOPYTHON[QAction*](%CPPSELF.addAction(%1, %2)); + Shiboken::AutoDecRef result(PyObject_CallMethod(%PYARG_0, "connect", "OsO", %PYARG_0, SIGNAL(triggered()), %PYARG_3)); + + + + + + + + + + + %PYARG_0 = %CONVERTTOPYTHON[QAction*](%CPPSELF.addAction(%1)); + Shiboken::AutoDecRef result(PyObject_CallMethod(%PYARG_0, "connect", "OsO", %PYARG_0, SIGNAL(triggered()), %PYARG_2)); + + @@ -4287,10 +5041,30 @@ + + + QList<PyObject* > lst; + Shiboken::BindingManager& bm = Shiboken::BindingManager::instance(); + foreach(QToolButton* child, %CPPSELF.findChildren<QToolButton*>()) { + if (bm.hasWrapper(child)) { + PyObject* pyChild = %CONVERTTOPYTHON[QToolButton*](child); + Shiboken::Object::setParent(0, pyChild); + lst << pyChild; + } + } + + %CPPSELF.clear(); + + foreach(PyObject* obj, lst) { + Shiboken::Object::invalidate(reinterpret_cast<SbkObject* >(obj)); + Py_XDECREF(obj); + } + + - - + + @@ -4305,6 +5079,7 @@ + @@ -4323,7 +5098,7 @@ - + @@ -4340,20 +5115,18 @@ - + + - - - - + - + @@ -4373,37 +5146,11 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -4417,23 +5164,78 @@ - - + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + %BEGIN_ALLOW_THREADS + %CPPSELF.%FUNCTION_NAME(%1.data(), %1.size(), %2); + %END_ALLOW_THREADS + + + + + + %BEGIN_ALLOW_THREADS + %CPPSELF.%FUNCTION_NAME(%1.data(), %1.size(), %2); + %END_ALLOW_THREADS + + + + + + + + + + + + + + @@ -4505,16 +5307,14 @@ + + - - - - - + @@ -4533,23 +5333,33 @@ - - - + + + + QApplicationConstructor(%PYSELF, %1, &%0); + + + + + + QApplicationConstructor(%PYSELF, %1, %2, &%0); + + + + + + QApplicationConstructor(%PYSELF, %1, %2, &%0); + + - + - - - - - - - + + @@ -4621,10 +5431,58 @@ - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4707,9 +5565,11 @@ - - - + + + + + @@ -4729,14 +5589,65 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4788,16 +5699,58 @@ - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4869,11 +5822,7 @@ - - - - - + @@ -4888,12 +5837,21 @@ - + - + + + + + + + + + + @@ -4954,7 +5912,16 @@ - + + + + + + + + + + @@ -5015,7 +5982,16 @@ - + + + + + + + + + + @@ -5076,7 +6052,16 @@ - + + + + + + + + + + @@ -5137,7 +6122,16 @@ - + + + + + + + + + + @@ -5198,7 +6192,16 @@ - + + + + + + + + + + @@ -5259,7 +6262,16 @@ - + + + + + + + + + + @@ -5320,7 +6332,16 @@ - + + + + + + + + + + @@ -5381,8 +6402,16 @@ + + + + + + + + + - @@ -5391,7 +6420,10 @@ + + + @@ -5435,30 +6467,49 @@ } - - + + + + + + + + if (PySequence_Check(_key)) { + Shiboken::AutoDecRef key(PySequence_Fast(_key, "Invalid matrix index.")); + if (PySequence_Fast_GET_SIZE(key.object()) == 2) { + PyObject* posx = PySequence_Fast_GET_ITEM(key.object(), 0); + PyObject* posy = PySequence_Fast_GET_ITEM(key.object(), 1); + Py_ssize_t x = PyInt_AsSsize_t(posx); + Py_ssize_t y = PyInt_AsSsize_t(posy); + return %CONVERTTOPYTHON[qreal]((*%CPPSELF)(x,y)); + } + } + PyErr_SetString(PyExc_IndexError, "Invalid matrix index."); + return 0; + + - + - - + + - - - - - - + + + + + + - - + + - - + + @@ -5466,18 +6517,27 @@ --> - - - - - - - - - - + + + + + + + + + + - + + + + + + + + + + @@ -5500,18 +6560,27 @@ --> - + - + - + - + - + + + + + + + + + + @@ -5520,11 +6589,30 @@ + + + + + + + + + + - + + + + + + + + + + @@ -5533,11 +6621,30 @@ + + + + + + + + + + - + + + + + + + + + + @@ -5546,6 +6653,15 @@ + + + + + + + + + @@ -5555,11 +6671,122 @@ - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PySide/QtGui/typesystem_gui_mac.xml b/PySide/QtGui/typesystem_gui_mac.xml index 2f4ac4c..b7597b9 100644 --- a/PySide/QtGui/typesystem_gui_mac.xml +++ b/PySide/QtGui/typesystem_gui_mac.xml @@ -23,6 +23,10 @@ + + + + diff --git a/PySide/QtGui/typesystem_gui_x11.xml b/PySide/QtGui/typesystem_gui_x11.xml index 920b6a2..96bfb24 100644 --- a/PySide/QtGui/typesystem_gui_x11.xml +++ b/PySide/QtGui/typesystem_gui_x11.xml @@ -23,8 +23,10 @@ + + @@ -32,6 +34,6 @@ - + diff --git a/PySide/QtMaemo5/CMakeLists.txt b/PySide/QtMaemo5/CMakeLists.txt index fadf91d..30bf15c 100644 --- a/PySide/QtMaemo5/CMakeLists.txt +++ b/PySide/QtMaemo5/CMakeLists.txt @@ -11,7 +11,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/${BINDING_NAME}/QtMaemo5/qmaemo5valuebutton_wrapper. ${CMAKE_CURRENT_BINARY_DIR}/${BINDING_NAME}/QtMaemo5/qtmaemo5_module_wrapper.cpp ) -set(QtMaemo5_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtMaemo5_SOURCE_DIR}") +set(QtMaemo5_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtMaemo5_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}") # QT_QTMAEMO5_* variables are not defined by CMake if(NOT QT_QTMAEMO5_INCLUDE_DIR) diff --git a/PySide/QtMaemo5/typesystem_maemo5.xml b/PySide/QtMaemo5/typesystem_maemo5.xml index 74715ea..803404d 100644 --- a/PySide/QtMaemo5/typesystem_maemo5.xml +++ b/PySide/QtMaemo5/typesystem_maemo5.xml @@ -47,7 +47,7 @@ - + @@ -61,7 +61,7 @@ - + diff --git a/PySide/QtNetwork/CMakeLists.txt b/PySide/QtNetwork/CMakeLists.txt index 3afa0cf..9149202 100644 --- a/PySide/QtNetwork/CMakeLists.txt +++ b/PySide/QtNetwork/CMakeLists.txt @@ -10,6 +10,15 @@ else() set(QtNetwork_47_SRC ) endif () +set(QtNetwork_OPTIONAL_SRC ) +set(QtNetwork_DROPPED_ENTRIES ) +check_qt_class(QtNetwork QSslCertificate QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES) +check_qt_class(QtNetwork QSslCipher QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES) +check_qt_class(QtNetwork QSslConfiguration QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES) +check_qt_class(QtNetwork QSslError QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES) +check_qt_class(QtNetwork QSslKey QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES) +check_qt_class(QtNetwork QSslSocket QtNetwork_OPTIONAL_SRC QtNetwork_DROPPED_ENTRIES) + set(QtNetwork_SRC ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qabstractnetworkcache_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qabstractsocket_wrapper.cpp @@ -32,6 +41,8 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qnetworkcookiejar_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qnetworkdiskcache_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qnetworkinterface_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qnetworkproxy_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qnetworkproxyfactory_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qnetworkproxyquery_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qnetworkreply_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qnetworkrequest_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qssl_wrapper.cpp @@ -42,14 +53,9 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qudpsocket_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/qurlinfo_wrapper.cpp ${QtNetwork_47_SRC} +${QtNetwork_OPTIONAL_SRC} ) -check_qt_class(QtNetwork QSslCipher QtNetwork_SRC) -check_qt_class(QtNetwork QSslConfiguration QtNetwork_SRC) -check_qt_class(QtNetwork QSslError QtNetwork_SRC) -check_qt_class(QtNetwork QSslKey QtNetwork_SRC) -check_qt_class(QtNetwork QSslSocket QtNetwork_SRC) - set(QtNetwork_typesystem_path "${QtCore_SOURCE_DIR}") set(QtNetwork_include_dirs ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtNetwork/ @@ -72,4 +78,6 @@ create_pyside_module(QtNetwork QtNetwork_deps QtNetwork_typesystem_path QtNetwork_SRC - "") + "" + "" + QtNetwork_DROPPED_ENTRIES) diff --git a/PySide/QtNetwork/typesystem_network.xml b/PySide/QtNetwork/typesystem_network.xml index e608786..ab3f1ef 100644 --- a/PySide/QtNetwork/typesystem_network.xml +++ b/PySide/QtNetwork/typesystem_network.xml @@ -33,12 +33,11 @@ - - + @@ -93,7 +92,6 @@ - @@ -106,6 +104,9 @@ + + + @@ -127,7 +128,7 @@ - + @@ -149,13 +150,13 @@ - + + + - - - + @@ -190,7 +191,7 @@ - + @@ -204,7 +205,9 @@ + + @@ -219,21 +222,62 @@ - + - + + + + + + - - + + + return 16; + + + + + if (_i >= 16) { + PyErr_SetString(PyExc_IndexError, "index out of bounds"); + return 0; + } + + if (_i < 0) + _i = 16 - qAbs(_i); + + return %CONVERTTOPYTHON[uint](%CPPSELF->c[_i]); + + + + + return 16; + + + + + if (_i >= 16) { + PyErr_SetString(PyExc_IndexError, "index out of bounds"); + return -1; + } + + if (_i < 0) + _i = 16 - qAbs(_i); + + %CPPSELF->c[_i] = %CONVERTTOCPP[quint8](_value); + + return 0; + + @@ -251,37 +295,20 @@ - - - - - - - - - - - - - - - - - - + - + @@ -293,4 +320,23 @@ + + + + + + + + + + + + + + + + + + + diff --git a/PySide/QtOpenGL/typesystem_opengl.xml b/PySide/QtOpenGL/typesystem_opengl.xml index f58d849..abed718 100644 --- a/PySide/QtOpenGL/typesystem_opengl.xml +++ b/PySide/QtOpenGL/typesystem_opengl.xml @@ -22,11 +22,10 @@ - - + @@ -40,11 +39,12 @@ - + + - + @@ -52,16 +52,10 @@ - - - - - - - + - - + + @@ -84,24 +78,28 @@ - + + + + - - - + + + - - + + + @@ -124,12 +122,18 @@ - - void *data = %CPPSELF.map(%1); - QByteArray ret; - if (data) - ret.append((const char*)data, %CPPSELF.size()); - %PYARG_0 = %CONVERTTOPYTHON[QByteArray](ret); + + Py_ssize_t dataSize = %CPPSELF.size(); + void* data = %CPPSELF.map(%1); + + if (!data) { + Py_INCREF(Py_None); + %PYARG_0 = Py_None; + } else if (%1 == QGLBuffer::ReadOnly) { + %PYARG_0 = Shiboken::Buffer::newObject(data, dataSize, Shiboken::Buffer::ReadOnly); + } else { + %PYARG_0 = Shiboken::Buffer::newObject(data, dataSize, Shiboken::Buffer::ReadWrite); + } diff --git a/PySide/QtScript/typesystem_script.xml b/PySide/QtScript/typesystem_script.xml index e23542e..870aec0 100644 --- a/PySide/QtScript/typesystem_script.xml +++ b/PySide/QtScript/typesystem_script.xml @@ -38,16 +38,16 @@ - + - + - - + + diff --git a/PySide/QtScriptTools/typesystem_scripttools.xml b/PySide/QtScriptTools/typesystem_scripttools.xml index d223112..5c2b5e0 100644 --- a/PySide/QtScriptTools/typesystem_scripttools.xml +++ b/PySide/QtScriptTools/typesystem_scripttools.xml @@ -24,7 +24,7 @@ - + diff --git a/PySide/QtSql/typesystem_sql.xml b/PySide/QtSql/typesystem_sql.xml index f7c5325..2efe429 100644 --- a/PySide/QtSql/typesystem_sql.xml +++ b/PySide/QtSql/typesystem_sql.xml @@ -27,7 +27,7 @@ - + @@ -113,7 +113,9 @@ + + @@ -143,7 +145,9 @@ + + diff --git a/PySide/QtSvg/typesystem_svg.xml b/PySide/QtSvg/typesystem_svg.xml index 484864e..0592fc6 100644 --- a/PySide/QtSvg/typesystem_svg.xml +++ b/PySide/QtSvg/typesystem_svg.xml @@ -27,7 +27,7 @@ - + diff --git a/PySide/QtTest/CMakeLists.txt b/PySide/QtTest/CMakeLists.txt index fea841d..6ef7a42 100644 --- a/PySide/QtTest/CMakeLists.txt +++ b/PySide/QtTest/CMakeLists.txt @@ -1,8 +1,17 @@ project(QtTest) +if (${QT_VERSION_MAJOR} EQUAL 4 AND ${QT_VERSION_MINOR} LESS 6) + set(QtTest_46_SRC "") +else() + set(QtTest_46_SRC + ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtTest/qtest_pysideqtoucheventsequence_wrapper.cpp + ) +endif() + set(QtTest_SRC ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtTest/qtest_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtTest/qttest_module_wrapper.cpp +${QtTest_46_SRC} ) set(QtTest_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}") diff --git a/PySide/QtTest/typesystem_test.xml b/PySide/QtTest/typesystem_test.xml index b7028eb..9897225 100644 --- a/PySide/QtTest/typesystem_test.xml +++ b/PySide/QtTest/typesystem_test.xml @@ -51,11 +51,12 @@ + - + - + @@ -64,10 +65,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/PySide/QtUiTools/typesystem_uitools.xml b/PySide/QtUiTools/typesystem_uitools.xml index 2f94f21..130880c 100644 --- a/PySide/QtUiTools/typesystem_uitools.xml +++ b/PySide/QtUiTools/typesystem_uitools.xml @@ -30,6 +30,40 @@ Q_IMPORT_PLUGIN(uiplugin); + + + + + Registers a Python created custom widget to QUiLoader, so it can be recognized when + loading a `.ui` file. The custom widget type is passed via the ``customWidgetType`` argument. + This is needed when you want to override a virtual method of some widget in the interface, + since duck punching will not work with widgets created by QUiLoader based on the contents + of the `.ui` file. + + (Remember that `duck punching virtual methods is an invitation for your own demise! + <http://www.pyside.org/docs/shiboken/wordsofadvice.html#duck-punching-and-virtual-methods>`_) + + Let's see an obvious example. If you want to create a new widget it's probable you'll end up + overriding :class:`~PySide.QtGui.QWidget`'s :meth:`~PySide.QtGui.QWidget.paintEvent` method. + + .. code-block:: python + + class Circle(QWidget): + def paintEvent(self, event): + painter = QPainter(self) + painter.setPen(self.pen) + painter.setBrush(QBrush(self.color)) + painter.drawEllipse(event.rect().center(), 20, 20) + + # ... + + loader = QUiLoader() + loader.registerCustomWidget(Circle) + circle = loader.load('circle.ui') + circle.show() + + # ... + registerCustomWidget(%PYARG_1); %CPPSELF.addPluginPath(""); // force reload widgets @@ -71,7 +105,7 @@ - //Avoid calling the original function: %CPPSELF.load + // Avoid calling the original function: %CPPSELF.%FUNCTION_NAME() %PYARG_0 = quiloader_load_ui_from_device(%CPPSELF, %1, %2); @@ -89,7 +123,7 @@ - //Avoid calling the original function: %CPPSELF.load + // Avoid calling the original function: %CPPSELF.%FUNCTION_NAME() %PYARG_0 = quiloader_load_ui(%CPPSELF, %1, %2); diff --git a/PySide/QtWebKit/CMakeLists.txt b/PySide/QtWebKit/CMakeLists.txt index 479448a..83445db 100644 --- a/PySide/QtWebKit/CMakeLists.txt +++ b/PySide/QtWebKit/CMakeLists.txt @@ -7,6 +7,8 @@ else () ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtWebKit/qwebelement_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtWebKit/qwebelementcollection_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtWebKit/qwebinspector_wrapper.cpp + ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtWebKit/qwebpage_errorpageextensionoption_wrapper.cpp + ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtWebKit/qwebpage_errorpageextensionreturn_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtWebKit/qgraphicswebview_wrapper.cpp ) endif () @@ -20,6 +22,10 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtWebKit/qwebhistoryitem_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtWebKit/qwebhistory_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtWebKit/qwebhittestresult_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtWebKit/qwebpage_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/PySide/QtWebKit/qwebpage_choosemultiplefilesextensionoption_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/PySide/QtWebKit/qwebpage_choosemultiplefilesextensionreturn_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/PySide/QtWebKit/qwebpage_extensionoption_wrapper.cpp +${CMAKE_CURRENT_BINARY_DIR}/PySide/QtWebKit/qwebpage_extensionreturn_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtWebKit/qwebpluginfactory_mimetype_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtWebKit/qwebpluginfactory_plugin_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtWebKit/qwebpluginfactory_wrapper.cpp diff --git a/PySide/QtWebKit/typesystem_webkit.xml b/PySide/QtWebKit/typesystem_webkit.xml index da709a4..a021a04 100644 --- a/PySide/QtWebKit/typesystem_webkit.xml +++ b/PySide/QtWebKit/typesystem_webkit.xml @@ -31,7 +31,7 @@ - + @@ -47,14 +47,26 @@ - + - - + + + + + + + + + + + + + + @@ -64,16 +76,70 @@ - - + - + + + + + + + + + + + + PyObject* %out = 0; + // Cast the parameters according to the extension type + if (extension == QWebPage::ChooseMultipleFilesExtension) + %out = %CONVERTTOPYTHON[ChooseMultipleFilesExtensionOption*](reinterpret_cast<const ChooseMultipleFilesExtensionOption*>(option)); + #if QT_VERSION >= 0x040600 + else if (extension == QWebPage::ErrorPageExtension) + %out = %CONVERTTOPYTHON[ErrorPageExtensionOption*](reinterpret_cast<const ErrorPageExtensionOption*>(option)); + #endif + + + + + PyObject* %out = 0; + // Cast the parameters according to the extension type + if (extension == QWebPage::ChooseMultipleFilesExtension) + %out = %CONVERTTOPYTHON[ChooseMultipleFilesExtensionReturn*](reinterpret_cast<const ChooseMultipleFilesExtensionReturn*>(output)); + #if QT_VERSION >= 0x040600 + else if (extension == QWebPage::ErrorPageExtension) + %out = %CONVERTTOPYTHON[ErrorPageExtensionReturn*](reinterpret_cast<const ErrorPageExtensionReturn*>(output)); + #endif + + + + + + + + + + + + + + + + + + + + + + + + + @@ -104,10 +170,25 @@ - - - + + + - + + + + return %CPPSELF.count(); + + + + + if (_i < 0 || _i >= %CPPSELF.count()) { + PyErr_SetString(PyExc_IndexError, "index out of bounds"); + return 0; + } + return %CONVERTTOPYTHON[QWebElement](%CPPSELF.at(_i)); + + + diff --git a/PySide/QtXml/typesystem_xml.xml b/PySide/QtXml/typesystem_xml.xml index d018ee5..1bf07de 100644 --- a/PySide/QtXml/typesystem_xml.xml +++ b/PySide/QtXml/typesystem_xml.xml @@ -27,33 +27,23 @@ - - - - - - - - - - - - - - - + + + + - - @@ -217,22 +207,10 @@ - - - - - - - - - - - - - - - - + + + + @@ -247,30 +225,13 @@ + + - - - - - - - - - - - + - - @@ -309,7 +270,11 @@ QXmlInputSource* _qxmlinputsource_arg_ = 0; + + %BEGIN_ALLOW_THREADS %RETURN_TYPE %0 = %CPPSELF.%FUNCTION_NAME(%1, %2, _qxmlinputsource_arg_); + %END_ALLOW_THREADS + %PYARG_0 = Shiboken::makeTuple(%0, _qxmlinputsource_arg_); @@ -332,7 +297,9 @@ QXmlInputSource* _qxmlinputsource_arg_ = 0; + %BEGIN_ALLOW_THREADS %RETURN_TYPE %0 = %CPPSELF.%TYPE::%FUNCTION_NAME(%1, %2, _qxmlinputsource_arg_); + %END_ALLOW_THREADS %PYARG_0 = Shiboken::makeTuple(%0, _qxmlinputsource_arg_); @@ -340,16 +307,6 @@ - - @@ -452,9 +409,5 @@ - - - - diff --git a/PySide/QtXmlPatterns/typesystem_xmlpatterns.xml b/PySide/QtXmlPatterns/typesystem_xmlpatterns.xml index 322e2f0..665b302 100644 --- a/PySide/QtXmlPatterns/typesystem_xmlpatterns.xml +++ b/PySide/QtXmlPatterns/typesystem_xmlpatterns.xml @@ -21,8 +21,8 @@ - - + + @@ -44,6 +44,7 @@ + @@ -55,14 +56,19 @@ + + + + + + + - - - + @@ -76,6 +82,7 @@ + @@ -84,7 +91,6 @@ - - - + + diff --git a/PySide/__init__.py.in b/PySide/__init__.py.in index f931fad..40731a8 100644 --- a/PySide/__init__.py.in +++ b/PySide/__init__.py.in @@ -1,5 +1,5 @@ __all__ = ['QtCore', 'QtGui', 'QtNetwork', 'QtOpenGL', 'QtSql', 'QtSvg', 'QtTest', 'QtWebKit', 'QtScript'] import private -__version__ = "@BINDING_API_VERSION@" -__version_info__ = (@BINDING_API_MAJOR_VERSION@, @BINDING_API_MINOR_VERSION@, @BINDING_API_MICRO_VERSION@) +__version__ = "@BINDING_API_VERSION_FULL@" +__version_info__ = (@BINDING_API_MAJOR_VERSION@, @BINDING_API_MINOR_VERSION@, @BINDING_API_MICRO_VERSION@, "@BINDING_API_RELEASE_LEVEL@", @BINDING_API_SERIAL@) diff --git a/PySide/global.h.in b/PySide/global.h.in index 0e76e46..acd30d0 100644 --- a/PySide/global.h.in +++ b/PySide/global.h.in @@ -20,8 +20,9 @@ #undef QT_NO_STL #undef QT_NO_STL_WCHAR +#define Q_BYTE_ORDER // used to enable QSysInfo.Endian detection on MacOSX -#include +#include "@QT_QTCORE_INCLUDE_DIR@/qnamespace.h" QT_BEGIN_HEADER @@ -318,6 +319,7 @@ QT_END_HEADER #elif @ENABLE_MAC@ #define Q_WS_MAC #elif @ENABLE_WIN@ + #include "pysidewtypes.h" #define Q_WS_WIN #elif @ENABLE_SIMULATOR@ #define Q_WS_SIMULATOR @@ -327,1169 +329,91 @@ QT_END_HEADER // not in release #define QT_NO_DEBUG -#include +#include "@QT_QTCORE_INCLUDE_DIR@/QtCore" #if @ENABLE_MAC@ || @ENABLE_WIN@ // Workaround to parse the QApplication header #define Q_INTERNAL_QAPP_SRC #undef qdoc #endif -#include -#include "qpytextobject.h" +#include "@QT_QTGUI_INCLUDE_DIR@/QtGui" +#include "qpytextobject.h" // PySide class #if @ENABLE_X11@ - #include - #include - #include + #include "@QT_QTGUI_INCLUDE_DIR@/QX11Info" + #include "@QT_QTGUI_INCLUDE_DIR@/QX11EmbedContainer" + #include "@QT_QTGUI_INCLUDE_DIR@/QX11EmbedWidget" +#elif @ENABLE_MAC@ + #include "@QT_QTGUI_INCLUDE_DIR@/qmacstyle_mac.h" #endif -#include -#include -#include -#include -#include -#include +#include "@QT_QTXML_INCLUDE_DIR@/QtXml" +#include "@QT_QTUITOOLS_INCLUDE_DIR@/QtUiTools" +#include "@QT_QTNETWORK_INCLUDE_DIR@/QtNetwork" +#include "@QT_QTSCRIPT_INCLUDE_DIR@/QtScript" +#include "@QT_QTSCRIPTTOOLS_INCLUDE_DIR@/QtScriptTools" +#include "@QT_QTMULTIMEDIA_INCLUDE_DIR@/QtMultimedia" #include -#include +#include "@QT_QTDECLARATIVE_INCLUDE_DIR@/QtDeclarative" // QT_GUI_LIB must be defined to QSqlRelationalDelegate become visible #define QT_GUI_LIB #undef Q_DECLARE_INTERFACE -#include -#include +#include "@QT_QTSQL_INCLUDE_DIR@/QtSql" +#include "@QT_QTSVG_INCLUDE_DIR@/QtSvg" #if @QT_QTXMLPATTERNS_FOUND@ -# include +# include "@QT_QTXMLPATTERNS_INCLUDE_DIR@/QtXmlPatterns" #endif #if @QT_QTWEBKIT_FOUND@ -# include +# include "@QT_QTWEBKIT_INCLUDE_DIR@/QtWebKit" #endif #if @QT_QTTEST_FOUND@ -# include +# include "@QT_QTTEST_INCLUDE_DIR@/QtTest" +#if @QT_VERSION_MINOR@ > 5 +# include "pysideqtesttouch.h" +#endif #endif // Phonon #include "phonon/pyside_phonon.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "@QT_PHONON_INCLUDE_DIR@/abstractaudiooutput.h" +#include "@QT_PHONON_INCLUDE_DIR@/abstractmediastream.h" +#include "@QT_PHONON_INCLUDE_DIR@/abstractvideooutput.h" +#include "@QT_PHONON_INCLUDE_DIR@/addoninterface.h" +#include "@QT_PHONON_INCLUDE_DIR@/audiooutput.h" +#include "@QT_PHONON_INCLUDE_DIR@/audiooutputinterface.h" +#include "@QT_PHONON_INCLUDE_DIR@/backendcapabilities.h" +#include "@QT_PHONON_INCLUDE_DIR@/backendinterface.h" +#include "@QT_PHONON_INCLUDE_DIR@/effect.h" +#include "@QT_PHONON_INCLUDE_DIR@/effectinterface.h" +#include "@QT_PHONON_INCLUDE_DIR@/effectparameter.h" +#include "@QT_PHONON_INCLUDE_DIR@/effectwidget.h" +#include "@QT_PHONON_INCLUDE_DIR@/mediacontroller.h" +#include "@QT_PHONON_INCLUDE_DIR@/medianode.h" +#include "@QT_PHONON_INCLUDE_DIR@/mediaobject.h" +#include "@QT_PHONON_INCLUDE_DIR@/mediaobjectinterface.h" +#include "@QT_PHONON_INCLUDE_DIR@/mediasource.h" +#include "@QT_PHONON_INCLUDE_DIR@/objectdescription.h" +#include "@QT_PHONON_INCLUDE_DIR@/objectdescriptionmodel.h" +#include "@QT_PHONON_INCLUDE_DIR@/path.h" +#include "@QT_PHONON_INCLUDE_DIR@/phonon_export.h" +#include "@QT_PHONON_INCLUDE_DIR@/phonondefs.h" +#include "@QT_PHONON_INCLUDE_DIR@/phononnamespace.h" +#include "@QT_PHONON_INCLUDE_DIR@/platformplugin.h" +#include "@QT_PHONON_INCLUDE_DIR@/seekslider.h" +#include "@QT_PHONON_INCLUDE_DIR@/streaminterface.h" +#include "@QT_PHONON_INCLUDE_DIR@/videoplayer.h" +#include "@QT_PHONON_INCLUDE_DIR@/videowidget.h" +#include "@QT_PHONON_INCLUDE_DIR@/videowidgetinterface.h" +#include "@QT_PHONON_INCLUDE_DIR@/volumefadereffect.h" +#include "@QT_PHONON_INCLUDE_DIR@/volumefaderinterface.h" +#include "@QT_PHONON_INCLUDE_DIR@/volumeslider.h" //QtHelp need be included after QtSql -#include +#include "@QT_QTHELP_INCLUDE_DIR@/QtHelp" #ifndef QT_NO_OPENGL -#define GL_ACCUM 0x0100 -#define GL_LOAD 0x0101 -#define GL_RETURN 0x0102 -#define GL_MULT 0x0103 -#define GL_ADD 0x0104 - -/* AlphaFunction */ -#define GL_NEVER 0x0200 -#define GL_LESS 0x0201 -#define GL_EQUAL 0x0202 -#define GL_LEQUAL 0x0203 -#define GL_GREATER 0x0204 -#define GL_NOTEQUAL 0x0205 -#define GL_GEQUAL 0x0206 -#define GL_ALWAYS 0x0207 - -/* AttribMask */ -#define GL_CURRENT_BIT 0x00000001 -#define GL_POINT_BIT 0x00000002 -#define GL_LINE_BIT 0x00000004 -#define GL_POLYGON_BIT 0x00000008 -#define GL_POLYGON_STIPPLE_BIT 0x00000010 -#define GL_PIXEL_MODE_BIT 0x00000020 -#define GL_LIGHTING_BIT 0x00000040 -#define GL_FOG_BIT 0x00000080 -#define GL_DEPTH_BUFFER_BIT 0x00000100 -#define GL_ACCUM_BUFFER_BIT 0x00000200 -#define GL_STENCIL_BUFFER_BIT 0x00000400 -#define GL_VIEWPORT_BIT 0x00000800 -#define GL_TRANSFORM_BIT 0x00001000 -#define GL_ENABLE_BIT 0x00002000 -#define GL_COLOR_BUFFER_BIT 0x00004000 -#define GL_HINT_BIT 0x00008000 -#define GL_EVAL_BIT 0x00010000 -#define GL_LIST_BIT 0x00020000 -#define GL_TEXTURE_BIT 0x00040000 -#define GL_SCISSOR_BIT 0x00080000 -#define GL_ALL_ATTRIB_BITS 0x000fffff - -/* BeginMode */ -#define GL_POINTS 0x0000 -#define GL_LINES 0x0001 -#define GL_LINE_LOOP 0x0002 -#define GL_LINE_STRIP 0x0003 -#define GL_TRIANGLES 0x0004 -#define GL_TRIANGLE_STRIP 0x0005 -#define GL_TRIANGLE_FAN 0x0006 -#define GL_QUADS 0x0007 -#define GL_QUAD_STRIP 0x0008 -#define GL_POLYGON 0x0009 - -/* BlendingFactorDest */ -#define GL_ZERO 0 -#define GL_ONE 1 -#define GL_SRC_COLOR 0x0300 -#define GL_ONE_MINUS_SRC_COLOR 0x0301 -#define GL_SRC_ALPHA 0x0302 -#define GL_ONE_MINUS_SRC_ALPHA 0x0303 -#define GL_DST_ALPHA 0x0304 -#define GL_ONE_MINUS_DST_ALPHA 0x0305 - -/* BlendingFactorSrc */ -/* GL_ZERO */ -/* GL_ONE */ -#define GL_DST_COLOR 0x0306 -#define GL_ONE_MINUS_DST_COLOR 0x0307 -#define GL_SRC_ALPHA_SATURATE 0x0308 -/* GL_SRC_ALPHA */ -/* GL_ONE_MINUS_SRC_ALPHA */ -/* GL_DST_ALPHA */ -/* GL_ONE_MINUS_DST_ALPHA */ - -/* Boolean */ -#define GL_TRUE 1 -#define GL_FALSE 0 - -/* ClearBufferMask */ -/* GL_COLOR_BUFFER_BIT */ -/* GL_ACCUM_BUFFER_BIT */ -/* GL_STENCIL_BUFFER_BIT */ -/* GL_DEPTH_BUFFER_BIT */ - -/* ClientArrayType */ -/* GL_VERTEX_ARRAY */ -/* GL_NORMAL_ARRAY */ -/* GL_COLOR_ARRAY */ -/* GL_INDEX_ARRAY */ -/* GL_TEXTURE_COORD_ARRAY */ -/* GL_EDGE_FLAG_ARRAY */ - -/* ClipPlaneName */ -#define GL_CLIP_PLANE0 0x3000 -#define GL_CLIP_PLANE1 0x3001 -#define GL_CLIP_PLANE2 0x3002 -#define GL_CLIP_PLANE3 0x3003 -#define GL_CLIP_PLANE4 0x3004 -#define GL_CLIP_PLANE5 0x3005 - -/* ColorMaterialFace */ -/* GL_FRONT */ -/* GL_BACK */ -/* GL_FRONT_AND_BACK */ - -/* ColorMaterialParameter */ -/* GL_AMBIENT */ -/* GL_DIFFUSE */ -/* GL_SPECULAR */ -/* GL_EMISSION */ -/* GL_AMBIENT_AND_DIFFUSE */ - -/* ColorPointerType */ -/* GL_BYTE */ -/* GL_UNSIGNED_BYTE */ -/* GL_SHORT */ -/* GL_UNSIGNED_SHORT */ -/* GL_INT */ -/* GL_UNSIGNED_INT */ -/* GL_FLOAT */ -/* GL_DOUBLE */ - -/* CullFaceMode */ -/* GL_FRONT */ -/* GL_BACK */ -/* GL_FRONT_AND_BACK */ - -/* DataType */ -#define GL_BYTE 0x1400 -#define GL_UNSIGNED_BYTE 0x1401 -#define GL_SHORT 0x1402 -#define GL_UNSIGNED_SHORT 0x1403 -#define GL_INT 0x1404 -#define GL_UNSIGNED_INT 0x1405 -#define GL_FLOAT 0x1406 -#define GL_2_BYTES 0x1407 -#define GL_3_BYTES 0x1408 -#define GL_4_BYTES 0x1409 -#define GL_DOUBLE 0x140A - -/* DepthFunction */ -/* GL_NEVER */ -/* GL_LESS */ -/* GL_EQUAL */ -/* GL_LEQUAL */ -/* GL_GREATER */ -/* GL_NOTEQUAL */ -/* GL_GEQUAL */ -/* GL_ALWAYS */ - -/* DrawBufferMode */ -#define GL_NONE 0 -#define GL_FRONT_LEFT 0x0400 -#define GL_FRONT_RIGHT 0x0401 -#define GL_BACK_LEFT 0x0402 -#define GL_BACK_RIGHT 0x0403 -#define GL_FRONT 0x0404 -#define GL_BACK 0x0405 -#define GL_LEFT 0x0406 -#define GL_RIGHT 0x0407 -#define GL_FRONT_AND_BACK 0x0408 -#define GL_AUX0 0x0409 -#define GL_AUX1 0x040A -#define GL_AUX2 0x040B -#define GL_AUX3 0x040C - -/* Enable */ -/* GL_FOG */ -/* GL_LIGHTING */ -/* GL_TEXTURE_1D */ -/* GL_TEXTURE_2D */ -/* GL_LINE_STIPPLE */ -/* GL_POLYGON_STIPPLE */ -/* GL_CULL_FACE */ -/* GL_ALPHA_TEST */ -/* GL_BLEND */ -/* GL_INDEX_LOGIC_OP */ -/* GL_COLOR_LOGIC_OP */ -/* GL_DITHER */ -/* GL_STENCIL_TEST */ -/* GL_DEPTH_TEST */ -/* GL_CLIP_PLANE0 */ -/* GL_CLIP_PLANE1 */ -/* GL_CLIP_PLANE2 */ -/* GL_CLIP_PLANE3 */ -/* GL_CLIP_PLANE4 */ -/* GL_CLIP_PLANE5 */ -/* GL_LIGHT0 */ -/* GL_LIGHT1 */ -/* GL_LIGHT2 */ -/* GL_LIGHT3 */ -/* GL_LIGHT4 */ -/* GL_LIGHT5 */ -/* GL_LIGHT6 */ -/* GL_LIGHT7 */ -/* GL_TEXTURE_GEN_S */ -/* GL_TEXTURE_GEN_T */ -/* GL_TEXTURE_GEN_R */ -/* GL_TEXTURE_GEN_Q */ -/* GL_MAP1_VERTEX_3 */ -/* GL_MAP1_VERTEX_4 */ -/* GL_MAP1_COLOR_4 */ -/* GL_MAP1_INDEX */ -/* GL_MAP1_NORMAL */ -/* GL_MAP1_TEXTURE_COORD_1 */ -/* GL_MAP1_TEXTURE_COORD_2 */ -/* GL_MAP1_TEXTURE_COORD_3 */ -/* GL_MAP1_TEXTURE_COORD_4 */ -/* GL_MAP2_VERTEX_3 */ -/* GL_MAP2_VERTEX_4 */ -/* GL_MAP2_COLOR_4 */ -/* GL_MAP2_INDEX */ -/* GL_MAP2_NORMAL */ -/* GL_MAP2_TEXTURE_COORD_1 */ -/* GL_MAP2_TEXTURE_COORD_2 */ -/* GL_MAP2_TEXTURE_COORD_3 */ -/* GL_MAP2_TEXTURE_COORD_4 */ -/* GL_POINT_SMOOTH */ -/* GL_LINE_SMOOTH */ -/* GL_POLYGON_SMOOTH */ -/* GL_SCISSOR_TEST */ -/* GL_COLOR_MATERIAL */ -/* GL_NORMALIZE */ -/* GL_AUTO_NORMAL */ -/* GL_VERTEX_ARRAY */ -/* GL_NORMAL_ARRAY */ -/* GL_COLOR_ARRAY */ -/* GL_INDEX_ARRAY */ -/* GL_TEXTURE_COORD_ARRAY */ -/* GL_EDGE_FLAG_ARRAY */ -/* GL_POLYGON_OFFSET_POINT */ -/* GL_POLYGON_OFFSET_LINE */ -/* GL_POLYGON_OFFSET_FILL */ - -/* ErrorCode */ -#define GL_NO_ERROR 0 -#define GL_INVALID_ENUM 0x0500 -#define GL_INVALID_VALUE 0x0501 -#define GL_INVALID_OPERATION 0x0502 -#define GL_STACK_OVERFLOW 0x0503 -#define GL_STACK_UNDERFLOW 0x0504 -#define GL_OUT_OF_MEMORY 0x0505 - -/* FeedBackMode */ -#define GL_2D 0x0600 -#define GL_3D 0x0601 -#define GL_3D_COLOR 0x0602 -#define GL_3D_COLOR_TEXTURE 0x0603 -#define GL_4D_COLOR_TEXTURE 0x0604 - -/* FeedBackToken */ -#define GL_PASS_THROUGH_TOKEN 0x0700 -#define GL_POINT_TOKEN 0x0701 -#define GL_LINE_TOKEN 0x0702 -#define GL_POLYGON_TOKEN 0x0703 -#define GL_BITMAP_TOKEN 0x0704 -#define GL_DRAW_PIXEL_TOKEN 0x0705 -#define GL_COPY_PIXEL_TOKEN 0x0706 -#define GL_LINE_RESET_TOKEN 0x0707 - -/* FogMode */ -/* GL_LINEAR */ -#define GL_EXP 0x0800 -#define GL_EXP2 0x0801 - - -/* FogParameter */ -/* GL_FOG_COLOR */ -/* GL_FOG_DENSITY */ -/* GL_FOG_END */ -/* GL_FOG_INDEX */ -/* GL_FOG_MODE */ -/* GL_FOG_START */ - -/* FrontFaceDirection */ -#define GL_CW 0x0900 -#define GL_CCW 0x0901 - -/* GetMapTarget */ -#define GL_COEFF 0x0A00 -#define GL_ORDER 0x0A01 -#define GL_DOMAIN 0x0A02 - -/* GetPixelMap */ -/* GL_PIXEL_MAP_I_TO_I */ -/* GL_PIXEL_MAP_S_TO_S */ -/* GL_PIXEL_MAP_I_TO_R */ -/* GL_PIXEL_MAP_I_TO_G */ -/* GL_PIXEL_MAP_I_TO_B */ -/* GL_PIXEL_MAP_I_TO_A */ -/* GL_PIXEL_MAP_R_TO_R */ -/* GL_PIXEL_MAP_G_TO_G */ -/* GL_PIXEL_MAP_B_TO_B */ -/* GL_PIXEL_MAP_A_TO_A */ - -/* GetPointerTarget */ -/* GL_VERTEX_ARRAY_POINTER */ -/* GL_NORMAL_ARRAY_POINTER */ -/* GL_COLOR_ARRAY_POINTER */ -/* GL_INDEX_ARRAY_POINTER */ -/* GL_TEXTURE_COORD_ARRAY_POINTER */ -/* GL_EDGE_FLAG_ARRAY_POINTER */ - -/* GetTarget */ -#define GL_CURRENT_COLOR 0x0B00 -#define GL_CURRENT_INDEX 0x0B01 -#define GL_CURRENT_NORMAL 0x0B02 -#define GL_CURRENT_TEXTURE_COORDS 0x0B03 -#define GL_CURRENT_RASTER_COLOR 0x0B04 -#define GL_CURRENT_RASTER_INDEX 0x0B05 -#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 -#define GL_CURRENT_RASTER_POSITION 0x0B07 -#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 -#define GL_CURRENT_RASTER_DISTANCE 0x0B09 -#define GL_POINT_SMOOTH 0x0B10 -#define GL_POINT_SIZE 0x0B11 -#define GL_POINT_SIZE_RANGE 0x0B12 -#define GL_POINT_SIZE_GRANULARITY 0x0B13 -#define GL_LINE_SMOOTH 0x0B20 -#define GL_LINE_WIDTH 0x0B21 -#define GL_LINE_WIDTH_RANGE 0x0B22 -#define GL_LINE_WIDTH_GRANULARITY 0x0B23 -#define GL_LINE_STIPPLE 0x0B24 -#define GL_LINE_STIPPLE_PATTERN 0x0B25 -#define GL_LINE_STIPPLE_REPEAT 0x0B26 -#define GL_LIST_MODE 0x0B30 -#define GL_MAX_LIST_NESTING 0x0B31 -#define GL_LIST_BASE 0x0B32 -#define GL_LIST_INDEX 0x0B33 -#define GL_POLYGON_MODE 0x0B40 -#define GL_POLYGON_SMOOTH 0x0B41 -#define GL_POLYGON_STIPPLE 0x0B42 -#define GL_EDGE_FLAG 0x0B43 -#define GL_CULL_FACE 0x0B44 -#define GL_CULL_FACE_MODE 0x0B45 -#define GL_FRONT_FACE 0x0B46 -#define GL_LIGHTING 0x0B50 -#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 -#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 -#define GL_LIGHT_MODEL_AMBIENT 0x0B53 -#define GL_SHADE_MODEL 0x0B54 -#define GL_COLOR_MATERIAL_FACE 0x0B55 -#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 -#define GL_COLOR_MATERIAL 0x0B57 -#define GL_FOG 0x0B60 -#define GL_FOG_INDEX 0x0B61 -#define GL_FOG_DENSITY 0x0B62 -#define GL_FOG_START 0x0B63 -#define GL_FOG_END 0x0B64 -#define GL_FOG_MODE 0x0B65 -#define GL_FOG_COLOR 0x0B66 -#define GL_DEPTH_RANGE 0x0B70 -#define GL_DEPTH_TEST 0x0B71 -#define GL_DEPTH_WRITEMASK 0x0B72 -#define GL_DEPTH_CLEAR_VALUE 0x0B73 -#define GL_DEPTH_FUNC 0x0B74 -#define GL_ACCUM_CLEAR_VALUE 0x0B80 -#define GL_STENCIL_TEST 0x0B90 -#define GL_STENCIL_CLEAR_VALUE 0x0B91 -#define GL_STENCIL_FUNC 0x0B92 -#define GL_STENCIL_VALUE_MASK 0x0B93 -#define GL_STENCIL_FAIL 0x0B94 -#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 -#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 -#define GL_STENCIL_REF 0x0B97 -#define GL_STENCIL_WRITEMASK 0x0B98 -#define GL_MATRIX_MODE 0x0BA0 -#define GL_NORMALIZE 0x0BA1 -#define GL_VIEWPORT 0x0BA2 -#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 -#define GL_PROJECTION_STACK_DEPTH 0x0BA4 -#define GL_TEXTURE_STACK_DEPTH 0x0BA5 -#define GL_MODELVIEW_MATRIX 0x0BA6 -#define GL_PROJECTION_MATRIX 0x0BA7 -#define GL_TEXTURE_MATRIX 0x0BA8 -#define GL_ATTRIB_STACK_DEPTH 0x0BB0 -#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 -#define GL_ALPHA_TEST 0x0BC0 -#define GL_ALPHA_TEST_FUNC 0x0BC1 -#define GL_ALPHA_TEST_REF 0x0BC2 -#define GL_DITHER 0x0BD0 -#define GL_BLEND_DST 0x0BE0 -#define GL_BLEND_SRC 0x0BE1 -#define GL_BLEND 0x0BE2 -#define GL_LOGIC_OP_MODE 0x0BF0 -#define GL_INDEX_LOGIC_OP 0x0BF1 -#define GL_COLOR_LOGIC_OP 0x0BF2 -#define GL_AUX_BUFFERS 0x0C00 -#define GL_DRAW_BUFFER 0x0C01 -#define GL_READ_BUFFER 0x0C02 -#define GL_SCISSOR_BOX 0x0C10 -#define GL_SCISSOR_TEST 0x0C11 -#define GL_INDEX_CLEAR_VALUE 0x0C20 -#define GL_INDEX_WRITEMASK 0x0C21 -#define GL_COLOR_CLEAR_VALUE 0x0C22 -#define GL_COLOR_WRITEMASK 0x0C23 -#define GL_INDEX_MODE 0x0C30 -#define GL_RGBA_MODE 0x0C31 -#define GL_DOUBLEBUFFER 0x0C32 -#define GL_STEREO 0x0C33 -#define GL_RENDER_MODE 0x0C40 -#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 -#define GL_POINT_SMOOTH_HINT 0x0C51 -#define GL_LINE_SMOOTH_HINT 0x0C52 -#define GL_POLYGON_SMOOTH_HINT 0x0C53 -#define GL_FOG_HINT 0x0C54 -#define GL_TEXTURE_GEN_S 0x0C60 -#define GL_TEXTURE_GEN_T 0x0C61 -#define GL_TEXTURE_GEN_R 0x0C62 -#define GL_TEXTURE_GEN_Q 0x0C63 -#define GL_PIXEL_MAP_I_TO_I 0x0C70 -#define GL_PIXEL_MAP_S_TO_S 0x0C71 -#define GL_PIXEL_MAP_I_TO_R 0x0C72 -#define GL_PIXEL_MAP_I_TO_G 0x0C73 -#define GL_PIXEL_MAP_I_TO_B 0x0C74 -#define GL_PIXEL_MAP_I_TO_A 0x0C75 -#define GL_PIXEL_MAP_R_TO_R 0x0C76 -#define GL_PIXEL_MAP_G_TO_G 0x0C77 -#define GL_PIXEL_MAP_B_TO_B 0x0C78 -#define GL_PIXEL_MAP_A_TO_A 0x0C79 -#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 -#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 -#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 -#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 -#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 -#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 -#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 -#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 -#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 -#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 -#define GL_UNPACK_SWAP_BYTES 0x0CF0 -#define GL_UNPACK_LSB_FIRST 0x0CF1 -#define GL_UNPACK_ROW_LENGTH 0x0CF2 -#define GL_UNPACK_SKIP_ROWS 0x0CF3 -#define GL_UNPACK_SKIP_PIXELS 0x0CF4 -#define GL_UNPACK_ALIGNMENT 0x0CF5 -#define GL_PACK_SWAP_BYTES 0x0D00 -#define GL_PACK_LSB_FIRST 0x0D01 -#define GL_PACK_ROW_LENGTH 0x0D02 -#define GL_PACK_SKIP_ROWS 0x0D03 -#define GL_PACK_SKIP_PIXELS 0x0D04 -#define GL_PACK_ALIGNMENT 0x0D05 -#define GL_MAP_COLOR 0x0D10 -#define GL_MAP_STENCIL 0x0D11 -#define GL_INDEX_SHIFT 0x0D12 -#define GL_INDEX_OFFSET 0x0D13 -#define GL_RED_SCALE 0x0D14 -#define GL_RED_BIAS 0x0D15 -#define GL_ZOOM_X 0x0D16 -#define GL_ZOOM_Y 0x0D17 -#define GL_GREEN_SCALE 0x0D18 -#define GL_GREEN_BIAS 0x0D19 -#define GL_BLUE_SCALE 0x0D1A -#define GL_BLUE_BIAS 0x0D1B -#define GL_ALPHA_SCALE 0x0D1C -#define GL_ALPHA_BIAS 0x0D1D -#define GL_DEPTH_SCALE 0x0D1E -#define GL_DEPTH_BIAS 0x0D1F -#define GL_MAX_EVAL_ORDER 0x0D30 -#define GL_MAX_LIGHTS 0x0D31 -#define GL_MAX_CLIP_PLANES 0x0D32 -#define GL_MAX_TEXTURE_SIZE 0x0D33 -#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 -#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 -#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 -#define GL_MAX_NAME_STACK_DEPTH 0x0D37 -#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 -#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 -#define GL_MAX_VIEWPORT_DIMS 0x0D3A -#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B -#define GL_SUBPIXEL_BITS 0x0D50 -#define GL_INDEX_BITS 0x0D51 -#define GL_RED_BITS 0x0D52 -#define GL_GREEN_BITS 0x0D53 -#define GL_BLUE_BITS 0x0D54 -#define GL_ALPHA_BITS 0x0D55 -#define GL_DEPTH_BITS 0x0D56 -#define GL_STENCIL_BITS 0x0D57 -#define GL_ACCUM_RED_BITS 0x0D58 -#define GL_ACCUM_GREEN_BITS 0x0D59 -#define GL_ACCUM_BLUE_BITS 0x0D5A -#define GL_ACCUM_ALPHA_BITS 0x0D5B -#define GL_NAME_STACK_DEPTH 0x0D70 -#define GL_AUTO_NORMAL 0x0D80 -#define GL_MAP1_COLOR_4 0x0D90 -#define GL_MAP1_INDEX 0x0D91 -#define GL_MAP1_NORMAL 0x0D92 -#define GL_MAP1_TEXTURE_COORD_1 0x0D93 -#define GL_MAP1_TEXTURE_COORD_2 0x0D94 -#define GL_MAP1_TEXTURE_COORD_3 0x0D95 -#define GL_MAP1_TEXTURE_COORD_4 0x0D96 -#define GL_MAP1_VERTEX_3 0x0D97 -#define GL_MAP1_VERTEX_4 0x0D98 -#define GL_MAP2_COLOR_4 0x0DB0 -#define GL_MAP2_INDEX 0x0DB1 -#define GL_MAP2_NORMAL 0x0DB2 -#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 -#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 -#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 -#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 -#define GL_MAP2_VERTEX_3 0x0DB7 -#define GL_MAP2_VERTEX_4 0x0DB8 -#define GL_MAP1_GRID_DOMAIN 0x0DD0 -#define GL_MAP1_GRID_SEGMENTS 0x0DD1 -#define GL_MAP2_GRID_DOMAIN 0x0DD2 -#define GL_MAP2_GRID_SEGMENTS 0x0DD3 -#define GL_TEXTURE_1D 0x0DE0 -#define GL_TEXTURE_2D 0x0DE1 -#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 -#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 -#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 -#define GL_SELECTION_BUFFER_POINTER 0x0DF3 -#define GL_SELECTION_BUFFER_SIZE 0x0DF4 -/* GL_TEXTURE_BINDING_1D */ -/* GL_TEXTURE_BINDING_2D */ -/* GL_VERTEX_ARRAY */ -/* GL_NORMAL_ARRAY */ -/* GL_COLOR_ARRAY */ -/* GL_INDEX_ARRAY */ -/* GL_TEXTURE_COORD_ARRAY */ -/* GL_EDGE_FLAG_ARRAY */ -/* GL_VERTEX_ARRAY_SIZE */ -/* GL_VERTEX_ARRAY_TYPE */ -/* GL_VERTEX_ARRAY_STRIDE */ -/* GL_NORMAL_ARRAY_TYPE */ -/* GL_NORMAL_ARRAY_STRIDE */ -/* GL_COLOR_ARRAY_SIZE */ -/* GL_COLOR_ARRAY_TYPE */ -/* GL_COLOR_ARRAY_STRIDE */ -/* GL_INDEX_ARRAY_TYPE */ -/* GL_INDEX_ARRAY_STRIDE */ -/* GL_TEXTURE_COORD_ARRAY_SIZE */ -/* GL_TEXTURE_COORD_ARRAY_TYPE */ -/* GL_TEXTURE_COORD_ARRAY_STRIDE */ -/* GL_EDGE_FLAG_ARRAY_STRIDE */ -/* GL_POLYGON_OFFSET_FACTOR */ -/* GL_POLYGON_OFFSET_UNITS */ - -/* GetTextureParameter */ -/* GL_TEXTURE_MAG_FILTER */ -/* GL_TEXTURE_MIN_FILTER */ -/* GL_TEXTURE_WRAP_S */ -/* GL_TEXTURE_WRAP_T */ -#define GL_TEXTURE_WIDTH 0x1000 -#define GL_TEXTURE_HEIGHT 0x1001 -#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 -#define GL_TEXTURE_BORDER_COLOR 0x1004 -#define GL_TEXTURE_BORDER 0x1005 -/* GL_TEXTURE_RED_SIZE */ -/* GL_TEXTURE_GREEN_SIZE */ -/* GL_TEXTURE_BLUE_SIZE */ -/* GL_TEXTURE_ALPHA_SIZE */ -/* GL_TEXTURE_LUMINANCE_SIZE */ -/* GL_TEXTURE_INTENSITY_SIZE */ -/* GL_TEXTURE_PRIORITY */ -/* GL_TEXTURE_RESIDENT */ - -/* HintMode */ -#define GL_DONT_CARE 0x1100 -#define GL_FASTEST 0x1101 -#define GL_NICEST 0x1102 - -/* HintTarget */ -/* GL_PERSPECTIVE_CORRECTION_HINT */ -/* GL_POINT_SMOOTH_HINT */ -/* GL_LINE_SMOOTH_HINT */ -/* GL_POLYGON_SMOOTH_HINT */ -/* GL_FOG_HINT */ -/* GL_PHONG_HINT */ - -/* IndexPointerType */ -/* GL_SHORT */ -/* GL_INT */ -/* GL_FLOAT */ -/* GL_DOUBLE */ - -/* LightModelParameter */ -/* GL_LIGHT_MODEL_AMBIENT */ -/* GL_LIGHT_MODEL_LOCAL_VIEWER */ -/* GL_LIGHT_MODEL_TWO_SIDE */ - -/* LightName */ -#define GL_LIGHT0 0x4000 -#define GL_LIGHT1 0x4001 -#define GL_LIGHT2 0x4002 -#define GL_LIGHT3 0x4003 -#define GL_LIGHT4 0x4004 -#define GL_LIGHT5 0x4005 -#define GL_LIGHT6 0x4006 -#define GL_LIGHT7 0x4007 - -/* LightParameter */ -#define GL_AMBIENT 0x1200 -#define GL_DIFFUSE 0x1201 -#define GL_SPECULAR 0x1202 -#define GL_POSITION 0x1203 -#define GL_SPOT_DIRECTION 0x1204 -#define GL_SPOT_EXPONENT 0x1205 -#define GL_SPOT_CUTOFF 0x1206 -#define GL_CONSTANT_ATTENUATION 0x1207 -#define GL_LINEAR_ATTENUATION 0x1208 -#define GL_QUADRATIC_ATTENUATION 0x1209 - -/* InterleavedArrays */ -/* GL_V2F */ -/* GL_V3F */ -/* GL_C4UB_V2F */ -/* GL_C4UB_V3F */ -/* GL_C3F_V3F */ -/* GL_N3F_V3F */ -/* GL_C4F_N3F_V3F */ -/* GL_T2F_V3F */ -/* GL_T4F_V4F */ -/* GL_T2F_C4UB_V3F */ -/* GL_T2F_C3F_V3F */ -/* GL_T2F_N3F_V3F */ -/* GL_T2F_C4F_N3F_V3F */ -/* GL_T4F_C4F_N3F_V4F */ - -/* ListMode */ -#define GL_COMPILE 0x1300 -#define GL_COMPILE_AND_EXECUTE 0x1301 - -/* ListNameType */ -/* GL_BYTE */ -/* GL_UNSIGNED_BYTE */ -/* GL_SHORT */ -/* GL_UNSIGNED_SHORT */ -/* GL_INT */ -/* GL_UNSIGNED_INT */ -/* GL_FLOAT */ -/* GL_2_BYTES */ -/* GL_3_BYTES */ -/* GL_4_BYTES */ - -/* LogicOp */ -#define GL_CLEAR 0x1500 -#define GL_AND 0x1501 -#define GL_AND_REVERSE 0x1502 -#define GL_COPY 0x1503 -#define GL_AND_INVERTED 0x1504 -#define GL_NOOP 0x1505 -#define GL_XOR 0x1506 -#define GL_OR 0x1507 -#define GL_NOR 0x1508 -#define GL_EQUIV 0x1509 -#define GL_INVERT 0x150A -#define GL_OR_REVERSE 0x150B -#define GL_COPY_INVERTED 0x150C -#define GL_OR_INVERTED 0x150D -#define GL_NAND 0x150E -#define GL_SET 0x150F - -/* MapTarget */ -/* GL_MAP1_COLOR_4 */ -/* GL_MAP1_INDEX */ -/* GL_MAP1_NORMAL */ -/* GL_MAP1_TEXTURE_COORD_1 */ -/* GL_MAP1_TEXTURE_COORD_2 */ -/* GL_MAP1_TEXTURE_COORD_3 */ -/* GL_MAP1_TEXTURE_COORD_4 */ -/* GL_MAP1_VERTEX_3 */ -/* GL_MAP1_VERTEX_4 */ -/* GL_MAP2_COLOR_4 */ -/* GL_MAP2_INDEX */ -/* GL_MAP2_NORMAL */ -/* GL_MAP2_TEXTURE_COORD_1 */ -/* GL_MAP2_TEXTURE_COORD_2 */ -/* GL_MAP2_TEXTURE_COORD_3 */ -/* GL_MAP2_TEXTURE_COORD_4 */ -/* GL_MAP2_VERTEX_3 */ -/* GL_MAP2_VERTEX_4 */ - -/* MaterialFace */ -/* GL_FRONT */ -/* GL_BACK */ -/* GL_FRONT_AND_BACK */ - -/* MaterialParameter */ -#define GL_EMISSION 0x1600 -#define GL_SHININESS 0x1601 -#define GL_AMBIENT_AND_DIFFUSE 0x1602 -#define GL_COLOR_INDEXES 0x1603 -/* GL_AMBIENT */ -/* GL_DIFFUSE */ -/* GL_SPECULAR */ - -/* MatrixMode */ -#define GL_MODELVIEW 0x1700 -#define GL_PROJECTION 0x1701 -#define GL_TEXTURE 0x1702 - -/* MeshMode1 */ -/* GL_POINT */ -/* GL_LINE */ - -/* MeshMode2 */ -/* GL_POINT */ -/* GL_LINE */ -/* GL_FILL */ - -/* NormalPointerType */ -/* GL_BYTE */ -/* GL_SHORT */ -/* GL_INT */ -/* GL_FLOAT */ -/* GL_DOUBLE */ - -/* PixelCopyType */ -#define GL_COLOR 0x1800 -#define GL_DEPTH 0x1801 -#define GL_STENCIL 0x1802 - -/* PixelFormat */ -#define GL_COLOR_INDEX 0x1900 -#define GL_STENCIL_INDEX 0x1901 -#define GL_DEPTH_COMPONENT 0x1902 -#define GL_RED 0x1903 -#define GL_GREEN 0x1904 -#define GL_BLUE 0x1905 -#define GL_ALPHA 0x1906 -#define GL_RGB 0x1907 -#define GL_RGBA 0x1908 -#define GL_LUMINANCE 0x1909 -#define GL_LUMINANCE_ALPHA 0x190A - -/* PixelMap */ -/* GL_PIXEL_MAP_I_TO_I */ -/* GL_PIXEL_MAP_S_TO_S */ -/* GL_PIXEL_MAP_I_TO_R */ -/* GL_PIXEL_MAP_I_TO_G */ -/* GL_PIXEL_MAP_I_TO_B */ -/* GL_PIXEL_MAP_I_TO_A */ -/* GL_PIXEL_MAP_R_TO_R */ -/* GL_PIXEL_MAP_G_TO_G */ -/* GL_PIXEL_MAP_B_TO_B */ -/* GL_PIXEL_MAP_A_TO_A */ - -/* PixelStore */ -/* GL_UNPACK_SWAP_BYTES */ -/* GL_UNPACK_LSB_FIRST */ -/* GL_UNPACK_ROW_LENGTH */ -/* GL_UNPACK_SKIP_ROWS */ -/* GL_UNPACK_SKIP_PIXELS */ -/* GL_UNPACK_ALIGNMENT */ -/* GL_PACK_SWAP_BYTES */ -/* GL_PACK_LSB_FIRST */ -/* GL_PACK_ROW_LENGTH */ -/* GL_PACK_SKIP_ROWS */ -/* GL_PACK_SKIP_PIXELS */ -/* GL_PACK_ALIGNMENT */ - -/* PixelTransfer */ -/* GL_MAP_COLOR */ -/* GL_MAP_STENCIL */ -/* GL_INDEX_SHIFT */ -/* GL_INDEX_OFFSET */ -/* GL_RED_SCALE */ -/* GL_RED_BIAS */ -/* GL_GREEN_SCALE */ -/* GL_GREEN_BIAS */ -/* GL_BLUE_SCALE */ -/* GL_BLUE_BIAS */ -/* GL_ALPHA_SCALE */ -/* GL_ALPHA_BIAS */ -/* GL_DEPTH_SCALE */ -/* GL_DEPTH_BIAS */ - -/* PixelType */ -#define GL_BITMAP 0x1A00 -/* GL_BYTE */ -/* GL_UNSIGNED_BYTE */ -/* GL_SHORT */ -/* GL_UNSIGNED_SHORT */ -/* GL_INT */ -/* GL_UNSIGNED_INT */ -/* GL_FLOAT */ - -/* PolygonMode */ -#define GL_POINT 0x1B00 -#define GL_LINE 0x1B01 -#define GL_FILL 0x1B02 - -/* ReadBufferMode */ -/* GL_FRONT_LEFT */ -/* GL_FRONT_RIGHT */ -/* GL_BACK_LEFT */ -/* GL_BACK_RIGHT */ -/* GL_FRONT */ -/* GL_BACK */ -/* GL_LEFT */ -/* GL_RIGHT */ -/* GL_AUX0 */ -/* GL_AUX1 */ -/* GL_AUX2 */ -/* GL_AUX3 */ - -/* RenderingMode */ -#define GL_RENDER 0x1C00 -#define GL_FEEDBACK 0x1C01 -#define GL_SELECT 0x1C02 - -/* ShadingModel */ -#define GL_FLAT 0x1D00 -#define GL_SMOOTH 0x1D01 - - -/* StencilFunction */ -/* GL_NEVER */ -/* GL_LESS */ -/* GL_EQUAL */ -/* GL_LEQUAL */ -/* GL_GREATER */ -/* GL_NOTEQUAL */ -/* GL_GEQUAL */ -/* GL_ALWAYS */ - -/* StencilOp */ -/* GL_ZERO */ -#define GL_KEEP 0x1E00 -#define GL_REPLACE 0x1E01 -#define GL_INCR 0x1E02 -#define GL_DECR 0x1E03 -/* GL_INVERT */ - -/* StringName */ -#define GL_VENDOR 0x1F00 -#define GL_RENDERER 0x1F01 -#define GL_VERSION 0x1F02 -#define GL_EXTENSIONS 0x1F03 - -/* TextureCoordName */ -#define GL_S 0x2000 -#define GL_T 0x2001 -#define GL_R 0x2002 -#define GL_Q 0x2003 - -/* TexCoordPointerType */ -/* GL_SHORT */ -/* GL_INT */ -/* GL_FLOAT */ -/* GL_DOUBLE */ - -/* TextureEnvMode */ -#define GL_MODULATE 0x2100 -#define GL_DECAL 0x2101 -/* GL_BLEND */ -/* GL_REPLACE */ - -/* TextureEnvParameter */ -#define GL_TEXTURE_ENV_MODE 0x2200 -#define GL_TEXTURE_ENV_COLOR 0x2201 - -/* TextureEnvTarget */ -#define GL_TEXTURE_ENV 0x2300 - -/* TextureGenMode */ -#define GL_EYE_LINEAR 0x2400 -#define GL_OBJECT_LINEAR 0x2401 -#define GL_SPHERE_MAP 0x2402 - -/* TextureGenParameter */ -#define GL_TEXTURE_GEN_MODE 0x2500 -#define GL_OBJECT_PLANE 0x2501 -#define GL_EYE_PLANE 0x2502 - -/* TextureMagFilter */ -#define GL_NEAREST 0x2600 -#define GL_LINEAR 0x2601 - -/* TextureMinFilter */ -/* GL_NEAREST */ -/* GL_LINEAR */ -#define GL_NEAREST_MIPMAP_NEAREST 0x2700 -#define GL_LINEAR_MIPMAP_NEAREST 0x2701 -#define GL_NEAREST_MIPMAP_LINEAR 0x2702 -#define GL_LINEAR_MIPMAP_LINEAR 0x2703 - -/* TextureParameterName */ -#define GL_TEXTURE_MAG_FILTER 0x2800 -#define GL_TEXTURE_MIN_FILTER 0x2801 -#define GL_TEXTURE_WRAP_S 0x2802 -#define GL_TEXTURE_WRAP_T 0x2803 -/* GL_TEXTURE_BORDER_COLOR */ -/* GL_TEXTURE_PRIORITY */ - -/* TextureTarget */ -/* GL_TEXTURE_1D */ -/* GL_TEXTURE_2D */ -/* GL_PROXY_TEXTURE_1D */ -/* GL_PROXY_TEXTURE_2D */ - -/* TextureWrapMode */ -#define GL_CLAMP 0x2900 -#define GL_REPEAT 0x2901 - -/* VertexPointerType */ -/* GL_SHORT */ -/* GL_INT */ -/* GL_FLOAT */ -/* GL_DOUBLE */ - -/* ClientAttribMask */ -#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 -#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 -#define GL_CLIENT_ALL_ATTRIB_BITS 0xffffffff - -/* polygon_offset */ -#define GL_POLYGON_OFFSET_FACTOR 0x8038 -#define GL_POLYGON_OFFSET_UNITS 0x2A00 -#define GL_POLYGON_OFFSET_POINT 0x2A01 -#define GL_POLYGON_OFFSET_LINE 0x2A02 -#define GL_POLYGON_OFFSET_FILL 0x8037 - -/* texture */ -#define GL_ALPHA4 0x803B -#define GL_ALPHA8 0x803C -#define GL_ALPHA12 0x803D -#define GL_ALPHA16 0x803E -#define GL_LUMINANCE4 0x803F -#define GL_LUMINANCE8 0x8040 -#define GL_LUMINANCE12 0x8041 -#define GL_LUMINANCE16 0x8042 -#define GL_LUMINANCE4_ALPHA4 0x8043 -#define GL_LUMINANCE6_ALPHA2 0x8044 -#define GL_LUMINANCE8_ALPHA8 0x8045 -#define GL_LUMINANCE12_ALPHA4 0x8046 -#define GL_LUMINANCE12_ALPHA12 0x8047 -#define GL_LUMINANCE16_ALPHA16 0x8048 -#define GL_INTENSITY 0x8049 -#define GL_INTENSITY4 0x804A -#define GL_INTENSITY8 0x804B -#define GL_INTENSITY12 0x804C -#define GL_INTENSITY16 0x804D -#define GL_R3_G3_B2 0x2A10 -#define GL_RGB4 0x804F -#define GL_RGB5 0x8050 -#define GL_RGB8 0x8051 -#define GL_RGB10 0x8052 -#define GL_RGB12 0x8053 -#define GL_RGB16 0x8054 -#define GL_RGBA2 0x8055 -#define GL_RGBA4 0x8056 -#define GL_RGB5_A1 0x8057 -#define GL_RGBA8 0x8058 -#define GL_RGB10_A2 0x8059 -#define GL_RGBA12 0x805A -#define GL_RGBA16 0x805B -#define GL_TEXTURE_RED_SIZE 0x805C -#define GL_TEXTURE_GREEN_SIZE 0x805D -#define GL_TEXTURE_BLUE_SIZE 0x805E -#define GL_TEXTURE_ALPHA_SIZE 0x805F -#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 -#define GL_TEXTURE_INTENSITY_SIZE 0x8061 -#define GL_PROXY_TEXTURE_1D 0x8063 -#define GL_PROXY_TEXTURE_2D 0x8064 - -/* texture_object */ -#define GL_TEXTURE_PRIORITY 0x8066 -#define GL_TEXTURE_RESIDENT 0x8067 -#define GL_TEXTURE_BINDING_1D 0x8068 -#define GL_TEXTURE_BINDING_2D 0x8069 - -/* vertex_array */ -#define GL_VERTEX_ARRAY 0x8074 -#define GL_NORMAL_ARRAY 0x8075 -#define GL_COLOR_ARRAY 0x8076 -#define GL_INDEX_ARRAY 0x8077 -#define GL_TEXTURE_COORD_ARRAY 0x8078 -#define GL_EDGE_FLAG_ARRAY 0x8079 -#define GL_VERTEX_ARRAY_SIZE 0x807A -#define GL_VERTEX_ARRAY_TYPE 0x807B -#define GL_VERTEX_ARRAY_STRIDE 0x807C -#define GL_NORMAL_ARRAY_TYPE 0x807E -#define GL_NORMAL_ARRAY_STRIDE 0x807F -#define GL_COLOR_ARRAY_SIZE 0x8081 -#define GL_COLOR_ARRAY_TYPE 0x8082 -#define GL_COLOR_ARRAY_STRIDE 0x8083 -#define GL_INDEX_ARRAY_TYPE 0x8085 -#define GL_INDEX_ARRAY_STRIDE 0x8086 -#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 -#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 -#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A -#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C -#define GL_VERTEX_ARRAY_POINTER 0x808E -#define GL_NORMAL_ARRAY_POINTER 0x808F -#define GL_COLOR_ARRAY_POINTER 0x8090 -#define GL_INDEX_ARRAY_POINTER 0x8091 -#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 -#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 -#define GL_V2F 0x2A20 -#define GL_V3F 0x2A21 -#define GL_C4UB_V2F 0x2A22 -#define GL_C4UB_V3F 0x2A23 -#define GL_C3F_V3F 0x2A24 -#define GL_N3F_V3F 0x2A25 -#define GL_C4F_N3F_V3F 0x2A26 -#define GL_T2F_V3F 0x2A27 -#define GL_T4F_V4F 0x2A28 -#define GL_T2F_C4UB_V3F 0x2A29 -#define GL_T2F_C3F_V3F 0x2A2A -#define GL_T2F_N3F_V3F 0x2A2B -#define GL_T2F_C4F_N3F_V3F 0x2A2C -#define GL_T4F_C4F_N3F_V4F 0x2A2D - -/* Extensions */ -#define GL_EXT_vertex_array 1 -#define GL_EXT_bgra 1 -#define GL_EXT_paletted_texture 1 -#define GL_WIN_swap_hint 1 -#define GL_WIN_draw_range_elements 1 -// #define GL_WIN_phong_shading 1 -// #define GL_WIN_specular_fog 1 - -/* EXT_vertex_array */ -#define GL_VERTEX_ARRAY_EXT 0x8074 -#define GL_NORMAL_ARRAY_EXT 0x8075 -#define GL_COLOR_ARRAY_EXT 0x8076 -#define GL_INDEX_ARRAY_EXT 0x8077 -#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078 -#define GL_EDGE_FLAG_ARRAY_EXT 0x8079 -#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A -#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B -#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C -#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D -#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E -#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F -#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080 -#define GL_COLOR_ARRAY_SIZE_EXT 0x8081 -#define GL_COLOR_ARRAY_TYPE_EXT 0x8082 -#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083 -#define GL_COLOR_ARRAY_COUNT_EXT 0x8084 -#define GL_INDEX_ARRAY_TYPE_EXT 0x8085 -#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086 -#define GL_INDEX_ARRAY_COUNT_EXT 0x8087 -#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088 -#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089 -#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A -#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B -#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C -#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D -#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E -#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F -#define GL_COLOR_ARRAY_POINTER_EXT 0x8090 -#define GL_INDEX_ARRAY_POINTER_EXT 0x8091 -#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092 -#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093 -#define GL_DOUBLE_EXT GL_DOUBLE - -/* EXT_bgra */ -#define GL_BGR_EXT 0x80E0 -#define GL_BGRA_EXT 0x80E1 - -/* EXT_paletted_texture */ - -/* These must match the GL_COLOR_TABLE_*_SGI enumerants */ -#define GL_COLOR_TABLE_FORMAT_EXT 0x80D8 -#define GL_COLOR_TABLE_WIDTH_EXT 0x80D9 -#define GL_COLOR_TABLE_RED_SIZE_EXT 0x80DA -#define GL_COLOR_TABLE_GREEN_SIZE_EXT 0x80DB -#define GL_COLOR_TABLE_BLUE_SIZE_EXT 0x80DC -#define GL_COLOR_TABLE_ALPHA_SIZE_EXT 0x80DD -#define GL_COLOR_TABLE_LUMINANCE_SIZE_EXT 0x80DE -#define GL_COLOR_TABLE_INTENSITY_SIZE_EXT 0x80DF - -#define GL_COLOR_INDEX1_EXT 0x80E2 -#define GL_COLOR_INDEX2_EXT 0x80E3 -#define GL_COLOR_INDEX4_EXT 0x80E4 -#define GL_COLOR_INDEX8_EXT 0x80E5 -#define GL_COLOR_INDEX12_EXT 0x80E6 -#define GL_COLOR_INDEX16_EXT 0x80E7 - -/* WIN_draw_range_elements */ -#define GL_MAX_ELEMENTS_VERTICES_WIN 0x80E8 -#define GL_MAX_ELEMENTS_INDICES_WIN 0x80E9 - -/* WIN_phong_shading */ -#define GL_PHONG_WIN 0x80EA -#define GL_PHONG_HINT_WIN 0x80EB - -/* WIN_specular_fog */ -#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC - -/* For compatibility with OpenGL v1.0 */ -#define GL_LOGIC_OP GL_INDEX_LOGIC_OP -#define GL_TEXTURE_COMPONENTS GL_TEXTURE_INTERNAL_FORMAT -#include +#include <@GL_H@> +#include <@QT_QTOPENGL_INCLUDE_DIR@/QtOpenGL> #endif // QT_NO_OPENGL diff --git a/PySide/phonon/CMakeLists.txt b/PySide/phonon/CMakeLists.txt index 0452d1b..c11fe43 100644 --- a/PySide/phonon/CMakeLists.txt +++ b/PySide/phonon/CMakeLists.txt @@ -5,6 +5,10 @@ if (NOT QT_PHONON_INCLUDE_DIR AND CMAKE_HOST_APPLE) set(QT_PHONON_INCLUDE_DIR "${QT_LIBRARY_DIR}/phonon.framework/Headers") endif () +set(phonon_OPTIONAL_SRC ) +set(phonon_DROPPED_ENTRIES ) +check_qt_class(phonon VideoCaptureDevice phonon_OPTIONAL_SRC phonon_DROPPED_ENTRIES Phonon ObjectDescription) + set(phonon_SRC ${CMAKE_CURRENT_BINARY_DIR}/PySide/phonon/phonon_abstractaudiooutput_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/phonon/phonon_abstractmediastream_wrapper.cpp @@ -42,10 +46,9 @@ ${CMAKE_CURRENT_BINARY_DIR}/PySide/phonon/phonon_volumefaderinterface_wrapper.cp ${CMAKE_CURRENT_BINARY_DIR}/PySide/phonon/phonon_volumeslider_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/phonon/phonon_wrapper.cpp ${CMAKE_CURRENT_BINARY_DIR}/PySide/phonon/phonon_backendcapabilities_notifierwrapper_wrapper.cpp +${phonon_OPTIONAL_SRC} ) -check_qt_class("phonon" "VideoCaptureDevice" phonon_SRC "Phonon" "ObjectDescription") - set(phonon_typesystem_path "${QtCore_SOURCE_DIR}${PATH_SEP}${QtGui_SOURCE_DIR}${PATH_SEP}${phonon_SOURCE_DIR}${PATH_SEP}${QtGui_BINARY_DIR}") set(phonon_include_dirs ${CMAKE_CURRENT_SOURCE_DIR} ${QT_QTCORE_INCLUDE_DIR} @@ -70,4 +73,6 @@ create_pyside_module(phonon phonon_deps phonon_typesystem_path phonon_SRC - "") + "" + "" + phonon_DROPPED_ENTRIES) diff --git a/PySide/phonon/typesystem_phonon.xml b/PySide/phonon/typesystem_phonon.xml index 16dd72c..509e053 100644 --- a/PySide/phonon/typesystem_phonon.xml +++ b/PySide/phonon/typesystem_phonon.xml @@ -78,20 +78,22 @@ + - + + PySideSignal* signal_item; signal_item = PySide::Signal::newObject("capabilitiesChanged", "void", NULL); PyDict_SetItemString(Sbk_Phonon_BackendCapabilities_NotifierWrapper_Type.super.ht_type.tp_dict, "capabilitiesChanged", (PyObject*)signal_item); - Py_DECREF(signal_item); + Py_DECREF((PyObject*)signal_item); signal_item = PySide::Signal::newObject("availableAudioOutputDevicesChanged", "void", NULL); PyDict_SetItemString( Sbk_Phonon_BackendCapabilities_NotifierWrapper_Type.super.ht_type.tp_dict, "availableAudioOutputDevicesChanged", (PyObject*)signal_item); - Py_DECREF(signal_item); + Py_DECREF((PyObject*)signal_item); @@ -102,6 +104,7 @@ + @@ -126,22 +129,20 @@ - - - - - - - + + + + + + + - - @@ -170,37 +171,90 @@ - - - + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + - - @@ -211,7 +265,8 @@ - + + @@ -236,6 +291,25 @@ - + + + + + + + + + + + + + + + + + + + + diff --git a/PySide/pysideqtesttouch.h b/PySide/pysideqtesttouch.h new file mode 100644 index 0000000..fa7d2e4 --- /dev/null +++ b/PySide/pysideqtesttouch.h @@ -0,0 +1,147 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtTest module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef PYSIDEQTESTTOUCH_H +#define PYSIDEQTESTTOUCH_H + +#include +#include +#include +#include +#include + +#include +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QTest +{ + + class PySideQTouchEventSequence + { + public: + ~PySideQTouchEventSequence() + { + commit(); + } + + PySideQTouchEventSequence* press(int touchId, const QPoint &pt, QWidget *widget = 0) + { + QTouchEvent::TouchPoint &p = point(touchId); + p.setScreenPos(mapToScreen(widget, pt)); + p.setState(Qt::TouchPointPressed); + return this; + } + + PySideQTouchEventSequence* move(int touchId, const QPoint &pt, QWidget *widget = 0) + { + QTouchEvent::TouchPoint &p = point(touchId); + p.setScreenPos(mapToScreen(widget, pt)); + p.setState(Qt::TouchPointMoved); + return this; + } + + PySideQTouchEventSequence* release(int touchId, const QPoint &pt, QWidget *widget = 0) + { + QTouchEvent::TouchPoint &p = point(touchId); + p.setScreenPos(mapToScreen(widget, pt)); + p.setState(Qt::TouchPointReleased); + return this; + } + + PySideQTouchEventSequence* stationary(int touchId) + { + QTouchEvent::TouchPoint &p = point(touchId); + p.setState(Qt::TouchPointStationary); + return this; + } + + void commit() + { + qt_translateRawTouchEvent(targetWidget, deviceType, points.values()); + targetWidget = 0; + points.clear(); + } + + private: + PySideQTouchEventSequence(QWidget *widget, QTouchEvent::DeviceType aDeviceType) + : targetWidget(widget), deviceType(aDeviceType) + { + } + + PySideQTouchEventSequence(const PySideQTouchEventSequence &v); + + void operator=(const PySideQTouchEventSequence&); + + QTouchEvent::TouchPoint &point(int touchId) + { + if (!points.contains(touchId)) + points[touchId] = QTouchEvent::TouchPoint(touchId); + return points[touchId]; + } + + QPoint mapToScreen(QWidget *widget, const QPoint &pt) + { + if (widget) + return widget->mapToGlobal(pt); + return targetWidget ? targetWidget->mapToGlobal(pt) : pt; + } + + QMap points; + QWidget *targetWidget; + QTouchEvent::DeviceType deviceType; + friend PySideQTouchEventSequence* generateTouchEvent(QWidget *, QTouchEvent::DeviceType); + }; + + inline + PySideQTouchEventSequence* generateTouchEvent(QWidget *widget = 0, + QTouchEvent::DeviceType deviceType = QTouchEvent::TouchScreen) + { + return new PySideQTouchEventSequence(widget, deviceType); + } + +} + +QT_END_NAMESPACE + +#endif // PYSIDEQTESTTOUCH_H diff --git a/PySide/pysidewtypes.h b/PySide/pysidewtypes.h new file mode 100644 index 0000000..4d9d4f0 --- /dev/null +++ b/PySide/pysidewtypes.h @@ -0,0 +1,27 @@ +#ifndef __PYSIDEWTYPES__ +#define __PYSIDEWTYPES__ + +typedef struct HWND__ *HWND; +typedef unsigned UINT; +typedef long LONG; +typedef unsigned long DWORD; +typedef UINT WPARAM; +typedef LONG LPARAM; + +struct POINT +{ + LONG x; + LONG y; +}; + +struct MSG +{ + HWND hwnd; + UINT message; + WPARAM wParam; + LPARAM lParam; + DWORD time; + POINT pt; +}; + +#endif diff --git a/PySide/typesystem_templates.xml b/PySide/typesystem_templates.xml index 9d39bb4..3a46c62 100644 --- a/PySide/typesystem_templates.xml +++ b/PySide/typesystem_templates.xml @@ -31,47 +31,65 @@