]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/misc2.i
Some compilation fixes
[wxWidgets.git] / wxPython / src / misc2.i
index 9b4909698304e04db42b3d9f5bcd9e7d7f0c5108..31fb8758cea5664bbef2ec8a7f3ed7f13f7b8183 100644 (file)
@@ -166,26 +166,24 @@ bool wxResourceParseString(char *resource, wxResourceTable *table = NULL);
 //---------------------------------------------------------------------------
 // System Settings
 
-enum {
-    wxSYS_WHITE_BRUSH,
-    wxSYS_LTGRAY_BRUSH,
-    wxSYS_GRAY_BRUSH,
-    wxSYS_DKGRAY_BRUSH,
-    wxSYS_BLACK_BRUSH,
-    wxSYS_NULL_BRUSH,
-    wxSYS_HOLLOW_BRUSH,
-    wxSYS_WHITE_PEN,
-    wxSYS_BLACK_PEN,
-    wxSYS_NULL_PEN,
-    wxSYS_OEM_FIXED_FONT,
+// possible values for wxSystemSettings::GetFont() parameter
+//
+enum wxSystemFont
+{
+    wxSYS_OEM_FIXED_FONT = 10,
     wxSYS_ANSI_FIXED_FONT,
     wxSYS_ANSI_VAR_FONT,
     wxSYS_SYSTEM_FONT,
     wxSYS_DEVICE_DEFAULT_FONT,
     wxSYS_DEFAULT_PALETTE,
     wxSYS_SYSTEM_FIXED_FONT,
-    wxSYS_DEFAULT_GUI_FONT,
+    wxSYS_DEFAULT_GUI_FONT
+};
 
+// possible values for wxSystemSettings::GetColour() parameter
+//
+enum wxSystemColour
+{
     wxSYS_COLOUR_SCROLLBAR,
     wxSYS_COLOUR_BACKGROUND,
     wxSYS_COLOUR_ACTIVECAPTION,
@@ -207,20 +205,25 @@ enum {
     wxSYS_COLOUR_BTNTEXT,
     wxSYS_COLOUR_INACTIVECAPTIONTEXT,
     wxSYS_COLOUR_BTNHIGHLIGHT,
-
     wxSYS_COLOUR_3DDKSHADOW,
     wxSYS_COLOUR_3DLIGHT,
     wxSYS_COLOUR_INFOTEXT,
     wxSYS_COLOUR_INFOBK,
+    wxSYS_COLOUR_LISTBOX,
+
+    wxSYS_COLOUR_DESKTOP = wxSYS_COLOUR_BACKGROUND,
+    wxSYS_COLOUR_3DFACE = wxSYS_COLOUR_BTNFACE,
+    wxSYS_COLOUR_3DSHADOW = wxSYS_COLOUR_BTNSHADOW,
+    wxSYS_COLOUR_3DHIGHLIGHT = wxSYS_COLOUR_BTNHIGHLIGHT,
+    wxSYS_COLOUR_3DHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT,
+    wxSYS_COLOUR_BTNHILIGHT = wxSYS_COLOUR_BTNHIGHLIGHT
+};
 
-    wxSYS_COLOUR_DESKTOP,
-    wxSYS_COLOUR_3DFACE,
-    wxSYS_COLOUR_3DSHADOW,
-    wxSYS_COLOUR_3DHIGHLIGHT,
-    wxSYS_COLOUR_3DHILIGHT,
-    wxSYS_COLOUR_BTNHILIGHT,
-
-    wxSYS_MOUSE_BUTTONS,
+// possible values for wxSystemSettings::GetMetric() parameter
+//
+enum wxSystemMetric
+{
+    wxSYS_MOUSE_BUTTONS = 1,
     wxSYS_BORDER_X,
     wxSYS_BORDER_Y,
     wxSYS_CURSOR_X,
@@ -256,25 +259,42 @@ enum {
     wxSYS_NETWORK_PRESENT,
     wxSYS_PENWINDOWS_PRESENT,
     wxSYS_SHOW_SOUNDS,
-    wxSYS_SWAP_BUTTONS,
+    wxSYS_SWAP_BUTTONS
 };
 
+// possible values for wxSystemSettings::HasFeature() parameter
+enum wxSystemFeature
+{
+    wxSYS_CAN_DRAW_FRAME_DECORATIONS = 1,
+    wxSYS_CAN_ICONIZE_FRAME
+};
 
 
-%inline %{
 
-    wxColour wxSystemSettings_GetSystemColour(int index) {
-        return wxSystemSettings::GetSystemColour(index);
-    }
+class wxSystemSettings {
+public:
+    // get a standard system colour
+    static wxColour GetColour(wxSystemColour index);
+
+    // get a standard system font
+    static wxFont GetFont(wxSystemFont index);
+
+    // get a system-dependent metric
+    static int GetMetric(wxSystemMetric index);
+
+    // return true if the port has certain feature
+    static bool HasFeature(wxSystemFeature index);
+
+
+    // the backwards compatible versions, don't use these methods in the new
+    // code!
+    static wxColour GetSystemColour(int index);
+    static wxFont GetSystemFont(int index);
+    static int GetSystemMetric(int index);
+
+};
 
-    wxFont wxSystemSettings_GetSystemFont(int index) {
-        return wxSystemSettings::GetSystemFont(index);
-    }
 
-    int wxSystemSettings_GetSystemMetric(int index) {
-        return wxSystemSettings::GetSystemMetric(index);
-    }
-%}
 
 //---------------------------------------------------------------------------
 // wxToolTip
@@ -347,8 +367,8 @@ IMP_PYCALLBACK_BOOL_STRINGSTRING(wxPyFontEnumerator, wxFontEnumerator, OnFontEnc
 public:
     wxPyFontEnumerator();
     ~wxPyFontEnumerator();
-    void _setCallbackInfo(PyObject* self, PyObject* _class);
-    %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxFontEnumerator)"
+    void _setCallbackInfo(PyObject* self, PyObject* _class, bool incref);
+    %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxFontEnumerator, 0)"
 
     bool EnumerateFacenames(
         wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all
@@ -360,12 +380,12 @@ public:
     %addmethods {
         PyObject* GetEncodings() {
             wxArrayString* arr = self->GetEncodings();
-            return wxArrayString2PyList_helper(arr);
+            return wxArrayString2PyList_helper(*arr);
         }
 
         PyObject* GetFacenames() {
             wxArrayString* arr = self->GetFacenames();
-            return wxArrayString2PyList_helper(arr);
+            return wxArrayString2PyList_helper(*arr);
         }
     }
 };
@@ -410,7 +430,11 @@ public:
 
 %inline %{
     bool wxThread_IsMain() {
+#ifdef WXP_WITH_THREAD
         return wxThread::IsMain();
+#else
+        return TRUE;
+#endif
     }
 %}
 
@@ -667,20 +691,20 @@ public:
 
     virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t) {
         bool found;
-        wxPyTState* state = wxPyBeginBlockThreads();
+        wxPyBeginBlockThreads();
         if ((found = wxPyCBH_findCallback(m_myInst, "DoLog")))
             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(isi)", level, szString, t));
-        wxPyEndBlockThreads(state);
+        wxPyEndBlockThreads();
         if (! found)
             wxLog::DoLog(level, szString, t);
     }
 
     virtual void DoLogString(const wxChar *szString, time_t t) {
         bool found;
-        wxPyTState* state = wxPyBeginBlockThreads();
+        wxPyBeginBlockThreads();
         if ((found = wxPyCBH_findCallback(m_myInst, "DoLogString")))
             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(si)", szString, t));
-        wxPyEndBlockThreads(state);
+        wxPyEndBlockThreads();
         if (! found)
             wxLog::DoLogString(szString, t);
     }
@@ -773,9 +797,9 @@ long wxExecute(const wxString& command,
 class wxJoystick : public wxObject {
 public:
     wxJoystick(int joystick = wxJOYSTICK1) {
-        wxPyTState* state = wxPyBeginBlockThreads();
+        wxPyBeginBlockThreads();
         PyErr_SetString(PyExc_NotImplementedError, "wxJoystick is not available on this platform.");
-        wxPyEndBlockThreads(state);
+        wxPyEndBlockThreads();
     }
     wxPoint GetPosition() { return wxPoint(-1,-1); }
     int GetZPosition() { return -1; }
@@ -888,14 +912,14 @@ class wxWave : public wxObject
 {
 public:
     wxWave(const wxString& fileName, bool isResource = FALSE) {
-        wxPyTState* state = wxPyBeginBlockThreads();
+        wxPyBeginBlockThreads();
         PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform.");
-        wxPyEndBlockThreads(state);
+        wxPyEndBlockThreads();
     }
     wxWave(int size, const wxByte* data) {
-        wxPyTState* state = wxPyBeginBlockThreads();
+        wxPyBeginBlockThreads();
         PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform.");
-        wxPyEndBlockThreads(state);
+        wxPyEndBlockThreads();
     }
 
     ~wxWave() {}
@@ -1083,13 +1107,13 @@ public:
             wxString iconFile;
             int iconIndex;
             if (self->GetIcon(&icon, &iconFile, &iconIndex)) {
-                wxPyTState* state = wxPyBeginBlockThreads();
+                wxPyBeginBlockThreads();
                 PyObject* tuple = PyTuple_New(3);
                 PyTuple_SetItem(tuple, 0, wxPyConstructObject(new wxIcon(icon),
                                                               "wxIcon", TRUE));
                 PyTuple_SetItem(tuple, 1, PyString_FromString(iconFile.c_str()));
                 PyTuple_SetItem(tuple, 2, PyInt_FromLong(iconIndex));
-                wxPyEndBlockThreads(state);
+                wxPyEndBlockThreads();
                 return tuple;
             }
             else
@@ -1143,11 +1167,11 @@ public:
             wxArrayString commands;
             if (self->GetAllCommands(&verbs, &commands,
                                      wxFileType::MessageParameters(filename, mimetype))) {
-                wxPyTState* state = wxPyBeginBlockThreads();
+                wxPyBeginBlockThreads();
                 PyObject* tuple = PyTuple_New(2);
                 PyTuple_SetItem(tuple, 0, wxArrayString2PyList_helper(verbs));
                 PyTuple_SetItem(tuple, 1, wxArrayString2PyList_helper(commands));
-                wxPyEndBlockThreads(state);
+                wxPyEndBlockThreads();
                 return tuple;
             }
             else