X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/185d7c3ee4c6e4a9ddaf811ae38e57d68a0fdff3..a22be3e1fcf362850fe33d52d55518ad68b98d02:/wxPython/src/msw/wx.cpp diff --git a/wxPython/src/msw/wx.cpp b/wxPython/src/msw/wx.cpp index 0b7f33e6fa..d07edf5db1 100644 --- a/wxPython/src/msw/wx.cpp +++ b/wxPython/src/msw/wx.cpp @@ -623,6 +623,8 @@ PyObject *ptrfree(PyObject *_PTRVALUE) { __wxCleanup(); } + + extern "C" SWIGEXPORT(void) initwindowsc(); extern "C" SWIGEXPORT(void) initwindows2c(); extern "C" SWIGEXPORT(void) initeventsc(); @@ -640,17 +642,49 @@ extern "C" SWIGEXPORT(void) initimagec(); extern "C" SWIGEXPORT(void) initprintfwc(); extern "C" SWIGEXPORT(void) initsizersc(); extern "C" SWIGEXPORT(void) initclip_dndc(); -extern "C" SWIGEXPORT(void) initgridc(); -extern "C" SWIGEXPORT(void) initutilsc(); -extern "C" SWIGEXPORT(void) inithtmlc(); -extern "C" SWIGEXPORT(void) inithtmlhelpc(); -extern "C" SWIGEXPORT(void) initcalendarc(); extern "C" SWIGEXPORT(void) initstreamsc(); extern "C" SWIGEXPORT(void) initfilesysc(); -extern "C" SWIGEXPORT(void) initglcanvasc(); -extern "C" SWIGEXPORT(void) initoglc(); -extern "C" SWIGEXPORT(void) initstc_c(); + + +// Export a C API in a struct. Other modules will be able to load this from +// the wxc module and will then have safe access to these functions, even if +// in another shared library. +static wxPyCoreAPI API = { + SWIG_MakePtr, + SWIG_GetPtr, + SWIG_GetPtrObj, + SWIG_RegisterMapping, + SWIG_addvarlink, + SWIG_newvarlink, + + wxPySaveThread, + wxPyRestoreThread, + wxPyConstructObject, + wxPy_ConvertList, + + byte_LIST_helper, + int_LIST_helper, + long_LIST_helper, + string_LIST_helper, + wxPoint_LIST_helper, + wxBitmap_LIST_helper, + wxString_LIST_helper, + wxAcceleratorEntry_LIST_helper, + + wxSize_helper, + wxPoint_helper, + wxRealPoint_helper, + wxRect_helper, + wxColour_helper, + + wxPyCBH_setSelf, + wxPyCBH_findCallback, + wxPyCBH_callCallback, + wxPyCBH_callCallbackObj, + wxPyCBH_delete, +}; + #ifdef __cplusplus extern "C" { #endif @@ -831,48 +865,32 @@ static PyObject *_wrap_ptrmap(PyObject *self, PyObject *args, PyObject *kwargs) return _resultobj; } -static int _wrap_wxPyDefaultPosition_set(PyObject *val) { - wxPoint * temp; +static int _wrap_wxDefaultPosition_set(PyObject *val) { - if (val) { - if (val == Py_None) { temp = NULL; } - else if (SWIG_GetPtrObj(val,(void **) &temp,"_wxPoint_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in value of wxPyDefaultPosition. Expected _wxPoint_p."); - return 1; - } - } - wxPyDefaultPosition = *temp; - return 0; + PyErr_SetString(PyExc_TypeError,"Variable wxDefaultPosition is read-only."); + return 1; } -static PyObject *_wrap_wxPyDefaultPosition_get() { +static PyObject *_wrap_wxDefaultPosition_get() { PyObject * pyobj; char ptemp[128]; - SWIG_MakePtr(ptemp,(char *) &wxPyDefaultPosition,"_wxPoint_p"); + SWIG_MakePtr(ptemp,(char *) &wxDefaultPosition,"_wxPoint_p"); pyobj = PyString_FromString(ptemp); return pyobj; } -static int _wrap_wxPyDefaultSize_set(PyObject *val) { - wxSize * temp; +static int _wrap_wxDefaultSize_set(PyObject *val) { - if (val) { - if (val == Py_None) { temp = NULL; } - else if (SWIG_GetPtrObj(val,(void **) &temp,"_wxSize_p")) { - PyErr_SetString(PyExc_TypeError,"Type error in value of wxPyDefaultSize. Expected _wxSize_p."); - return 1; - } - } - wxPyDefaultSize = *temp; - return 0; + PyErr_SetString(PyExc_TypeError,"Variable wxDefaultSize is read-only."); + return 1; } -static PyObject *_wrap_wxPyDefaultSize_get() { +static PyObject *_wrap_wxDefaultSize_get() { PyObject * pyobj; char ptemp[128]; - SWIG_MakePtr(ptemp,(char *) &wxPyDefaultSize,"_wxSize_p"); + SWIG_MakePtr(ptemp,(char *) &wxDefaultSize,"_wxSize_p"); pyobj = PyString_FromString(ptemp); return pyobj; } @@ -1868,9 +1886,9 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxRealPoint","_wxRealPoint",0}, { "_wxNavigationKeyEvent","_class_wxNavigationKeyEvent",0}, { "_wxPNMHandler","_class_wxPNMHandler",0}, - { "_wxPrinterDC","_class_wxPrinterDC",0}, { "_wxWindowCreateEvent","_class_wxWindowCreateEvent",0}, { "_wxLogGui","_class_wxLogGui",0}, + { "_wxPrinterDC","_class_wxPrinterDC",0}, { "_class_wxMenuItem","_wxMenuItem",0}, { "_class_wxPaintEvent","_wxPaintEvent",0}, { "_wxSysColourChangedEvent","_class_wxSysColourChangedEvent",0}, @@ -2177,12 +2195,12 @@ static struct { char *n1; char *n2; void *(*pcnv)(void *); } _swig_mapping[] = { { "_class_wxPyApp","_wxPyApp",0}, { "_wxSize","_class_wxSize",0}, { "_wxRegionIterator","_class_wxRegionIterator",0}, - { "_class_wxPrinterDC","_wxPrinterDC",0}, { "_class_wxPyTextDataObject","_wxPyTextDataObject",0}, { "_class_wxLogTextCtrl","_wxLogTextCtrl",0}, { "_class_wxLogGui","_wxLogGui",0}, { "_class_wxMDIParentFrame","_wxMDIParentFrame",0}, { "_wxPyTreeItemData","_class_wxPyTreeItemData",0}, + { "_class_wxPrinterDC","_wxPrinterDC",0}, { "_wxStaticBoxSizer","_class_wxStaticBoxSizer",0}, { "_class_wxTimeSpan","_wxTimeSpan",0}, { "_class_wxPyFileSystemHandler","_wxPyFileSystemHandler",0}, @@ -2338,6 +2356,8 @@ SWIGEXPORT(void) initwxc() { PyDict_SetItemString(d,"wxFRAME_TOOL_WINDOW", PyInt_FromLong((long) wxFRAME_TOOL_WINDOW)); PyDict_SetItemString(d,"wxFRAME_FLOAT_ON_PARENT", PyInt_FromLong((long) wxFRAME_FLOAT_ON_PARENT)); PyDict_SetItemString(d,"wxFRAME_NO_WINDOW_MENU", PyInt_FromLong((long) wxFRAME_NO_WINDOW_MENU)); + PyDict_SetItemString(d,"wxFRAME_NO_TASKBAR", PyInt_FromLong((long) wxFRAME_NO_TASKBAR)); + PyDict_SetItemString(d,"wxFRAME_EX_CONTEXTHELP", PyInt_FromLong((long) wxFRAME_EX_CONTEXTHELP)); PyDict_SetItemString(d,"wxED_CLIENT_MARGIN", PyInt_FromLong((long) wxED_CLIENT_MARGIN)); PyDict_SetItemString(d,"wxED_BUTTONS_BOTTOM", PyInt_FromLong((long) wxED_BUTTONS_BOTTOM)); PyDict_SetItemString(d,"wxED_BUTTONS_RIGHT", PyInt_FromLong((long) wxED_BUTTONS_RIGHT)); @@ -2364,6 +2384,7 @@ SWIGEXPORT(void) initwxc() { PyDict_SetItemString(d,"wxALIGN_CENTER", PyInt_FromLong((long) wxALIGN_CENTER)); PyDict_SetItemString(d,"wxALIGN_CENTRE", PyInt_FromLong((long) wxALIGN_CENTRE)); PyDict_SetItemString(d,"wxSHAPED", PyInt_FromLong((long) wxSHAPED)); + PyDict_SetItemString(d,"wxADJUST_MINSIZE", PyInt_FromLong((long) wxADJUST_MINSIZE)); PyDict_SetItemString(d,"wxLB_NEEDED_SB", PyInt_FromLong((long) wxLB_NEEDED_SB)); PyDict_SetItemString(d,"wxLB_ALWAYS_SB", PyInt_FromLong((long) wxLB_ALWAYS_SB)); PyDict_SetItemString(d,"wxLB_SORT", PyInt_FromLong((long) wxLB_SORT)); @@ -2434,12 +2455,17 @@ SWIGEXPORT(void) initwxc() { PyDict_SetItemString(d,"wxLC_MASK_TYPE", PyInt_FromLong((long) wxLC_MASK_TYPE)); PyDict_SetItemString(d,"wxLC_MASK_ALIGN", PyInt_FromLong((long) wxLC_MASK_ALIGN)); PyDict_SetItemString(d,"wxLC_MASK_SORT", PyInt_FromLong((long) wxLC_MASK_SORT)); + PyDict_SetItemString(d,"wxLC_HRULES", PyInt_FromLong((long) wxLC_HRULES)); + PyDict_SetItemString(d,"wxLC_VRULES", PyInt_FromLong((long) wxLC_VRULES)); PyDict_SetItemString(d,"wxSP_VERTICAL", PyInt_FromLong((long) wxSP_VERTICAL)); PyDict_SetItemString(d,"wxSP_HORIZONTAL", PyInt_FromLong((long) wxSP_HORIZONTAL)); PyDict_SetItemString(d,"wxSP_ARROW_KEYS", PyInt_FromLong((long) wxSP_ARROW_KEYS)); PyDict_SetItemString(d,"wxSP_WRAP", PyInt_FromLong((long) wxSP_WRAP)); PyDict_SetItemString(d,"wxSP_NOBORDER", PyInt_FromLong((long) wxSP_NOBORDER)); PyDict_SetItemString(d,"wxSP_3D", PyInt_FromLong((long) wxSP_3D)); + PyDict_SetItemString(d,"wxSP_3DSASH", PyInt_FromLong((long) wxSP_3DSASH)); + PyDict_SetItemString(d,"wxSP_3DBORDER", PyInt_FromLong((long) wxSP_3DBORDER)); + PyDict_SetItemString(d,"wxSP_FULLSASH", PyInt_FromLong((long) wxSP_FULLSASH)); PyDict_SetItemString(d,"wxSP_BORDER", PyInt_FromLong((long) wxSP_BORDER)); PyDict_SetItemString(d,"wxSP_LIVE_UPDATE", PyInt_FromLong((long) wxSP_LIVE_UPDATE)); PyDict_SetItemString(d,"wxSP_PERMIT_UNSPLIT", PyInt_FromLong((long) wxSP_PERMIT_UNSPLIT)); @@ -2551,6 +2577,7 @@ SWIGEXPORT(void) initwxc() { PyDict_SetItemString(d,"wxOVERWRITE_PROMPT", PyInt_FromLong((long) wxOVERWRITE_PROMPT)); PyDict_SetItemString(d,"wxFILE_MUST_EXIST", PyInt_FromLong((long) wxFILE_MUST_EXIST)); PyDict_SetItemString(d,"wxMULTIPLE", PyInt_FromLong((long) wxMULTIPLE)); + PyDict_SetItemString(d,"wxCHANGE_DIR", PyInt_FromLong((long) wxCHANGE_DIR)); PyDict_SetItemString(d,"wxACCEL_ALT", PyInt_FromLong((long) wxACCEL_ALT)); PyDict_SetItemString(d,"wxACCEL_CTRL", PyInt_FromLong((long) wxACCEL_CTRL)); PyDict_SetItemString(d,"wxACCEL_SHIFT", PyInt_FromLong((long) wxACCEL_SHIFT)); @@ -2932,54 +2959,18 @@ SWIGEXPORT(void) initwxc() { PyDict_SetItemString(d,"wxEVT_COMMAND_SET_FOCUS", PyInt_FromLong((long) wxEVT_COMMAND_SET_FOCUS)); PyDict_SetItemString(d,"wxEVT_COMMAND_KILL_FOCUS", PyInt_FromLong((long) wxEVT_COMMAND_KILL_FOCUS)); PyDict_SetItemString(d,"wxEVT_COMMAND_ENTER", PyInt_FromLong((long) wxEVT_COMMAND_ENTER)); - PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_BEGIN_DRAG", PyInt_FromLong((long) wxEVT_COMMAND_TREE_BEGIN_DRAG)); - PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_BEGIN_RDRAG", PyInt_FromLong((long) wxEVT_COMMAND_TREE_BEGIN_RDRAG)); - PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT", PyInt_FromLong((long) wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT)); - PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_END_LABEL_EDIT", PyInt_FromLong((long) wxEVT_COMMAND_TREE_END_LABEL_EDIT)); - PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_DELETE_ITEM", PyInt_FromLong((long) wxEVT_COMMAND_TREE_DELETE_ITEM)); - PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_GET_INFO", PyInt_FromLong((long) wxEVT_COMMAND_TREE_GET_INFO)); - PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_SET_INFO", PyInt_FromLong((long) wxEVT_COMMAND_TREE_SET_INFO)); - PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_ITEM_EXPANDED", PyInt_FromLong((long) wxEVT_COMMAND_TREE_ITEM_EXPANDED)); - PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_ITEM_EXPANDING", PyInt_FromLong((long) wxEVT_COMMAND_TREE_ITEM_EXPANDING)); - PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_ITEM_COLLAPSED", PyInt_FromLong((long) wxEVT_COMMAND_TREE_ITEM_COLLAPSED)); - PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_ITEM_COLLAPSING", PyInt_FromLong((long) wxEVT_COMMAND_TREE_ITEM_COLLAPSING)); - PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_SEL_CHANGED", PyInt_FromLong((long) wxEVT_COMMAND_TREE_SEL_CHANGED)); - PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_SEL_CHANGING", PyInt_FromLong((long) wxEVT_COMMAND_TREE_SEL_CHANGING)); - PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_KEY_DOWN", PyInt_FromLong((long) wxEVT_COMMAND_TREE_KEY_DOWN)); - PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_ITEM_ACTIVATED", PyInt_FromLong((long) wxEVT_COMMAND_TREE_ITEM_ACTIVATED)); - PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK", PyInt_FromLong((long) wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK)); - PyDict_SetItemString(d,"wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK", PyInt_FromLong((long) wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK)); - PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_BEGIN_DRAG", PyInt_FromLong((long) wxEVT_COMMAND_LIST_BEGIN_DRAG)); - PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_BEGIN_RDRAG", PyInt_FromLong((long) wxEVT_COMMAND_LIST_BEGIN_RDRAG)); - PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT", PyInt_FromLong((long) wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT)); - PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_END_LABEL_EDIT", PyInt_FromLong((long) wxEVT_COMMAND_LIST_END_LABEL_EDIT)); - PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_DELETE_ITEM", PyInt_FromLong((long) wxEVT_COMMAND_LIST_DELETE_ITEM)); - PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS", PyInt_FromLong((long) wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS)); - PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_GET_INFO", PyInt_FromLong((long) wxEVT_COMMAND_LIST_GET_INFO)); - PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_SET_INFO", PyInt_FromLong((long) wxEVT_COMMAND_LIST_SET_INFO)); - PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_ITEM_SELECTED", PyInt_FromLong((long) wxEVT_COMMAND_LIST_ITEM_SELECTED)); - PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_ITEM_DESELECTED", PyInt_FromLong((long) wxEVT_COMMAND_LIST_ITEM_DESELECTED)); - PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_KEY_DOWN", PyInt_FromLong((long) wxEVT_COMMAND_LIST_KEY_DOWN)); - PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_INSERT_ITEM", PyInt_FromLong((long) wxEVT_COMMAND_LIST_INSERT_ITEM)); - PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_COL_CLICK", PyInt_FromLong((long) wxEVT_COMMAND_LIST_COL_CLICK)); - PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_ITEM_ACTIVATED", PyInt_FromLong((long) wxEVT_COMMAND_LIST_ITEM_ACTIVATED)); - PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK", PyInt_FromLong((long) wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK)); - PyDict_SetItemString(d,"wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK", PyInt_FromLong((long) wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK)); - PyDict_SetItemString(d,"wxEVT_COMMAND_TAB_SEL_CHANGED", PyInt_FromLong((long) wxEVT_COMMAND_TAB_SEL_CHANGED)); - PyDict_SetItemString(d,"wxEVT_COMMAND_TAB_SEL_CHANGING", PyInt_FromLong((long) wxEVT_COMMAND_TAB_SEL_CHANGING)); - PyDict_SetItemString(d,"wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED", PyInt_FromLong((long) wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)); - PyDict_SetItemString(d,"wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING", PyInt_FromLong((long) wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)); - PyDict_SetItemString(d,"wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING", PyInt_FromLong((long) wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING)); - PyDict_SetItemString(d,"wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED", PyInt_FromLong((long) wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGED)); - PyDict_SetItemString(d,"wxEVT_COMMAND_SPLITTER_UNSPLIT", PyInt_FromLong((long) wxEVT_COMMAND_SPLITTER_UNSPLIT)); - PyDict_SetItemString(d,"wxEVT_COMMAND_SPLITTER_DOUBLECLICKED", PyInt_FromLong((long) wxEVT_COMMAND_SPLITTER_DOUBLECLICKED)); PyDict_SetItemString(d,"wxEVT_NAVIGATION_KEY", PyInt_FromLong((long) wxEVT_NAVIGATION_KEY)); PyDict_SetItemString(d,"wxEVT_TIMER", PyInt_FromLong((long) wxEVT_TIMER)); - PyDict_SetItemString(d,"wxEVT_END_PROCESS", PyInt_FromLong((long) wxEVT_END_PROCESS)); PyDict_SetItemString(d,"__version__", PyString_FromString("0.0.0")); PyDict_SetItemString(d,"cvar", SWIG_globals); - SWIG_addvarlink(SWIG_globals,"wxPyDefaultPosition",_wrap_wxPyDefaultPosition_get, _wrap_wxPyDefaultPosition_set); - SWIG_addvarlink(SWIG_globals,"wxPyDefaultSize",_wrap_wxPyDefaultSize_get, _wrap_wxPyDefaultSize_set); + SWIG_addvarlink(SWIG_globals,"wxDefaultPosition",_wrap_wxDefaultPosition_get, _wrap_wxDefaultPosition_set); + SWIG_addvarlink(SWIG_globals,"wxDefaultSize",_wrap_wxDefaultSize_get, _wrap_wxDefaultSize_set); + + // Make our API structure a CObject so other modules can import it + // from this module. + PyObject* v = PyCObject_FromVoidPtr(&API, NULL); + PyDict_SetItemString(d,"wxPyCoreAPI", v); + Py_XDECREF(v); __wxPreStart(); // initialize the GUI toolkit, if needed. @@ -3008,15 +2999,6 @@ SWIGEXPORT(void) initwxc() { initstreamsc(); initfilesysc(); - initgridc(); - initutilsc(); - inithtmlc(); - inithtmlhelpc(); - initcalendarc(); - - initglcanvasc(); - initoglc(); - initstc_c(); { int i; for (i = 0; _swig_mapping[i].n1; i++)