2023-08-15 12:42:21 +00:00
|
|
|
/**
|
|
|
|
* @file Container.h
|
|
|
|
* @author apio (cloudapio.eu)
|
|
|
|
* @brief A container widget to pad and align objects inside it.
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2023, the Luna authors.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
#include <ui/Alignment.h>
|
|
|
|
#include <ui/Widget.h>
|
|
|
|
|
|
|
|
namespace ui
|
|
|
|
{
|
|
|
|
class Container : public Widget
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Container(Rect rect, VerticalAlignment valign, HorizontalAlignment halign);
|
|
|
|
|
|
|
|
void set_widget(Widget& widget);
|
|
|
|
|
2023-08-15 13:10:13 +00:00
|
|
|
Result<EventResult> handle_mouse_move(Point position) override;
|
2023-08-29 13:26:34 +00:00
|
|
|
Result<EventResult> handle_mouse_leave() override;
|
2023-08-15 13:10:13 +00:00
|
|
|
Result<EventResult> handle_mouse_down(Point position, int buttons) override;
|
|
|
|
Result<EventResult> handle_mouse_up(Point position, int buttons) override;
|
2023-08-15 12:42:21 +00:00
|
|
|
Result<void> draw(Canvas& canvas) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
Widget* m_widget;
|
|
|
|
VerticalAlignment m_valign;
|
|
|
|
HorizontalAlignment m_halign;
|
|
|
|
};
|
|
|
|
}
|