const wxDataViewColumn *column = NULL ) = 0;
virtual void HitTest( const wxPoint & point, wxDataViewItem &item, wxDataViewColumn* &column ) const = 0;
virtual wxRect GetItemRect( const wxDataViewItem & item, const wxDataViewColumn *column = NULL ) const = 0;
+
+ virtual void StartEditor( const wxDataViewItem & item, unsigned int column ) { }
#if wxUSE_DRAG_AND_DROP
virtual bool EnableDragSource(const wxDataFormat& WXUNUSED(format))
virtual wxBorder GetDefaultBorder() const;
- void StartEditor( const wxDataViewItem & item, unsigned int column );
+ virtual void StartEditor( const wxDataViewItem & item, unsigned int column );
protected:
virtual int GetSelections( wxArrayInt & sel ) const;
wxDataViewColumn *&column ) const;
virtual wxRect GetItemRect( const wxDataViewItem &item,
const wxDataViewColumn *column = NULL ) const;
+
+ virtual void StartEditor( const wxDataViewItem & item, unsigned int column );
virtual void Expand( const wxDataViewItem & item );
virtual void Collapse( const wxDataViewItem & item );
virtual void SetRowHeight(wxDataViewItem const& item, unsigned int height);
virtual void OnSize ();
+ virtual void StartEditor( const wxDataViewItem & item, unsigned int column );
+
//
// other methods
//
wxDataViewColumn*& columnPtr) const;
virtual void SetRowHeight(const wxDataViewItem& item, unsigned int height);
virtual void OnSize();
+
+ virtual void StartEditor( const wxDataViewItem & item, unsigned int column );
// drag & drop helper methods
wxDataFormat GetDnDDataFormat(wxDataObjectComposite* dataObjects);
virtual void HitTest (wxPoint const& point, wxDataViewItem& item, wxDataViewColumn*& columnPtr) const = 0; // return the item and column pointer that contains with the passed point
virtual void SetRowHeight(wxDataViewItem const& item, unsigned int height) = 0; // sets the height of the row containg the passed item in the native control
virtual void OnSize (void) = 0; // updates the layout of the native control after a size event
+ virtual void StartEditor( const wxDataViewItem & item, unsigned int column ) = 0; // starts editing the passed in item and column
};
#endif // _WX_DATAVIEWCTRL_CORE_H_
// 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 );
// 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 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.
*/
{
wxDataViewTreeCtrl* ctrl = (wxDataViewTreeCtrl*) m_ctrl[3];
wxDataViewItem selected = ctrl->GetSelection();
- if (ctrl->IsContainer(selected))
- ctrl->AppendItem( selected, "Item", 0 );
+ if (ctrl->IsContainer(selected)) {
+ wxDataViewItem newitem = ctrl->AppendItem( selected, "Item", 0 );
+ ctrl->Select(newitem);
+ ctrl->StartEditor(newitem, 0);
+ }
}
void MyFrame::OnAddTreeContainerItem(wxCommandEvent& WXUNUSED(event))
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) );
SetHasScrollBars(true,true);
}
+void wxMacDataViewDataBrowserListViewControl::StartEditor( const wxDataViewItem & item, unsigned int column )
+{
+ // implement me
+}
+
//
// callback functions (inherited from wxMacDataBrowserTableViewControl)
//
[m_OutlineView reloadData];
}
+void wxCocoaDataViewControl::StartEditor( const wxDataViewItem & item, unsigned int column )
+{
+ [m_OutlineView editColumn:column row:[m_OutlineView rowForItem:[m_DataSource getDataViewItemFromBuffer:item]] withEvent:nil select:YES];
+}
+
//
// other methods (inherited from wxDataViewWidgetImpl)
//
(void) GetModel()->ItemsAdded(parentItem,items);
}
+void wxDataViewCtrl::StartEditor( const wxDataViewItem & item, unsigned int column )
+{
+ GetDataViewPeer()->StartEditor(item, column);
+}
+
void wxDataViewCtrl::FinishCustomItemEditing()
{
if (GetCustomRendererItem().IsOk())