diff options
Diffstat (limited to 'src/gui/DropdownButton.cpp')
-rw-r--r-- | src/gui/DropdownButton.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gui/DropdownButton.cpp b/src/gui/DropdownButton.cpp index bfda834..b20dbb4 100644 --- a/src/gui/DropdownButton.cpp +++ b/src/gui/DropdownButton.cpp @@ -37,9 +37,20 @@ namespace gsr { } } else if(event.type == mgl::Event::MouseButtonPressed) { const bool clicked_inside = mouse_inside; + + if(show_dropdown && clicked_inside && mouse_inside_item == -1) { + show_dropdown = false; + remove_widget_as_selected_in_parent(); + return false; + } + show_dropdown = clicked_inside; + if(show_dropdown) - move_to_top = true; + set_widget_as_selected_in_parent(); + else + remove_widget_as_selected_in_parent(); + if(mouse_inside_item >= 0 && mouse_inside_item < (int)items.size()) { if(on_click) on_click(items[mouse_inside_item].id); |