9 #include "tb_widgets.h"
14 #define SPACING_FROM_SKIN TB_INVALID_DIMENSION
111 int GetSpacing()
const {
return m_spacing; }
117 int GetOverflowScroll()
const {
return m_overflow_scroll; }
152 virtual void OnResized(
int old_w,
int old_h);
155 virtual void ScrollTo(
int x,
int y);
161 int m_overflow_scroll;
164 uint32_t layout_is_invalid : 1;
165 uint32_t layout_mode_size : 4;
166 uint32_t layout_mode_pos : 4;
167 uint32_t layout_mode_overflow : 4;
168 uint32_t layout_mode_dist : 4;
169 uint32_t layout_mode_dist_pos : 4;
170 uint32_t mode_reverse_order : 1;
171 uint32_t paint_overflow_fadeout : 1;
173 uint32_t m_packed_init;
175 void ValidateLayout(
const SizeConstraints &constraints, PreferredSize *calculate_ps =
nullptr);
178 int GetWantedHeight(
WIDGET_GRAVITY gravity,
const PreferredSize &ps,
int available_height)
const;
179 TBWidget *GetNextNonCollapsedWidget(TBWidget *child)
const;
180 int GetTrailingSpace(TBWidget *child,
int spacing)
const;
181 int CalculateSpacing();
182 TBWidget *GetFirstInLayoutOrder()
const;
183 TBWidget *GetNextInLayoutOrder(TBWidget *child)
const;
188 #endif // TB_LAYOUT_H
AXIS
Definition: tb_widgets.h:251
Create a scroller.
Definition: tb_layout.h:82
virtual void GetChildTranslation(int &x, int &y) const
Return translation the children should have.
Definition: tb_layout.cpp:520
virtual void InvalidateLayout(INVALIDATE_LAYOUT il)
Invalidate layout for this widget so it will be scheduled for relayout.
Definition: tb_layout.cpp:110
Size should grow to all available space.
Definition: tb_layout.h:27
void SetSpacing(int spacing)
Set the spacing between widgets in this layout.
Definition: tb_layout.cpp:39
Clip the chilren widgtes. [default].
Definition: tb_layout.h:81
virtual PreferredSize OnCalculatePreferredContentSize(const SizeConstraints &constraints)
Calculate the preferred content size for this widget.
Definition: tb_layout.cpp:403
WIDGET_GRAVITY
TBWidget gravity (may be combined).
Definition: tb_widgets.h:237
virtual WIDGET_HIT_STATUS GetHitStatus(int x, int y)
Check if there's an interactible child at the location.
Definition: tb_layout.cpp:411
virtual void OnProcess()
Callback for doing anything that might be needed before paint.
Definition: tb_layout.cpp:502
void SetLayoutDistribution(LAYOUT_DISTRIBUTION distribution)
Set the layout distribution mode.
Definition: tb_layout.cpp:85
LAYOUT_POSITION
Specifies which y position widgets in a AXIS_X layout should have, or which x position widgets in a A...
Definition: tb_layout.h:37
Size will be the preferred so each widget may be sized differently. [default].
Definition: tb_layout.h:53
Size will be the preferred so each widget may be sized differently. [default].
Definition: tb_layout.h:26
virtual void OnDeflate(const INFLATE_INFO &info)
Called when this widget is deflated to a node, before any children have been deflated.
Definition: tb_widgets_reader.cpp:526
virtual bool OnEvent(const TBWidgetEvent &ev)
Callback for handling events.
Definition: tb_layout.cpp:435
Position is to the right for AXIS_Y layout and bottom for AXIS_X layout.
Definition: tb_layout.h:40
Specifies size constraints used during size calculations.
Definition: tb_widgets.h:321
Horizontal layout.
Definition: tb_widgets.h:252
void SetLayoutDistributionPosition(LAYOUT_DISTRIBUTION_POSITION distribution_pos)
Set the layout distribution position mode.
Definition: tb_layout.cpp:93
Size should grow to all available space.
Definition: tb_layout.h:54
Sizes depend on the gravity for each widget.
Definition: tb_layout.h:24
virtual void OnResized(int old_w, int old_h)
Called when this widget has been resized.
Definition: tb_layout.cpp:508
void SetPaintOverflowFadeout(bool paint_fadeout)
Set if a fadeout should be painter where the layout overflows or not.
Definition: tb_layout.h:120
LAYOUT_DISTRIBUTION_POSITION
Specifies how widgets should be moved horizontally in a AXIS_X layout (or vertically in a AXIS_Y layo...
Definition: tb_layout.h:66
LAYOUT_OVERFLOW
Specifies what happens when there is not enough room for the layout, even when all the children have ...
Definition: tb_layout.h:80
Position depend on the gravity for each widget.
Definition: tb_layout.h:41
From top to bottom widget.
Definition: tb_layout.h:75
Position centered. [default].
Definition: tb_layout.h:67
WIDGET_HIT_STATUS
Hit status return value for TBWidget::GetHitStatus.
Definition: tb_widgets.h:398
Position to the lower right.
Definition: tb_layout.h:69
void SetOverflowScroll(int overflow_scroll)
Set the overflow scroll.
Definition: tb_layout.cpp:47
INFLATE_INFO contains info passed to TBWidget::OnInflate during resource loading. ...
Definition: tb_widgets_reader.h:21
LAYOUT_DISTRIBUTION
Specifies which width widgets in a AXIS_X layout should have, or which height widgets in a AXIS_Y lay...
Definition: tb_layout.h:52
bool QualifyForExpansion(WIDGET_GRAVITY gravity) const
Can this TBLayout expand in its direction?
Definition: tb_layout.cpp:160
void SetLayoutSize(LAYOUT_SIZE size)
Set the layout size mode.
Definition: tb_layout.cpp:61
LAYOUT_SIZE
Specifies which height widgets in a AXIS_X layout should have, or which width widgets in a AXIS_Y lay...
Definition: tb_layout.h:23
Position is to the left for AXIS_Y layout and top for AXIS_X layout.
Definition: tb_layout.h:39
virtual void OnInflateChild(TBWidget *child)
Called just after a child has been inflated into this widget.
Definition: tb_layout.cpp:515
virtual void OnPaintChildren(const PaintProps &paint_props)
Callback for painting child widgets.
Definition: tb_layout.cpp:450
virtual void SetAxis(AXIS axis)
Set along which axis the content should be layouted.
Definition: tb_layout.cpp:30
From bottom to top widget (default creation order).
Definition: tb_layout.h:74
Position is centered. [default].
Definition: tb_layout.h:38
Sizes depend on the gravity for each widget.
Definition: tb_layout.h:55
virtual AXIS GetAxis() const
See TBWidget::SetAxis.
Definition: tb_layout.h:106
void SetLayoutPosition(LAYOUT_POSITION pos)
Set the layout position mode.
Definition: tb_layout.cpp:69
virtual void OnInflate(const INFLATE_INFO &info)
Called when this widget is inflated from resources, before any children have been inflated...
Definition: tb_widgets_reader.cpp:453
void SetLayoutOrder(LAYOUT_ORDER order)
Set the layout order.
Definition: tb_layout.cpp:101
Position to the upper left.
Definition: tb_layout.h:68
PreferredSize contains size preferences for a TBWidget.
Definition: tb_widgets.h:277
void SetLayoutOverflow(LAYOUT_OVERFLOW overflow)
Set the layout size mode.
Definition: tb_layout.cpp:77
TBLayout layouts its children along the given axis.
Definition: tb_layout.h:96
virtual TBWidget::ScrollInfo GetScrollInfo()
If this is a widget that scroll children (see GetChildTranslation), it should return the current scro...
Definition: tb_layout.cpp:539
LAYOUT_ORDER
Layout order parameter for TBLayout::SetLayoutOrder.
Definition: tb_layout.h:73
virtual void ScrollTo(int x, int y)
If this is a widget that scroll children (see GetChildTranslation), it should scroll to the coordinat...
Definition: tb_layout.cpp:534