summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2024-04-09 03:15:19 +0200
committerCarl Hetherington <cth@carlh.net>2024-04-16 00:39:05 +0200
commit1e3e63c16db89f8f8623283d683139587aa139b6 (patch)
tree6c9249d25b8f2bef6b651e63a1efbad22aaf8b35
parentec68c0a5aa1ae345e0054548b6f6f70d4cafa106 (diff)
Add leaf parameter to DirPickerCtrl.
-rw-r--r--src/wx/dir_picker_ctrl.cc9
-rw-r--r--src/wx/dir_picker_ctrl.h3
2 files changed, 9 insertions, 3 deletions
diff --git a/src/wx/dir_picker_ctrl.cc b/src/wx/dir_picker_ctrl.cc
index 3371c734b..a8c09e334 100644
--- a/src/wx/dir_picker_ctrl.cc
+++ b/src/wx/dir_picker_ctrl.cc
@@ -36,8 +36,9 @@ using namespace std;
using namespace boost;
-DirPickerCtrl::DirPickerCtrl (wxWindow* parent)
+DirPickerCtrl::DirPickerCtrl(wxWindow* parent, bool leaf)
: wxPanel (parent)
+ , _leaf(leaf)
{
_sizer = new wxBoxSizer (wxHORIZONTAL);
@@ -62,7 +63,11 @@ DirPickerCtrl::SetPath (wxString p)
if (_path == wxStandardPaths::Get().GetDocumentsDir()) {
_folder->SetLabel (_("My Documents"));
} else {
- _folder->SetLabel (_path);
+ if (_leaf) {
+ _folder->SetLabel(std_to_wx(boost::filesystem::path(wx_to_std(_path)).filename().string()));
+ } else {
+ _folder->SetLabel(_path);
+ }
}
wxCommandEvent ev (wxEVT_DIRPICKER_CHANGED, wxID_ANY);
diff --git a/src/wx/dir_picker_ctrl.h b/src/wx/dir_picker_ctrl.h
index f70168db4..31df9518c 100644
--- a/src/wx/dir_picker_ctrl.h
+++ b/src/wx/dir_picker_ctrl.h
@@ -33,7 +33,7 @@ LIBDCP_ENABLE_WARNINGS
class DirPickerCtrl : public wxPanel
{
public:
- explicit DirPickerCtrl (wxWindow *);
+ DirPickerCtrl(wxWindow *, bool leaf = false);
wxString GetPath () const;
void SetPath (wxString);
@@ -47,6 +47,7 @@ private:
wxButton* _browse;
wxString _path;
wxSizer* _sizer;
+ bool _leaf = false;
};
#endif