@@ -1,79 +1,79 | |||||
1 |
#ifndef _PYTHONQT |
|
1 | #ifndef _PYTHONQTCLASSWRAPPER_H | |
2 |
#define _PYTHONQT |
|
2 | #define _PYTHONQTCLASSWRAPPER_H | |
3 |
|
3 | |||
4 | /* |
|
4 | /* | |
5 | * |
|
5 | * | |
6 | * Copyright (C) 2006 MeVis Research GmbH All Rights Reserved. |
|
6 | * Copyright (C) 2006 MeVis Research GmbH All Rights Reserved. | |
7 | * |
|
7 | * | |
8 | * This library is free software; you can redistribute it and/or |
|
8 | * This library is free software; you can redistribute it and/or | |
9 | * modify it under the terms of the GNU Lesser General Public |
|
9 | * modify it under the terms of the GNU Lesser General Public | |
10 | * License as published by the Free Software Foundation; either |
|
10 | * License as published by the Free Software Foundation; either | |
11 | * version 2.1 of the License, or (at your option) any later version. |
|
11 | * version 2.1 of the License, or (at your option) any later version. | |
12 | * |
|
12 | * | |
13 | * This library is distributed in the hope that it will be useful, |
|
13 | * This library is distributed in the hope that it will be useful, | |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | * Lesser General Public License for more details. |
|
16 | * Lesser General Public License for more details. | |
17 | * |
|
17 | * | |
18 | * Further, this software is distributed without any warranty that it is |
|
18 | * Further, this software is distributed without any warranty that it is | |
19 | * free of the rightful claim of any third person regarding infringement |
|
19 | * free of the rightful claim of any third person regarding infringement | |
20 | * or the like. Any license provided herein, whether implied or |
|
20 | * or the like. Any license provided herein, whether implied or | |
21 | * otherwise, applies only to this software file. Patent licenses, if |
|
21 | * otherwise, applies only to this software file. Patent licenses, if | |
22 | * any, provided herein do not apply to combinations of this program with |
|
22 | * any, provided herein do not apply to combinations of this program with | |
23 | * other software, or any other product whatsoever. |
|
23 | * other software, or any other product whatsoever. | |
24 | * |
|
24 | * | |
25 | * You should have received a copy of the GNU Lesser General Public |
|
25 | * You should have received a copy of the GNU Lesser General Public | |
26 | * License along with this library; if not, write to the Free Software |
|
26 | * License along with this library; if not, write to the Free Software | |
27 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
27 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
28 | * |
|
28 | * | |
29 | * Contact information: MeVis Research GmbH, Universitaetsallee 29, |
|
29 | * Contact information: MeVis Research GmbH, Universitaetsallee 29, | |
30 | * 28359 Bremen, Germany or: |
|
30 | * 28359 Bremen, Germany or: | |
31 | * |
|
31 | * | |
32 | * http://www.mevis.de |
|
32 | * http://www.mevis.de | |
33 | * |
|
33 | * | |
34 | */ |
|
34 | */ | |
35 |
|
35 | |||
36 | //---------------------------------------------------------------------------------- |
|
36 | //---------------------------------------------------------------------------------- | |
37 | /*! |
|
37 | /*! | |
38 | // \file PythonQtClassWrapper.h |
|
38 | // \file PythonQtClassWrapper.h | |
39 | // \author Florian Link |
|
39 | // \author Florian Link | |
40 | // \author Last changed by $Author: florian $ |
|
40 | // \author Last changed by $Author: florian $ | |
41 | // \date 2006-05 |
|
41 | // \date 2006-05 | |
42 | */ |
|
42 | */ | |
43 | //---------------------------------------------------------------------------------- |
|
43 | //---------------------------------------------------------------------------------- | |
44 |
|
44 | |||
45 | #include <Python.h> |
|
45 | #include <Python.h> | |
46 |
|
46 | |||
47 | #include "structmember.h" |
|
47 | #include "structmember.h" | |
48 | #include "methodobject.h" |
|
48 | #include "methodobject.h" | |
49 | #include "compile.h" |
|
49 | #include "compile.h" | |
50 | #include "eval.h" |
|
50 | #include "eval.h" | |
51 | #include <QString> |
|
51 | #include <QString> | |
52 |
|
52 | |||
53 | class PythonQtClassInfo; |
|
53 | class PythonQtClassInfo; | |
54 | class QObject; |
|
54 | class QObject; | |
55 | struct QMetaObject; |
|
55 | struct QMetaObject; | |
56 |
|
56 | |||
57 | extern PyTypeObject PythonQtClassWrapper_Type; |
|
57 | extern PyTypeObject PythonQtClassWrapper_Type; | |
58 |
|
58 | |||
59 | //--------------------------------------------------------------- |
|
59 | //--------------------------------------------------------------- | |
60 | //! a Python wrapper object for Qt meta objects |
|
60 | //! a Python wrapper object for Qt meta objects | |
61 | typedef struct { |
|
61 | typedef struct { | |
62 | PyObject_HEAD |
|
62 | PyObject_HEAD | |
63 |
|
63 | |||
64 | //! the class information (which contains the meta object as well) |
|
64 | //! the class information (which contains the meta object as well) | |
65 | PythonQtClassInfo* _info; |
|
65 | PythonQtClassInfo* _info; | |
66 |
|
66 | |||
67 | } PythonQtClassWrapper; |
|
67 | } PythonQtClassWrapper; | |
68 |
|
68 | |||
69 | //--------------------------------------------------------------- |
|
69 | //--------------------------------------------------------------- | |
70 | // an abstact class for handling construction of objects |
|
70 | // an abstact class for handling construction of objects | |
71 | class PythonQtConstructorHandler { |
|
71 | class PythonQtConstructorHandler { | |
72 | public: |
|
72 | public: | |
73 | //! get rid of warnings |
|
73 | //! get rid of warnings | |
74 | virtual ~PythonQtConstructorHandler() {} |
|
74 | virtual ~PythonQtConstructorHandler() {} | |
75 |
|
75 | |||
76 | virtual QObject* create(const QMetaObject* meta, PyObject *args, PyObject *kw, QString& error) = 0; |
|
76 | virtual QObject* create(const QMetaObject* meta, PyObject *args, PyObject *kw, QString& error) = 0; | |
77 | }; |
|
77 | }; | |
78 |
|
78 | |||
79 | #endif No newline at end of file |
|
79 | #endif |
@@ -1,92 +1,92 | |||||
1 | #ifndef _PYTHONQTWRAPPER_H |
|
1 | #ifndef _PYTHONQTINSTANCEWRAPPER_H | |
2 | #define _PYTHONQTWRAPPER_H |
|
2 | #define _PYTHONQTINSTANCEWRAPPER_H | |
3 |
|
3 | |||
4 | /* |
|
4 | /* | |
5 | * |
|
5 | * | |
6 | * Copyright (C) 2006 MeVis Research GmbH All Rights Reserved. |
|
6 | * Copyright (C) 2006 MeVis Research GmbH All Rights Reserved. | |
7 | * |
|
7 | * | |
8 | * This library is free software; you can redistribute it and/or |
|
8 | * This library is free software; you can redistribute it and/or | |
9 | * modify it under the terms of the GNU Lesser General Public |
|
9 | * modify it under the terms of the GNU Lesser General Public | |
10 | * License as published by the Free Software Foundation; either |
|
10 | * License as published by the Free Software Foundation; either | |
11 | * version 2.1 of the License, or (at your option) any later version. |
|
11 | * version 2.1 of the License, or (at your option) any later version. | |
12 | * |
|
12 | * | |
13 | * This library is distributed in the hope that it will be useful, |
|
13 | * This library is distributed in the hope that it will be useful, | |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 | * Lesser General Public License for more details. |
|
16 | * Lesser General Public License for more details. | |
17 | * |
|
17 | * | |
18 | * Further, this software is distributed without any warranty that it is |
|
18 | * Further, this software is distributed without any warranty that it is | |
19 | * free of the rightful claim of any third person regarding infringement |
|
19 | * free of the rightful claim of any third person regarding infringement | |
20 | * or the like. Any license provided herein, whether implied or |
|
20 | * or the like. Any license provided herein, whether implied or | |
21 | * otherwise, applies only to this software file. Patent licenses, if |
|
21 | * otherwise, applies only to this software file. Patent licenses, if | |
22 | * any, provided herein do not apply to combinations of this program with |
|
22 | * any, provided herein do not apply to combinations of this program with | |
23 | * other software, or any other product whatsoever. |
|
23 | * other software, or any other product whatsoever. | |
24 | * |
|
24 | * | |
25 | * You should have received a copy of the GNU Lesser General Public |
|
25 | * You should have received a copy of the GNU Lesser General Public | |
26 | * License along with this library; if not, write to the Free Software |
|
26 | * License along with this library; if not, write to the Free Software | |
27 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
27 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
28 | * |
|
28 | * | |
29 | * Contact information: MeVis Research GmbH, Universitaetsallee 29, |
|
29 | * Contact information: MeVis Research GmbH, Universitaetsallee 29, | |
30 | * 28359 Bremen, Germany or: |
|
30 | * 28359 Bremen, Germany or: | |
31 | * |
|
31 | * | |
32 | * http://www.mevis.de |
|
32 | * http://www.mevis.de | |
33 | * |
|
33 | * | |
34 | */ |
|
34 | */ | |
35 |
|
35 | |||
36 | //---------------------------------------------------------------------------------- |
|
36 | //---------------------------------------------------------------------------------- | |
37 | /*! |
|
37 | /*! | |
38 | // \file PythonQtInstanceWrapper.h |
|
38 | // \file PythonQtInstanceWrapper.h | |
39 | // \author Florian Link |
|
39 | // \author Florian Link | |
40 | // \author Last changed by $Author: florian $ |
|
40 | // \author Last changed by $Author: florian $ | |
41 | // \date 2006-05 |
|
41 | // \date 2006-05 | |
42 | */ |
|
42 | */ | |
43 | //---------------------------------------------------------------------------------- |
|
43 | //---------------------------------------------------------------------------------- | |
44 |
|
44 | |||
45 | #include <Python.h> |
|
45 | #include <Python.h> | |
46 |
|
46 | |||
47 | #include "PythonQtSystem.h" |
|
47 | #include "PythonQtSystem.h" | |
48 | #include <QPointer> |
|
48 | #include <QPointer> | |
49 |
|
49 | |||
50 | #include "structmember.h" |
|
50 | #include "structmember.h" | |
51 | #include "methodobject.h" |
|
51 | #include "methodobject.h" | |
52 | #include "compile.h" |
|
52 | #include "compile.h" | |
53 | #include "eval.h" |
|
53 | #include "eval.h" | |
54 |
|
54 | |||
55 | class PythonQtClassInfo; |
|
55 | class PythonQtClassInfo; | |
56 | class QObject; |
|
56 | class QObject; | |
57 |
|
57 | |||
58 | extern PYTHONQT_EXPORT PyTypeObject PythonQtInstanceWrapper_Type; |
|
58 | extern PYTHONQT_EXPORT PyTypeObject PythonQtInstanceWrapper_Type; | |
59 |
|
59 | |||
60 | //--------------------------------------------------------------- |
|
60 | //--------------------------------------------------------------- | |
61 | //! a Python wrapper object for Qt objects and C++ objects (that are themselves wrapped by wrapper QObjects) |
|
61 | //! a Python wrapper object for Qt objects and C++ objects (that are themselves wrapped by wrapper QObjects) | |
62 | typedef struct { |
|
62 | typedef struct { | |
63 | PyObject_HEAD |
|
63 | PyObject_HEAD | |
64 |
|
64 | |||
65 | //! set the QObject pointer |
|
65 | //! set the QObject pointer | |
66 | void setQObject(QObject* object) { |
|
66 | void setQObject(QObject* object) { | |
67 | _obj = object; |
|
67 | _obj = object; | |
68 | _objPointerCopy = object; |
|
68 | _objPointerCopy = object; | |
69 | } |
|
69 | } | |
70 |
|
70 | |||
71 | //! pointer to the wrapped Qt object or if _wrappedPtr is set, the Qt object that wraps the C++ Ptr |
|
71 | //! pointer to the wrapped Qt object or if _wrappedPtr is set, the Qt object that wraps the C++ Ptr | |
72 | QPointer<QObject> _obj; |
|
72 | QPointer<QObject> _obj; | |
73 | //! a copy of the _obj pointer, which is required because the wrapper needs to |
|
73 | //! a copy of the _obj pointer, which is required because the wrapper needs to | |
74 | //! deregister itself via the _obj pointer, even when the QPointer<QObject> object was destroyed |
|
74 | //! deregister itself via the _obj pointer, even when the QPointer<QObject> object was destroyed | |
75 | void* _objPointerCopy; |
|
75 | void* _objPointerCopy; | |
76 |
|
76 | |||
77 | //! optional C++ object Ptr that is wrapped by the above _obj |
|
77 | //! optional C++ object Ptr that is wrapped by the above _obj | |
78 | void* _wrappedPtr; |
|
78 | void* _wrappedPtr; | |
79 |
|
79 | |||
80 | //! the class information, this is set even if the _obj or _wrappedPtr is NULL to support typed NULL pointers |
|
80 | //! the class information, this is set even if the _obj or _wrappedPtr is NULL to support typed NULL pointers | |
81 | PythonQtClassInfo* _info; |
|
81 | PythonQtClassInfo* _info; | |
82 |
|
82 | |||
83 | //! flag that stores if the object is owned by pythonQt |
|
83 | //! flag that stores if the object is owned by pythonQt | |
84 | bool _ownedByPythonQt; |
|
84 | bool _ownedByPythonQt; | |
85 |
|
85 | |||
86 | //! stores that the owned object should be destroyed using QMetaType::destroy() |
|
86 | //! stores that the owned object should be destroyed using QMetaType::destroy() | |
87 | bool _useQMetaTypeDestroy; |
|
87 | bool _useQMetaTypeDestroy; | |
88 |
|
88 | |||
89 | } PythonQtInstanceWrapper; |
|
89 | } PythonQtInstanceWrapper; | |
90 |
|
90 | |||
91 |
|
91 | |||
92 | #endif No newline at end of file |
|
92 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now