No-op: remove all trailing whitespace.
[dcpomatic.git] / src / wx / dir_picker_ctrl.cc
index 05b680288c248baaf0605f88d67eac45e71556d5..fe4937edf5cc8002f24dfff543b188167723b516 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <wx/wx.h>
 #include <wx/stdpaths.h>
+#include <wx/filepicker.h>
 #include <boost/filesystem.hpp>
 #include "dir_picker_ctrl.h"
 #include "wx_util.h"
@@ -28,7 +29,6 @@ using namespace boost;
 
 DirPickerCtrl::DirPickerCtrl (wxWindow* parent)
        : wxPanel (parent)
-       , _parent (parent)
 {
        _sizer = new wxBoxSizer (wxHORIZONTAL);
 
@@ -39,26 +39,22 @@ DirPickerCtrl::DirPickerCtrl (wxWindow* parent)
 
        SetSizerAndFit (_sizer);
 
-       _browse->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (DirPickerCtrl::browse_clicked), 0, this);
-
-       /* Do this after the fit so that our folder label stays long */
-       SetPath (wxStandardPaths::Get().GetDocumentsDir());
+       _browse->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DirPickerCtrl::browse_clicked, this));
 }
 
 void
 DirPickerCtrl::SetPath (wxString p)
 {
        _path = p;
-               
+
        if (_path == wxStandardPaths::Get().GetDocumentsDir()) {
                _folder->SetLabel (_("My Documents"));
        } else {
-#if BOOST_FILESYSTEM_VERSION == 3              
                _folder->SetLabel (std_to_wx (filesystem::path (wx_to_std (_path)).leaf().string()));
-#else
-               _folder->SetLabel (std_to_wx (filesystem::path (wx_to_std (_path)).leaf()));
-#endif         
        }
+
+       wxCommandEvent ev (wxEVT_COMMAND_DIRPICKER_CHANGED, wxID_ANY);
+       GetEventHandler()->ProcessEvent (ev);
 }
 
 wxString
@@ -68,10 +64,11 @@ DirPickerCtrl::GetPath () const
 }
 
 void
-DirPickerCtrl::browse_clicked (wxCommandEvent &)
+DirPickerCtrl::browse_clicked ()
 {
        wxDirDialog* d = new wxDirDialog (this);
-       d->ShowModal ();
-       SetPath (d->GetPath ());
+       if (d->ShowModal () == wxID_OK) {
+               SetPath (d->GetPath ());
+       }
        d->Destroy ();
 }