]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/widgets/dirctrl.cpp
Add a public wxModalDialogHook class for intercepting modal dialogs.
[wxWidgets.git] / samples / widgets / dirctrl.cpp
index ff3b96cf3ec9ab38066fe0a13b9fbaf9b290e662..485c247c34d1fd5b6514ce9ec9f211218200fdcd 100644 (file)
@@ -113,6 +113,7 @@ protected:
     void OnCheckBox(wxCommandEvent& event);
     void OnRadioBox(wxCommandEvent& event);
     void OnSelChanged(wxTreeEvent& event);
+    void OnFileActivated(wxTreeEvent& event);
 
     // reset the control parameters
     void Reset();
@@ -156,7 +157,8 @@ BEGIN_EVENT_TABLE(DirCtrlWidgetsPage, WidgetsPage)
     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)
+    EVT_DIRCTRL_SELECTIONCHANGED(DirCtrlPage_Ctrl, DirCtrlWidgetsPage::OnSelChanged)
+    EVT_DIRCTRL_FILEACTIVATED(DirCtrlPage_Ctrl, DirCtrlWidgetsPage::OnFileActivated)
 END_EVENT_TABLE()
 
 // ============================================================================
@@ -377,4 +379,15 @@ void DirCtrlWidgetsPage::OnSelChanged(wxTreeEvent& event)
     event.Skip();
 }
 
+void DirCtrlWidgetsPage::OnFileActivated(wxTreeEvent& event)
+{
+    if ( m_dirCtrl )
+    {
+        wxLogMessage("File activated \"%s\"",
+                     m_dirCtrl->GetPath(event.GetItem()));
+    }
+
+    event.Skip();
+}
+
 #endif // wxUSE_DIRDLG