summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-12-17 18:26:06 +0100
committerCarl Hetherington <cth@carlh.net>2025-12-18 02:07:55 +0100
commit566a07ab73dd2d0dfc592771a4bff9ef2357e1b6 (patch)
tree0d2385a6ec38110856ef1a2bebd1fd82b3746457
parent48d8075858dd3587ffeadb8df9f40ec0fcc3b946 (diff)
Add optional custom button to EditableList.
-rw-r--r--src/wx/editable_list.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/wx/editable_list.h b/src/wx/editable_list.h
index 6b8c7110d..4b0a48f44 100644
--- a/src/wx/editable_list.h
+++ b/src/wx/editable_list.h
@@ -86,7 +86,8 @@ public:
std::function<void (wxWindow*, T&)> edit,
std::function<std::string (T, int)> column,
EditableListTitle title,
- int buttons
+ int buttons,
+ boost::optional<wxString> custom_button = {}
)
: wxPanel (parent)
, _get (get)
@@ -148,6 +149,10 @@ public:
_edit_button = new Button(this, _("Edit..."));
s->Add(_edit_button, 1, wxEXPAND | wxTOP | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP);
}
+ if (custom_button) {
+ _custom_button = new Button(this, *custom_button);
+ s->Add(_custom_button, 1, wxEXPAND | wxTOP | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP);
+ }
if (buttons & EditableListButton::REMOVE) {
_remove_button = new Button(this, _("Remove"));
s->Add(_remove_button, 1, wxEXPAND | wxTOP | wxBOTTOM, DCPOMATIC_BUTTON_STACK_GAP);
@@ -204,6 +209,11 @@ public:
_sizer->Layout ();
}
+ Button* custom_button()
+ {
+ return _custom_button;
+ }
+
boost::signals2::signal<void ()> SelectionChanged;
template <class S>
@@ -340,6 +350,7 @@ private:
wxButton* _add_button = nullptr;
wxButton* _edit_button = nullptr;
+ Button* _custom_button = nullptr;
wxButton* _remove_button = nullptr;
wxListCtrl* _list;
wxBoxSizer* _sizer;