summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2018-09-23 01:34:15 +0100
committerCarl Hetherington <cth@carlh.net>2018-09-23 01:34:15 +0100
commit69e46a5803c9c015f3da4153340b3d4554deea2e (patch)
treeedae6849bb2523c3d688100def95e7671aa320e6 /src
parentdc9e313384e77a2cad31f40b87b42b7378e9be36 (diff)
Add checked_set for wxDirPickerCtrl.
Diffstat (limited to 'src')
-rw-r--r--src/wx/wx_util.cc15
-rw-r--r--src/wx/wx_util.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc
index 7edcabf40..91fd42624 100644
--- a/src/wx/wx_util.cc
+++ b/src/wx/wx_util.cc
@@ -30,6 +30,7 @@
#include <dcp/locale_convert.h>
#include <wx/spinctrl.h>
#include <wx/splash.h>
+#include <wx/filepicker.h>
#include <boost/thread.hpp>
using namespace std;
@@ -196,6 +197,20 @@ checked_set (FilePickerCtrl* widget, boost::filesystem::path value)
}
void
+checked_set (wxDirPickerCtrl* widget, boost::filesystem::path value)
+{
+ if (widget->GetPath() != std_to_wx (value.string())) {
+ if (value.empty()) {
+ /* Hack to make wxWidgets clear the control when we are passed
+ an empty value.
+ */
+ value = " ";
+ }
+ widget->SetPath (std_to_wx (value.string()));
+ }
+}
+
+void
checked_set (wxSpinCtrl* widget, int value)
{
if (widget->GetValue() != value) {
diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h
index f59f5d683..1acca044a 100644
--- a/src/wx/wx_util.h
+++ b/src/wx/wx_util.h
@@ -36,6 +36,7 @@
#endif
class FilePickerCtrl;
+class wxDirPickerCtrl;
class wxSpinCtrl;
class wxSpinCtrlDouble;
class wxGridBagSizer;
@@ -89,6 +90,7 @@ extern boost::filesystem::path path_from_file_dialog (wxFileDialog* dialog, std:
extern double calculate_mark_interval (double start);
extern void checked_set (FilePickerCtrl* widget, boost::filesystem::path value);
+extern void checked_set (wxDirPickerCtrl* widget, boost::filesystem::path value);
extern void checked_set (wxSpinCtrl* widget, int value);
extern void checked_set (wxSpinCtrlDouble* widget, double value);
extern void checked_set (wxChoice* widget, int value);