diff options
author | Renato Filho <renato.filho@openbossa.org> | 2011-06-07 11:07:06 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2012-03-08 16:54:28 -0300 |
commit | 23d1e497d87ee9ba4b6aff96f65e67e91cc73705 (patch) | |
tree | c6ca9c7ba871ac0e0fc72900f17d11526120a8f5 /PySide/QtCore | |
parent | 3e88ef1c54f54e9aca8c82b2519a4525a11c1fc1 (diff) |
Implemented support to MSG type on windows.
Diffstat (limited to 'PySide/QtCore')
-rw-r--r-- | PySide/QtCore/CMakeLists.txt | 15 | ||||
-rw-r--r-- | PySide/QtCore/glue/hwnd_conversions.h | 32 | ||||
-rw-r--r-- | PySide/QtCore/typesystem_core.xml | 36 | ||||
-rw-r--r-- | PySide/QtCore/typesystem_core_win.xml | 35 |
4 files changed, 116 insertions, 2 deletions
diff --git a/PySide/QtCore/CMakeLists.txt b/PySide/QtCore/CMakeLists.txt index df05bf652..86df1d172 100644 --- a/PySide/QtCore/CMakeLists.txt +++ b/PySide/QtCore/CMakeLists.txt @@ -36,6 +36,17 @@ 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 ${CMAKE_CURRENT_BINARY_DIR}/PySide/QtCore/qabstractfileengine_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) + 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 000000000..bf2de4df1 --- /dev/null +++ b/PySide/QtCore/glue/hwnd_conversions.h @@ -0,0 +1,32 @@ +namespace Shiboken { +template <> +struct Converter<HWND__> +{ + 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/typesystem_core.xml b/PySide/QtCore/typesystem_core.xml index b78642138..6de9e4556 100644 --- a/PySide/QtCore/typesystem_core.xml +++ b/PySide/QtCore/typesystem_core.xml @@ -2477,6 +2477,29 @@ <define-ownership owner="c++"/> </modify-argument> </modify-function> + <modify-function signature="winEventFilter(MSG*, long*)"> + <modify-argument index="2"> + <remove-argument /> + <conversion-rule class="native"> + long *%out = new long; + %out = 0; + </conversion-rule> + </modify-argument> + <modify-argument index="return"> + <replace-type modified-type="PyObject"/> + <conversion-rule class="native"> + %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); + } + </conversion-rule> + </modify-argument> + <inject-code position="end"> + %PYARG_0 = Shiboken::makeTuple(%0, *result_out); + delete result_out; + </inject-code> + </modify-function> </object-type> <object-type name="QSettings"> <enum-type name="Format"/> @@ -3243,7 +3266,6 @@ <suppress-warning text="Unable to decide type of property: 'QLibrary::LoadHints' in class 'QPluginLoader'" /> <suppress-warning text="enum '_ISalnum' does not have a type entry or is not an enum" /> <suppress-warning text="enum 'Qt::Initialization' does not have a type entry or is not an enum" /> - <suppress-warning text="skipping function '*'"/> <suppress-warning text="visibility of function '*' modified in class '*'"/> <suppress-warning text="hiding of function '*' in class '*'"/> <suppress-warning text="namespace '*' does not have a type entry"/> @@ -3272,4 +3294,16 @@ <!-- this enum is defined on Qt global header but only used in QtGui module --> <suppress-warning text="enum 'PM_MessageBoxHeight' does not have a type entry or is not an enum" /> + + <!-- this function only exists on Windows --> + <suppress-warning text="signature 'winEventFilter(MSG*,long*)' for function modification in 'QCoreApplication' not found. Possible candidates:*"/> + + <!-- this is necessary to avoid warning on other modules --> + <suppress-warning text="signature 'operator*(QByteArray,const char*)' for function modification in 'QByteArray' not found. Possible candidates: *"/> + <suppress-warning text="signature 'operator+(QByteArray,QString)' for function modification in 'QByteArray' not found. Possible candidates: *"/> + + <!-- TODO: this need be removed --> + <suppress-warning text="skipping function '*', unmatched return type '*'"/> + <suppress-warning text="skipping function '*', unmatched parameter type '*'"/> + </typesystem> diff --git a/PySide/QtCore/typesystem_core_win.xml b/PySide/QtCore/typesystem_core_win.xml new file mode 100644 index 000000000..c4150cd80 --- /dev/null +++ b/PySide/QtCore/typesystem_core_win.xml @@ -0,0 +1,35 @@ +<?xml version="1.0"?> +<!-- + This file is part of PySide project. + Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). + Contact: PySide team <contact@pyside.org> + + 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 +--> +<typesystem package="PySide.QtCore"> + <primitive-type name="HWND__"> + <conversion-rule file="glue/hwnd_conversions.h"/> + </primitive-type> + <value-type name="POINT"> + <include file-name="wtypes.h" location="global"/> + </value-type> + <value-type name="MSG"> + <include file-name="wtypes.h" location="global"/> + </value-type> + <suppress-warning text="class 'MSG' inherits from unknown base class 'tagMSG'"/> + <suppress-warning text="class not found for setup inheritance 'tagMSG'"/> + <load-typesystem name="typesystem_core.xml" generate="yes"/> +</typesystem> + |