]> git.saurik.com Git - wxWidgets.git/commitdiff
Add wxDataViewCtrl::{Set,Get}CurrentItem().
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 10 Aug 2010 12:53:03 +0000 (12:53 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 10 Aug 2010 12:53:03 +0000 (12:53 +0000)
Current item is the same as the selected item in single selection mode but in
multiple selection mode there was no way to neither get this item nor change
it before so add the new functions to allow doing this now.

The new methods are implemented for the generic, GTK and OS X/Cocoa versions
but only stubs are provided for OS X/Carbon.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65228 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

16 files changed:
docs/changes.txt
include/wx/dataview.h
include/wx/generic/dataview.h
include/wx/gtk/dataview.h
include/wx/osx/carbon/dataview.h
include/wx/osx/cocoa/dataview.h
include/wx/osx/core/dataview.h
include/wx/osx/dataview.h
interface/wx/dataview.h
samples/dataview/dataview.cpp
src/common/datavcmn.cpp
src/generic/datavgen.cpp
src/gtk/dataview.cpp
src/osx/carbon/dataview.cpp
src/osx/cocoa/dataview.mm
src/osx/dataview_osx.cpp

index c673d9046b2c518aa19134a0cce2f7ff1fdcb453..9aa667e0be19e6e87a0dd9e03cf39f9cbf3a1c34 100644 (file)
@@ -411,6 +411,7 @@ MSW:
 All (GUI):
 
 - wxAUI: support auto-orientable toolbars (wsu).
+- Added wxDataViewCtrl::Set/GetCurrentItem().
 - wxHTML: render in RTL order inside RTL window (Richard Bullington-McGuire).
 - wxRibbon: added EVT_RIBBONGALLERY_CLICKED event (John Roberts).
 - Add support for CP-866 encoding to wxEncodingConverter (madnut).
index 86218f0d08ee6fec2e4e4be5917ba93c7d96d6cd..2e324dc752b9385843c26c83dd8641cb44c5c647 100644 (file)
@@ -642,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;
@@ -688,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 ;
index 9f5dc741f1501348445b35d976cf00d35b30b035..a0e1cf369ced65d91e042fdbcfb59e15566f33ba 100644 (file)
@@ -229,6 +229,9 @@ public:     // utility functions not part of the API
     wxDataViewColumn *GetColumnAt(unsigned int pos) const;
 
 private:
+    virtual wxDataViewItem DoGetCurrentItem() const;
+    virtual void DoSetCurrentItem(const wxDataViewItem& item);
+
     wxDataViewColumnList      m_cols;
     wxDataViewModelNotifier  *m_notifier;
     wxDataViewMainWindow     *m_clientArea;
index 2c22beb144481f286b442c822b80c548dcc4db28..06649c507f89b5ad9cd9ecec46ff16e53574f56d 100644 (file)
@@ -190,6 +190,9 @@ protected:
 private:
     void Init();
 
+    virtual wxDataViewItem DoGetCurrentItem() const;
+    virtual void DoSetCurrentItem(const wxDataViewItem& item);
+
     friend class wxDataViewCtrlDCImpl;
     friend class wxDataViewColumn;
     friend class wxGtkDataViewModelNotifier;
index 501c5c95eb0bf55dbc40bd5306433567588a542f..f4d8f93fd67459c026b211f29ec781e8ced40ed0 100644 (file)
@@ -403,6 +403,8 @@ public:
  //
  // selection related methods (inherited from wxDataViewWidgetImpl)
  //
+  virtual wxDataViewItem GetCurrentItem() const;
+  virtual void SetCurrentItem(const wxDataViewItem& item);
   virtual int  GetSelections(wxDataViewItemArray& sel)   const;
   virtual bool IsSelected   (wxDataViewItem const& item) const;
   virtual void Select       (wxDataViewItem const& item);
index 09fa842aa7e8ce99fe3c04ec93e82abcad835ac7..6e97eb87eda3aec5f523d1df935f28d2f078adeb 100644 (file)
@@ -471,6 +471,8 @@ public:
     //
     // selection related methods (inherited from wxDataViewWidgetImpl)
     //
+    virtual wxDataViewItem GetCurrentItem() const;
+    virtual void SetCurrentItem(const wxDataViewItem& item);
     virtual int  GetSelections(wxDataViewItemArray& sel)   const;
     virtual bool IsSelected(const wxDataViewItem& item) const;
     virtual void Select(const wxDataViewItem& item);
index c8af8cd05c9f423fcdd61b045f74654a9c746579..a35f7324d50155313e2fc78028b20be16f42bcd1 100644 (file)
@@ -85,6 +85,9 @@ public:
  //
  // selection related methods
  //
+  virtual wxDataViewItem GetCurrentItem() const = 0;
+  virtual void SetCurrentItem(const wxDataViewItem& item) = 0;
+
   virtual int  GetSelections(wxDataViewItemArray& sel)   const = 0; // returns all selected items in the native control
   virtual bool IsSelected   (wxDataViewItem const& item) const = 0; // checks if the passed item is selected in the native control
   virtual void Select       (wxDataViewItem const& item)       = 0; // selects the passed item in the native control
index cd97cd038c94aa8477d4f420a3833c65cc8250ab..34e114a5a2ef256182154f66e1ec3a8e8471bfee 100644 (file)
@@ -174,7 +174,6 @@ public:
   virtual void Expand(const wxDataViewItem& item);
   virtual bool IsExpanded(const wxDataViewItem & item) const;
 
-
   virtual unsigned int GetCount() const;
   virtual wxRect GetItemRect(const wxDataViewItem& item, const wxDataViewColumn* columnPtr) const;
   virtual wxDataViewItem GetSelection() const;
@@ -279,6 +278,9 @@ private:
  // initializing of local variables:
   void Init();
 
+  virtual wxDataViewItem DoGetCurrentItem() const;
+  virtual void DoSetCurrentItem(const wxDataViewItem& item);
+
  //
  // variables
  //
index 46a623fdb1dd7825f43c4de700ad1fe18668fdbb..f1f7edc84cfc1d33aaea86d7b188bf0fdbee9cba 100644 (file)
@@ -913,6 +913,26 @@ public:
     */
     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.
     */
@@ -980,6 +1000,25 @@ public:
     */
     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.
     */
index e1d7d70a48f67f45b3d6f73702cc4bedbc134f6c..eb750bd33a9e37dcb2e8b657c73383f68f60a353 100644 (file)
@@ -88,6 +88,8 @@ private:
     void OnSelectNinth(wxCommandEvent& event);
     void OnCollapse(wxCommandEvent& event);
     void OnExpand(wxCommandEvent& event);
+    void OnShowCurrent(wxCommandEvent& event);
+    void OnSetNinthCurrent(wxCommandEvent& event);
 
     void OnPrependList(wxCommandEvent& event);
     void OnDeleteList(wxCommandEvent& event);
@@ -283,6 +285,8 @@ enum
     ID_SELECT_NINTH     = 103,
     ID_COLLAPSE         = 104,
     ID_EXPAND           = 105,
+    ID_SHOW_CURRENT,
+    ID_SET_NINTH_CURRENT,
 
     ID_PREPEND_LIST     = 200,
     ID_DELETE_LIST      = 201,
@@ -315,6 +319,8 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame)
     EVT_BUTTON( ID_SELECT_NINTH, MyFrame::OnSelectNinth )
     EVT_BUTTON( ID_COLLAPSE, MyFrame::OnCollapse )
     EVT_BUTTON( ID_EXPAND, MyFrame::OnExpand )
+    EVT_BUTTON( ID_SHOW_CURRENT, MyFrame::OnShowCurrent )
+    EVT_BUTTON( ID_SET_NINTH_CURRENT, MyFrame::OnSetNinthCurrent )
 
     EVT_BUTTON( ID_PREPEND_LIST, MyFrame::OnPrependList )
     EVT_BUTTON( ID_DELETE_LIST, MyFrame::OnDeleteList )
@@ -411,13 +417,21 @@ MyFrame::MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int
 
     BuildDataViewCtrl(firstPanel, 0);    // sets m_ctrl[0]
 
+    const wxSizerFlags border = wxSizerFlags().DoubleBorder();
+
     wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
-    button_sizer->Add( new wxButton( firstPanel, ID_ADD_MOZART,  "Add Mozart"),             0, wxALL, 10 );
-    button_sizer->Add( new wxButton( firstPanel, ID_DELETE_SEL,  "Delete selected"),        0, wxALL, 10 );
-    button_sizer->Add( new wxButton( firstPanel, ID_DELETE_YEAR, "Delete \"Year\" column"), 0, wxALL, 10 );
-    button_sizer->Add( new wxButton( firstPanel, ID_SELECT_NINTH,"Select ninth symphony"),  0, wxALL, 10 );
-    button_sizer->Add( new wxButton( firstPanel, ID_COLLAPSE,    "Collapse"),               0, wxALL, 10 );
-    button_sizer->Add( new wxButton( firstPanel, ID_EXPAND,      "Expand"),                 0, wxALL, 10 );
+    button_sizer->Add( new wxButton( firstPanel, ID_ADD_MOZART,  "Add Mozart"),             border );
+    button_sizer->Add( new wxButton( firstPanel, ID_DELETE_SEL,  "Delete selected"),        border );
+    button_sizer->Add( new wxButton( firstPanel, ID_DELETE_YEAR, "Delete \"Year\" column"), border );
+    button_sizer->Add( new wxButton( firstPanel, ID_SELECT_NINTH,"Select ninth symphony"),  border );
+    button_sizer->Add( new wxButton( firstPanel, ID_COLLAPSE,    "Collapse"),               border );
+    button_sizer->Add( new wxButton( firstPanel, ID_EXPAND,      "Expand"),                 border );
+
+    wxBoxSizer *sizerCurrent = new wxBoxSizer(wxHORIZONTAL);
+    sizerCurrent->Add(new wxButton(firstPanel, ID_SHOW_CURRENT,
+                                   "&Show current"), border);
+    sizerCurrent->Add(new wxButton(firstPanel, ID_SET_NINTH_CURRENT,
+                                   "Make &ninth symphony current"), border);
 
     wxSizer *firstPanelSz = new wxBoxSizer( wxVERTICAL );
     m_ctrl[0]->SetMinSize(wxSize(-1, 200));
@@ -426,6 +440,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int
         new wxStaticText(firstPanel, wxID_ANY, "Most of the cells above are editable!"),
         0, wxGROW|wxALL, 5);
     firstPanelSz->Add(button_sizer);
+    firstPanelSz->Add(sizerCurrent);
     firstPanel->SetSizerAndFit(firstPanelSz);
 
 
@@ -914,6 +929,33 @@ void MyFrame::OnExpand( wxCommandEvent& WXUNUSED(event) )
         m_ctrl[0]->Expand( item );
 }
 
+void MyFrame::OnShowCurrent(wxCommandEvent& WXUNUSED(event))
+{
+    wxDataViewItem item = m_ctrl[0]->GetCurrentItem();
+    if ( item.IsOk() )
+    {
+        wxLogMessage("Current item: \"%s\" by %s",
+                     m_music_model->GetTitle(item),
+                     m_music_model->GetArtist(item));
+    }
+    else
+    {
+        wxLogMessage("There is no current item.");
+    }
+}
+
+void MyFrame::OnSetNinthCurrent(wxCommandEvent& WXUNUSED(event))
+{
+    wxDataViewItem item(m_music_model->GetNinthItem());
+    if ( !item.IsOk() )
+    {
+        wxLogError( "Cannot make the ninth symphony current: it was removed!" );
+        return;
+    }
+
+    m_ctrl[0]->SetCurrentItem(item);
+}
+
 void MyFrame::OnValueChanged( wxDataViewEvent &event )
 {
     if (!m_log)
index b63171d1182946fe16e9b626e23364073ce76add..779df4727a5e28f8765121088b5f0c06344e9890 100644 (file)
@@ -994,6 +994,22 @@ void wxDataViewCtrlBase::ExpandAncestors( const wxDataViewItem & item )
     }
 }
 
+wxDataViewItem wxDataViewCtrlBase::GetCurrentItem() const
+{
+    return HasFlag(wxDV_MULTIPLE) ? DoGetCurrentItem()
+                                  : GetSelection();
+}
+
+void wxDataViewCtrlBase::SetCurrentItem(const wxDataViewItem& item)
+{
+    wxCHECK_RET( item.IsOk(), "Can't make current an invalid item." );
+
+    if ( HasFlag(wxDV_MULTIPLE) )
+        DoSetCurrentItem(item);
+    else
+        Select(item);
+}
+
 wxDataViewColumn *
 wxDataViewCtrlBase::AppendTextColumn( const wxString &label, unsigned int model_column,
                             wxDataViewCellMode mode, int width, wxAlignment align, int flags )
index b80eeaf6224cbdcc888b7ac0e64c121556b8cd49..db9fe4be06728e317f7b402f1fb28bb3caf49998 100644 (file)
@@ -471,6 +471,7 @@ public:
     void ScrollWindow( int dx, int dy, const wxRect *rect = NULL );
     void ScrollTo( int rows, int column );
 
+    unsigned GetCurrentRow() const { return m_currentRow; }
     bool HasCurrentRow() { return m_currentRow != (unsigned int)-1; }
     void ChangeCurrentRow( unsigned int row );
 
@@ -4174,6 +4175,24 @@ wxDataViewColumn *wxDataViewCtrl::GetSortingColumn() const
                                             : GetColumn(m_sortingColumnIdx);
 }
 
+wxDataViewItem wxDataViewCtrl::DoGetCurrentItem() const
+{
+    return GetItemByRow(m_clientArea->GetCurrentRow());
+}
+
+void wxDataViewCtrl::DoSetCurrentItem(const wxDataViewItem& item)
+{
+    const int row = m_clientArea->GetRowByItem(item);
+
+    const unsigned oldCurrent = m_clientArea->GetCurrentRow();
+    if ( static_cast<unsigned>(row) != oldCurrent )
+    {
+        m_clientArea->ChangeCurrentRow(row);
+        m_clientArea->RefreshRow(oldCurrent);
+        m_clientArea->RefreshRow(row);
+    }
+}
+
 // Selection code with wxDataViewItem as parameters
 wxDataViewItem wxDataViewCtrl::GetSelection() const
 {
index 1763e1881e5edec34f18ddc36e0e3e6d304ba6fb..e3ae840c43582b22c9c9503ff47a01f90e8f4ccc 100644 (file)
@@ -96,6 +96,97 @@ private:
     wxDECLARE_NO_COPY_CLASS(wxGtkTreePath);
 };
 
+// ----------------------------------------------------------------------------
+// wxGtkTreeSelectionLock: prevent selection from changing during the
+//                                 lifetime of this object
+// ----------------------------------------------------------------------------
+
+// Implementation note: it could be expected that setting the selection
+// function in this class ctor and resetting it back to the old value in its
+// dtor would work. However currently gtk_tree_selection_get_select_function()
+// can't be passed NULL (see https://bugzilla.gnome.org/show_bug.cgi?id=626276)
+// so we can't do this. Instead, we always use the selection function (which
+// imposes extra overhead, albeit minimal one, on all selection operations) and
+// just set/reset the flag telling it whether it should allow or forbid the
+// selection.
+//
+// Also notice that currently only a single object of this class may exist at
+// any given moment. It's just simpler like this and we don't need anything
+// more for now.
+
+extern "C"
+gboolean wxdataview_selection_func(GtkTreeSelection * WXUNUSED(selection),
+                                   GtkTreeModel * WXUNUSED(model),
+                                   GtkTreePath * WXUNUSED(path),
+                                   gboolean WXUNUSED(path_currently_selected),
+                                   gpointer data)
+{
+    return data == NULL;
+}
+
+class wxGtkTreeSelectionLock
+{
+public:
+    wxGtkTreeSelectionLock(GtkTreeSelection *selection)
+        : m_selection(selection)
+    {
+        wxASSERT_MSG( !ms_instance, "this class is not reentrant currently" );
+
+        ms_instance = this;
+
+        CheckCurrentSelectionFunc(NULL);
+
+        // Pass some non-NULL pointer as "data" for the callback, it doesn't
+        // matter what it is as long as it's non-NULL.
+        gtk_tree_selection_set_select_function(selection,
+                                               wxdataview_selection_func,
+                                               this,
+                                               NULL);
+    }
+
+    ~wxGtkTreeSelectionLock()
+    {
+        CheckCurrentSelectionFunc(wxdataview_selection_func);
+
+        gtk_tree_selection_set_select_function(m_selection,
+                                               wxdataview_selection_func,
+                                               NULL,
+                                               NULL);
+
+        ms_instance = NULL;
+    }
+
+private:
+    void CheckCurrentSelectionFunc(GtkTreeSelectionFunc func)
+    {
+        // We can only use gtk_tree_selection_get_select_function() with 2.14+
+        // so check for its availability both during compile- and run-time.
+#if GTK_CHECK_VERSION(2, 14, 0)
+        if ( gtk_check_version(2, 14, 0) != NULL )
+            return;
+
+        // If this assert is triggered, it means the code elsewhere has called
+        // gtk_tree_selection_set_select_function() but currently doing this
+        // breaks this class so the code here needs to be changed.
+        wxASSERT_MSG
+        (
+            gtk_tree_selection_get_select_function(m_selection) == func,
+            "selection function has changed unexpectedly, review this code!"
+        );
+#endif // GTK+ 2.14+
+
+        wxUnusedVar(func);
+    }
+
+    static wxGtkTreeSelectionLock *ms_instance;
+
+    GtkTreeSelection * const m_selection;
+
+    wxDECLARE_NO_COPY_CLASS(wxGtkTreeSelectionLock);
+};
+
+wxGtkTreeSelectionLock *wxGtkTreeSelectionLock::ms_instance = NULL;
+
 //-----------------------------------------------------------------------------
 // wxDataViewCtrlInternal
 //-----------------------------------------------------------------------------
@@ -4571,6 +4662,43 @@ bool wxDataViewCtrl::IsExpanded( const wxDataViewItem & item ) const
     return gtk_tree_view_row_expanded( GTK_TREE_VIEW(m_treeview), path );
 }
 
+wxDataViewItem wxDataViewCtrl::DoGetCurrentItem() const
+{
+    // The tree doesn't have any current item if it hadn't been created yet but
+    // it's arguably not an error to call this function in this case so just
+    // return an invalid item without asserting.
+    if ( !m_treeview )
+        return wxDataViewItem();
+
+    wxGtkTreePath path;
+    gtk_tree_view_get_cursor(GTK_TREE_VIEW(m_treeview), path.ByRef(), NULL);
+
+    return GTKPathToItem(path);
+}
+
+void wxDataViewCtrl::DoSetCurrentItem(const wxDataViewItem& item)
+{
+    wxCHECK_RET( m_treeview,
+                 "Current item can't be set before creating the control." );
+
+    // We need to make sure the model knows about this item or the path would
+    // be invalid and gtk_tree_view_set_cursor() would silently do nothing.
+    ExpandAncestors(item);
+
+    // We also need to preserve the existing selection from changing.
+    // Unfortunately the only way to do it seems to use our own selection
+    // function and forbid any selection changes during set cursor call.
+    wxGtkTreeSelectionLock
+        lock(gtk_tree_view_get_selection(GTK_TREE_VIEW(m_treeview)));
+
+    // Do move the cursor now.
+    GtkTreeIter iter;
+    iter.user_data = item.GetID();
+    wxGtkTreePath path(m_internal->get_path( &iter ));
+
+    gtk_tree_view_set_cursor(GTK_TREE_VIEW(m_treeview), path, NULL, FALSE);
+}
+
 wxDataViewItem wxDataViewCtrl::GetSelection() const
 {
     GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(m_treeview) );
index ef441c892d00491683da82fb74af52c033b08289..48cb63956e9823a54e5df72e0fd3db75dc780ab3 100644 (file)
@@ -1095,6 +1095,18 @@ bool wxMacDataViewDataBrowserListViewControl::AssociateModel(wxDataViewModel* WX
 //
 // selection related methods (inherited from wxDataViewWidgetImpl)
 //
+wxDataViewItem wxMacDataViewDataBrowserListViewControl::GetCurrentItem() const
+{
+    wxFAIL_MSG( "unimplemented for Carbon" );
+
+    return wxDataViewItem();
+}
+
+void wxMacDataViewDataBrowserListViewControl::SetCurrentItem(const wxDataViewItem& WXUNUSED(item))
+{
+    wxFAIL_MSG( "unimplemented for Carbon" );
+}
+
 int wxMacDataViewDataBrowserListViewControl::GetSelections(wxDataViewItemArray& sel) const
 {
   size_t noOfSelectedItems;
index f8f8c38b024656508d73b7f96f2b4a7d89269424..87d16daae706abb4bf8661ae537deb2d6a64cf03 100644 (file)
@@ -2069,6 +2069,22 @@ bool wxCocoaDataViewControl::AssociateModel(wxDataViewModel* model)
 //
 // selection related methods (inherited from wxDataViewWidgetImpl)
 //
+
+wxDataViewItem wxCocoaDataViewControl::GetCurrentItem() const
+{
+    return wxDataViewItem([[m_OutlineView itemAtRow:[m_OutlineView selectedRow]] pointer]);
+}
+
+void wxCocoaDataViewControl::SetCurrentItem(const wxDataViewItem& item)
+{
+    // We can't have unselected current item in a NSTableView, as the
+    // documentation of its deselectRow method explains, the control will
+    // automatically change the current item to the closest still selected item
+    // if the current item is deselected. So we have no choice but to select
+    // the item in the same time as making it current.
+    Select(item);
+}
+
 int wxCocoaDataViewControl::GetSelections(wxDataViewItemArray& sel) const
 {
     NSIndexSet* selectedRowIndexes([m_OutlineView selectedRowIndexes]);
index 41d7ca3260a257dea36ea90077d38446cd3df8ed..45e2b3ca35f2d612925acde31b28da3b4f415140 100644 (file)
@@ -496,6 +496,16 @@ unsigned int wxDataViewCtrl::GetCount() const
   return GetDataViewPeer()->GetCount();
 }
 
+wxDataViewItem wxDataViewCtrl::DoGetCurrentItem() const
+{
+    return GetDataViewPeer()->GetCurrentItem();
+}
+
+void wxDataViewCtrl::DoSetCurrentItem(const wxDataViewItem& item)
+{
+    GetDataViewPeer()->SetCurrentItem(item);
+}
+
 wxRect wxDataViewCtrl::GetItemRect(wxDataViewItem const& item, wxDataViewColumn const* columnPtr) const
 {
   if (item.IsOk() && (columnPtr != NULL))