]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/misc2.i
compilation fix for recent commit
[wxWidgets.git] / wxPython / src / misc2.i
index 15385017102396c33dd8d9250de0531152f9595f..9b0bebca18a3d642b7b7973cc140430f6702a743 100644 (file)
@@ -46,6 +46,7 @@
 %import gdi.i
 %import events.i
 %import streams.i
 %import gdi.i
 %import events.i
 %import streams.i
+%import utils.i
 
 %{
     static wxString wxPyEmptyStr("");
 
 %{
     static wxString wxPyEmptyStr("");
@@ -346,8 +347,8 @@ IMP_PYCALLBACK_BOOL_STRINGSTRING(wxPyFontEnumerator, wxFontEnumerator, OnFontEnc
 public:
     wxPyFontEnumerator();
     ~wxPyFontEnumerator();
 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
 
     bool EnumerateFacenames(
         wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all
@@ -359,12 +360,12 @@ public:
     %addmethods {
         PyObject* GetEncodings() {
             wxArrayString* arr = self->GetEncodings();
     %addmethods {
         PyObject* GetEncodings() {
             wxArrayString* arr = self->GetEncodings();
-            return wxArrayString2PyList_helper(arr);
+            return wxArrayString2PyList_helper(*arr);
         }
 
         PyObject* GetFacenames() {
             wxArrayString* arr = self->GetFacenames();
         }
 
         PyObject* GetFacenames() {
             wxArrayString* arr = self->GetFacenames();
-            return wxArrayString2PyList_helper(arr);
+            return wxArrayString2PyList_helper(*arr);
         }
     }
 };
         }
     }
 };
@@ -409,7 +410,11 @@ public:
 
 %inline %{
     bool wxThread_IsMain() {
 
 %inline %{
     bool wxThread_IsMain() {
+#ifdef WXP_WITH_THREAD
         return wxThread::IsMain();
         return wxThread::IsMain();
+#else
+        return TRUE;
+#endif
     }
 %}
 
     }
 %}
 
@@ -666,20 +671,20 @@ public:
 
     virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t) {
         bool found;
 
     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));
         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;
         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));
         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);
     }
         if (! found)
             wxLog::DoLogString(szString, t);
     }
@@ -772,9 +777,9 @@ long wxExecute(const wxString& command,
 class wxJoystick : public wxObject {
 public:
     wxJoystick(int joystick = wxJOYSTICK1) {
 class wxJoystick : public wxObject {
 public:
     wxJoystick(int joystick = wxJOYSTICK1) {
-        wxPyTState* state = wxPyBeginBlockThreads();
+        wxPyBeginBlockThreads();
         PyErr_SetString(PyExc_NotImplementedError, "wxJoystick is not available on this platform.");
         PyErr_SetString(PyExc_NotImplementedError, "wxJoystick is not available on this platform.");
-        wxPyEndBlockThreads(state);
+        wxPyEndBlockThreads();
     }
     wxPoint GetPosition() { return wxPoint(-1,-1); }
     int GetZPosition() { return -1; }
     }
     wxPoint GetPosition() { return wxPoint(-1,-1); }
     int GetZPosition() { return -1; }
@@ -887,14 +892,14 @@ class wxWave : public wxObject
 {
 public:
     wxWave(const wxString& fileName, bool isResource = FALSE) {
 {
 public:
     wxWave(const wxString& fileName, bool isResource = FALSE) {
-        wxPyTState* state = wxPyBeginBlockThreads();
+        wxPyBeginBlockThreads();
         PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform.");
         PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform.");
-        wxPyEndBlockThreads(state);
+        wxPyEndBlockThreads();
     }
     wxWave(int size, const wxByte* data) {
     }
     wxWave(int size, const wxByte* data) {
-        wxPyTState* state = wxPyBeginBlockThreads();
+        wxPyBeginBlockThreads();
         PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform.");
         PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform.");
-        wxPyEndBlockThreads(state);
+        wxPyEndBlockThreads();
     }
 
     ~wxWave() {}
     }
 
     ~wxWave() {}
@@ -1082,13 +1087,13 @@ public:
             wxString iconFile;
             int iconIndex;
             if (self->GetIcon(&icon, &iconFile, &iconIndex)) {
             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));
                 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
                 return tuple;
             }
             else
@@ -1142,11 +1147,11 @@ public:
             wxArrayString commands;
             if (self->GetAllCommands(&verbs, &commands,
                                      wxFileType::MessageParameters(filename, mimetype))) {
             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));
                 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
                 return tuple;
             }
             else
@@ -1277,6 +1282,42 @@ extern wxMimeTypesManager* wxTheMimeTypesManager;
 %}
 %readwrite
 
 %}
 %readwrite
 
+//----------------------------------------------------------------------
+
+%{
+#include <wx/docview.h>
+%}
+
+class wxFileHistory : public wxObject
+{
+public:
+    wxFileHistory(int maxFiles = 9);
+    ~wxFileHistory();
+
+    // Operations
+    void AddFileToHistory(const wxString& file);
+    void RemoveFileFromHistory(int i);
+    int GetMaxFiles() const;
+    void UseMenu(wxMenu *menu);
+
+    // Remove menu from the list (MDI child may be closing)
+    void RemoveMenu(wxMenu *menu);
+
+    void Load(wxConfigBase& config);
+    void Save(wxConfigBase& config);
+
+    void AddFilesToMenu();
+    %name(AddFilesToSingleMenu)void AddFilesToMenu(wxMenu* menu);
+
+    // Accessors
+    wxString GetHistoryFile(int i) const;
+
+    // A synonym for GetNoHistoryFiles
+    int GetCount() const;
+    int GetNoHistoryFiles() const;
+
+};
+
 //----------------------------------------------------------------------
 //----------------------------------------------------------------------
 
 //----------------------------------------------------------------------
 //----------------------------------------------------------------------