]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/controls2.i
Updated note about wxSTC using wxPopupWindow
[wxWidgets.git] / wxPython / src / controls2.i
index aa63f8a257b7a6e7f6bbd0aee3a8b632c3dc06d6..37671c76bc7f04704aa69035dc47f2a9d707c7cb 100644 (file)
@@ -358,7 +358,8 @@ public:
     wxListItem    m_item;
 %readwrite
 
-    int GetCode();
+    int GetKeyCode();
+    %pragma(python) addtoclass = "GetCode = GetKeyCode"
     long GetIndex();
     int GetColumn();
     wxPoint GetPoint();
@@ -444,14 +445,15 @@ public:
     %addmethods {
         %new wxListItem* GetColumn(int col) {
             wxListItem item;
+            item.SetMask(0xFFFF);
             if (self->GetColumn(col, item))
                 return new wxListItem(item);
             else
                 return NULL;
         }
-    }  // The OOR typemaps don't know what to do with the %new, so fix it up.
+    } // The OOR typemaps don't know what to do with the %new, so fix it up.
     %pragma(python) addtoclass = "
-    def GetItem(self, *_args, **_kwargs):
+    def GetColumn(self, *_args, **_kwargs):
         val = apply(controls2c.wxListCtrl_GetColumn,(self,) + _args, _kwargs)
         if val is not None: val.thisown = 1
         return val
@@ -492,7 +494,7 @@ public:
     %pragma(python) addtoclass = "
     def GetItem(self, *_args, **_kwargs):
         val = apply(controls2c.wxListCtrl_GetItem,(self,) + _args, _kwargs)
-        val.thisown = 1
+        if val is not None: val.thisown = 1
         return val
     "
 
@@ -738,6 +740,17 @@ public:
             return self->SortItems(wxPyListCtrl_SortItems, (long)func);
         }
     }
+
+
+    %addmethods {
+        wxWindow* GetMainWindow() {
+        #ifdef __WXMSW__
+            return self;
+        #else
+            return (wxWindow*)self->m_mainWin;
+        #endif
+        }
+    }
 };
 
 
@@ -1041,7 +1054,8 @@ public:
     wxTreeItemId GetOldItem();
     wxPoint GetPoint();
     const wxKeyEvent& GetKeyEvent();
-    int GetCode();
+    int GetKeyCode();
+    %pragma(python) addtoclass = "GetCode = GetKeyCode"
     const wxString& GetLabel();
 };
 
@@ -1075,11 +1089,13 @@ public:
         int rval = 0;
         bool found;
         wxPyBeginBlockThreads();
-        if ((found = m_myInst.findCallback("OnCompareItems")))
-            rval = m_myInst.callCallback(Py_BuildValue(
-                "(OO)",
-                wxPyConstructObject((void*)&item1, "wxTreeItemId"),
-                wxPyConstructObject((void*)&item2, "wxTreeItemId")));
+        if ((found = m_myInst.findCallback("OnCompareItems"))) {
+            PyObject *o1 = wxPyConstructObject((void*)&item1, "wxTreeItemId");
+            PyObject *o2 = wxPyConstructObject((void*)&item2, "wxTreeItemId");
+            rval = m_myInst.callCallback(Py_BuildValue("(OO)",o1,o2));
+            Py_DECREF(o1);
+            Py_DECREF(o2);
+        }
         wxPyEndBlockThreads();
         if (! found)
             rval = wxTreeCtrl::OnCompareItems(item1, item2);