virtual bool SetRowHeight( int WXUNUSED(rowHeight) ) { return false; }
- virtual void StartEditor( const wxDataViewItem & WXUNUSED(item),
- unsigned int WXUNUSED(column) )
- { }
+ virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column) = 0;
+
+ // Use EditItem() instead
+ wxDEPRECATED( void StartEditor(const wxDataViewItem& item, unsigned int column) );
#if wxUSE_DRAG_AND_DROP
virtual bool EnableDragSource(const wxDataFormat& WXUNUSED(format))
virtual wxBorder GetDefaultBorder() const;
- virtual void StartEditor( const wxDataViewItem & item, unsigned int column );
+ virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column);
protected:
virtual void EnsureVisible( int row, int column );
virtual bool SetRowHeight( int rowHeight );
- virtual void StartEditor( const wxDataViewItem & item, unsigned int column );
+ virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column);
virtual void Expand( const wxDataViewItem & item );
virtual void Collapse( const wxDataViewItem & item );
// finishes editing of custom items; if no custom item is currently edited the method does nothing
void FinishCustomItemEditing();
- virtual void StartEditor( const wxDataViewItem & item, unsigned int column );
+ virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column);
// returns the n-th pointer to a column;
// this method is different from GetColumn(unsigned int pos) because here 'n' is not a position in the control but the n-th
*/
virtual bool DeleteColumn(wxDataViewColumn* column);
+ /**
+ Programmatically starts editing given cell of @a item.
+
+ Doesn't do anything if the item or this column is not editable.
+
+ @note Currently not implemented in wxOSX/Carbon.
+
+ @since 2.9.4
+ */
+ virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column);
+
/**
Enable drag operations using the given @a format.
*/
*/
virtual void SetSelections(const wxDataViewItemArray& sel);
- /**
- Programmatically starts editing the given item on the given column.
- Currently not implemented on wxOSX Carbon.
- @since 2.9.2
- */
-
- virtual void StartEditor(const wxDataViewItem & item, unsigned int column);
-
/**
Unselect the given item.
*/
return true;
}
+void wxDataViewCtrlBase::StartEditor(const wxDataViewItem& item, unsigned int column)
+{
+ EditItem(item, GetColumn(column));
+}
+
// ---------------------------------------------------------
// wxDataViewEvent
// ---------------------------------------------------------
wxDataViewColumn *editableCol = FindColumnForEditing(item, wxDATAVIEW_CELL_EDITABLE);
if ( editableCol )
- GetOwner()->StartEditor(item, GetOwner()->GetColumnIndex(editableCol));
+ GetOwner()->EditItem(item, editableCol);
}
}
break;
return false;
}
-void wxDataViewCtrl::StartEditor( const wxDataViewItem & item, unsigned int column )
+void wxDataViewCtrl::EditItem(const wxDataViewItem& item, const wxDataViewColumn *column)
{
- wxDataViewColumn* col = GetColumn( column );
- if (!col)
- return;
+ wxCHECK_RET( item.IsOk(), "invalid item" );
+ wxCHECK_RET( column, "no column provided" );
- m_clientArea->StartEditing(item, col);
+ m_clientArea->StartEditing(item, column);
}
#endif // !wxUSE_GENERICDATAVIEWCTRL
return FromGTKColumn(col);
}
-void wxDataViewCtrl::StartEditor(const wxDataViewItem& item, unsigned int column)
+void wxDataViewCtrl::EditItem(const wxDataViewItem& item, const wxDataViewColumn *column)
{
wxCHECK_RET( m_treeview,
"Current item can't be set before creating the control." );
+ wxCHECK_RET( item.IsOk(), "invalid item" );
+ wxCHECK_RET( column, "no column provided" );
// 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());
+
+ GtkTreeViewColumn *gcolumn = GTK_TREE_VIEW_COLUMN(column->GetGtkHandle());
// We also need to preserve the existing selection from changing.
// Unfortunately the only way to do it seems to use our own selection
(void) GetModel()->ItemsAdded(parentItem,items);
}
-void wxDataViewCtrl::StartEditor( const wxDataViewItem & item, unsigned int column )
+void wxDataViewCtrl::EditItem(const wxDataViewItem& item, const wxDataViewColumn *column)
{
- GetDataViewPeer()->StartEditor(item, column);
+ GetDataViewPeer()->StartEditor(item, GetColumnPosition(column));
}
void wxDataViewCtrl::FinishCustomItemEditing()