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/Entry.cpp | |
parent | b229b060add5f66bd5532698c4a790285095e98a (diff) |
Add radio button with simple/advanced view, add widget visibility
Diffstat (limited to 'src/gui/Entry.cpp')
-rw-r--r-- | src/gui/Entry.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gui/Entry.cpp b/src/gui/Entry.cpp index e853bc8..e74e41e 100644 --- a/src/gui/Entry.cpp +++ b/src/gui/Entry.cpp @@ -22,6 +22,9 @@ namespace gsr { } bool Entry::on_event(mgl::Event &event, mgl::Window&, mgl::vec2f offset) { + if(!visible) + return true; + if(event.type == mgl::Event::MouseButtonPressed && event.mouse_button.button == mgl::Mouse::Left) { selected = mgl::FloatRect(position + offset, get_size()).contains({ (float)event.mouse_button.x, (float)event.mouse_button.y }); } else if(event.type == mgl::Event::KeyPressed && selected) { @@ -40,6 +43,9 @@ namespace gsr { } void Entry::draw(mgl::Window &window, mgl::vec2f offset) { + if(!visible) + return; + const mgl::vec2f draw_pos = position + offset; const int padding_top = padding_top_scale * get_theme().window_height; @@ -66,6 +72,9 @@ namespace gsr { } mgl::vec2f Entry::get_size() { + if(!visible) + return {0.0f, 0.0f}; + const int padding_top = padding_top_scale * get_theme().window_height; const int padding_bottom = padding_bottom_scale * get_theme().window_height; return { max_width, text.get_bounds().size.y + padding_top + padding_bottom }; |