X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7ef67bb9b2f9eab5e71c53bd065cfd514304ad58..42f8298f6f42d5d63bb3caf65682b7d9d9f8b702:/wxPython/src/_vscroll.i diff --git a/wxPython/src/_vscroll.i b/wxPython/src/_vscroll.i index fdbf1cf3c7..db0f28cee9 100644 --- a/wxPython/src/_vscroll.i +++ b/wxPython/src/_vscroll.i @@ -87,7 +87,7 @@ public: // find the index of the line we need to show at the top of the window such // that the last (fully or partially) visible line is the given one - size_t FindFirstFromBottom(size_t lineLast, bool fullyVisible = False) + size_t FindFirstFromBottom(size_t lineLast, bool fullyVisible = false) { return wxVScrolledWindow::FindFirstFromBottom(lineLast, fullyVisible); } // get the total height of the lines between lineMin (inclusive) and @@ -125,7 +125,10 @@ IMP_PYCALLBACK_COORD_const (wxPyVScrolledWindow, wxVScrolledWindow, Est of the window and not its entire client area. */ -%name(VScrolledWindow) class wxPyVScrolledWindow : public wxPanel +MustHaveApp(wxPyVScrolledWindow); + +%rename(VScrolledWindow) wxPyVScrolledWindow; +class wxPyVScrolledWindow : public wxPanel { public: %pythonAppend wxPyVScrolledWindow "self._setOORInfo(self); self._setCallbackInfo(self, VScrolledWindow)" @@ -139,7 +142,7 @@ public: long style = 0, const wxString& name = wxPyPanelNameStr); - %name(PreVScrolledWindow)wxPyVScrolledWindow(); + %RenameCtor(PreVScrolledWindow, wxPyVScrolledWindow()); void _setCallbackInfo(PyObject* self, PyObject* _class); @@ -174,7 +177,7 @@ public: // return the item at the specified (in physical coordinates) position or // wxNOT_FOUND if none, i.e. if it is below the last item - %name(HitTestXT) int HitTest(wxCoord x, wxCoord y) const; + %Rename(HitTestXY, int, HitTest(wxCoord x, wxCoord y) const); int HitTest(const wxPoint& pt) const; // recalculate all our parameters and redisplay all lines @@ -282,7 +285,10 @@ IMP_PYCALLBACK__DCRECTSIZET_const (wxPyVListBox, wxVListBox, OnDrawBackground It emits the same events as wxListBox and the same event macros may be used with it. */ -%name(VListBox) class wxPyVListBox : public wxPyVScrolledWindow +MustHaveApp(wxPyVListBox); + +%rename(VListBox) wxPyVListBox; +class wxPyVListBox : public wxPyVScrolledWindow { public: %pythonAppend wxPyVListBox "self._setOORInfo(self);self._setCallbackInfo(self, VListBox)" @@ -296,7 +302,7 @@ public: long style = 0, const wxString& name = wxPyVListBoxNameStr); - %name(PreVListBox) wxPyVListBox(); + %RenameCtor(PreVListBox, wxPyVListBox()); void _setCallbackInfo(PyObject* self, PyObject* _class); @@ -329,22 +335,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; @@ -373,7 +401,7 @@ public: // otherwise // // this function is only valid for the multiple selection listboxes - bool Select(size_t item, bool select = True); + bool Select(size_t item, bool select = true); // selects the items in the specified range whose end points may be given // in any order @@ -405,7 +433,7 @@ public: // // by default both margins are 0 void SetMargins(const wxPoint& pt); - %name(SetMarginsXY) void SetMargins(wxCoord x, wxCoord y); + %Rename(SetMarginsXY, void, SetMargins(wxCoord x, wxCoord y)); // change the background colour of the selected cells void SetSelectionBackground(const wxColour& col); @@ -478,7 +506,9 @@ IMP_PYCALLBACK_STRING_SIZET (wxPyHtmlListBox, wxHtmlListBox, OnGetItemMarkup // wxHtmlListBox is a listbox whose items are wxHtmlCells -%name(HtmlListBox) class wxPyHtmlListBox : public wxPyVListBox +MustHaveApp(wxPyHtmlListBox); +%rename(HtmlListBox) wxPyHtmlListBox; +class wxPyHtmlListBox : public wxPyVListBox { public: %pythonAppend wxPyHtmlListBox "self._setOORInfo(self);self._setCallbackInfo(self, HtmlListBox)" @@ -493,7 +523,7 @@ public: long style = 0, const wxString& name = wxPyVListBoxNameStr); - %name(PreHtmlListBox) wxPyHtmlListBox(); + %RenameCtor(PreHtmlListBox, wxPyHtmlListBox()); void _setCallbackInfo(PyObject* self, PyObject* _class);