From 17de95e4e05b3da583600d7d1082bdc5515a68d0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Tue, 27 Jul 2010 21:45:45 +0000 Subject: [PATCH] Add item<->row mapping helpers to wxDataViewListCtrl. These are commonly needed when using wxDataViewListCtrl, yet they were only available in wxDataViewIndexListModel. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65121 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/dataview.h | 5 +++++ interface/wx/dataview.h | 15 +++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/include/wx/dataview.h b/include/wx/dataview.h index b220665ddf..bdbc2f4bc0 100644 --- a/include/wx/dataview.h +++ b/include/wx/dataview.h @@ -950,6 +950,11 @@ public: const wxDataViewListStore *GetStore() const { return (const wxDataViewListStore*) GetModel(); } + int ItemToRow(const wxDataViewItem &item) const + { return item.IsOk() ? GetStore()->GetRow(item) : wxNOT_FOUND; } + wxDataViewItem RowToItem(int row) const + { return row == wxNOT_FOUND ? wxDataViewItem() : GetStore()->GetItem(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 5893ecebcb..a5e2096cac 100644 --- a/interface/wx/dataview.h +++ b/interface/wx/dataview.h @@ -1754,6 +1754,21 @@ public: const wxDataViewListStore *GetStore() const; //@} + /** + Returns the position of given @e item or wxNOT_FOUND if it's + not a valid item. + + @since 2.9.2 + */ + int ItemToRow(const wxDataViewItem &item) const; + + /** + Returns the wxDataViewItem at the given @e row. + + @since 2.9.2 + */ + wxDataViewItem RowToItem(int row) const; + /** @name Column management functions */ -- 2.45.2