]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/mac/gdi.cpp
Removed deprecation warnings in OGL and Gizmos
[wxWidgets.git] / wxPython / src / mac / gdi.cpp
index 8b65db226dd82655efd2ad6d03e8f11feec480a4..171413ef9de0c67ba69c744cfd746b34dc140c47 100644 (file)
@@ -136,8 +136,11 @@ static PyObject* t_output_helper(PyObject* target, PyObject* o) {
     }
 
 
-    wxBitmap* wxBitmapFromBits(char* bits, int width, int height, int depth = 1 ) {
-        return new wxBitmap(bits, width, height, depth);
+    wxBitmap* wxBitmapFromBits(PyObject* bits, int width, int height, int depth = 1 ) {
+        char* buf;
+        int   length;
+        PyString_AsStringAndSize(bits, &buf, &length);
+        return new wxBitmap(buf, width, height, depth);
     }
 
 
@@ -368,16 +371,20 @@ static PyObject *_wrap_wxBitmapFromIcon(PyObject *self, PyObject *args, PyObject
 static PyObject *_wrap_wxBitmapFromBits(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
     wxBitmap * _result;
-    char * _arg0;
+    PyObject * _arg0;
     int  _arg1;
     int  _arg2;
     int  _arg3 = (int ) 1;
+    PyObject * _obj0 = 0;
     char *_kwnames[] = { "bits","width","height","depth", NULL };
     char _ptemp[128];
 
     self = self;
-    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"sii|i:wxBitmapFromBits",_kwnames,&_arg0,&_arg1,&_arg2,&_arg3)) 
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Oii|i:wxBitmapFromBits",_kwnames,&_obj0,&_arg1,&_arg2,&_arg3)) 
         return NULL;
+{
+  _arg0 = _obj0;
+}
 {
     PyThreadState* __tstate = wxPyBeginAllowThreads();
     _result = (wxBitmap *)wxBitmapFromBits(_arg0,_arg1,_arg2,_arg3);
@@ -5143,6 +5150,42 @@ static PyObject *_wrap_wxDC_DrawRectangle(PyObject *self, PyObject *args, PyObje
     return _resultobj;
 }
 
+#define wxDC_DrawRectangleRect(_swigobj,_swigarg0)  (_swigobj->DrawRectangle(_swigarg0))
+static PyObject *_wrap_wxDC_DrawRectangleRect(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxDC * _arg0;
+    wxRect * _arg1;
+    PyObject * _argo0 = 0;
+    wxRect  temp;
+    PyObject * _obj1 = 0;
+    char *_kwnames[] = { "self","rect", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxDC_DrawRectangleRect",_kwnames,&_argo0,&_obj1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxDC_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxDC_DrawRectangleRect. Expected _wxDC_p.");
+        return NULL;
+        }
+    }
+{
+    _arg1 = &temp;
+    if (! wxRect_helper(_obj1, &_arg1))
+        return NULL;
+}
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    wxDC_DrawRectangleRect(_arg0,*_arg1);
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
 #define wxDC_DrawRotatedText(_swigobj,_swigarg0,_swigarg1,_swigarg2,_swigarg3)  (_swigobj->DrawRotatedText(_swigarg0,_swigarg1,_swigarg2,_swigarg3))
 static PyObject *_wrap_wxDC_DrawRotatedText(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
@@ -6628,6 +6671,42 @@ static PyObject *_wrap_wxDC_SetClippingRegionAsRegion(PyObject *self, PyObject *
     return _resultobj;
 }
 
+#define wxDC_SetClippingRect(_swigobj,_swigarg0)  (_swigobj->SetClippingRegion(_swigarg0))
+static PyObject *_wrap_wxDC_SetClippingRect(PyObject *self, PyObject *args, PyObject *kwargs) {
+    PyObject * _resultobj;
+    wxDC * _arg0;
+    wxRect * _arg1;
+    PyObject * _argo0 = 0;
+    wxRect  temp;
+    PyObject * _obj1 = 0;
+    char *_kwnames[] = { "self","rect", NULL };
+
+    self = self;
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxDC_SetClippingRect",_kwnames,&_argo0,&_obj1)) 
+        return NULL;
+    if (_argo0) {
+        if (_argo0 == Py_None) { _arg0 = NULL; }
+        else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxDC_p")) {
+            PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxDC_SetClippingRect. Expected _wxDC_p.");
+        return NULL;
+        }
+    }
+{
+    _arg1 = &temp;
+    if (! wxRect_helper(_obj1, &_arg1))
+        return NULL;
+}
+{
+    PyThreadState* __tstate = wxPyBeginAllowThreads();
+    wxDC_SetClippingRect(_arg0,*_arg1);
+
+    wxPyEndAllowThreads(__tstate);
+    if (PyErr_Occurred()) return NULL;
+}    Py_INCREF(Py_None);
+    _resultobj = Py_None;
+    return _resultobj;
+}
+
 #define wxDC_SetPalette(_swigobj,_swigarg0)  (_swigobj->SetPalette(_swigarg0))
 static PyObject *_wrap_wxDC_SetPalette(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
@@ -7504,6 +7583,8 @@ static PyObject *_wrap_wxDC_GetBoundingBox(PyObject *self, PyObject *args, PyObj
 }
 
 static PyObject * wxDC__DrawPointList(wxDC *self,PyObject * pyPoints,PyObject * pyPens) {
+            wxPyBeginBlockThreads();
+
             bool      isFastSeq  = PyList_Check(pyPoints) || PyTuple_Check(pyPoints);
             bool      isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens);
             int       numObjs = 0;
@@ -7512,6 +7593,7 @@ static PyObject * wxDC__DrawPointList(wxDC *self,PyObject * pyPoints,PyObject *
             PyObject* obj;
             int       x1, y1;
             int       i = 0;
+            PyObject* retval;
 
             if (!PySequence_Check(pyPoints)) {
                 goto err0;
@@ -7554,6 +7636,13 @@ static PyObject * wxDC__DrawPointList(wxDC *self,PyObject * pyPoints,PyObject *
                         Py_DECREF(obj);
                     goto err0;
                 }
+                if (PyErr_Occurred()) {
+                    retval = NULL;
+                    if (!isFastPens)
+                        Py_DECREF(obj);
+                    goto exit;
+                }
+
 
                 // Now draw the point
                 self->DrawPoint(x1, y1);
@@ -7563,14 +7652,21 @@ static PyObject * wxDC__DrawPointList(wxDC *self,PyObject * pyPoints,PyObject *
             }
 
             Py_INCREF(Py_None);
-            return Py_None;
+            retval = Py_None;
+            goto exit;
 
         err1:
             PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxPens");
-            return NULL;
+            retval = NULL;
+            goto exit;
         err0:
             PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x,y) sequences.");
-            return NULL;
+            retval = NULL;
+            goto exit;
+
+        exit:
+            wxPyEndBlockThreads();
+            return retval;
         }
 static PyObject *_wrap_wxDC__DrawPointList(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
@@ -7612,6 +7708,8 @@ static PyObject *_wrap_wxDC__DrawPointList(PyObject *self, PyObject *args, PyObj
 }
 
 static PyObject * wxDC__DrawLineList(wxDC *self,PyObject * pyLines,PyObject * pyPens) {
+            wxPyBeginBlockThreads();
+
             bool      isFastSeq  = PyList_Check(pyLines) || PyTuple_Check(pyLines);
             bool      isFastPens = PyList_Check(pyPens) || PyTuple_Check(pyPens);
             int       numObjs = 0;
@@ -7620,6 +7718,7 @@ static PyObject * wxDC__DrawLineList(wxDC *self,PyObject * pyLines,PyObject * py
             PyObject* obj;
             int       x1, y1, x2, y2;
             int       i = 0;
+            PyObject* retval;
 
             if (!PySequence_Check(pyLines)) {
                 goto err0;
@@ -7662,6 +7761,12 @@ static PyObject * wxDC__DrawLineList(wxDC *self,PyObject * pyLines,PyObject * py
                         Py_DECREF(obj);
                     goto err0;
                 }
+                if (PyErr_Occurred()) {
+                    retval = NULL;
+                    if (!isFastPens)
+                        Py_DECREF(obj);
+                    goto exit;
+                }
 
                 // Now draw the line
                 self->DrawLine(x1, y1, x2, y2);
@@ -7671,14 +7776,22 @@ static PyObject * wxDC__DrawLineList(wxDC *self,PyObject * pyLines,PyObject * py
             }
 
             Py_INCREF(Py_None);
-            return Py_None;
+            retval = Py_None;
+            goto exit;
 
         err1:
             PyErr_SetString(PyExc_TypeError, "Expected a sequence of wxPens");
-            return NULL;
+            retval = NULL;
+            goto exit;
+
         err0:
             PyErr_SetString(PyExc_TypeError, "Expected a sequence of (x1,y1, x2,y2) sequences.");
-            return NULL;
+            retval = NULL;
+            goto exit;
+
+        exit:
+            wxPyEndBlockThreads();
+            return retval;
         }
 static PyObject *_wrap_wxDC__DrawLineList(PyObject *self, PyObject *args, PyObject *kwargs) {
     PyObject * _resultobj;
@@ -10110,6 +10223,7 @@ static PyMethodDef gdicMethods[] = {
         { "wxDC_SetFont", (PyCFunction) _wrap_wxDC_SetFont, METH_VARARGS | METH_KEYWORDS },
         { "wxDC_SetBrush", (PyCFunction) _wrap_wxDC_SetBrush, METH_VARARGS | METH_KEYWORDS },
         { "wxDC_SetPalette", (PyCFunction) _wrap_wxDC_SetPalette, METH_VARARGS | METH_KEYWORDS },
+        { "wxDC_SetClippingRect", (PyCFunction) _wrap_wxDC_SetClippingRect, METH_VARARGS | METH_KEYWORDS },
         { "wxDC_SetClippingRegionAsRegion", (PyCFunction) _wrap_wxDC_SetClippingRegionAsRegion, METH_VARARGS | METH_KEYWORDS },
         { "wxDC_SetClippingRegion", (PyCFunction) _wrap_wxDC_SetClippingRegion, METH_VARARGS | METH_KEYWORDS },
         { "wxDC_SetBackgroundMode", (PyCFunction) _wrap_wxDC_SetBackgroundMode, METH_VARARGS | METH_KEYWORDS },
@@ -10152,6 +10266,7 @@ static PyMethodDef gdicMethods[] = {
         { "wxDC_DrawSpline", (PyCFunction) _wrap_wxDC_DrawSpline, METH_VARARGS | METH_KEYWORDS },
         { "wxDC_DrawRoundedRectangle", (PyCFunction) _wrap_wxDC_DrawRoundedRectangle, METH_VARARGS | METH_KEYWORDS },
         { "wxDC_DrawRotatedText", (PyCFunction) _wrap_wxDC_DrawRotatedText, METH_VARARGS | METH_KEYWORDS },
+        { "wxDC_DrawRectangleRect", (PyCFunction) _wrap_wxDC_DrawRectangleRect, METH_VARARGS | METH_KEYWORDS },
         { "wxDC_DrawRectangle", (PyCFunction) _wrap_wxDC_DrawRectangle, METH_VARARGS | METH_KEYWORDS },
         { "wxDC_DrawPoint", (PyCFunction) _wrap_wxDC_DrawPoint, METH_VARARGS | METH_KEYWORDS },
         { "wxDC_DrawPolygon", (PyCFunction) _wrap_wxDC_DrawPolygon, METH_VARARGS | METH_KEYWORDS },