summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2011-06-07 11:07:06 -0300
committerRenato Filho <renato.filho@openbossa.org>2011-06-08 16:20:53 -0300
commitba2510c52a384b1f6b853a176613551f7ae34364 (patch)
tree750c72bdb60accf490cd642d1f58259e889879aa
parent45bf56e8311cbe9ff19ff3978c55070e56233aab (diff)
downloadpyside-ba2510c52a384b1f6b853a176613551f7ae34364.tar.gz
pyside-ba2510c52a384b1f6b853a176613551f7ae34364.tar.xz
pyside-ba2510c52a384b1f6b853a176613551f7ae34364.zip
Implemented support to MSG type on windows.
-rw-r--r--PySide/QtCore/CMakeLists.txt15
-rw-r--r--PySide/QtCore/glue/hwnd_conversions.h32
-rw-r--r--PySide/QtCore/typesystem_core.xml36
-rw-r--r--PySide/QtCore/typesystem_core_win.xml35
-rw-r--r--PySide/global.h.in1
-rw-r--r--PySide/pysidewtypes.h27
6 files changed, 144 insertions, 2 deletions
diff --git a/PySide/QtCore/CMakeLists.txt b/PySide/QtCore/CMakeLists.txt
index df05bf6..86df1d1 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 0000000..bf2de4d
--- /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 212ecfa..aff4ac1 100644
--- a/PySide/QtCore/typesystem_core.xml
+++ b/PySide/QtCore/typesystem_core.xml
@@ -2485,6 +2485,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) &amp;&amp; (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"/>
@@ -3251,7 +3274,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"/>
@@ -3280,4 +3302,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 0000000..c4150cd
--- /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>
+
diff --git a/PySide/global.h.in b/PySide/global.h.in
index a0a0ed1..acd30d0 100644
--- a/PySide/global.h.in
+++ b/PySide/global.h.in
@@ -319,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
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