![]() |
BSB Developer Docs
|
A widget that arranges its elements in flexible rows or columns. More...
#include <gui/widget.h>Go to the source code of this file.
Typedefs | |
| typedef struct FlexLayout | FlexLayout |
| FlexLayout opaque structure. | |
Enumerations | |
| enum | FlexLayoutType { FlexLayoutTypeRow , FlexLayoutTypeColumn , FlexLayoutTypeMax } |
| Enumeration of possible flow types. More... | |
| enum | FlexLayoutAlign { FlexLayoutAlignStart , FlexLayoutAlignEnd , FlexLayoutAlignCenter , FlexLayoutAlignSpaceEvenly , FlexLayoutAlignSpaceAround , FlexLayoutAlignSpaceBetween } |
| Enumeration of possible item alignments. More... | |
Functions | |
| FlexLayout * | flex_layout_alloc (Widget *parent, FlexLayoutType type) |
| Create a new FlexLayout instance. | |
| void | flex_layout_free (FlexLayout *instance) |
| Delete a FlexLayout instance. | |
| Widget * | flex_layout_get_base (FlexLayout *instance) |
| Get a pointer to the base class instance. | |
| void | flex_layout_set_spacing (FlexLayout *instance, int32_t spacing) |
| Set the spacing between child elements. | |
| void | flex_layout_set_wrap (FlexLayout *instance, bool wrap) |
| Set the wrap behaviour of a FlexLayout instance. | |
| void | flex_layout_set_reverse (FlexLayout *instance, bool reverse) |
| Set the order of elements a FlexLayout instance. | |
| void | flex_layout_set_align (FlexLayout *instance, FlexLayoutAlign main, FlexLayoutAlign cross, FlexLayoutAlign track_cross) |
| Sets alignment, distribution and placement of child items. | |
| void | flex_layout_set_child_widget_grow (FlexLayout *instance, Widget *child, uint8_t grow) |
| Set how much space child widget will take in flex layout. | |
A widget that arranges its elements in flexible rows or columns.
To add a widget to a FlexLayout, pass it as the parent during your widget's creation.
| enum FlexLayoutAlign |
Enumeration of possible item alignments.
See flex_layout_set_align for more info
| enum FlexLayoutType |
| FlexLayout * flex_layout_alloc | ( | Widget * | parent, |
| FlexLayoutType | type ) |
Create a new FlexLayout instance.
| [in,out] | parent | pointer to the parent Widget instance |
| [in] | type | value determining the layout behaviour (row or column) |
| void flex_layout_free | ( | FlexLayout * | instance | ) |
Delete a FlexLayout instance.
| [in,out] | instance | pointer to the FlexLayout instance to be deleted |
| Widget * flex_layout_get_base | ( | FlexLayout * | instance | ) |
Get a pointer to the base class instance.
The return value can be used in all Widget methods.
| [in,out] | instance | pointer to the FlexLayout instance to be queried |
| void flex_layout_set_align | ( | FlexLayout * | instance, |
| FlexLayoutAlign | main, | ||
| FlexLayoutAlign | cross, | ||
| FlexLayoutAlign | track_cross ) |
Sets alignment, distribution and placement of child items.
Resources:
| [in,out] | instance | pointer to the FlexLayout instance to be modified |
| [in] | main | Placement of items along main axis. See https://css-tricks.com/snippets/css/a-guide-to-flexbox/#aa-justify-content |
| [in] | cross | Placement of items along cross axis. Doesn't accept the FlexLayoutAlignSpaceX variants of the enum. See https://css-tricks.com/snippets/css/a-guide-to-flexbox/#aa-align-items |
| [in] | track_cross | Placement of tracks along the cross axis. See https://css-tricks.com/snippets/css/a-guide-to-flexbox/#aa-align-content |
| void flex_layout_set_child_widget_grow | ( | FlexLayout * | instance, |
| Widget * | child, | ||
| uint8_t | grow ) |
Set how much space child widget will take in flex layout.
| [in,out] | instance | pointer to the FlexLayout instance to be modified |
| [in,out] | child | pointer to the widget instance to be modified, must be child if FlexLayout |
| [in] | grow | new grow value needs to be > 1 or 0 to disable grow on the child. |
| void flex_layout_set_reverse | ( | FlexLayout * | instance, |
| bool | reverse ) |
Set the order of elements a FlexLayout instance.
If reverse is false (the default), the widgets will be shown in the order of addition.
| [in,out] | instance | pointer to the FlexLayout instance to be modified |
| [in] | reverse | arrange elements in reverse order if true, regular order otherwise |
| void flex_layout_set_spacing | ( | FlexLayout * | instance, |
| int32_t | spacing ) |
Set the spacing between child elements.
| [in,out] | instance | pointer to the FlexLayout instance to be modified |
| [in] | spacing | spacing between elements, in pixels |
| void flex_layout_set_wrap | ( | FlexLayout * | instance, |
| bool | wrap ) |
Set the wrap behaviour of a FlexLayout instance.
| [in,out] | instance | pointer to the FlexLayout instance to be modified |
| [in] | wrap | wrap overflowing elements if true, do now wrap otherwise |