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/DropdownButton.cpp | |
parent | b229b060add5f66bd5532698c4a790285095e98a (diff) |
Add radio button with simple/advanced view, add widget visibility
Diffstat (limited to 'src/gui/DropdownButton.cpp')
-rw-r--r-- | src/gui/DropdownButton.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gui/DropdownButton.cpp b/src/gui/DropdownButton.cpp index 5cc9a3d..50a3105 100644 --- a/src/gui/DropdownButton.cpp +++ b/src/gui/DropdownButton.cpp @@ -26,6 +26,9 @@ namespace gsr { } bool DropdownButton::on_event(mgl::Event &event, mgl::Window&, mgl::vec2f offset) { + if(!visible) + return true; + if(event.type == mgl::Event::MouseMoved) { const mgl::vec2f draw_pos = position + offset; const mgl::vec2f collision_margin(1.0f, 1.0f); // Makes sure that multiple buttons that are next to each other wont activate at the same time when the cursor is right between them @@ -56,6 +59,9 @@ namespace gsr { } void DropdownButton::draw(mgl::Window &window, mgl::vec2f offset) { + if(!visible) + return; + update_if_dirty(); const mgl::vec2f draw_pos = position + offset; @@ -199,6 +205,9 @@ namespace gsr { } mgl::vec2f DropdownButton::get_size() { + if(!visible) + return {0.0f, 0.0f}; + update_if_dirty(); return size; } |