46 lines
893 B
C
46 lines
893 B
C
|
/**
|
||
|
* @file Layout.h
|
||
|
* @author apio (cloudapio.eu)
|
||
|
* @brief Layout widgets to organize content.
|
||
|
*
|
||
|
* @copyright Copyright (c) 2023, the Luna authors.
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
#pragma once
|
||
|
#include <luna/Vector.h>
|
||
|
#include <ui/Widget.h>
|
||
|
|
||
|
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<EventResult> handle_mousemove(Point position) override;
|
||
|
|
||
|
Result<void> draw(Canvas& canvas) override;
|
||
|
|
||
|
Result<void> add_widget(Widget& widget);
|
||
|
|
||
|
private:
|
||
|
Vector<Widget*> m_widgets;
|
||
|
AdjustHeight m_adjust_height;
|
||
|
AdjustWidth m_adjust_width;
|
||
|
int m_used_width;
|
||
|
};
|
||
|
}
|