X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/450d55a035d90e211026a51eb2072d55f5a738a3..015fd9ef4833ec3d8b0043a1c7e448c8be4f734a:/wxPython/src/_vscroll.i?ds=sidebyside diff --git a/wxPython/src/_vscroll.i b/wxPython/src/_vscroll.i index b8b7546831..467a4a2494 100644 --- a/wxPython/src/_vscroll.i +++ b/wxPython/src/_vscroll.i @@ -125,6 +125,8 @@ IMP_PYCALLBACK_COORD_const (wxPyVScrolledWindow, wxVScrolledWindow, Est of the window and not its entire client area. */ +MustHaveApp(wxPyVScrolledWindow); + %name(VScrolledWindow) class wxPyVScrolledWindow : public wxPanel { public: @@ -282,6 +284,8 @@ IMP_PYCALLBACK__DCRECTSIZET_const (wxPyVListBox, wxVListBox, OnDrawBackground It emits the same events as wxListBox and the same event macros may be used with it. */ +MustHaveApp(wxPyVListBox); + %name(VListBox) class wxPyVListBox : public wxPyVScrolledWindow { public: @@ -329,22 +333,44 @@ public: // this method is valid for both single and multi selection listboxes size_t GetSelectedCount() const; - // get the first selected item, returns wxNOT_FOUND if none - // - // cookie is an opaque parameter which should be passed to - // GetNextSelected() later - // - // this method is only valid for the multi selection listboxes - int GetFirstSelected(unsigned long& cookie) const; - - // get next selection item, return wxNOT_FOUND if no more - // - // cookie must be the same parameter that was passed to GetFirstSelected() - // before - // - // this method is only valid for the multi selection listboxes - int GetNextSelected(unsigned long& cookie) const; + %extend { + // get the first selected item, returns wxNOT_FOUND if none + // + // cookie is an opaque parameter which should be passed to + // GetNextSelected() later + // + // this method is only valid for the multi selection listboxes + //int GetFirstSelected(unsigned long& cookie) const; + PyObject* GetFirstSelected() { + unsigned long cookie = 0; + int selected = self->GetFirstSelected(cookie); + bool blocked = wxPyBeginBlockThreads(); + PyObject* tup = PyTuple_New(2); + PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(selected)); + PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(cookie)); + wxPyEndBlockThreads(blocked); + return tup; + } + + // get next selection item, return wxNOT_FOUND if no more + // + // cookie must be the same parameter that was passed to GetFirstSelected() + // before + // + // this method is only valid for the multi selection listboxes + // int GetNextSelected(unsigned long& cookie) const; + PyObject* GetNextSelected(unsigned long cookie) { + int selected = self->GetNextSelected(cookie); + bool blocked = wxPyBeginBlockThreads(); + PyObject* tup = PyTuple_New(2); + PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(selected)); + PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(cookie)); + wxPyEndBlockThreads(blocked); + return tup; + } + } + // get the margins around each item wxPoint GetMargins() const; @@ -478,6 +504,7 @@ IMP_PYCALLBACK_STRING_SIZET (wxPyHtmlListBox, wxHtmlListBox, OnGetItemMarkup // wxHtmlListBox is a listbox whose items are wxHtmlCells +MustHaveApp(wxPyHtmlListBox); %name(HtmlListBox) class wxPyHtmlListBox : public wxPyVListBox { public: @@ -511,7 +538,6 @@ public: // retrieve the file system used by the wxHtmlWinParser: if you use // relative paths in your HTML, you should use its ChangePathTo() method wxFileSystem& GetFileSystem(); - const wxFileSystem& GetFileSystem(); };