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
This commit is contained in:
Václav Slavík
2010-07-27 21:45:50 +00:00
parent 17de95e4e0
commit fa629adae4
2 changed files with 52 additions and 0 deletions

View File

@@ -955,6 +955,15 @@ public:
wxDataViewItem RowToItem(int row) const wxDataViewItem RowToItem(int row) const
{ return row == wxNOT_FOUND ? wxDataViewItem() : GetStore()->GetItem(row); } { 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 AppendColumn( wxDataViewColumn *column, const wxString &varianttype );
bool PrependColumn( wxDataViewColumn *column, const wxString &varianttype ); bool PrependColumn( wxDataViewColumn *column, const wxString &varianttype );
bool InsertColumn( unsigned int pos, wxDataViewColumn *column, const wxString &varianttype ); bool InsertColumn( unsigned int pos, wxDataViewColumn *column, const wxString &varianttype );

View File

@@ -1769,6 +1769,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
*/ */