]> git.saurik.com Git - wxWidgets.git/blobdiff - interface/wx/dataview.h
Fix warnings about signed/unsigned comparisons inside wxMax() and friends.
[wxWidgets.git] / interface / wx / dataview.h
index a5e2096cacaab71f1266f6f69e55912c0f20ce77..bfbf14018c8bed1e8f82b3ae37c2c481362ace86 100644 (file)
@@ -327,28 +327,17 @@ protected:
 
 
 /**
 
 
 /**
-    @class wxDataViewIndexListModel
-
-    wxDataViewIndexListModel is a specialized data model which lets you address
-    an item by its position (row) rather than its wxDataViewItem (which you can
-    obtain from this class).
-    This model also provides its own wxDataViewIndexListModel::Compare
-    method which sorts the model's data by the index.
+    @class wxDataViewListModel
 
 
-    This model is not a virtual model since the control stores each wxDataViewItem.
-    Use wxDataViewVirtualListModel if you need to display millions of items or
-    have other reason to use a virtual control.
+    Base class with abstract API for wxDataViewIndexListModel and
+    wxDataViewVirtualListModel.
 
     @library{wxadv}
     @category{dvc}
 */
 
     @library{wxadv}
     @category{dvc}
 */
-class wxDataViewIndexListModel : public wxDataViewModel
+class wxDataViewListModel : public wxDataViewModel
 {
 public:
 {
 public:
-    /**
-        Constructor.
-    */
-    wxDataViewIndexListModel(unsigned int initial_size = 0);
 
     /**
         Destructor.
 
     /**
         Destructor.
@@ -455,6 +444,34 @@ public:
 };
 
 
 };
 
 
+/**
+    @class wxDataViewIndexListModel
+
+    wxDataViewIndexListModel is a specialized data model which lets you address
+    an item by its position (row) rather than its wxDataViewItem (which you can
+    obtain from this class).
+    This model also provides its own wxDataViewIndexListModel::Compare
+    method which sorts the model's data by the index.
+
+    This model is not a virtual model since the control stores each wxDataViewItem.
+    Use wxDataViewVirtualListModel if you need to display millions of items or
+    have other reason to use a virtual control.
+
+    @see wxDataViewListModel for the API.
+    
+    @library{wxadv}
+    @category{dvc}
+*/
+
+class wxDataViewIndexListModel : public wxDataViewListModel
+{
+public:
+    /**
+        Constructor.
+    */
+    wxDataViewIndexListModel(unsigned int initial_size = 0);
+
+};
 
 /**
     @class wxDataViewVirtualListModel
 
 /**
     @class wxDataViewVirtualListModel
@@ -464,15 +481,15 @@ public:
     the exact same interface as wxDataViewIndexListModel.
     The important difference is that under platforms other than OS X, using this
     model will result in a truly virtual control able to handle millions of items
     the exact same interface as wxDataViewIndexListModel.
     The important difference is that under platforms other than OS X, using this
     model will result in a truly virtual control able to handle millions of items
-    as the control doesn't store any item (a feature not supported by the
-    Carbon API under OS X).
+    as the control doesn't store any item (a feature not supported by OS X).
 
 
-    @see wxDataViewIndexListModel for the API.
+    @see wxDataViewListModel for the API.
 
     @library{wxadv}
     @category{dvc}
 */
 
     @library{wxadv}
     @category{dvc}
 */
-class wxDataViewVirtualListModel : public wxDataViewModel
+
+class wxDataViewVirtualListModel : public wxDataViewListModel
 {
 public:
     /**
 {
 public:
     /**
@@ -480,10 +497,6 @@ public:
     */
     wxDataViewVirtualListModel(unsigned int initial_size = 0);
 
     */
     wxDataViewVirtualListModel(unsigned int initial_size = 0);
 
-    /**
-        Returns the number of virtual items (i.e. rows) in the list.
-    */
-    unsigned int GetCount() const;
 };
 
 
 };
 
 
@@ -676,7 +689,8 @@ public:
                    const wxPoint& pos = wxDefaultPosition,
                    const wxSize& size = wxDefaultSize,
                    long style = 0,
                    const wxPoint& pos = wxDefaultPosition,
                    const wxSize& size = wxDefaultSize,
                    long style = 0,
-                   const wxValidator& validator = wxDefaultValidator);
+                   const wxValidator& validator = wxDefaultValidator,
+                   const wxString& name = wxDataViewCtrlNameStr);
 
     /**
         Destructor.
 
     /**
         Destructor.
@@ -857,7 +871,8 @@ public:
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
                 long style = 0,
                 const wxPoint& pos = wxDefaultPosition,
                 const wxSize& size = wxDefaultSize,
                 long style = 0,
-                const wxValidator& validator = wxDefaultValidator);
+                const wxValidator& validator = wxDefaultValidator,
+                const wxString& name = wxDataViewCtrlNameStr);
 
     /**
         Deletes given column.
 
     /**
         Deletes given column.
@@ -913,6 +928,26 @@ public:
     */
     wxDataViewColumn* GetExpanderColumn() const;
 
     */
     wxDataViewColumn* GetExpanderColumn() const;
 
+    /**
+        Returns the currently focused item.
+
+        This is the item that the keyboard commands apply to. It may be invalid
+        if there is no focus currently.
+
+        This method is mostly useful for the controls with @c wxDV_MULTIPLE
+        style as in the case of single selection it returns the same thing as
+        GetSelection().
+
+        Notice that under all platforms except Mac OS X the currently focused
+        item may be selected or not but under OS X the current item is always
+        selected.
+
+        @see SetCurrentItem()
+
+        @since 2.9.2
+     */
+    wxDataViewItem GetCurrentItem() const;
+
     /**
         Returns indentation.
     */
     /**
         Returns indentation.
     */
@@ -963,6 +998,10 @@ public:
 
     /**
         Select the given item.
 
     /**
         Select the given item.
+
+        In single selection mode this changes the (unique) currently selected
+        item. In multi selection mode, the @a item is selected and the
+        previously selected items remain selected.
     */
     virtual void Select(const wxDataViewItem& item);
 
     */
     virtual void Select(const wxDataViewItem& item);
 
@@ -976,6 +1015,25 @@ public:
     */
     void SetExpanderColumn(wxDataViewColumn* col);
 
     */
     void SetExpanderColumn(wxDataViewColumn* col);
 
+    /**
+        Changes the currently focused item.
+
+        The @a item parameter must be valid, there is no way to remove the
+        current item from the control.
+
+        In single selection mode, calling this method is the same as calling
+        Select() and is thus not very useful. In multiple selection mode this
+        method only moves the current item however without changing the
+        selection except under OS X where the current item is always selected,
+        so calling SetCurrentItem() selects @a item if it hadn't been selected
+        before.
+
+        @see GetCurrentItem()
+
+        @since 2.9.2
+     */
+    void SetCurrentItem(const wxDataViewItem& item);
+
     /**
         Sets the indendation.
     */
     /**
         Sets the indendation.
     */
@@ -1769,6 +1827,49 @@ public:
      */
     wxDataViewItem RowToItem(int row) const;
 
      */
     wxDataViewItem RowToItem(int row) const;
 
+    //@{
+    /**
+        @name Selection handling functions
+     */
+
+    /**
+        Returns index of the selected row or wxNOT_FOUND.
+
+        @see wxDataViewCtrl::GetSelection()
+
+        @since 2.9.2
+     */
+    int GetSelectedRow() const;
+
+    /**
+        Selects given row.
+
+        @see wxDataViewCtrl::Select()
+
+        @since 2.9.2
+     */
+    void SelectRow(unsigned row);
+
+    /**
+        Unselects given row.
+
+        @see wxDataViewCtrl::Unselect()
+
+        @since 2.9.2
+     */
+    void UnselectRow(unsigned row);
+
+    /**
+        Returns true if @a row is selected.
+
+        @see wxDataViewCtrl::IsSelected()
+
+        @since 2.9.2
+     */
+    bool IsRowSelected(unsigned row) const;
+
+    //@}
+
     /**
         @name Column management functions
     */
     /**
         @name Column management functions
     */