11#include <unordered_map>
13#include "sys/syscall.h"
30 LEFT_TO_RIGHT, TOP_TO_BOTTOM
33 enum class GrowPriority
43 Direction getDirection()
const;
44 void setDirection(Direction direction);
46 bool getFillAcross()
const;
47 void setFillAcross(
bool fillAcross);
49 int32_t getSpacing()
const;
50 void setSpacing(int32_t spacing);
52 void setGrowPriority(
Component* component, GrowPriority priority);
53 GrowPriority getGrowPriority(
Component* component)
const;
55 void pushBackSpacer(uint32_t weight = 1);
56 void pushFrontSpacer(uint32_t weight = 1);
61 Spacer(
Component* prevComponent =
nullptr, uint32_t weight = 1)
62 : prevComponent(prevComponent), weight(weight) {}
69 Direction m_Direction = Direction::LEFT_TO_RIGHT;
70 bool m_FillAcross =
false;
71 int32_t m_Spacing = 0;
73 std::list<Spacer> m_Spacers;
80 std::unordered_map<Component*, GrowPriority> m_GrowPriorities;
83 virtual void layoutChildren()
override;
85 virtual int32_t computeCustomPrefWidth(int32_t height = -1)
const override;
86 virtual int32_t computeCustomPrefHeight(int32_t width = -1)
const override;
88 virtual int32_t computeCustomMinWidth(int32_t height = -1)
const override;
89 virtual int32_t computeCustomMinHeight(int32_t width = -1)
const override;
91 enum class SizeDimension { WIDTH, HEIGHT };
93 int32_t computeTotalPrefSizeWithSpacing(SizeDimension sizeDimension)
const;
94 int32_t computeMaximumPrefSize(SizeDimension sizeDimension)
const;
96 void splitFreeSpace(int32_t freeSpace,
size_t countSpacers,
size_t countGrowingComponents,
97 int32_t* totalSpacersSpace, int32_t* totalGrowingComponentsSpace)
const;
99 uint32_t computeTotalSpacersWeight()
const;
100 int32_t computeSpacerSize(
Component* prev, uint32_t totalWeight, int32_t totalSpacersSize)
const;
103 size_t computeGrowingComponentsCount(GrowPriority priority)
const;
110 virtual ~HBox()
override =
default;
117 virtual ~VBox()
override =
default;
Basic list-like container which lays out children in a line one after another.