aboutsummaryrefslogtreecommitdiff
path: root/include/gui/Subsection.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-09-08 17:07:22 +0200
committerdec05eba <dec05eba@protonmail.com>2024-09-08 17:07:22 +0200
commitb145d957e3809fd6c2d814c34c58234ade983bb0 (patch)
tree3e8842c72afe0045645ad32a0b3a9ab708c575ee /include/gui/Subsection.hpp
parent3d5e8baa5f66547f1250950b10bd4108e30af423 (diff)
More
Diffstat (limited to 'include/gui/Subsection.hpp')
-rw-r--r--include/gui/Subsection.hpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/gui/Subsection.hpp b/include/gui/Subsection.hpp
new file mode 100644
index 0000000..90cb798
--- /dev/null
+++ b/include/gui/Subsection.hpp
@@ -0,0 +1,24 @@
+#pragma once
+
+#include "Widget.hpp"
+#include "Label.hpp"
+#include <memory>
+
+namespace gsr {
+ class Subsection : public Widget {
+ public:
+ // If size width or height is 0 then the size in that direction is the size of the widgets
+ Subsection(const char *title, std::unique_ptr<Widget> inner_widget, mgl::vec2f size);
+ Subsection(const Subsection&) = delete;
+ Subsection& operator=(const Subsection&) = 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;
+ private:
+ Label label;
+ std::unique_ptr<Widget> inner_widget;
+ mgl::vec2f size;
+ };
+} \ No newline at end of file