12#include "../paint/insets.h"
13#include "../paint/border.h"
14#include "../paint/background.h"
22 virtual ~Parent()
override =
default;
24 virtual Component* getHitComponent(int32_t x, int32_t y)
override;
25 virtual void render(
const Sml::Rectangle<int32_t>& targetRegion)
override;
26 virtual void layout()
override final;
27 virtual void prerender()
override final;
28 virtual bool containsComponent(
Component* component)
override final;
30 virtual bool isResizable()
const override;
52 template <
typename Head,
typename... Tail>
75 std::list<Component*>& getChildren();
76 const std::list<Component*>& getChildrenReadonly()
const;
78 Sml::Texture* getSnapshot();
80 bool needLayoutPass()
const;
81 void requestLayoutPass();
84 void setBackground(
const Background* background);
86 const Border* getBorder()
const;
87 void setBorder(
const Border* border);
90 Sml::Rectangle<int32_t> getContentArea()
const;
93 void setPadding(
const Insets& padding);
95 void setPrefWidth(int32_t width);
96 void setPrefHeight(int32_t height);
98 void setMinWidth(int32_t width);
99 void setMinHeight(int32_t height);
101 void setMaxWidth(int32_t width);
102 void setMaxHeight(int32_t height);
104 int32_t getPrefWidth()
const;
105 int32_t getPrefHeight()
const;
107 int32_t getMinWidth()
const;
108 int32_t getMinHeight()
const;
110 int32_t getMaxWidth()
const;
111 int32_t getMaxHeight()
const;
113 virtual int32_t computePrefWidth(int32_t height = -1) const override final;
114 virtual int32_t computePrefHeight(int32_t width = -1) const override final;
116 virtual int32_t computeMinWidth(int32_t height = -1) const override final;
117 virtual int32_t computeMinHeight(int32_t width = -1) const override final;
119 virtual int32_t computeMaxWidth(int32_t height = -1) const override final;
120 virtual int32_t computeMaxHeight(int32_t width = -1) const override final;
124 Sml::Texture* m_Snapshot =
nullptr;
126 bool m_NeedLayoutPass = false;
128 const
Border* m_Border =
nullptr;
131 int32_t m_PrefWidth = USE_COMPUTED_SIZE;
132 int32_t m_PrefHeight = USE_COMPUTED_SIZE;
133 int32_t m_MinWidth = USE_COMPUTED_SIZE;
134 int32_t m_MinHeight = USE_COMPUTED_SIZE;
135 int32_t m_MaxWidth = USE_COMPUTED_SIZE;
136 int32_t m_MaxHeight = USE_COMPUTED_SIZE;
138 virtual
void setSceneInSceneTree(
Scene* scene) override final;
140 virtual
void layoutChildren();
141 virtual
void prerenderSelf();
142 void updateSnapshotSize();
144 virtual int32_t computeCustomPrefWidth(int32_t height = -1) const;
145 virtual int32_t computeCustomPrefHeight(int32_t width = -1) const;
147 virtual int32_t computeCustomMinWidth(int32_t height = -1) const;
148 virtual int32_t computeCustomMinHeight(int32_t width = -1) const;
150 virtual int32_t computeCustomMaxWidth(int32_t height = -1) const;
151 virtual int32_t computeCustomMaxHeight(int32_t width = -1) const;
void addChild(Component *child)
Convenience method for adding a child to Parent.
void removeChild(Component *child)
Convenience method for removing a child to Parent.
void addChildren(Head head, Tail... tail)
Convenience method for adding multiple children to Parent.