X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3bd1e033857b8dd6f4dea024d3f18fcc7682e09d..bffe56c5d19df9926686722fc09ad096afb47633:/wxPython/src/controls2.i diff --git a/wxPython/src/controls2.i b/wxPython/src/controls2.i index 43591b6f94..37671c76bc 100644 --- a/wxPython/src/controls2.i +++ b/wxPython/src/controls2.i @@ -52,6 +52,11 @@ static const wxString wxPyEmptyString(wxT("")); %} + +%{ + static const long longzero = 0; +%} + //---------------------------------------------------------------------- enum { @@ -344,14 +349,17 @@ class wxListEvent: public wxNotifyEvent { public: wxListEvent(wxEventType commandType = wxEVT_NULL, int id = 0); +%readonly int m_code; long m_oldItemIndex; long m_itemIndex; int m_col; wxPoint m_pointDrag; wxListItem m_item; +%readwrite - int GetCode(); + int GetKeyCode(); + %pragma(python) addtoclass = "GetCode = GetKeyCode" long GetIndex(); int GetColumn(); wxPoint GetPoint(); @@ -437,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 @@ -485,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 " @@ -731,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 + } + } }; @@ -1034,7 +1054,8 @@ public: wxTreeItemId GetOldItem(); wxPoint GetPoint(); const wxKeyEvent& GetKeyEvent(); - int GetCode(); + int GetKeyCode(); + %pragma(python) addtoclass = "GetCode = GetKeyCode" const wxString& GetLabel(); }; @@ -1068,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); @@ -1211,7 +1234,7 @@ public: size_t GetChildrenCount(const wxTreeItemId& item, bool recursively = TRUE); - wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& INOUT); + wxTreeItemId GetFirstChild(const wxTreeItemId& item, long& INOUT = longzero); wxTreeItemId GetNextChild(const wxTreeItemId& item, long& INOUT); wxTreeItemId GetNextSibling(const wxTreeItemId& item); wxTreeItemId GetPrevSibling(const wxTreeItemId& item);