]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/mac/_controls_wrap.cpp
Get/SetTitle only for wxTopLevelWindow (wxMGL part).
[wxWidgets.git] / wxPython / src / mac / _controls_wrap.cpp
index 551f5a382820ea66a6c39a8071e0e30122369c03..5b0831ea8c74be4523cd66a2fcce79d09b80bdbf 100644 (file)
@@ -1037,7 +1037,8 @@ SWIG_Python_TypeError(const char *type, PyObject *obj)
          PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
                       type, otype);
        }
-       Py_DECREF(str);
+       if (str)
+          Py_DECREF(str);
        return;
       }
     }   
@@ -2164,6 +2165,16 @@ public:
 
     void SetBestSize(const wxSize& size) { wxControl::SetBestSize(size); }
 
+    bool DoEraseBackground(wxDC* dc) {
+#ifdef __WXMSW__
+        return wxWindow::DoEraseBackground(dc->GetHDC());
+#else
+        dc->SetBackground(wxBrush(GetBackgroundColour()));
+        dc->Clear();
+        return true;
+#endif
+    }
+
     DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
     DEC_PYCALLBACK_VOID_INT5(DoSetSize);
     DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
@@ -2193,6 +2204,8 @@ public:
     
     DEC_PYCALLBACK_BOOL_(HasTransparentBackground);
 
+    DEC_PYCALLBACK_VOID_(OnInternalIdle);
+
     PYPRIVATE;
 };
 
@@ -2226,7 +2239,9 @@ IMP_PYCALLBACK_BOOL_const(wxPyControl, wxControl, ShouldInheritColours);
 IMP_PYCALLBACK_VIZATTR_(wxPyControl, wxControl, GetDefaultAttributes);
 
 IMP_PYCALLBACK_BOOL_(wxPyControl, wxControl, HasTransparentBackground);
+
+IMP_PYCALLBACK_VOID_(wxPyControl, wxControl, OnInternalIdle);
+
 
 
 static void wxHelpProvider_Destroy(wxHelpProvider *self){ delete self; }
@@ -3822,15 +3837,11 @@ static PyObject *_wrap_new_Choice(PyObject *, PyObject *args, PyObject *kwargs)
             int i, len=PySequence_Length(obj4);
             for (i=0; i<len; i++) {
                 PyObject* item = PySequence_GetItem(obj4, i);
-#if wxUSE_UNICODE
-                PyObject* str  = PyObject_Unicode(item);
-#else
-                PyObject* str  = PyObject_Str(item);
-#endif
+                wxString* s = wxString_in_helper(item);
                 if (PyErr_Occurred())  SWIG_fail;
-                arg5->Add(Py2wxString(str));
+                arg5->Add(*s);
+                delete s;
                 Py_DECREF(item);
-                Py_DECREF(str);
             }
         }
     }
@@ -3977,15 +3988,11 @@ static PyObject *_wrap_Choice_Create(PyObject *, PyObject *args, PyObject *kwarg
             int i, len=PySequence_Length(obj5);
             for (i=0; i<len; i++) {
                 PyObject* item = PySequence_GetItem(obj5, i);
-#if wxUSE_UNICODE
-                PyObject* str  = PyObject_Unicode(item);
-#else
-                PyObject* str  = PyObject_Str(item);
-#endif
+                wxString* s = wxString_in_helper(item);
                 if (PyErr_Occurred())  SWIG_fail;
-                arg6->Add(Py2wxString(str));
+                arg6->Add(*s);
+                delete s;
                 Py_DECREF(item);
-                Py_DECREF(str);
             }
         }
     }
@@ -4179,15 +4186,11 @@ static PyObject *_wrap_new_ComboBox(PyObject *, PyObject *args, PyObject *kwargs
             int i, len=PySequence_Length(obj5);
             for (i=0; i<len; i++) {
                 PyObject* item = PySequence_GetItem(obj5, i);
-#if wxUSE_UNICODE
-                PyObject* str  = PyObject_Unicode(item);
-#else
-                PyObject* str  = PyObject_Str(item);
-#endif
+                wxString* s = wxString_in_helper(item);
                 if (PyErr_Occurred())  SWIG_fail;
-                arg6->Add(Py2wxString(str));
+                arg6->Add(*s);
+                delete s;
                 Py_DECREF(item);
-                Py_DECREF(str);
             }
         }
     }
@@ -4353,15 +4356,11 @@ static PyObject *_wrap_ComboBox_Create(PyObject *, PyObject *args, PyObject *kwa
             int i, len=PySequence_Length(obj6);
             for (i=0; i<len; i++) {
                 PyObject* item = PySequence_GetItem(obj6, i);
-#if wxUSE_UNICODE
-                PyObject* str  = PyObject_Unicode(item);
-#else
-                PyObject* str  = PyObject_Str(item);
-#endif
+                wxString* s = wxString_in_helper(item);
                 if (PyErr_Occurred())  SWIG_fail;
-                arg7->Add(Py2wxString(str));
+                arg7->Add(*s);
+                delete s;
                 Py_DECREF(item);
-                Py_DECREF(str);
             }
         }
     }
@@ -7145,15 +7144,11 @@ static PyObject *_wrap_new_ListBox(PyObject *, PyObject *args, PyObject *kwargs)
             int i, len=PySequence_Length(obj4);
             for (i=0; i<len; i++) {
                 PyObject* item = PySequence_GetItem(obj4, i);
-#if wxUSE_UNICODE
-                PyObject* str  = PyObject_Unicode(item);
-#else
-                PyObject* str  = PyObject_Str(item);
-#endif
+                wxString* s = wxString_in_helper(item);
                 if (PyErr_Occurred())  SWIG_fail;
-                arg5->Add(Py2wxString(str));
+                arg5->Add(*s);
+                delete s;
                 Py_DECREF(item);
-                Py_DECREF(str);
             }
         }
     }
@@ -7300,15 +7295,11 @@ static PyObject *_wrap_ListBox_Create(PyObject *, PyObject *args, PyObject *kwar
             int i, len=PySequence_Length(obj5);
             for (i=0; i<len; i++) {
                 PyObject* item = PySequence_GetItem(obj5, i);
-#if wxUSE_UNICODE
-                PyObject* str  = PyObject_Unicode(item);
-#else
-                PyObject* str  = PyObject_Str(item);
-#endif
+                wxString* s = wxString_in_helper(item);
                 if (PyErr_Occurred())  SWIG_fail;
-                arg6->Add(Py2wxString(str));
+                arg6->Add(*s);
+                delete s;
                 Py_DECREF(item);
-                Py_DECREF(str);
             }
         }
     }
@@ -7443,15 +7434,11 @@ static PyObject *_wrap_ListBox_InsertItems(PyObject *, PyObject *args, PyObject
         int i, len=PySequence_Length(obj1);
         for (i=0; i<len; i++) {
             PyObject* item = PySequence_GetItem(obj1, i);
-#if wxUSE_UNICODE
-            PyObject* str  = PyObject_Unicode(item);
-#else
-            PyObject* str  = PyObject_Str(item);
-#endif
+            wxString* s = wxString_in_helper(item);
             if (PyErr_Occurred())  SWIG_fail;
-            arg2->Add(Py2wxString(str));
+            arg2->Add(*s);
+            delete s;
             Py_DECREF(item);
-            Py_DECREF(str);
         }
     }
     {
@@ -7502,15 +7489,11 @@ static PyObject *_wrap_ListBox_Set(PyObject *, PyObject *args, PyObject *kwargs)
         int i, len=PySequence_Length(obj1);
         for (i=0; i<len; i++) {
             PyObject* item = PySequence_GetItem(obj1, i);
-#if wxUSE_UNICODE
-            PyObject* str  = PyObject_Unicode(item);
-#else
-            PyObject* str  = PyObject_Str(item);
-#endif
+            wxString* s = wxString_in_helper(item);
             if (PyErr_Occurred())  SWIG_fail;
-            arg2->Add(Py2wxString(str));
+            arg2->Add(*s);
+            delete s;
             Py_DECREF(item);
-            Py_DECREF(str);
         }
     }
     {
@@ -8174,15 +8157,11 @@ static PyObject *_wrap_new_CheckListBox(PyObject *, PyObject *args, PyObject *kw
             int i, len=PySequence_Length(obj4);
             for (i=0; i<len; i++) {
                 PyObject* item = PySequence_GetItem(obj4, i);
-#if wxUSE_UNICODE
-                PyObject* str  = PyObject_Unicode(item);
-#else
-                PyObject* str  = PyObject_Str(item);
-#endif
+                wxString* s = wxString_in_helper(item);
                 if (PyErr_Occurred())  SWIG_fail;
-                arg5->Add(Py2wxString(str));
+                arg5->Add(*s);
+                delete s;
                 Py_DECREF(item);
-                Py_DECREF(str);
             }
         }
     }
@@ -8329,15 +8308,11 @@ static PyObject *_wrap_CheckListBox_Create(PyObject *, PyObject *args, PyObject
             int i, len=PySequence_Length(obj5);
             for (i=0; i<len; i++) {
                 PyObject* item = PySequence_GetItem(obj5, i);
-#if wxUSE_UNICODE
-                PyObject* str  = PyObject_Unicode(item);
-#else
-                PyObject* str  = PyObject_Str(item);
-#endif
+                wxString* s = wxString_in_helper(item);
                 if (PyErr_Occurred())  SWIG_fail;
-                arg6->Add(Py2wxString(str));
+                arg6->Add(*s);
+                delete s;
                 Py_DECREF(item);
-                Py_DECREF(str);
             }
         }
     }
@@ -13505,15 +13480,11 @@ static PyObject *_wrap_new_RadioBox(PyObject *, PyObject *args, PyObject *kwargs
             int i, len=PySequence_Length(obj5);
             for (i=0; i<len; i++) {
                 PyObject* item = PySequence_GetItem(obj5, i);
-#if wxUSE_UNICODE
-                PyObject* str  = PyObject_Unicode(item);
-#else
-                PyObject* str  = PyObject_Str(item);
-#endif
+                wxString* s = wxString_in_helper(item);
                 if (PyErr_Occurred())  SWIG_fail;
-                arg6->Add(Py2wxString(str));
+                arg6->Add(*s);
+                delete s;
                 Py_DECREF(item);
-                Py_DECREF(str);
             }
         }
     }
@@ -13687,15 +13658,11 @@ static PyObject *_wrap_RadioBox_Create(PyObject *, PyObject *args, PyObject *kwa
             int i, len=PySequence_Length(obj6);
             for (i=0; i<len; i++) {
                 PyObject* item = PySequence_GetItem(obj6, i);
-#if wxUSE_UNICODE
-                PyObject* str  = PyObject_Unicode(item);
-#else
-                PyObject* str  = PyObject_Str(item);
-#endif
+                wxString* s = wxString_in_helper(item);
                 if (PyErr_Occurred())  SWIG_fail;
-                arg7->Add(Py2wxString(str));
+                arg7->Add(*s);
+                delete s;
                 Py_DECREF(item);
-                Py_DECREF(str);
             }
         }
     }
@@ -32237,6 +32204,38 @@ static PyObject *_wrap_PyControl_SetBestSize(PyObject *, PyObject *args, PyObjec
 }
 
 
+static PyObject *_wrap_PyControl_DoEraseBackground(PyObject *, PyObject *args, PyObject *kwargs) {
+    PyObject *resultobj;
+    wxPyControl *arg1 = (wxPyControl *) 0 ;
+    wxDC *arg2 = (wxDC *) 0 ;
+    bool result;
+    PyObject * obj0 = 0 ;
+    PyObject * obj1 = 0 ;
+    char *kwnames[] = {
+        (char *) "self",(char *) "dc", NULL 
+    };
+    
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:PyControl_DoEraseBackground",kwnames,&obj0,&obj1)) goto fail;
+    SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_wxPyControl, SWIG_POINTER_EXCEPTION | 0);
+    if (SWIG_arg_fail(1)) SWIG_fail;
+    SWIG_Python_ConvertPtr(obj1, (void **)&arg2, SWIGTYPE_p_wxDC, SWIG_POINTER_EXCEPTION | 0);
+    if (SWIG_arg_fail(2)) SWIG_fail;
+    {
+        PyThreadState* __tstate = wxPyBeginAllowThreads();
+        result = (bool)(arg1)->DoEraseBackground(arg2);
+        
+        wxPyEndAllowThreads(__tstate);
+        if (PyErr_Occurred()) SWIG_fail;
+    }
+    {
+        resultobj = result ? Py_True : Py_False; Py_INCREF(resultobj);
+    }
+    return resultobj;
+    fail:
+    return NULL;
+}
+
+
 static PyObject *_wrap_PyControl_base_DoMoveWindow(PyObject *, PyObject *args, PyObject *kwargs) {
     PyObject *resultobj;
     wxPyControl *arg1 = (wxPyControl *) 0 ;
@@ -32899,6 +32898,31 @@ static PyObject *_wrap_PyControl_base_GetDefaultAttributes(PyObject *, PyObject
 }
 
 
+static PyObject *_wrap_PyControl_base_OnInternalIdle(PyObject *, PyObject *args, PyObject *kwargs) {
+    PyObject *resultobj;
+    wxPyControl *arg1 = (wxPyControl *) 0 ;
+    PyObject * obj0 = 0 ;
+    char *kwnames[] = {
+        (char *) "self", NULL 
+    };
+    
+    if(!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O:PyControl_base_OnInternalIdle",kwnames,&obj0)) goto fail;
+    SWIG_Python_ConvertPtr(obj0, (void **)&arg1, SWIGTYPE_p_wxPyControl, SWIG_POINTER_EXCEPTION | 0);
+    if (SWIG_arg_fail(1)) SWIG_fail;
+    {
+        PyThreadState* __tstate = wxPyBeginAllowThreads();
+        (arg1)->base_OnInternalIdle();
+        
+        wxPyEndAllowThreads(__tstate);
+        if (PyErr_Occurred()) SWIG_fail;
+    }
+    Py_INCREF(Py_None); resultobj = Py_None;
+    return resultobj;
+    fail:
+    return NULL;
+}
+
+
 static PyObject * PyControl_swigregister(PyObject *, PyObject *args) {
     PyObject *obj;
     if (!PyArg_ParseTuple(args,(char*)"O", &obj)) return NULL;
@@ -35609,6 +35633,7 @@ static PyMethodDef SwigMethods[] = {
         { (char *)"new_PrePyControl", (PyCFunction) _wrap_new_PrePyControl, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"PyControl__setCallbackInfo", (PyCFunction) _wrap_PyControl__setCallbackInfo, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"PyControl_SetBestSize", (PyCFunction) _wrap_PyControl_SetBestSize, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"PyControl_DoEraseBackground", (PyCFunction) _wrap_PyControl_DoEraseBackground, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"PyControl_base_DoMoveWindow", (PyCFunction) _wrap_PyControl_base_DoMoveWindow, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"PyControl_base_DoSetSize", (PyCFunction) _wrap_PyControl_base_DoSetSize, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"PyControl_base_DoSetClientSize", (PyCFunction) _wrap_PyControl_base_DoSetClientSize, METH_VARARGS | METH_KEYWORDS, NULL},
@@ -35629,6 +35654,7 @@ static PyMethodDef SwigMethods[] = {
         { (char *)"PyControl_base_RemoveChild", (PyCFunction) _wrap_PyControl_base_RemoveChild, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"PyControl_base_ShouldInheritColours", (PyCFunction) _wrap_PyControl_base_ShouldInheritColours, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"PyControl_base_GetDefaultAttributes", (PyCFunction) _wrap_PyControl_base_GetDefaultAttributes, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"PyControl_base_OnInternalIdle", (PyCFunction) _wrap_PyControl_base_OnInternalIdle, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"PyControl_swigregister", PyControl_swigregister, METH_VARARGS, NULL},
         { (char *)"new_HelpEvent", (PyCFunction) _wrap_new_HelpEvent, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"HelpEvent_GetPosition", (PyCFunction) _wrap_HelpEvent_GetPosition, METH_VARARGS | METH_KEYWORDS, NULL},