/////////////////////////////////////////////////////////////////////////////
-// Name: treebase.cpp
+// Name: src/common/treebase.cpp
// Purpose: Base wxTreeCtrl classes
// Author: Julian Smart
// Created: 01/02/97
// wxTreeCtrlBase
// ----------------------------------------------------------------------------
+wxTreeCtrlBase::wxTreeCtrlBase()
+{
+ m_imageListNormal =
+ m_imageListState = NULL;
+ m_ownsImageListNormal =
+ m_ownsImageListState = false;
+
+ // arbitrary default
+ m_spacing = 18;
+
+ // quick DoGetBestSize calculation
+ m_quickBestSize = true;
+
+ Connect(wxEVT_CHAR_HOOK, wxKeyEventHandler(wxTreeCtrlBase::OnCharHook));
+}
+
wxTreeCtrlBase::~wxTreeCtrlBase()
{
if (m_ownsImageListNormal)
return !GetRootItem().IsOk();
}
+void wxTreeCtrlBase::OnCharHook(wxKeyEvent& event)
+{
+ if ( GetEditControl() )
+ {
+ bool discardChanges = false;
+ switch ( event.GetKeyCode() )
+ {
+ case WXK_ESCAPE:
+ discardChanges = true;
+ // fall through
+
+ case WXK_RETURN:
+ EndEditLabel(GetFocusedItem(), discardChanges);
+
+ // Do not call Skip() below.
+ return;
+ }
+ }
+
+ event.Skip();
+}
+
#endif // wxUSE_TREECTRL