]> git.saurik.com Git - wxWidgets.git/commitdiff
some little tweaks
authorRobin Dunn <robin@alldunn.com>
Sat, 4 Nov 2000 07:41:29 +0000 (07:41 +0000)
committerRobin Dunn <robin@alldunn.com>
Sat, 4 Nov 2000 07:41:29 +0000 (07:41 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8684 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/src/helpers.cpp
wxPython/src/helpers.h
wxPython/src/windows.i

index 6d0cb2173016eeb8e26f73fa23b05b43c20d9a90..715c3e357678a6341d6f8297400bafc5fcfbde94 100644 (file)
@@ -246,8 +246,16 @@ PyObject* __wxSetDictionary(PyObject* /* self */, PyObject* args)
 //---------------------------------------------------------------------------
 
 PyObject* wxPyConstructObject(void* ptr,
-                              const char* className,
-                              int setThisOwn) {
+                                 const char* className,
+                                 int setThisOwn) {
+    PyObject* obj;
+    PyObject* arg;
+
+    if (!ptr) {
+        Py_INCREF(Py_None);
+        return Py_None;
+    }
+
     char    buff[64];               // should always be big enough...
     char    swigptr[64];
 
@@ -257,12 +265,18 @@ PyObject* wxPyConstructObject(void* ptr,
     sprintf(buff, "%sPtr", className);
     PyObject* classobj = PyDict_GetItemString(wxPython_dict, buff);
     if (! classobj) {
-        Py_INCREF(Py_None);
-        return Py_None;
-    }
-
-    PyObject* arg = Py_BuildValue("(s)", swigptr);
-    PyObject* obj = PyInstance_New(classobj, arg, NULL);
+        //Py_INCREF(Py_None);
+        //return Py_None;
+        char temp[128];
+        sprintf(temp,
+                "*** Unknown class name %s, tell Robin about it please ***",
+                buff);
+        obj = PyString_FromString(temp);
+        return obj;
+    }
+
+    arg = Py_BuildValue("(s)", swigptr);
+    obj = PyInstance_New(classobj, arg, NULL);
     Py_DECREF(arg);
 
     if (setThisOwn) {
@@ -399,9 +413,9 @@ wxPyCallbackHelper::wxPyCallbackHelper(const wxPyCallbackHelper& other) {
 }
 
 
-void wxPyCallbackHelper::setSelf(PyObject* self, PyObject* _class, int incref) {
+void wxPyCallbackHelper::setSelf(PyObject* self, PyObject* klass, int incref) {
     m_self = self;
-    m_class = _class;
+    m_class = klass;
     m_incRef = incref;
     if (incref) {
         Py_INCREF(m_self);
index 5030715b3e5817bbaea46e723005cf7073c557fe..dcc6fb1aea2380a956e4279e004287e877015993 100644 (file)
@@ -214,7 +214,7 @@ public:
 
     wxPyCallbackHelper(const wxPyCallbackHelper& other);
 
-    void        setSelf(PyObject* self, PyObject* _class, int incref=TRUE);
+    void        setSelf(PyObject* self, PyObject* klass, int incref=TRUE);
 
     bool        findCallback(const wxString& name) const;
     int         callCallback(PyObject* argTuple) const;
index f41accb0440281174b3630c9268bc6aa7445db92..40a07a1517428dcdc22fe8b6919965f0f4481df4 100644 (file)
@@ -331,6 +331,10 @@ public:
         void SetPosition(const wxPoint& pos) {
             self->Move(pos);
         }
+
+        void SetRect(const wxRect& rect, int sizeFlags=wxSIZE_AUTO) {
+            self->SetSize(rect, sizeFlags);
+        }
     }
 
     void SetSizeHints(int minW=-1, int minH=-1, int maxW=-1, int maxH=-1, int incW=-1, int incH=-1);