Flint Engine
Modular C++20 2D game engine powered by SDL3
Loading...
Searching...
No Matches
panel.h
1// SPDX-License-Identifier: MIT
2// SPDX-FileCopyrightText: 2025-2026 Manuel Osorio
3#pragma once
4
5#include "flint/core/api.h"
6#include "flint/ui/ui-node.h"
7#include "flint/ui/ui-types.h"
8
9namespace Flint {
10
19 class UIPanel : public UINode {
20 public:
21 UIPanel() = default;
22 ~UIPanel() override = default;
23
25 FLINT_API void setLayout(UILayoutDirection direction);
26
28 [[nodiscard]] UILayoutDirection getLayout() const {
29 return m_direction;
30 }
31
33 FLINT_API void setPadding(UIPadding padding);
34
35 [[nodiscard]] const UIPadding &getPadding() const {
36 return m_padding;
37 }
38
40 FLINT_API void setGap(float gap);
41
42 [[nodiscard]] float getGap() const {
43 return m_gap;
44 }
45
49 FLINT_API void measure(UIConstraints constraints) override;
50
56 FLINT_API void arrange(const Rect<float> &rect) override;
57 FLINT_API void render(UICanvas &canvas) const override;
58
59 private:
60 UILayoutDirection m_direction = UILayoutDirection::Vertical;
61 UIPadding m_padding = {};
62 float m_gap = 8.0f;
63 };
64
65}
Dynamic 2D batching engine processing shape vector geometry and hardware-accelerated text strings....
Definition ui-canvas.h:107
Abstract base class for all UI widgets, managing hierarchy tracking, layout passes,...
Definition ui-node.h:31
A container widget that arranges child nodes into sequential layout distributions.
Definition panel.h:19
UILayoutDirection getLayout() const
Gets the active layout axis stacking direction.
Definition panel.h:28
FLINT_API void setGap(float gap)
Gap inserted between consecutive children (pixels). Default: 8.
FLINT_API void render(UICanvas &canvas) const override
Pushes current styling rules and geometries straight down to the active pipeline vertex drawing queue...
FLINT_API void measure(UIConstraints constraints) override
Accumulates the child node sizes along the layout axis, adding border paddings.
FLINT_API void arrange(const Rect< float > &rect) override
Computes and maps specific layout regions for all children.
FLINT_API void setPadding(UIPadding padding)
Space added inside the panel border on all four sides.
FLINT_API void setLayout(UILayoutDirection direction)
Sets the layout axis direction along which children are sequentially stacked.
Generic axis-aligned rectangle defined by a position and size.
Definition types.h:87
Represents the boundary budget passed down the node tree during layout allocation.
Definition ui-types.h:76
Defines the internal spacing boundaries (in pixels) for UI layout containers.
Definition ui-types.h:50