BSB Developer Docs
Loading...
Searching...
No Matches
flex_box.h File Reference

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 FlexBox FlexBox
 FlexBox opaque structure.
 

Enumerations

enum  FlexBoxFlow { FlexBoxFlowRow , FlexBoxFlowColumn , FlexBoxFlowMax }
 Enumeration of possible flow types. More...
 
enum  FlexBoxAlign { FlexBoxAlignStart , FlexBoxAlignEnd , FlexBoxAlignCenter , FlexBoxAlignMax }
 Enumeration of possible item alignment types. More...
 

Functions

FlexBox * flex_box_alloc (Widget *parent)
 Create a new FlexBox instance.
 
void flex_box_free (FlexBox *instance)
 Delete a FlexBox instance.
 
Widget * flex_box_get_base (FlexBox *instance)
 Get a pointer to the base class instance.
 
void flex_box_set_flow (FlexBox *instance, FlexBoxFlow flow)
 Set the direction in which the child elements will be arranged.
 
void flex_box_set_align (FlexBox *instance, FlexBoxAlign main, FlexBoxAlign cross)
 Set the alignment type of the child elements.
 
void flex_box_set_spacing (FlexBox *instance, int32_t spacing)
 Set the spacing between child elements.
 

Detailed Description

A widget that arranges its elements in flexible rows or columns.

To add a widget to a FlexBox, pass it as the parent during your widget's creation.

Enumeration Type Documentation

◆ FlexBoxAlign

Enumeration of possible item alignment types.

Enumerator
FlexBoxAlignStart 

Align items to start of axis.

FlexBoxAlignEnd 

Align items to start of axis.

FlexBoxAlignCenter 

Align items to middle of axis.

FlexBoxAlignMax 

Special value, not to be used in user code.

◆ FlexBoxFlow

Enumeration of possible flow types.

Enumerator
FlexBoxFlowRow 

Arrange elements in a row.

FlexBoxFlowColumn 

Arrange elements in a column.

FlexBoxFlowMax 

Special value, not to be used in user code.

Function Documentation

◆ flex_box_alloc()

FlexBox * flex_box_alloc ( Widget * parent)

Create a new FlexBox instance.

Parameters
[in,out]parentpointer to the parent Widget instance
Returns
pointer to the newly created FlexBox instance

◆ flex_box_free()

void flex_box_free ( FlexBox * instance)

Delete a FlexBox instance.

Parameters
[in,out]instancepointer to the FlexBox instance to be deleted

◆ flex_box_get_base()

Widget * flex_box_get_base ( FlexBox * instance)

Get a pointer to the base class instance.

The return value can be used in all Widget methods.

Parameters
[in,out]instancepointer to the FlexBox instance to be queried
Returns
pointer to the base class instance

◆ flex_box_set_align()

void flex_box_set_align ( FlexBox * instance,
FlexBoxAlign main,
FlexBoxAlign cross )

Set the alignment type of the child elements.

Parameters
[in,out]instancepointer to the FlexBox instance to be modified
[in]mainPlacement of items along main axis.
[in]crossPlacement of items along cross axis.

◆ flex_box_set_flow()

void flex_box_set_flow ( FlexBox * instance,
FlexBoxFlow flow )

Set the direction in which the child elements will be arranged.

Parameters
[in,out]instancepointer to the FlexBox instance to be modified
[in]flowvalue corresponding to the flow type required

◆ flex_box_set_spacing()

void flex_box_set_spacing ( FlexBox * instance,
int32_t spacing )

Set the spacing between child elements.

Parameters
[in,out]instancepointer to the FlexBox instance to be modified
[in]spacingspacing between elements, in pixels