diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-08-07 20:32:59 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-08-07 20:32:59 +0200 |
commit | b709805cfac4d1fe1bfe28e497a3e48e224372a8 (patch) | |
tree | 82f4bb638805dd58017d933fafd2143eb8019637 /src/gui/RadioButton.cpp | |
parent | 2ea32e11093a4d057338c02abbff4807446ff8de (diff) |
Move settings ui to SettingsPage class, show different widgets for different settings page, show different widgets depending on combobox selections
Diffstat (limited to 'src/gui/RadioButton.cpp')
-rw-r--r-- | src/gui/RadioButton.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/gui/RadioButton.cpp b/src/gui/RadioButton.cpp index b3e9a4e..15b0989 100644 --- a/src/gui/RadioButton.cpp +++ b/src/gui/RadioButton.cpp @@ -121,10 +121,16 @@ namespace gsr { dirty = true; } - void RadioButton::set_selected_item(const std::string &id) { + void RadioButton::set_selected_item(const std::string &id, bool trigger_event) { for(size_t i = 0; i < items.size(); ++i) { - if(items[i].id == id) { + auto &item = items[i]; + if(item.id == id) { + const size_t prev_selected_item = selected_item; selected_item = i; + + if(trigger_event && selected_item != prev_selected_item && on_selection_changed) + on_selection_changed(item.text.get_string(), item.id); + break; } } |