From: Václav Slavík Date: Tue, 27 Jul 2010 21:45:50 +0000 (+0000) Subject: Add index-based selection functions to wxDataViewListCtrl. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/fa629adae4b372620b2109777ec37c2deed24d58?ds=inline Add index-based selection functions to wxDataViewListCtrl. These are convenience functions for work working with indexes, for consistency with other wxDataViewListCtrl methods. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65122 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/dataview.h b/include/wx/dataview.h index bdbc2f4bc0..b1229375ad 100644 --- a/include/wx/dataview.h +++ b/include/wx/dataview.h @@ -955,6 +955,15 @@ public: wxDataViewItem RowToItem(int row) const { return row == wxNOT_FOUND ? wxDataViewItem() : GetStore()->GetItem(row); } + int GetSelectedRow() const + { return ItemToRow(GetSelection()); } + void SelectRow(unsigned row) + { Select(RowToItem(row)); } + void UnselectRow(unsigned row) + { Unselect(RowToItem(row)); } + bool IsRowSelected(unsigned row) const + { return IsSelected(RowToItem(row)); } + bool AppendColumn( wxDataViewColumn *column, const wxString &varianttype ); bool PrependColumn( wxDataViewColumn *column, const wxString &varianttype ); bool InsertColumn( unsigned int pos, wxDataViewColumn *column, const wxString &varianttype ); diff --git a/interface/wx/dataview.h b/interface/wx/dataview.h index a5e2096cac..1bcdf86eb0 100644 --- a/interface/wx/dataview.h +++ b/interface/wx/dataview.h @@ -1769,6 +1769,49 @@ public: */ 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 */