aboutsummaryrefslogtreecommitdiff
path: root/include/gui/GsrPage.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-08-25 13:39:33 +0200
committerdec05eba <dec05eba@protonmail.com>2024-08-25 13:39:33 +0200
commit3d5e8baa5f66547f1250950b10bd4108e30af423 (patch)
tree890101088903316749e2843829eb3aa6b67cd3ce /include/gui/GsrPage.hpp
parentb8e6949dfb8a88c832e82f8b7e853fe0ed462da0 (diff)
File chooser navigation
Diffstat (limited to 'include/gui/GsrPage.hpp')
-rw-r--r--include/gui/GsrPage.hpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/include/gui/GsrPage.hpp b/include/gui/GsrPage.hpp
index 916055a..1d298f4 100644
--- a/include/gui/GsrPage.hpp
+++ b/include/gui/GsrPage.hpp
@@ -3,6 +3,7 @@
#include "Page.hpp"
#include "Button.hpp"
+#include <functional>
#include <mglpp/graphics/Text.hpp>
namespace gsr {
@@ -19,9 +20,12 @@ namespace gsr {
mgl::vec2f get_inner_size() override;
void set_margins(float top, float bottom, float left, float right);
- void set_on_back_button_click(std::function<void()> on_click_handler);
+ void add_button(const std::string &text, const std::string &id, mgl::Color color);
+
+ std::function<void(const std::string &id)> on_click;
private:
void draw_page_label(mgl::Window &window, mgl::vec2f body_pos);
+ void draw_buttons(mgl::Window &window, mgl::vec2f body_pos, mgl::vec2f body_size);
void draw_children(mgl::Window &window, mgl::vec2f position);
float get_border_size() const;
@@ -29,11 +33,16 @@ namespace gsr {
mgl::vec2f get_content_position();
mgl::vec2f get_content_position_with_margin();
private:
+ struct ButtonItem {
+ std::unique_ptr<Button> button;
+ std::string id;
+ };
+
float margin_top_scale = 0.0f;
float margin_bottom_scale = 0.0f;
float margin_left_scale = 0.0f;
float margin_right_scale = 0.0f;
- Button back_button;
mgl::Text label_text;
+ std::vector<ButtonItem> buttons;
};
} \ No newline at end of file