]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/misc.i
wxUniversal fixes:
[wxWidgets.git] / wxPython / src / misc.i
index bae3d066b9235f133f6da53600c7446eadc93165..92f95b87da5c0080f28f925d04f5d422664a434c 100644 (file)
 %import _defs.i
 
 
 %import _defs.i
 
 
+//---------------------------------------------------------------------------
+%{
+    // Put some wx default wxChar* values into wxStrings.
+    static const wxString wxPyEmptyString(wxT(""));
+%}
 //---------------------------------------------------------------------------
 
 
 //---------------------------------------------------------------------------
 
 
@@ -66,9 +71,11 @@ public:
 
     %addmethods {
         PyObject* asTuple() {
 
     %addmethods {
         PyObject* asTuple() {
+            wxPyBeginBlockThreads();
             PyObject* tup = PyTuple_New(2);
             PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
             PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
             PyObject* tup = PyTuple_New(2);
             PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
             PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
+            wxPyEndBlockThreads();
             return tup;
         }
 
             return tup;
         }
 
@@ -107,9 +114,11 @@ public:
             self->y = y;
         }
         PyObject* asTuple() {
             self->y = y;
         }
         PyObject* asTuple() {
+            wxPyBeginBlockThreads();
             PyObject* tup = PyTuple_New(2);
             PyTuple_SET_ITEM(tup, 0, PyFloat_FromDouble(self->x));
             PyTuple_SET_ITEM(tup, 1, PyFloat_FromDouble(self->y));
             PyObject* tup = PyTuple_New(2);
             PyTuple_SET_ITEM(tup, 0, PyFloat_FromDouble(self->x));
             PyTuple_SET_ITEM(tup, 1, PyFloat_FromDouble(self->y));
+            wxPyEndBlockThreads();
             return tup;
         }
 
             return tup;
         }
 
@@ -155,9 +164,11 @@ public:
             self->y = y;
         }
         PyObject* asTuple() {
             self->y = y;
         }
         PyObject* asTuple() {
+            wxPyBeginBlockThreads();
             PyObject* tup = PyTuple_New(2);
             PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
             PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
             PyObject* tup = PyTuple_New(2);
             PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
             PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
+            wxPyEndBlockThreads();
             return tup;
         }
 
             return tup;
         }
 
@@ -227,11 +238,13 @@ public:
 
     %addmethods {
         PyObject* asTuple() {
 
     %addmethods {
         PyObject* asTuple() {
+            wxPyBeginBlockThreads();
             PyObject* tup = PyTuple_New(4);
             PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
             PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
             PyTuple_SET_ITEM(tup, 2, PyInt_FromLong(self->width));
             PyTuple_SET_ITEM(tup, 3, PyInt_FromLong(self->height));
             PyObject* tup = PyTuple_New(4);
             PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->x));
             PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->y));
             PyTuple_SET_ITEM(tup, 2, PyInt_FromLong(self->width));
             PyTuple_SET_ITEM(tup, 3, PyInt_FromLong(self->height));
+            wxPyEndBlockThreads();
             return tup;
         }
 
             return tup;
         }
 
@@ -345,7 +358,7 @@ long wxGetFreeMemory();
 void wxGetMousePosition(int* OUTPUT, int* OUTPUT);
 bool wxIsBusy();
 wxString wxNow();
 void wxGetMousePosition(int* OUTPUT, int* OUTPUT);
 bool wxIsBusy();
 wxString wxNow();
-bool wxShell(const wxString& command = wxEmptyString);
+bool wxShell(const wxString& command = wxPyEmptyString);
 void wxStartTimer();
 int wxGetOsVersion(int *OUTPUT, int *OUTPUT);
 wxString wxGetOsDescription();
 void wxStartTimer();
 int wxGetOsVersion(int *OUTPUT, int *OUTPUT);
 wxString wxGetOsDescription();
@@ -358,7 +371,7 @@ void wxEnableTopLevelWindows(bool enable);
 
 %inline %{
     wxString wxGetResource(const wxString& section, const wxString& entry,
 
 %inline %{
     wxString wxGetResource(const wxString& section, const wxString& entry,
-                          const wxString& file = wxEmptyString) {
+                           const wxString& file = wxPyEmptyString) {
         wxChar * retval;
         wxGetResource(section, entry, &retval, file);
         return retval;
         wxChar * retval;
         wxGetResource(section, entry, &retval, file);
         return retval;
@@ -374,7 +387,7 @@ wxString wxGetFullHostName();
 wxString wxGetUserId();
 wxString wxGetUserName();
 wxString wxGetHomeDir();
 wxString wxGetUserId();
 wxString wxGetUserName();
 wxString wxGetHomeDir();
-wxString wxGetUserHome(const char* user = "");
+wxString wxGetUserHome(const wxString& user = wxPyEmptyString);
 
 
 // When wxApp gets the virtual method magic then enable this.
 
 
 // When wxApp gets the virtual method magic then enable this.
@@ -475,6 +488,7 @@ public:
     ~wxBusyInfo();
 };
 
     ~wxBusyInfo();
 };
 
+
 //---------------------------------------------------------------------------
 
 
 //---------------------------------------------------------------------------