#include <wx/dcps.h>
#include <wx/dirctrl.h>
#include <wx/dirdlg.h>
+#include <wx/numdlg.h>
#include <wx/dnd.h>
#include <wx/docview.h>
#include <wx/encconv.h>
#include <wx/datectrl.h>
#include <wx/power.h>
#include <wx/hyperlink.h>
+#include <wx/pickerbase.h>
+#include <wx/clrpicker.h>
+#include <wx/filepicker.h>
+#include <wx/fontpicker.h>
+#include <wx/collpane.h>
+#include <wx/srchctrl.h>
#ifdef _MSC_VER
//---------------------------------------------------------------------------
-typedef unsigned char byte;
+#ifndef wxHAS_POWER_EVENTS
+class wxPowerEvent : public wxEvent
+{
+public:
+ wxPowerEvent(wxEventType evtType) : wxEvent(wxID_NONE, evtType) {}
+ void Veto() {}
+ bool IsVetoed() const { return false; }
+ virtual wxEvent *Clone() const { return new wxPowerEvent(*this); }
+};
+#endif
+
+//---------------------------------------------------------------------------
+typedef unsigned char byte;
+typedef unsigned char* buffer;
+
typedef wxPoint2DDouble wxPoint2D;
+typedef wxRect2DDouble wxRect2D;
#ifndef SWIG_TYPE_TABLE
#define SWIG_TYPE_TABLE wxPython_type_table
#if PY_VERSION_HEX < 0x02040000
#define wxPyUSE_GIL_STATE 0
typedef bool wxPyBlock_t;
+#define wxPyBlock_t_default false
#else
#define wxPyUSE_GIL_STATE 1
typedef PyGILState_STATE wxPyBlock_t;
+#define wxPyBlock_t_default PyGILState_UNLOCKED
+#endif
+
+
+// Python 2.5 changes the type of some API parameter and return types. Using
+// this typedef for versions < 2.5 will help with the transition...
+#if PY_VERSION_HEX < 0x02050000
+typedef int Py_ssize_t;
#endif
long* long_LIST_helper(PyObject* source);
char** string_LIST_helper(PyObject* source);
wxPoint* wxPoint_LIST_helper(PyObject* source, int* npoints);
+wxPoint2D* wxPoint2D_LIST_helper(PyObject* source, size_t* npoints);
wxBitmap** wxBitmap_LIST_helper(PyObject* source);
wxString* wxString_LIST_helper(PyObject* source);
wxAcceleratorEntry* wxAcceleratorEntry_LIST_helper(PyObject* source);
bool wxRect_helper(PyObject* source, wxRect** obj);
bool wxColour_helper(PyObject* source, wxColour** obj);
bool wxPoint2D_helper(PyObject* source, wxPoint2D** obj);
+bool wxRect2D_helper(PyObject* source, wxRect2D** obj);
+bool wxPosition_helper(PyObject* source, wxPosition** obj);
bool wxPySimple_typecheck(PyObject* source, const wxChar* classname, int seqLen);
bool wxColour_typecheck(PyObject* source);
-bool wxPyCheckForApp();
-
// Other helpful stuff
+bool wxPyCheckForApp();
+bool wxPyTestDisplayAvailable();
+
bool wxPy2int_seq_helper(PyObject* source, int* i1, int* i2);
bool wxPy4int_seq_helper(PyObject* source, int* i1, int* i2, int* i3, int* i4);
PyObject* wxArrayString2PyList_helper(const wxArrayString& arr);
PyObject* wxArrayInt2PyList_helper(const wxArrayInt& arr);
+PyObject* wxArrayDouble2PyList_helper(const wxArrayDouble& arr);
#endif // wxPyUSE_EXPORTED_API
bool (*p_wxRealPoint_helper)(PyObject* source, wxRealPoint** obj);
bool (*p_wxRect_helper)(PyObject* source, wxRect** obj);
bool (*p_wxColour_helper)(PyObject* source, wxColour** obj);
- bool (*p_wxPoint2D_helper)(PyObject* source, wxPoint2DDouble** obj);
+ bool (*p_wxPoint2D_helper)(PyObject* source, wxPoint2D** obj);
bool (*p_wxPySimple_typecheck)(PyObject* source, const wxChar* classname, int seqLen);
bool (*p_wxPyCheckForApp)();
+ // Add all new items at the end...
+ PyObject* (*p_wxArrayDoublePyList_helper)(const wxArrayDouble& arr);
+ wxPoint2D* (*p_wxPoint2D_LIST_helper)(PyObject* source, size_t* npoints);
+ bool (*p_wxRect2D_helper)(PyObject* source, wxRect2D** obj);
+ bool (*p_wxPosition_helper)(PyObject* source, wxPosition** obj);
+
};
+
#ifdef wxPyUSE_EXPORTED_API
// Notice that this is static, not extern. This is by design, each module
// needs one, but doesn't have to use it.
virtual bool OnInitGui();
virtual int OnExit();
#ifdef __WXDEBUG__
- virtual void OnAssert(const wxChar *file,
- int line,
- const wxChar *cond,
- const wxChar *msg);
+ virtual void OnAssertFailure(const wxChar *file,
+ int line,
+ const wxChar *func,
+ const wxChar *cond,
+ const wxChar *msg);
#endif
virtual void ExitMainLoop();
// virtual int FilterEvent(wxEvent& event); // This one too????
// For catching Apple Events
- virtual void MacOpenFile(const wxString &fileName);
- virtual void MacPrintFile(const wxString &fileName);
+ virtual void MacOpenFile(const wxString& fileName);
+ virtual void MacOpenURL(const wxString& url);
+ virtual void MacPrintFile(const wxString& fileName);
virtual void MacNewFile();
virtual void MacReopenApp();
}
+//---------------------------------------------------------------------------
+
+#define DEC_PYCALLBACK_INT_WIN(CBNAME) \
+ int CBNAME(wxWindow* a)
+
+
+#define IMP_PYCALLBACK_INT_WIN(CLASS, PCLASS, CBNAME) \
+ int CLASS::CBNAME(wxWindow* a) { \
+ int rval=0; \
+ bool found; \
+ wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
+ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
+ PyObject* obj = wxPyMake_wxObject(a, false); \
+ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)",obj)); \
+ Py_DECREF(obj); \
+ } \
+ wxPyEndBlockThreads(blocked); \
+ if (! found) \
+ rval = PCLASS::CBNAME(a); \
+ return rval; \
+ }
+
+
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK__DC(CBNAME) \
Py_DECREF(ro); \
} \
} \
+ wxPyEndBlockThreads(blocked); \
if (! found) \
rval = PCLASS::CBNAME(a); \
- wxPyEndBlockThreads(blocked); \
return rval; \
} \
PCLASS::CBNAME(c); \
} \
+//---------------------------------------------------------------------------
+#define DEC_PYCALLBACK__INTCOLOUR(CBNAME) \
+ void CBNAME(int a, const wxColour& c);
+
+#define IMP_PYCALLBACK__INTCOLOUR(CLASS, PCLASS, CBNAME) \
+ void CLASS::CBNAME(int a, const wxColour& c) { \
+ bool found; \
+ wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
+ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
+ PyObject* obj = wxPyConstructObject((void*)&c, wxT("wxColour"), 0); \
+ wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iO)",a, obj)); \
+ Py_DECREF(obj); \
+ } \
+ wxPyEndBlockThreads(blocked); \
+ if (! found) \
+ PCLASS::CBNAME(a, c); \
+ } \
+
+//---------------------------------------------------------------------------
+
+#define DEC_PYCALLBACK__INTFONT(CBNAME) \
+ void CBNAME(int a, const wxFont& c);
+
+#define IMP_PYCALLBACK__INTFONT(CLASS, PCLASS, CBNAME) \
+ void CLASS::CBNAME(int a, const wxFont& c) { \
+ bool found; \
+ wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
+ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
+ PyObject* obj = wxPyConstructObject((void*)&c, wxT("wxFont"), 0); \
+ wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iO)",a, obj)); \
+ Py_DECREF(obj); \
+ } \
+ wxPyEndBlockThreads(blocked); \
+ if (! found) \
+ PCLASS::CBNAME(a, c); \
+ } \
+
+//---------------------------------------------------------------------------
+
+#define DEC_PYCALLBACK__FONT(CBNAME) \
+ void CBNAME(const wxFont& a);
+
+#define IMP_PYCALLBACK__FONT(CLASS, PCLASS, CBNAME) \
+ void CLASS::CBNAME(const wxFont& a) { \
+ bool found; \
+ wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
+ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
+ PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxFont"), 0); \
+ wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", obj)); \
+ Py_DECREF(obj); \
+ } \
+ wxPyEndBlockThreads(blocked); \
+ if (! found) \
+ PCLASS::CBNAME(a); \
+ } \
+
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK_BOOL_CELLINTINTME(CBNAME) \
//---------------------------------------------------------------------------
-#define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
+#define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
bool CBNAME(wxWindow* a)
bool CLASS::CBNAME(wxWindow* a) { \
bool rval=false; \
bool found; \
- wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
+ wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
PyObject* obj = wxPyMake_wxObject(a,false); \
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
return rval; \
}
+
+
+#define DEC_PYCALLBACK_BOOL_WXWIN_pure(CBNAME) \
+ bool CBNAME(wxWindow* a)
+
+#define IMP_PYCALLBACK_BOOL_WXWIN_pure(CLASS, PCLASS, CBNAME) \
+ bool CLASS::CBNAME(wxWindow* a) { \
+ bool rval=false; \
+ bool found; \
+ wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
+ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
+ PyObject* obj = wxPyMake_wxObject(a,false); \
+ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
+ Py_DECREF(obj); \
+ } \
+ wxPyEndBlockThreads(blocked); \
+ return rval; \
+ }
+
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
bool CLASS::CBNAME() const { \
bool rval=false; \
bool found; \
- wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
+ wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
wxPyEndBlockThreads(blocked); \
wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
int rval=0; \
bool found; \
- wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
+ wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
wxPyEndBlockThreads(blocked); \
#define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
- wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
+ wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
wxFSFile* rval=0; \
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
PyObject* ro; \
obj, s)); \
if (ro) { \
wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFile")); \
+ /* release ownership of the C++ wx.FSFile object. */ \
+ PyObject_SetAttrString(ro, "thisown", Py_False); \
Py_DECREF(ro); \
} \
Py_DECREF(obj); \
bool CLASS::CBNAME(wxDragResult a) { \
bool rval=false; \
bool found; \
- wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
+ wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
wxPyEndBlockThreads(blocked); \
#define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
- wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
+ wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
int rval=0; \
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
//---------------------------------------------------------------------------
+#define DEC_PYCALLBACK_INT_INT(CBNAME) \
+ int CBNAME(int a)
+
+
+#define IMP_PYCALLBACK_INT_INT(CLASS, PCLASS, CBNAME) \
+ int CLASS::CBNAME(int a) { \
+ int rval=-1; \
+ bool found; \
+ wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
+ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
+ PyObject* ro; \
+ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)",a)); \
+ if (ro) { \
+ rval = PyInt_AsLong(ro); \
+ Py_DECREF(ro); \
+ } \
+ } \
+ wxPyEndBlockThreads(blocked); \
+ if (! found) \
+ rval = PCLASS::CBNAME(a); \
+ return rval; \
+ }
+
+//---------------------------------------------------------------------------
+
#define DEC_PYCALLBACK_INT_LONGLONG(CBNAME) \
int CBNAME(long a, long b) const
//---------------------------------------------------------------------------
-#define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
+#define DEC_PYCALLBACK_COORD_SIZET_const(CBNAME) \
wxCoord CBNAME(size_t a) const
+#define IMP_PYCALLBACK_COORD_SIZET_const(CLASS, PCLASS, CBNAME) \
+ wxCoord CLASS::CBNAME(size_t a) const { \
+ wxCoord rval=0; \
+ bool found; \
+ wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
+ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
+ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
+ } \
+ wxPyEndBlockThreads(blocked); \
+ if (! found) \
+ rval = PCLASS::CBNAME(a); \
+ return rval; \
+ } \
+
+
+#define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
+ wxCoord CBNAME(size_t a) const
#define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
wxCoord CLASS::CBNAME(size_t a) const { \
wxCoord rval=0; \
bool found; \
- wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
+ wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
} \
PyObject* obj = wxPyMake_wxObject(&a,false); \
PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
- Py_DECREF(obj); \
+ Py_DECREF(obj); Py_DECREF(ro); \
} \
wxPyEndBlockThreads(blocked); \
} \
PyObject* obj = wxPyMake_wxObject(&a,false); \
PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
- Py_DECREF(obj); \
+ Py_DECREF(obj); Py_DECREF(ro); \
} \
wxPyEndBlockThreads(blocked); \
if (! found) \
PyObject* obj = wxPyMake_wxObject(&a,false); \
PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
- Py_DECREF(obj); \
+ Py_DECREF(obj); Py_DECREF(ro); \
} \
wxPyEndBlockThreads(blocked); \
} \
PyObject* obj = wxPyMake_wxObject(&a,false); \
PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
- Py_DECREF(obj); \
+ Py_DECREF(obj); Py_DECREF(ro); \
} \
wxPyEndBlockThreads(blocked); \
if (! found) \
PCLASS::CBNAME(a,b,c); \
}
+//---------------------------------------------------------------------------
+
+#define DEC_PYCALLBACK__DCRECTINTINT_const(CBNAME) \
+ void CBNAME(wxDC& a, const wxRect& b, int c, int d) const
+
+#define IMP_PYCALLBACK__DCRECTINTINT_const(CLASS, PCLASS, CBNAME) \
+ void CLASS::CBNAME(wxDC& a, const wxRect& b, int c, int d) const { \
+ bool found; \
+ wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
+ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
+ PyObject* obj = wxPyMake_wxObject(&a,false); \
+ PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
+ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOii)", obj, ro, c, d)); \
+ Py_DECREF(obj); Py_DECREF(ro); \
+ } \
+ wxPyEndBlockThreads(blocked); \
+ if (! found) \
+ PCLASS::CBNAME(a,b,c,d); \
+ }
//---------------------------------------------------------------------------
+#define DEC_PYCALLBACK__RECTINT(CBNAME) \
+ void CBNAME(const wxRect& a, int b)
+
+#define IMP_PYCALLBACK__RECTINT(CLASS, PCLASS, CBNAME) \
+ void CLASS::CBNAME(const wxRect& a, int b) { \
+ bool found; \
+ wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
+ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
+ PyObject* ro = wxPyConstructObject((void*)&a, wxT("wxRect"), 0); \
+ wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", ro, b)); \
+ Py_DECREF(ro); \
+ } \
+ wxPyEndBlockThreads(blocked); \
+ if (! found) \
+ PCLASS::CBNAME(a,b); \
+ }
+
+
+#define DEC_PYCALLBACK_BOOL_RECTINT(CBNAME) \
+ bool CBNAME(const wxRect& a, int b)
+
+#define IMP_PYCALLBACK_BOOL_RECTINT(CLASS, PCLASS, CBNAME) \
+ bool CLASS::CBNAME(const wxRect& a, int b) { \
+ bool found; \
+ bool rval = false; \
+ wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
+ if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
+ PyObject* ro = wxPyConstructObject((void*)&a, wxT("wxRect"), 0); \
+ rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", ro, b));\
+ Py_DECREF(ro); \
+ } \
+ wxPyEndBlockThreads(blocked); \
+ if (! found) \
+ rval = PCLASS::CBNAME(a,b); \
+ return rval; \
+ }
-#define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
+//---------------------------------------------------------------------------
+
+#define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
wxString CBNAME(size_t a) const
#define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
//---------------------------------------------------------------------------
+#define DEC_PYCALLBACK_FONT_INT(CBNAME) \
+ wxFont CBNAME(int a)
+
+#define IMP_PYCALLBACK_FONT_INT(CLASS, PCLASS, CBNAME) \
+ wxFont CLASS::CBNAME(int a) { \
+ wxFont rv; \
+ bool found; \
+ wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
+ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
+ PyObject* ro; \
+ wxFont* ptr; \
+ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
+ if (ro) { \
+ if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxFont"))) \
+ rv = *ptr; \
+ Py_DECREF(ro); \
+ } \
+ } \
+ wxPyEndBlockThreads(blocked); \
+ if (! found) \
+ rv = PCLASS::CBNAME(a); \
+ return rv; \
+ }
+
+//---------------------------------------------------------------------------
+
+#define DEC_PYCALLBACK_COLOUR_INT(CBNAME) \
+ wxColour CBNAME(int a)
+
+#define IMP_PYCALLBACK_COLOUR_INT(CLASS, PCLASS, CBNAME) \
+ wxColour CLASS::CBNAME(int a) { \
+ wxColour rv; \
+ bool found; \
+ wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
+ if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
+ PyObject* ro; \
+ wxColour* ptr; \
+ ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
+ if (ro) { \
+ if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxColour"))) \
+ rv = *ptr; \
+ Py_DECREF(ro); \
+ } \
+ } \
+ wxPyEndBlockThreads(blocked); \
+ if (! found) \
+ rv = PCLASS::CBNAME(a); \
+ return rv; \
+ }
+
+//---------------------------------------------------------------------------
+
#endif