X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fa629adae4b372620b2109777ec37c2deed24d58..aebe0d3b6c7f616355816e4f23ad7e01cdb1b0ce:/include/wx/dataview.h diff --git a/include/wx/dataview.h b/include/wx/dataview.h index b1229375ad..2e324dc752 100644 --- a/include/wx/dataview.h +++ b/include/wx/dataview.h @@ -257,6 +257,7 @@ public: virtual bool HasDefaultCompare() const { return false; } // internal + virtual bool IsListModel() const { return false; } virtual bool IsVirtualListModel() const { return false; } protected: @@ -328,6 +329,8 @@ public: { return GetAttrByRow( GetRow(item), col, attr ); } + + virtual bool IsListModel() const { return true; } }; // --------------------------------------------------------- @@ -639,6 +642,12 @@ public: int GetIndent() const { return m_indent; } + // Current item is the one used by the keyboard navigation, it is the same + // as the (unique) selected item in single selection mode so these + // functions are mostly useful for controls with wxDV_MULTIPLE style. + wxDataViewItem GetCurrentItem() const; + void SetCurrentItem(const wxDataViewItem& item); + virtual wxDataViewItem GetSelection() const = 0; virtual int GetSelections( wxDataViewItemArray & sel ) const = 0; virtual void SetSelections( const wxDataViewItemArray & sel ) = 0; @@ -685,6 +694,12 @@ protected: virtual void DoSetIndent() = 0; private: + // Implementation of the public Set/GetCurrentItem() methods which are only + // called in multi selection case (for single selection controls their + // implementation is trivial and is done in the base class itself). + virtual wxDataViewItem DoGetCurrentItem() const = 0; + virtual void DoSetCurrentItem(const wxDataViewItem& item) = 0; + wxDataViewModel *m_model; wxDataViewColumn *m_expander_column; int m_indent ; @@ -951,7 +966,7 @@ public: { return (const wxDataViewListStore*) GetModel(); } int ItemToRow(const wxDataViewItem &item) const - { return item.IsOk() ? GetStore()->GetRow(item) : wxNOT_FOUND; } + { return item.IsOk() ? (int)GetStore()->GetRow(item) : wxNOT_FOUND; } wxDataViewItem RowToItem(int row) const { return row == wxNOT_FOUND ? wxDataViewItem() : GetStore()->GetItem(row); }