aboutsummaryrefslogtreecommitdiff
path: root/src/gui/ComboBox.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-08-03 23:36:11 +0200
committerdec05eba <dec05eba@protonmail.com>2024-08-03 23:36:11 +0200
commit3a20c417cbf7d5db1d9d26abfbda388e58f96c18 (patch)
treea7552bff0a5164446eaade0dde570cd6111e474d /src/gui/ComboBox.cpp
parentc080342fcd358561af7edc64cea2222880923b93 (diff)
Align list items, dont process selected item twice if changed in event loop, mouse button events should only occur when pressing left mouse button
Diffstat (limited to 'src/gui/ComboBox.cpp')
-rw-r--r--src/gui/ComboBox.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gui/ComboBox.cpp b/src/gui/ComboBox.cpp
index 03e66bd..3aa4439 100644
--- a/src/gui/ComboBox.cpp
+++ b/src/gui/ComboBox.cpp
@@ -46,7 +46,6 @@ namespace gsr {
set_widget_as_selected_in_parent();
else
remove_widget_as_selected_in_parent();
- return false;
} else {
show_dropdown = false;
remove_widget_as_selected_in_parent();
@@ -118,6 +117,15 @@ namespace gsr {
dirty = true;
}
+ void ComboBox::set_selected_item(const std::string &id) {
+ for(size_t i = 0; i < items.size(); ++i) {
+ if(items[i].id == id) {
+ selected_item = i;
+ break;
+ }
+ }
+ }
+
void ComboBox::update_if_dirty() {
if(!dirty)
return;