diff options
| author | Carl Hetherington <cth@carlh.net> | 2024-01-16 00:33:05 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-01-16 21:33:29 +0100 |
| commit | d464a939f9f851e835b2a4926fafd6eadaa183de (patch) | |
| tree | 824a491f85ef056d401b37f006bbced3f63919a5 /src/wx/file_picker_ctrl.cc | |
| parent | 4790b63ceadc38fba77954f531a455fff28f8b13 (diff) | |
Cleanup: rename some methods in FilePickerCtrl and use boost::filesystem::path more.
Diffstat (limited to 'src/wx/file_picker_ctrl.cc')
| -rw-r--r-- | src/wx/file_picker_ctrl.cc | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/wx/file_picker_ctrl.cc b/src/wx/file_picker_ctrl.cc index 4bb6518ef..07424e74c 100644 --- a/src/wx/file_picker_ctrl.cc +++ b/src/wx/file_picker_ctrl.cc @@ -55,13 +55,14 @@ FilePickerCtrl::FilePickerCtrl (wxWindow* parent, wxString prompt, wxString wild _file->Bind (wxEVT_BUTTON, boost::bind (&FilePickerCtrl::browse_clicked, this)); } + void -FilePickerCtrl::SetPath (wxString p) +FilePickerCtrl::set_path(boost::filesystem::path path) { - _path = p; + _path = path; - if (!_path.IsEmpty ()) { - _file->SetLabel(std_to_wx(filesystem::path(wx_to_std(_path)).filename().string())); + if (!_path.empty()) { + _file->SetLabel(std_to_wx(_path.filename().string())); } else { _file->SetLabel (_("(None)")); } @@ -70,12 +71,14 @@ FilePickerCtrl::SetPath (wxString p) GetEventHandler()->ProcessEvent (ev); } -wxString -FilePickerCtrl::GetPath () const + +boost::filesystem::path +FilePickerCtrl::path() const { return _path; } + void FilePickerCtrl::browse_clicked () { @@ -84,14 +87,14 @@ FilePickerCtrl::browse_clicked () style |= wxFD_OVERWRITE_PROMPT; } wxFileDialog dialog(this, _prompt, wxEmptyString, wxEmptyString, _wildcard, style); - dialog.SetPath(_path); + dialog.SetPath(std_to_wx(_path.string())); if (dialog.ShowModal() == wxID_OK) { - SetPath(dialog.GetPath()); + set_path(boost::filesystem::path(wx_to_std(dialog.GetPath()))); } } void -FilePickerCtrl::SetWildcard (wxString w) +FilePickerCtrl::set_wildcard(wxString w) { _wildcard = w; } |
