]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/misc2.i
Added URL drag and drop sample to the wxPython demo
[wxWidgets.git] / wxPython / src / misc2.i
index 81d212afdde41f5742a908d7e8ce18a6069bb88d..475493e05dc1e9a16d5897ab3422d79633745564 100644 (file)
@@ -141,7 +141,11 @@ wxWindow * wxGetActiveWindow();
 
 wxWindow* wxGenericFindWindowAtPoint(const wxPoint& pt);
 wxWindow* wxFindWindowAtPoint(const wxPoint& pt);
+
+#ifdef __WXMSW__
 bool wxCheckForInterrupt(wxWindow *wnd);
+void wxFlushEvents();
+#endif
 
 //---------------------------------------------------------------------------
 // Resource System
@@ -280,18 +284,10 @@ public:
     wxString GetTip();
     // *** Not in the "public" interface void SetWindow(wxWindow *win);
     wxWindow *GetWindow();
-};
-
-
-%inline %{
-    void wxToolTip_Enable(bool flag) {
-        wxToolTip::Enable(flag);
-    }
 
-    void wxToolTip_SetDelay(long milliseconds) {
-        wxToolTip::SetDelay(milliseconds);
-    }
-%}
+    static void Enable(bool flag);
+    static void SetDelay(long milliseconds);
+};
 
 //----------------------------------------------------------------------
 
@@ -348,8 +344,8 @@ IMP_PYCALLBACK_BOOL_STRINGSTRING(wxPyFontEnumerator, wxFontEnumerator, OnFontEnc
 public:
     wxPyFontEnumerator();
     ~wxPyFontEnumerator();
-    void _setSelf(PyObject* self, PyObject* _class);
-    %pragma(python) addtomethod = "__init__:self._setSelf(self, wxFontEnumerator)"
+    void _setCallbackInfo(PyObject* self, PyObject* _class);
+    %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxFontEnumerator)"
 
     bool EnumerateFacenames(
         wxFontEncoding encoding = wxFONTENCODING_SYSTEM, // all
@@ -469,7 +465,6 @@ bool wxShowTip(wxWindow *parent, wxTipProvider *tipProvider, bool showAtStartup
 
 %{
 #include <wx/generic/dragimgg.h>
-static wxPoint wxPyNullPoint;
 %}
 
 %name (wxDragImage) class wxGenericDragImage : public wxObject
@@ -477,10 +472,17 @@ static wxPoint wxPyNullPoint;
 public:
 
     wxGenericDragImage(const wxBitmap& image,
-                       const wxCursor& cursor = wxNullCursor,
-                       const wxPoint& hotspot = wxPyNullPoint);
+                       const wxCursor& cursor = wxNullCursor);
+    %name(wxDragIcon)wxGenericDragImage(const wxIcon& image,
+                                        const wxCursor& cursor = wxNullCursor);
+    %name(wxDragString)wxGenericDragImage(const wxString& str,
+                                          const wxCursor& cursor = wxNullCursor);
+    %name(wxDragTreeItem)wxGenericDragImage(const wxTreeCtrl& treeCtrl, wxTreeItemId& id);
+    %name(wxDragListItem)wxGenericDragImage(const wxListCtrl& listCtrl, long id);
+
     ~wxGenericDragImage();
 
+    void SetBackingBitmap(wxBitmap* bitmap);
     bool BeginDrag(const wxPoint& hotspot, wxWindow* window,
                    bool fullScreen = FALSE, wxRect* rect = NULL);
 
@@ -498,46 +500,6 @@ public:
 };
 
 
-// Alternate Constructors
-%new wxGenericDragImage* wxDragIcon(const wxIcon& image,
-                                   const wxCursor& cursor = wxNullCursor,
-                                   const wxPoint& hotspot = wxPyNullPoint);
-
-%new wxGenericDragImage* wxDragString(const wxString& str,
-                                      const wxCursor& cursor = wxNullCursor,
-                                      const wxPoint& hotspot = wxPyNullPoint);
-
-%new wxGenericDragImage* wxDragTreeItem(const wxTreeCtrl& treeCtrl, wxTreeItemId& id);
-
-%new wxGenericDragImage* wxDragListItem(const wxListCtrl& listCtrl, long id);
-
-
-%{
-
-wxGenericDragImage* wxDragIcon(const wxIcon& image,
-                               const wxCursor& cursor,
-                               const wxPoint& hotspot) {
-    return new wxGenericDragImage(image, cursor, hotspot);
-}
-
-wxGenericDragImage* wxDragString(const wxString& str,
-                                 const wxCursor& cursor,
-                                 const wxPoint& hotspot) {
-    return new wxGenericDragImage(str, cursor, hotspot);
-}
-
-wxGenericDragImage* wxDragTreeItem(const wxTreeCtrl& treeCtrl, wxTreeItemId& id) {
-    return new wxGenericDragImage(treeCtrl, id);
-}
-
-wxGenericDragImage* wxDragListItem(const wxListCtrl& listCtrl, long id) {
-    return new wxGenericDragImage(listCtrl, id);
-}
-
-%}
-
-
-
 //----------------------------------------------------------------------
 
 class wxPyTimer : public wxObject {
@@ -596,12 +558,24 @@ public:
     static void SetTraceMask(wxTraceMask ulMask);
     static void AddTraceMask(const wxString& str);
     static void RemoveTraceMask(const wxString& str);
+    static void ClearTraceMasks();
+
+    static void SetTimestamp(const wxChar *ts);
+    static const wxChar *GetTimestamp();
 
     bool GetVerbose() const { return m_bVerbose; }
 
     static wxTraceMask GetTraceMask();
     static bool IsAllowedTraceMask(const char *mask);
 
+    // static void TimeStamp(wxString *str);
+    %addmethods {
+        wxString TimeStamp() {
+            wxString msg;
+            wxLog::TimeStamp(&msg);
+            return msg;
+        }
+    }
 };
 
 
@@ -649,6 +623,17 @@ public:
 };
 
 
+class wxLogChain : public wxLog
+{
+public:
+    wxLogChain(wxLog *logger);
+    void SetLog(wxLog *logger);
+    void PassMessages(bool bDoPass);
+    bool IsPassingMessages();
+    wxLog *GetOldLog();
+};
+
+
 unsigned long wxSysErrorCode();
 const char* wxSysErrorMsg(unsigned long nErrCode = 0);
 void wxLogFatalError(const char *szFormat);
@@ -662,6 +647,46 @@ void wxLogStatus(const char *szFormat);
 void wxLogSysError(const char *szFormat);
 
 
+%{
+// A Log class that can be derived from in wxPython
+class wxPyLog : public wxLog {
+public:
+    wxPyLog() : wxLog() {}
+
+    virtual void DoLog(wxLogLevel level, const wxChar *szString, time_t t) {
+        bool found;
+        wxPyTState* state = wxPyBeginBlockThreads();
+        if ((found = wxPyCBH_findCallback(m_myInst, "DoLog")))
+            wxPyCBH_callCallback(m_myInst, Py_BuildValue("(isi)", level, szString, t));
+        wxPyEndBlockThreads(state);
+        if (! found)
+            wxLog::DoLog(level, szString, t);
+    }
+
+    virtual void DoLogString(const wxChar *szString, time_t t) {
+        bool found;
+        wxPyTState* state = wxPyBeginBlockThreads();
+        if ((found = wxPyCBH_findCallback(m_myInst, "DoLogString")))
+            wxPyCBH_callCallback(m_myInst, Py_BuildValue("(si)", szString, t));
+        wxPyEndBlockThreads(state);
+        if (! found)
+            wxLog::DoLogString(szString, t);
+    }
+
+    PYPRIVATE;
+};
+%}
+
+// Now tell SWIG about it
+class wxPyLog : public wxLog {
+public:
+    wxPyLog();
+    void _setCallbackInfo(PyObject* self, PyObject* _class);
+    %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyLog)"
+    %addmethods { void Destroy() { delete self; } }
+
+};
+
 
 //----------------------------------------------------------------------
 
@@ -697,6 +722,7 @@ public:
 };
 
 IMP_PYCALLBACK_VOID_INTINT( wxPyProcess, wxProcess, OnTerminate);
+
 %}
 
 
@@ -705,8 +731,8 @@ public:
     wxPyProcess(wxEvtHandler *parent = NULL, int id = -1);
     %addmethods { void Destroy() { delete self; } }
 
-    void _setSelf(PyObject* self, PyObject* _class);
-    %pragma(python) addtomethod = "__init__:self._setSelf(self, wxProcess)"
+    void _setCallbackInfo(PyObject* self, PyObject* _class);
+    %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxProcess)"
 
     void base_OnTerminate(int pid, int status);
 
@@ -748,7 +774,7 @@ public:
     int GetUPosition() { return -1; }
     int GetVPosition() { return -1; }
     int GetMovementThreshold() { return -1; }
-    void SetMovementThreshold(int threshold) ;
+    void SetMovementThreshold(int threshold) {}
 
     bool IsOk(void) { return FALSE; }
     int GetNumberJoysticks() { return -1; }
@@ -792,6 +818,8 @@ public:
 class wxJoystick : public wxObject {
 public:
     wxJoystick(int joystick = wxJOYSTICK1);
+    ~wxJoystick();
+
     wxPoint GetPosition();
     int GetZPosition();
     int GetButtonState();
@@ -842,20 +870,20 @@ public:
 //----------------------------------------------------------------------
 
 %{
-#if !wxUSE_WAVE && !defined(__WXMSW__)
+#if !wxUSE_WAVE
 // A C++ stub class for wxWave for platforms that don't have it.
 class wxWave : public wxObject
 {
 public:
     wxWave(const wxString& fileName, bool isResource = FALSE) {
-        bool doSave = wxPyRestoreThread();
+        wxPyTState* state = wxPyBeginBlockThreads();
         PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform.");
-        wxPySaveThread(doSave);
+        wxPyEndBlockThreads(state);
     }
     wxWave(int size, const wxByte* data) {
-        bool doSave = wxPyRestoreThread();
+        wxPyTState* state = wxPyBeginBlockThreads();
         PyErr_SetString(PyExc_NotImplementedError, "wxWave is not available on this platform.");
-        wxPySaveThread(doSave);
+        wxPyEndBlockThreads(state);
     }
 
     ~wxWave() {}
@@ -884,6 +912,8 @@ public:
     }
 %}
 
+
+//----------------------------------------------------------------------
 //----------------------------------------------------------------------