]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/helpers.cpp
Use a local copy of the old wxBufferedDC classes until the ones in the
[wxWidgets.git] / wxPython / src / helpers.cpp
index f2d08f0fcba6747dcf237fa60105cece28414c9e..99fdb3ce2781796172ffa84b5326ab47aa25365e 100644 (file)
 #include <wx/gtk/win_gtk.h>
 #endif
 
+#ifdef __WXMAC__
+#include <wx/mac/private.h>
+#endif
+
 #include <wx/clipbrd.h>
 #include <wx/mimetype.h>
 #include <wx/image.h>
@@ -1288,9 +1292,8 @@ off_t wxPyCBInputStream::OnSysTell() const {
         if (PyLong_Check(result))
             o = PyLong_AsLongLong(result);
         else
-#else
-        o = PyInt_AsLong(result);
 #endif
+            o = PyInt_AsLong(result);
         Py_DECREF(result);
     };
     wxPyEndBlockThreads();
@@ -1668,10 +1671,11 @@ PyObject* wxPy_ConvertList(wxListBase* listbase) {
 //----------------------------------------------------------------------
 
 long wxPyGetWinHandle(wxWindow* win) {
+
 #ifdef __WXMSW__
     return (long)win->GetHandle();
 #endif
-
+    
     // Find and return the actual X-Window.
 #ifdef __WXGTK__
     if (win->m_wxwindow) {
@@ -1685,6 +1689,11 @@ long wxPyGetWinHandle(wxWindow* win) {
 #endif
     }
 #endif
+    
+#ifdef __WXMAC__
+    return (long)MAC_WXHWND(win->MacGetRootWindow());
+#endif
+    
     return 0;
 }
 
@@ -2219,12 +2228,20 @@ bool wxPySimple_typecheck(PyObject* source, const wxChar* classname, int seqLen)
 
 bool wxSize_helper(PyObject* source, wxSize** obj)
 {
+    if (source == Py_None) {
+        **obj = wxSize(-1,-1);
+        return True;
+    }
     return wxPyTwoIntItem_helper(source, obj, wxT("wxSize"));
 }
 
 
 bool wxPoint_helper(PyObject* source, wxPoint** obj)
 {
+    if (source == Py_None) {
+        **obj = wxPoint(-1,-1);
+        return True;
+    }
     return wxPyTwoIntItem_helper(source, obj, wxT("wxPoint"));
 }
 
@@ -2232,6 +2249,11 @@ bool wxPoint_helper(PyObject* source, wxPoint** obj)
 
 bool wxRealPoint_helper(PyObject* source, wxRealPoint** obj) {
 
+    if (source == Py_None) {
+        **obj = wxRealPoint(-1,-1);
+        return True;
+    }
+    
     // If source is an object instance then it may already be the right type
     if (wxPySwigInstance_Check(source)) {
         wxRealPoint* ptr;
@@ -2264,6 +2286,11 @@ bool wxRealPoint_helper(PyObject* source, wxRealPoint** obj) {
 
 bool wxRect_helper(PyObject* source, wxRect** obj) {
 
+    if (source == Py_None) {
+        **obj = wxRect(-1,-1,-1,-1);
+        return True;
+    }
+
     // If source is an object instance then it may already be the right type
     if (wxPySwigInstance_Check(source)) {
         wxRect* ptr;
@@ -2304,6 +2331,11 @@ bool wxRect_helper(PyObject* source, wxRect** obj) {
 
 bool wxColour_helper(PyObject* source, wxColour** obj) {
 
+    if (source == Py_None) {
+        **obj = wxNullColour;
+        return True;
+    }
+
     // If source is an object instance then it may already be the right type
     if (wxPySwigInstance_Check(source)) {
         wxColour* ptr;
@@ -2369,6 +2401,12 @@ bool wxColour_typecheck(PyObject* source) {
 
 
 bool wxPoint2D_helper(PyObject* source, wxPoint2D** obj) {
+
+    if (source == Py_None) {
+        **obj = wxPoint2D(-1,-1);
+        return True;
+    }
+    
     // If source is an object instance then it may already be the right type
     if (wxPySwigInstance_Check(source)) {
         wxPoint2D* ptr;