+void wxGenericDirCtrl::OnTreeSelChange(wxTreeEvent &event)
+{
+ wxTreeEvent changedEvent(wxEVT_DIRCTRL_SELECTIONCHANGED, GetId());
+
+ changedEvent.SetEventObject(this);
+ changedEvent.SetItem(event.GetItem());
+ changedEvent.SetClientObject(m_treeCtrl->GetItemData(event.GetItem()));
+
+ if (GetEventHandler()->SafelyProcessEvent(changedEvent) && !changedEvent.IsAllowed())
+ event.Veto();
+ else
+ event.Skip();
+}
+
+void wxGenericDirCtrl::OnItemActivated(wxTreeEvent &event)
+{
+ wxTreeItemId treeid = event.GetItem();
+ const wxDirItemData *data = GetItemData(treeid);
+
+ if (data->m_isDir)
+ {
+ // is dir
+ event.Skip();
+ }
+ else
+ {
+ // is file
+ wxTreeEvent changedEvent(wxEVT_DIRCTRL_FILEACTIVATED, GetId());
+
+ changedEvent.SetEventObject(this);
+ changedEvent.SetItem(treeid);
+ changedEvent.SetClientObject(m_treeCtrl->GetItemData(treeid));
+
+ if (GetEventHandler()->SafelyProcessEvent(changedEvent) && !changedEvent.IsAllowed())
+ event.Veto();
+ else
+ event.Skip();
+ }
+}
+