/** * @file Layout.h * @author apio (cloudapio.eu) * @brief Layout widgets to organize content. * * @copyright Copyright (c) 2023, the Luna authors. * */ #pragma once #include #include namespace ui { enum class AdjustHeight { No, Yes }; enum class AdjustWidth { No, Yes }; class HorizontalLayout final : public Widget { public: HorizontalLayout(AdjustHeight adjust_height = AdjustHeight::Yes, AdjustWidth adjust_width = AdjustWidth::Yes); Result handle_mousemove(Point position) override; Result draw(Canvas& canvas) override; Result add_widget(Widget& widget); private: Vector m_widgets; AdjustHeight m_adjust_height; AdjustWidth m_adjust_width; int m_used_width; }; class VerticalLayout final : public Widget { public: VerticalLayout(AdjustHeight adjust_height = AdjustHeight::Yes, AdjustWidth adjust_width = AdjustWidth::Yes); Result handle_mousemove(Point position) override; Result draw(Canvas& canvas) override; Result add_widget(Widget& widget); private: Vector m_widgets; AdjustHeight m_adjust_height; AdjustWidth m_adjust_width; int m_used_height; }; }