Virtualize StartEditor and add implementations for the ports that can do it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67817 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2011-05-31 19:36:47 +00:00
parent 9f2b6b31b7
commit eeea3b039e
13 changed files with 67 additions and 3 deletions

View File

@@ -4836,6 +4836,33 @@ void wxDataViewCtrl::DoSetCurrentItem(const wxDataViewItem& item)
gtk_tree_view_set_cursor(GTK_TREE_VIEW(m_treeview), path, NULL, FALSE);
}
void wxDataViewCtrl::StartEditor(const wxDataViewItem& item, unsigned int column)
{
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);
wxDataViewColumn *dvcolumn = GetColumn(column);
wxASSERT_MSG(dvcolumn, "Could not retrieve column");
GtkTreeViewColumn *gcolumn = GTK_TREE_VIEW_COLUMN(dvcolumn->GetGtkHandle());
// 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, gcolumn, TRUE);
}
wxDataViewItem wxDataViewCtrl::GetSelection() const
{
GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW(m_treeview) );