]> git.saurik.com Git - wxWidgets.git/commitdiff
handle returning the cookie for Get[First|Next]Selected like in the treectrl.
authorRobin Dunn <robin@alldunn.com>
Mon, 7 Jun 2004 23:58:13 +0000 (23:58 +0000)
committerRobin Dunn <robin@alldunn.com>
Mon, 7 Jun 2004 23:58:13 +0000 (23:58 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27676 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/src/_vscroll.i

index 9cc2071a9bd73432b8cf816445a5c893fc2db648..467a4a2494a3d2086c1780dd7de6c4507e818515 100644 (file)
@@ -333,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;