aboutsummaryrefslogtreecommitdiff
path: root/include/gui/Subsection.hpp
diff options
context:
space:
mode:
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