git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28472
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
public:
wxTreeTextCtrl(wxGenericTreeCtrl *owner, wxGenericTreeItem *item);
public:
wxTreeTextCtrl(wxGenericTreeCtrl *owner, wxGenericTreeItem *item);
+ // wxGenericTreeCtrl can use this one to abandon editing the given item,
+ // it's not an error to call it if this item is not being edited
+ void StopEditing(wxGenericTreeItem *item)
+ {
+ if ( item == m_itemEdited )
+ DoStopEditing();
+ }
+
protected:
void OnChar( wxKeyEvent &event );
void OnKeyUp( wxKeyEvent &event );
void OnKillFocus( wxFocusEvent &event );
protected:
void OnChar( wxKeyEvent &event );
void OnKeyUp( wxKeyEvent &event );
void OnKillFocus( wxFocusEvent &event );
+ void DoStopEditing()
+ {
+ Finish();
+ m_owner->OnRenameCancelled(m_itemEdited);
+ }
+
bool AcceptChanges();
void Finish();
bool AcceptChanges();
void Finish();
Finish();
}
// else do nothing, do not accept and do not close
Finish();
}
// else do nothing, do not accept and do not close
- Finish();
- m_owner->OnRenameCancelled(m_itemEdited);
// called by wxTextTreeCtrl when it marks itself for deletion
void wxGenericTreeCtrl::ResetTextControl()
{
// called by wxTextTreeCtrl when it marks itself for deletion
void wxGenericTreeCtrl::ResetTextControl()
{
}
// find the first item starting with the given prefix after the given item
}
// find the first item starting with the given prefix after the given item
wxGenericTreeItem *item = (wxGenericTreeItem*) itemId.m_pItem;
wxGenericTreeItem *item = (wxGenericTreeItem*) itemId.m_pItem;
+ if ( m_textCtrl )
+ {
+ // can't delete the item being edited, cancel editing it first
+ m_textCtrl->StopEditing(item);
+ }
+
wxGenericTreeItem *parent = item->GetParent();
// don't keep stale pointers around!
wxGenericTreeItem *parent = item->GetParent();
// don't keep stale pointers around!
+ m_itemEdited = itemEdit;
+
// We have to call this here because the label in
// question might just have been added and no screen
// update taken place.
// We have to call this here because the label in
// question might just have been added and no screen
// update taken place.
GetEventHandler()->ProcessEvent( le );
}
GetEventHandler()->ProcessEvent( le );
}
void wxGenericTreeCtrl::OnRenameTimer()
{
Edit( m_current );
void wxGenericTreeCtrl::OnRenameTimer()
{
Edit( m_current );