diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-08-07 21:27:36 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-08-07 21:27:36 +0200 |
commit | 1a49f86e9841035fe670f6b42a3c988f737267d2 (patch) | |
tree | 9059935a17d2599ae9f366975472314a9c89e052 /include | |
parent | b709805cfac4d1fe1bfe28e497a3e48e224372a8 (diff) |
Add settings icon, close window when pressing the close button
Diffstat (limited to 'include')
-rw-r--r-- | include/Theme.hpp | 3 | ||||
-rw-r--r-- | include/gui/CheckBox.hpp | 2 | ||||
-rw-r--r-- | include/gui/CustomRendererWidget.hpp | 25 |
3 files changed, 29 insertions, 1 deletions
diff --git a/include/Theme.hpp b/include/Theme.hpp index ced85bd..cc321bd 100644 --- a/include/Theme.hpp +++ b/include/Theme.hpp @@ -28,7 +28,8 @@ namespace gsr { mgl::Font title_font; mgl::Font top_bar_font; - mgl::Texture combobox_arrow; + mgl::Texture combobox_arrow_texture; + mgl::Texture settings_texture; }; bool init_theme(const gsr::GsrInfo &gsr_info, mgl::vec2i window_size, const std::string &resources_path); diff --git a/include/gui/CheckBox.hpp b/include/gui/CheckBox.hpp index c91b947..19ffaf6 100644 --- a/include/gui/CheckBox.hpp +++ b/include/gui/CheckBox.hpp @@ -16,6 +16,8 @@ namespace gsr { void draw(mgl::Window &window, mgl::vec2f offset) override; mgl::vec2f get_size() override; + + void set_checked(bool checked); bool is_checked() const; private: mgl::vec2f get_checkbox_size(); diff --git a/include/gui/CustomRendererWidget.hpp b/include/gui/CustomRendererWidget.hpp new file mode 100644 index 0000000..e16e532 --- /dev/null +++ b/include/gui/CustomRendererWidget.hpp @@ -0,0 +1,25 @@ +#pragma once + +#include "Widget.hpp" + +#include <functional> + +namespace gsr { + class CustomRendererWidget : public Widget { + public: + CustomRendererWidget(mgl::vec2f size); + CustomRendererWidget(const CustomRendererWidget&) = delete; + CustomRendererWidget& operator=(const CustomRendererWidget&) = delete; + + bool on_event(mgl::Event &event, mgl::Window &window, mgl::vec2f offset) override; + void draw(mgl::Window &window, mgl::vec2f offset) override; + + mgl::vec2f get_size() override; + + std::function<void(mgl::Window &window, mgl::vec2f pos, mgl::vec2f size)> draw_handler; + // Return true to allow other widgets to handle events + std::function<bool(mgl::Event &event, mgl::Window &window, mgl::vec2f pos, mgl::vec2f size)> event_handler; + private: + mgl::vec2f size; + }; +}
\ No newline at end of file |