diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-08-25 13:39:33 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-08-25 13:39:33 +0200 |
commit | 3d5e8baa5f66547f1250950b10bd4108e30af423 (patch) | |
tree | 890101088903316749e2843829eb3aa6b67cd3ce /src/gui/Button.cpp | |
parent | b8e6949dfb8a88c832e82f8b7e853fe0ed462da0 (diff) |
File chooser navigation
Diffstat (limited to 'src/gui/Button.cpp')
-rw-r--r-- | src/gui/Button.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/gui/Button.cpp b/src/gui/Button.cpp index 6c475bd..0cf5bee 100644 --- a/src/gui/Button.cpp +++ b/src/gui/Button.cpp @@ -23,8 +23,9 @@ namespace gsr { const mgl::vec2f item_size = get_size().floor(); if(event.type == mgl::Event::MouseButtonPressed && event.mouse_button.button == mgl::Mouse::Left) { const bool clicked_inside = mgl::FloatRect(position + offset, item_size).contains({ (float)event.mouse_button.x, (float)event.mouse_button.y }); - if(clicked_inside && on_click) { - on_click(); + if(clicked_inside) { + if(on_click) + on_click(); return false; } } @@ -76,4 +77,8 @@ namespace gsr { const std::string& Button::get_text() const { return text.get_string(); } + + void Button::set_text(std::string str) { + text.set_string(std::move(str)); + } }
\ No newline at end of file |