diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-08-07 00:21:32 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-08-07 00:21:35 +0200 |
commit | a3e479d5b289166ff651fac4ff046656cf78cda0 (patch) | |
tree | 2ba345228acfe45acf9863bb122e163ed38db7db /src/gui/ComboBox.cpp | |
parent | b229b060add5f66bd5532698c4a790285095e98a (diff) |
Add radio button with simple/advanced view, add widget visibility
Diffstat (limited to 'src/gui/ComboBox.cpp')
-rw-r--r-- | src/gui/ComboBox.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gui/ComboBox.cpp b/src/gui/ComboBox.cpp index 9decab7..0b232f2 100644 --- a/src/gui/ComboBox.cpp +++ b/src/gui/ComboBox.cpp @@ -19,6 +19,9 @@ namespace gsr { } bool ComboBox::on_event(mgl::Event &event, mgl::Window&, mgl::vec2f offset) { + if(!visible) + return true; + const int padding_top = padding_top_scale * get_theme().window_height; const int padding_bottom = padding_bottom_scale * get_theme().window_height; const int padding_left = padding_left_scale * get_theme().window_height; @@ -60,6 +63,9 @@ namespace gsr { } void ComboBox::draw(mgl::Window &window, mgl::vec2f offset) { + if(!visible) + return; + update_if_dirty(); if(items.empty()) @@ -92,7 +98,7 @@ namespace gsr { window.draw(dropdown_arrow); } - const bool mouse_inside = mgl::FloatRect(draw_pos, item_size).contains(window.get_mouse_position().to_vec2f()); + const bool mouse_inside = mgl::FloatRect(draw_pos, item_size).contains(window.get_mouse_position().to_vec2f()) && !has_parent_with_selected_child_widget(); mgl::vec2f pos = draw_pos + mgl::vec2f(padding_left, padding_top); Item &item = items[selected_item]; @@ -164,6 +170,9 @@ namespace gsr { } mgl::vec2f ComboBox::get_size() { + if(!visible) + return {0.0f, 0.0f}; + update_if_dirty(); const int padding_top = padding_top_scale * get_theme().window_height; |