- Close wxLogWindow automatically if it's the last remaining top level window.
- Implement clipping for wxSVGFileDC (Steve Benbow).
- Added wxDirCtrl::GetPath() (troelsk).
+- Added wxEVT_COMMAND_DIRCTRL_CHANGED event (troelsk).
wxGTK:
void OnCollapseItem(wxTreeEvent &event );
void OnBeginEditItem(wxTreeEvent &event );
void OnEndEditItem(wxTreeEvent &event );
+ void OnTreeSelChange(wxTreeEvent &event);
void OnSize(wxSizeEvent &event );
// Try to expand as much of the given path as possible.
wxDECLARE_NO_COPY_CLASS(wxGenericDirCtrl);
};
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_COMMAND_DIRCTRL_CHANGED, wxTreeEvent );
+
+#define wx__DECLARE_DIRCTRL_EVT(evt, id, fn) \
+ wx__DECLARE_EVT1(wxEVT_COMMAND_DIRCTRL_ ## evt, id, wxTreeEventHandler(fn))
+
+#define EVT_DIRCTRL_CHANGED(id, fn) wx__DECLARE_DIRCTRL_EVT(CHANGED, id, fn)
+
//-----------------------------------------------------------------------------
// wxDirFilterListCtrl
//-----------------------------------------------------------------------------
@library{wxcore}
@category{ctrl}
@appearance{genericdirctrl.png}
+ @event{EVT_DIRCTRL_CHANGED(id, func)}
+ Selected directory has changed.
+ Processes a @c wxEVT_COMMAND_DIRCTRL_CHANGED event type.
+ Notice that this event is generated even for the changes done by the
+ program itself and not only those done by the user.
+ @since 2.9.5
*/
class wxGenericDirCtrl : public wxControl
{
void OnStdPath(wxCommandEvent& event);
void OnCheckBox(wxCommandEvent& event);
void OnRadioBox(wxCommandEvent& event);
+ void OnSelChanged(wxTreeEvent& event);
// reset the control parameters
void Reset();
EVT_BUTTON(DirCtrlPage_SetPath, DirCtrlWidgetsPage::OnButtonSetPath)
EVT_CHECKBOX(wxID_ANY, DirCtrlWidgetsPage::OnCheckBox)
EVT_RADIOBOX(wxID_ANY, DirCtrlWidgetsPage::OnRadioBox)
+ EVT_DIRCTRL_CHANGED(DirCtrlPage_Ctrl, DirCtrlWidgetsPage::OnSelChanged)
END_EVENT_TABLE()
// ============================================================================
wxImageList *imaglist)
:WidgetsPage(book, imaglist, dirctrl_xpm)
{
+ m_dirCtrl = NULL;
}
void DirCtrlWidgetsPage::CreateContent()
}
}
+void DirCtrlWidgetsPage::OnSelChanged(wxTreeEvent& event)
+{
+ if ( m_dirCtrl )
+ {
+ wxLogMessage("Selection changed to \"%s\"",
+ m_dirCtrl->GetPath(event.GetItem()));
+ }
+
+ event.Skip();
+}
+
#endif // wxUSE_DIRDLG
bool wxIsDriveAvailable(const wxString& dirName);
+// ----------------------------------------------------------------------------
+// events
+// ----------------------------------------------------------------------------
+
+wxDEFINE_EVENT( wxEVT_COMMAND_DIRCTRL_CHANGED, wxTreeEvent );
+
// ----------------------------------------------------------------------------
// wxGetAvailableDrives, for WINDOWS, DOS, OS2, MAC, UNIX (returns "/")
// ----------------------------------------------------------------------------
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()
}
}
+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();