Added wxEVT_COMMAND_DIRCTRL_CHANGED for wxDirCtrl selection changes.
This makes it much simpler to react to the changes in the control, update the sample to show it. Closes #14792. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72842 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -102,6 +102,12 @@ extern WXDLLEXPORT_DATA(const char) wxFileSelectorDefaultWildcardStr[];
|
||||
|
||||
bool wxIsDriveAvailable(const wxString& dirName);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// events
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxDEFINE_EVENT( wxEVT_COMMAND_DIRCTRL_CHANGED, wxTreeEvent );
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxGetAvailableDrives, for WINDOWS, DOS, OS2, MAC, UNIX (returns "/")
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -441,6 +447,7 @@ BEGIN_EVENT_TABLE(wxGenericDirCtrl, wxControl)
|
||||
EVT_TREE_ITEM_COLLAPSED (wxID_TREECTRL, wxGenericDirCtrl::OnCollapseItem)
|
||||
EVT_TREE_BEGIN_LABEL_EDIT (wxID_TREECTRL, wxGenericDirCtrl::OnBeginEditItem)
|
||||
EVT_TREE_END_LABEL_EDIT (wxID_TREECTRL, wxGenericDirCtrl::OnEndEditItem)
|
||||
EVT_TREE_SEL_CHANGED (wxID_TREECTRL, wxGenericDirCtrl::OnTreeSelChange)
|
||||
EVT_SIZE (wxGenericDirCtrl::OnSize)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
@@ -694,6 +701,17 @@ void wxGenericDirCtrl::OnEndEditItem(wxTreeEvent &event)
|
||||
}
|
||||
}
|
||||
|
||||
void wxGenericDirCtrl::OnTreeSelChange(wxTreeEvent &event)
|
||||
{
|
||||
wxTreeEvent changedEvent(wxEVT_COMMAND_DIRCTRL_CHANGED, GetId());
|
||||
|
||||
changedEvent.SetItem(event.GetItem());
|
||||
changedEvent.SetClientObject(m_treeCtrl->GetItemData(event.GetItem()));
|
||||
|
||||
GetEventHandler()->SafelyProcessEvent(changedEvent);
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxGenericDirCtrl::OnExpandItem(wxTreeEvent &event)
|
||||
{
|
||||
wxTreeItemId parentId = event.GetItem();
|
||||
|
Reference in New Issue
Block a user