]> git.saurik.com Git - wxWidgets.git/blob - wxPython/include/wx/wxPython/wxPython.h
6c87f80b7380866365758f68650202bbd73384ac
[wxWidgets.git] / wxPython / include / wx / wxPython / wxPython.h
1 ////////////////////////////////////////////////////////////////////////////
2 // Name: wxPython.h
3 // Purpose: To be used from modules that are not part of the core
4 // wxPython extension--or from 3rd party apps and modules--in
5 // order to get access to the wxPython API (some helper
6 // functions and such) that lives in the wx.core module
7 //
8 // Author: Robin Dunn
9 //
10 // Created: 14-Dec-2000
11 // RCS-ID: $Id$
12 // Copyright: (c) 2000 by Total Control Software
13 // Licence: wxWindows license
14 /////////////////////////////////////////////////////////////////////////////
15
16 #ifndef __wxp_export__
17 #define __wxp_export__
18
19 //----------------------------------------------------------------------
20
21 #define wxPyUSE_EXPORTED_API
22 #include "wx/wxPython/wxPython_int.h"
23
24 //----------------------------------------------------------------------
25
26 // wxPyCoreAPI_IMPORT can be called in extension modules or embedding
27 // applications in order to preload the API pointer, and then handle error
28 // conditions if it is not able to be loaded for any reason. If the import
29 // fails or there is any other Python related problem then there will be a
30 // Python exception set that can be checked with PyErr_Occurred and/or
31 // PyErr_Print.
32 //
33 // Returns true on success, false if there was an error.
34 //
35 // See also the definition of the wxPyCoreAPI struct in wxPython_int.h
36 //
37 static bool wxPyCoreAPI_IMPORT()
38 {
39 wxPyCoreAPIPtr = (wxPyCoreAPI*)PyCObject_Import("wx._core_", "_wxPyCoreAPI");
40 return wxPyCoreAPIPtr != NULL;
41 }
42
43
44 // Used by the macros below to fetch the API pointer, importing it first if
45 // needed. This should never need to be called directly.
46 inline wxPyCoreAPI* wxPyGetCoreAPIPtr()
47 {
48 if (wxPyCoreAPIPtr == NULL) wxPyCoreAPI_IMPORT();
49 // wxASSERT_MSG(wxPyCoreAPIPtr != NULL, wxT("wxPyCoreAPIPtr is NULL!!!")); // uncomment when needed for debugging
50 return wxPyCoreAPIPtr;
51 }
52
53
54 // The following macros call functions located in wx._core_ of the same name
55 // via the API pointer retrieved above. TODO: Should these be made into
56 // inline fucntions?
57
58 #define wxPyCheckSwigType(a) (wxPyGetCoreAPIPtr()->p_wxPyCheckSwigType(a))
59 #define wxPyConstructObject(a,b,c) (wxPyGetCoreAPIPtr()->p_wxPyConstructObject(a,b,c))
60 #define wxPyConvertSwigPtr(a,b,c) (wxPyGetCoreAPIPtr()->p_wxPyConvertSwigPtr(a,b,c))
61 #define wxPyMakeSwigPtr(a,b) (wxPyGetCoreAPIPtr()->p_wxPyMakeSwigPtr(a,b))
62
63 #define wxPyBeginAllowThreads() (wxPyGetCoreAPIPtr()->p_wxPyBeginAllowThreads())
64 #define wxPyEndAllowThreads(a) (wxPyGetCoreAPIPtr()->p_wxPyEndAllowThreads(a))
65 #define wxPyBeginBlockThreads() (wxPyGetCoreAPIPtr()->p_wxPyBeginBlockThreads())
66 #define wxPyEndBlockThreads(a) (wxPyGetCoreAPIPtr()->p_wxPyEndBlockThreads(a))
67
68 #define wxPyConstructObject(a,b,c) (wxPyGetCoreAPIPtr()->p_wxPyConstructObject(a,b,c))
69 #define wxPy_ConvertList(a) (wxPyGetCoreAPIPtr()->p_wxPy_ConvertList(a))
70
71 #define wxString_in_helper(a) (wxPyGetCoreAPIPtr()->p_wxString_in_helper(a))
72 #define Py2wxString(a) (wxPyGetCoreAPIPtr()->p_Py2wxString(a))
73 #define wx2PyString(a) (wxPyGetCoreAPIPtr()->p_wx2PyString(a))
74
75 #define byte_LIST_helper(a) (wxPyGetCoreAPIPtr()->p_byte_LIST_helper(a))
76 #define int_LIST_helper(a) (wxPyGetCoreAPIPtr()->p_int_LIST_helper(a))
77 #define long_LIST_helper(a) (wxPyGetCoreAPIPtr()->p_long_LIST_helper(a))
78 #define string_LIST_helper(a) (wxPyGetCoreAPIPtr()->p_string_LIST_helper(a))
79 #define wxPoint_LIST_helper(a,b) (wxPyGetCoreAPIPtr()->p_wxPoint_LIST_helper(a, b))
80 #define wxBitmap_LIST_helper(a) (wxPyGetCoreAPIPtr()->p_wxBitmap_LIST_helper(a))
81 #define wxString_LIST_helper(a) (wxPyGetCoreAPIPtr()->p_wxString_LIST_helper(a))
82 #define wxAcceleratorEntry_LIST_helper(a) (wxPyGetCoreAPIPtr()->p_wxAcceleratorEntry_LIST_helper(a))
83
84 #define wxSize_helper(a,b) (wxPyGetCoreAPIPtr()->p_wxSize_helper(a,b))
85 #define wxPoint_helper(a,b) (wxPyGetCoreAPIPtr()->p_wxPoint_helper(a,b))
86 #define wxRealPoint_helper(a,b) (wxPyGetCoreAPIPtr()->p_wxRealPoint_helper(a,b))
87 #define wxRect_helper(a,b) (wxPyGetCoreAPIPtr()->p_wxRect_helper(a,b))
88 #define wxColour_helper(a,b) (wxPyGetCoreAPIPtr()->p_wxColour_helper(a,b))
89 #define wxPoint2D_helper(a,b) (wxPyGetCoreAPIPtr()->p_wxPoint2D_helper(a,b))
90
91 #define wxPySimple_typecheck(a,b,c) (wxPyGetCoreAPIPtr()->p_wxPySimple_typecheck(a,b,c))
92 #define wxColour_typecheck(a) (wxPyGetCoreAPIPtr()->p_wxColour_typecheck(a))
93
94 #define wxPyCBH_setCallbackInfo(a, b, c, d) (wxPyGetCoreAPIPtr()->p_wxPyCBH_setCallbackInfo(a,b,c,d))
95 #define wxPyCBH_findCallback(a, b) (wxPyGetCoreAPIPtr()->p_wxPyCBH_findCallback(a, b))
96 #define wxPyCBH_callCallback(a, b) (wxPyGetCoreAPIPtr()->p_wxPyCBH_callCallback(a, b))
97 #define wxPyCBH_callCallbackObj(a, b) (wxPyGetCoreAPIPtr()->p_wxPyCBH_callCallbackObj(a, b))
98 #define wxPyCBH_delete(a) (wxPyGetCoreAPIPtr()->p_wxPyCBH_delete(a))
99
100 #define wxPyMake_wxObject(a,b) (wxPyGetCoreAPIPtr()->p_wxPyMake_wxObject(a,b,true))
101 #define wxPyMake_wxObject2(a,b,c) (wxPyGetCoreAPIPtr()->p_wxPyMake_wxObject(a,b,c))
102 #define wxPyMake_wxSizer(a,b) (wxPyGetCoreAPIPtr()->p_wxPyMake_wxSizer(a,b))
103 #define wxPyPtrTypeMap_Add(a, b) (wxPyGetCoreAPIPtr()->p_wxPyPtrTypeMap_Add(a, b))
104 #define wxPy2int_seq_helper(a, b, c) (wxPyGetCoreAPIPtr()->p_wxPy2int_seq_helper(a, b, c))
105 #define wxPy4int_seq_helper(a, b, c, d, e) (wxPyGetCoreAPIPtr()->p_wxPy4int_seq_helper(a, b, c, d, e))
106 #define wxArrayString2PyList_helper(a) (wxPyGetCoreAPIPtr()->p_wxArrayString2PyList_helper(a))
107 #define wxArrayInt2PyList_helper(a) (wxPyGetCoreAPIPtr()->p_wxArrayInt2PyList_helper(a))
108
109 #define wxPyClientData_dtor(a) (wxPyGetCoreAPIPtr()->p_wxPyClientData_dtor(a))
110 #define wxPyUserData_dtor(a) (wxPyGetCoreAPIPtr()->p_wxPyUserData_dtor(a))
111 #define wxPyOORClientData_dtor(a) (wxPyGetCoreAPIPtr()->p_wxPyOORClientData_dtor(a))
112
113 #define wxPyCBInputStream_create(a, b) (wxPyGetCoreAPIPtr()->p_wxPyCBInputStream_create(a, b))
114 #define wxPyCBInputStream_copy(a) (wxPyGetCoreAPIPtr()->p_wxPyCBInputStream_copy(a))
115
116 #define wxPyInstance_Check(a) (wxPyGetCoreAPIPtr()->p_wxPyInstance_Check(a))
117 #define wxPySwigInstance_Check(a) (wxPyGetCoreAPIPtr()->p_wxPySwigInstance_Check(a))
118
119 #define wxPyCheckForApp() (wxPyGetCoreAPIPtr()->p_wxPyCheckForApp())
120
121
122 //----------------------------------------------------------------------
123 #endif