diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-10-20 11:42:14 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-10-20 11:42:14 +0100 |
| commit | 00b60f52add041a36fa62118baf4b5ac78993980 (patch) | |
| tree | a1427c61dc4ed0a17bb9f120985481f1772b9d50 /src/wx/editable_list.h | |
| parent | bd3be0efd59054666fd04d69715275f257994f5e (diff) | |
Give a better error if the user tries to load a non-KDM as a DKDM into the KDM creator.
Diffstat (limited to 'src/wx/editable_list.h')
| -rw-r--r-- | src/wx/editable_list.h | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/wx/editable_list.h b/src/wx/editable_list.h index 8226c9cac..681588215 100644 --- a/src/wx/editable_list.h +++ b/src/wx/editable_list.h @@ -27,8 +27,6 @@ #include <boost/function.hpp> #include <vector> -bool always_valid (); - /** @param T type of things being edited. * @param S dialog to edit a thing. */ @@ -41,7 +39,6 @@ public: std::vector<std::string> columns, boost::function<std::vector<T> ()> get, boost::function<void (std::vector<T>)> set, - boost::function<bool (T)> valid, boost::function<std::string (T, int)> column, bool can_edit = true, bool title = true @@ -49,7 +46,6 @@ public: : wxPanel (parent) , _get (get) , _set (set) - , _valid (valid) , _columns (columns.size ()) , _column (column) , _edit (0) @@ -159,11 +155,11 @@ private: S* dialog = new S (this); if (dialog->ShowModal() == wxID_OK) { - T const v = dialog->get (); - if (_valid (v)) { - add_to_control (v); + boost::optional<T> const v = dialog->get (); + if (v) { + add_to_control (v.get ()); std::vector<T> all = _get (); - all.push_back (v); + all.push_back (v.get ()); _set (all); } } @@ -184,12 +180,12 @@ private: S* dialog = new S (this); dialog->set (all[item]); if (dialog->ShowModal() == wxID_OK) { - T const v = dialog->get (); - if (!_valid (v)) { + boost::optional<T> const v = dialog->get (); + if (!v) { return; } - all[item] = v; + all[item] = v.get (); } dialog->Destroy (); @@ -226,7 +222,6 @@ private: boost::function <std::vector<T> ()> _get; boost::function <void (std::vector<T>)> _set; - boost::function <bool (T)> _valid; int _columns; boost::function<std::string (T, int)> _column; |
