]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/wx.i
simplified definition
[wxWidgets.git] / wxPython / src / wx.i
index 41e0f7f90d9de1d729402cf2892d83513c4b8426..747fa6839e1847d4102a1e3ee41dd9d3bde7f101 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        wxp.i
+// Name:        wx.i
 // Purpose:     SWIG interface file for a python wxWindows module
 //
 // Author:      Robin Dunn
@@ -45,6 +45,9 @@
 %import sizers.i
 %import streams.i
 %import filesys.i
+%import utils.i
+%import fonts.i
+
 
 %native(_wxStart)           __wxStart;
 %native(_wxSetDictionary)   __wxSetDictionary;
 
 #define __version__ "0.0.0"   // The real value is now in setup.py...
 
-wxPoint     wxPyDefaultPosition;
-wxSize      wxPyDefaultSize;
+%readonly
+wxPoint     wxDefaultPosition;
+wxSize      wxDefaultSize;
+%readwrite
 
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 
+enum {
+    wxPYAPP_ASSERT_SUPPRESS  = 1,
+    wxPYAPP_ASSERT_EXCEPTION = 2,
+    wxPYAPP_ASSERT_DIALOG    = 4,
+    wxPYAPP_ASSERT_LOG       = 8
+};
+
+
 class wxPyApp : public wxEvtHandler {
 public:
     %addmethods {
@@ -71,6 +84,11 @@ public:
 
     ~wxPyApp();
 
+    void _setCallbackInfo(PyObject* self, PyObject* _class);
+    %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyApp)"
+    %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
+
+
     wxString GetAppName();
 #ifdef __WXMSW__
     bool GetAuto3D();
@@ -88,6 +106,7 @@ public:
     int  MainLoop();
     bool Pending();
     bool ProcessIdle();
+    bool Yield(bool onlyIfNeeded = FALSE);
 
     void SetAppName(const wxString& name);
 #ifdef __WXMSW__
@@ -99,17 +118,34 @@ public:
     void SetTopWindow(wxWindow* window);
     void SetVendorName(const wxString& name);
     void SetUseBestVisual(bool flag);
-    wxIcon GetStdIcon(int which);
 
+    int  GetAssertMode();
+    void SetAssertMode(int mode);
+
+
+    static bool GetMacDefaultEncodingIsPC();
+    static bool GetMacSupportPCMenuShortcuts();
+    static long GetMacAboutMenuItemId();
+    static long GetMacPreferencesMenuItemId();
+    static long GetMacExitMenuItemId();
+    static wxString GetMacHelpMenuTitleName();
 
+    static void SetMacDefaultEncodingIsPC(bool val);
+    static void SetMacSupportPCMenuShortcuts(bool val);
+    static void SetMacAboutMenuItemId(long val);
+    static void SetMacPreferencesMenuItemId(long val);
+    static void SetMacExitMenuItemId(long val);
+    static void SetMacHelpMenuTitleName(const wxString& val);
 };
 
 %inline %{
     wxPyApp* wxGetApp() {
-        return wxPythonApp;
+        //return wxPythonApp;
+        return (wxPyApp*)wxTheApp;
     }
 %}
 
+
 //----------------------------------------------------------------------
 // this is used to cleanup after wxWindows when Python shuts down.
 
@@ -124,6 +160,8 @@ public:
 //----------------------------------------------------------------------
 
 %{
+
+
 extern "C" SWIGEXPORT(void) initwindowsc();
 extern "C" SWIGEXPORT(void) initwindows2c();
 extern "C" SWIGEXPORT(void) initeventsc();
@@ -141,24 +179,86 @@ 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) initutilsc();
+extern "C" SWIGEXPORT(void) initfontsc();
+
+
+
+// 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 = {
+    (p_SWIG_MakePtr_t)SWIG_MakePtr,
+    (p_SWIG_GetPtr_t)SWIG_GetPtr,
+    (p_SWIG_GetPtrObj_t)SWIG_GetPtrObj,
+    (p_SWIG_RegisterMapping_t)SWIG_RegisterMapping,
+    (p_SWIG_addvarlink_t)SWIG_addvarlink,
+    (p_SWIG_newvarlink_t)SWIG_newvarlink,
+
+    wxPyBeginAllowThreads,
+    wxPyEndAllowThreads,
+    wxPyBeginBlockThreads,
+    wxPyEndBlockThreads,
+
+    wxPyConstructObject,
+    wxPy_ConvertList,
+
+    wxString_in_helper,
+    Py2wxString,
+    wx2PyString,
+
+    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,
+    wxPoint2DDouble_helper,
+
+    wxPyCBH_setCallbackInfo,
+    wxPyCBH_findCallback,
+    wxPyCBH_callCallback,
+    wxPyCBH_callCallbackObj,
+    wxPyCBH_delete,
+
+    wxPyClassExists,
+    wxPyMake_wxObject,
+    wxPyMake_wxSizer,
+    wxPyPtrTypeMap_Add,
+    wxArrayString2PyList_helper,
+    wxArrayInt2PyList_helper,
+
+    wxPyClientData_dtor,
+    wxPyUserData_dtor,
+    wxPyOORClientData_dtor,
+
+    wxPyCBInputStream_create
+};
+
 
-extern "C" SWIGEXPORT(void) initglcanvasc();
-extern "C" SWIGEXPORT(void) initoglc();
-extern "C" SWIGEXPORT(void) initstc_c();
 %}
 
 
 
 %init %{
+    // 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.
+
+    __wxPreStart(d);     // initialize the GUI toolkit, if needed.
 
 
         // Since these modules are all linked together, initialize them now
@@ -183,16 +283,22 @@ extern "C" SWIGEXPORT(void) initstc_c();
     initclip_dndc();
     initstreamsc();
     initfilesysc();
-
-    initgridc();
     initutilsc();
-    inithtmlc();
-    inithtmlhelpc();
-    initcalendarc();
+    initfontsc();
+
+
+    PyDict_SetItemString(d,"wxMAJOR_VERSION", PyInt_FromLong((long)wxMAJOR_VERSION ));
+    PyDict_SetItemString(d,"wxMINOR_VERSION", PyInt_FromLong((long)wxMINOR_VERSION ));
+    PyDict_SetItemString(d,"wxRELEASE_NUMBER", PyInt_FromLong((long)wxRELEASE_NUMBER ));
+    PyDict_SetItemString(d,"wxVERSION_NUMBER", PyInt_FromLong((long)wxVERSION_NUMBER ));
+#if wxUSE_UNICODE
+    wxString tempStr(wxVERSION_STRING);
+    PyDict_SetItemString(d,"wxVERSION_STRING", PyUnicode_FromWideChar(tempStr.c_str(), tempStr.Len()));
+#else
+    PyDict_SetItemString(d,"wxVERSION_STRING", PyString_FromString(wxVERSION_STRING));
+#endif
+
 
-    initglcanvasc();
-    initoglc();
-    initstc_c();
 %}
 
 //----------------------------------------------------------------------