- Implement clipping for wxSVGFileDC (Steve Benbow).
- Add wxDirCtrl::GetPath() (troelsk).
- Add wxEVT_DIRCTRL_SELECTIONCHANGED event (troelsk).
+- Add wxEVT_DIRCTRL_FILEACTIVATED event (troelsk).
- Add wxControl::GetSizeFromTextSize() (Manuel Martin).
- Optionally allow showing tooltips for disabled ribbon buttons (wxBen).
- Add wxTL_NO_HEADER style to wxTreeListCtrl (robboto).
void OnBeginEditItem(wxTreeEvent &event );
void OnEndEditItem(wxTreeEvent &event );
void OnTreeSelChange(wxTreeEvent &event);
+ void OnItemActivated(wxTreeEvent &event);
void OnSize(wxSizeEvent &event );
// Try to expand as much of the given path as possible.
};
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DIRCTRL_SELECTIONCHANGED, wxTreeEvent );
+wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_DIRCTRL_FILEACTIVATED, wxTreeEvent );
#define wx__DECLARE_DIRCTRL_EVT(evt, id, fn) \
wx__DECLARE_EVT1(wxEVT_DIRCTRL_ ## evt, id, wxTreeEventHandler(fn))
#define EVT_DIRCTRL_SELECTIONCHANGED(id, fn) wx__DECLARE_DIRCTRL_EVT(SELECTIONCHANGED, id, fn)
+#define EVT_DIRCTRL_FILEACTIVATED(id, fn) wx__DECLARE_DIRCTRL_EVT(FILEACTIVATED, id, fn)
//-----------------------------------------------------------------------------
// wxDirFilterListCtrl
// old wxEVT_COMMAND_* constants
#define wxEVT_COMMAND_DIRCTRL_SELECTIONCHANGED wxEVT_DIRCTRL_SELECTIONCHANGED
+#define wxEVT_COMMAND_DIRCTRL_FILEACTIVATED wxEVT_DIRCTRL_FILEACTIVATED
#endif
// _WX_DIRCTRLG_H_
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
+ @event{EVT_DIRCTRL_FILEACTIVATED(id, func)}
+ The user activated a file by double-clicking or pressing Enter.
+ @since 2.9.5
*/
class wxGenericDirCtrl : public wxControl
{
};
wxEventType wxEVT_DIRCTRL_SELECTIONCHANGED;
+wxEventType wxEVT_DIRCTRL_FILEACTIVATED;
void OnCheckBox(wxCommandEvent& event);
void OnRadioBox(wxCommandEvent& event);
void OnSelChanged(wxTreeEvent& event);
+ void OnFileActivated(wxTreeEvent& event);
// reset the control parameters
void Reset();
EVT_CHECKBOX(wxID_ANY, DirCtrlWidgetsPage::OnCheckBox)
EVT_RADIOBOX(wxID_ANY, DirCtrlWidgetsPage::OnRadioBox)
EVT_DIRCTRL_SELECTIONCHANGED(DirCtrlPage_Ctrl, DirCtrlWidgetsPage::OnSelChanged)
+ EVT_DIRCTRL_FILEACTIVATED(DirCtrlPage_Ctrl, DirCtrlWidgetsPage::OnFileActivated)
END_EVENT_TABLE()
// ============================================================================
event.Skip();
}
+void DirCtrlWidgetsPage::OnFileActivated(wxTreeEvent& event)
+{
+ if ( m_dirCtrl )
+ {
+ wxLogMessage("File activated \"%s\"",
+ m_dirCtrl->GetPath(event.GetItem()));
+ }
+
+ event.Skip();
+}
+
#endif // wxUSE_DIRDLG
// ----------------------------------------------------------------------------
wxDEFINE_EVENT( wxEVT_DIRCTRL_SELECTIONCHANGED, wxTreeEvent );
+wxDEFINE_EVENT( wxEVT_DIRCTRL_FILEACTIVATED, wxTreeEvent );
// ----------------------------------------------------------------------------
// wxGetAvailableDrives, for WINDOWS, DOS, OS2, MAC, UNIX (returns "/")
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_TREE_ITEM_ACTIVATED (wxID_TREECTRL, wxGenericDirCtrl::OnItemActivated)
EVT_SIZE (wxGenericDirCtrl::OnSize)
END_EVENT_TABLE()
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();
+ }
}
void wxGenericDirCtrl::OnExpandItem(wxTreeEvent &event)