![]() |
BSB Developer Docs
|
Base widget class. More...
Go to the source code of this file.
Typedefs | |
| typedef struct Widget | Widget |
| Widget opaque structure. | |
Enumerations | |
| enum | Align { AlignDefault , AlignTopLeft , AlignTopMid , AlignTopRight , AlignBottomLeft , AlignBottomMid , AlignBottomRight , AlignLeftMid , AlignRightMid , AlignCenter , AlignMax } |
| Enumeration of supported widget alignment modes. More... | |
| enum | AlignBitmask { AlignBitmaskLeft = (1 << 0) , AlignBitmaskHorCenter = (1 << 1) , AlignBitmaskRight = (1 << 2) , AlignBitmaskTop = (1 << 3) , AlignBitmaskVerCenter = (1 << 4) , AlignBitmaskBottom = (1 << 5) } |
Like Align, but with coded axes for ease of processing. | |
| enum | WidgetBlendMode { WidgetBlendModeNormal , WidgetBlendModeAdditive , WidgetBlendModeSubtractive , WidgetBlendModeMultiply , WidgetBlendModeDifference , WidgetBlendModesCount } |
| Enumeration of possible blend modes for widget. More... | |
Functions | |
| AlignBitmask | widget_align_to_bitmask (Align align) |
Convert Align into AlignBitmask | |
| Widget * | widget_alloc (Widget *parent) |
| Create a new widget instance. | |
| void | widget_free (Widget *instance) |
| Delete a widget instance. | |
| void | widget_set_visible (Widget *instance, bool visible) |
| Show or hide a Widget instance. | |
| bool | widget_is_visible (const Widget *instance) |
| Check if a Widget instance is currently visible. | |
| void | widget_set_ignore_layout (Widget *instance, bool ignore_layout) |
| Make widget ignore layout (e.g. | |
| bool | widget_does_ignore_layout (const Widget *instance) |
| Check if a Widget instance ignores layout. | |
| void | widget_set_width (Widget *instance, int32_t width) |
| Set the Widget width. | |
| int32_t | widget_get_width (const Widget *instance) |
| Get the Widget width. | |
| void | widget_set_height (Widget *instance, int32_t height) |
| Set the Widget height. | |
| int32_t | widget_get_height (const Widget *instance) |
| Get the Widget height. | |
| void | widget_set_size (Widget *instance, int32_t width, int32_t height) |
| Set both the width and height of a Widget. | |
| void | widget_set_max_width (Widget *instance, int32_t max_width) |
| Set the maximum width of a Widget. | |
| void | widget_set_max_height (Widget *instance, int32_t max_height) |
| Set the maximum height of a Widget. | |
| void | widget_set_max_size (Widget *instance, int32_t max_width, int32_t max_height) |
| Set the maximum width and height of a Widget. | |
| void | widget_set_size_content (Widget *instance) |
| Set both the width and height of a Widget to fit its content. | |
| void | widget_set_width_content (Widget *instance) |
| Set the width of a Widget to fit its content. | |
| void | widget_set_height_content (Widget *instance) |
| Set the height of a Widget to fit its content. | |
| int32_t | widget_get_max_width (const Widget *instance) |
| Get the Widget maximum width. | |
| int32_t | widget_get_max_height (const Widget *instance) |
| Get the Widget maximum height. | |
| void | widget_set_pos_x (Widget *instance, int32_t x) |
| Set the Widget x (horizontal) position. | |
| void | widget_set_pos_y (Widget *instance, int32_t y) |
| Set the Widget y (vertical) position. | |
| void | widget_set_pos (Widget *instance, int32_t x, int32_t y) |
| Set both the x (horizontal) and y (vertical) positions of a Widget. | |
| void | widget_set_align (Widget *instance, Align align) |
| Set the Widget alignment relative to its parent. | |
| void | widget_move_to_foreground (Widget *instance) |
| Make the Widget to be drawn above all others on the same layer. | |
| void | widget_move_to_background (Widget *instance) |
| Make the Widget to be drawn below all others on the same layer. | |
| void | widget_set_scrollbar_enabled (Widget *instance, bool is_enabled) |
| Set widget scrollbar mode. | |
| void | widget_set_background_color (Widget *instance, Color color) |
| Set the background color and opacity of a Widget instance. | |
| void | widget_set_opacity (Widget *instance, uint8_t opacity) |
| Set the global opacity of a Widget instance. | |
| void | widget_set_padding (Widget *instance, int32_t left, int32_t right, int32_t top, int32_t bottom) |
| Set the padding for a Widget instance. | |
| void | widget_set_margin (Widget *instance, int32_t left, int32_t right, int32_t top, int32_t bottom) |
| Set the margin for a Widget instance. | |
| void | widget_set_blend_mode (Widget *instance, WidgetBlendMode blend_mode) |
| Set the blend mode for a Widget instance. | |
| WidgetBlendMode | widget_get_blend_mode (const Widget *instance) |
| Get the blend mode for a Widget instance. | |
| void | widget_set_context (Widget *instance, void *context) |
| Set the widget context. | |
| void * | widget_get_context (const Widget *instance) |
| Get the widget context. | |
Base widget class.
Rule of thumb: if a class takes a parent Widget* instance, its instances can be safely cast to the Widget* type.
| enum Align |
| enum WidgetBlendMode |
Enumeration of possible blend modes for widget.
| AlignBitmask widget_align_to_bitmask | ( | Align | align | ) |
Convert Align into AlignBitmask
AlignBitmask may be easier to manually parse in some cases.
| [in] | align | Align value |
AlignBitmap value Create a new widget instance.
Either a regular Widget or a root widget can be used as the parent.
| [in,out] | parent | pointer to the parent Widget instance |
| bool widget_does_ignore_layout | ( | const Widget * | instance | ) |
Check if a Widget instance ignores layout.
| [in] | instance | pointer to the Widget instance to be queried |
true if widget instance ignores layout, false otherwise | void widget_free | ( | Widget * | instance | ) |
Delete a widget instance.
| [in,out] | instance | pointer to the Widget instance to be deleted |
| WidgetBlendMode widget_get_blend_mode | ( | const Widget * | instance | ) |
Get the blend mode for a Widget instance.
| [in] | instance | pointer to the Widget instance to be queried |
| void * widget_get_context | ( | const Widget * | instance | ) |
Get the widget context.
| [in] | instance | pointer to the Widget instance to be queried |
NULL) | int32_t widget_get_height | ( | const Widget * | instance | ) |
Get the Widget height.
| [in] | instance | pointer to the Widget instance to be queried |
| int32_t widget_get_max_height | ( | const Widget * | instance | ) |
Get the Widget maximum height.
| [in] | instance | pointer to the Widget instance to be queried |
| int32_t widget_get_max_width | ( | const Widget * | instance | ) |
Get the Widget maximum width.
| [in] | instance | pointer to the Widget instance to be queried |
| int32_t widget_get_width | ( | const Widget * | instance | ) |
Get the Widget width.
| [in] | instance | pointer to the Widget instance to be queried |
| bool widget_is_visible | ( | const Widget * | instance | ) |
Check if a Widget instance is currently visible.
| [in] | instance | pointer to the Widget instance to be queried |
true if widget is visible, false otherwise | void widget_move_to_background | ( | Widget * | instance | ) |
Make the Widget to be drawn below all others on the same layer.
| [in,out] | instance | pointer to the Widget instance to be modified |
| void widget_move_to_foreground | ( | Widget * | instance | ) |
Make the Widget to be drawn above all others on the same layer.
| [in,out] | instance | pointer to the Widget instance to be modified |
Set the Widget alignment relative to its parent.
| [in,out] | instance | pointer to the Widget instance to be modified |
| [in] | align | alignment value from the Align enumeration |
Set the background color and opacity of a Widget instance.
| [in,out] | instance | pointer to the Widget instance to be modified |
| [in] | color | new background color including opacity |
| void widget_set_blend_mode | ( | Widget * | instance, |
| WidgetBlendMode | blend_mode ) |
Set the blend mode for a Widget instance.
| [in,out] | instance | pointer to the Widget instance to be modified |
| [in] | blend_mode | new blend mode from the WidgetBlendMode enumeration |
| void widget_set_context | ( | Widget * | instance, |
| void * | context ) |
Set the widget context.
| [in,out] | instance | pointer to the Widget instance to be modified |
| [in,out] | context | pointer to a user-specific object |
| void widget_set_height | ( | Widget * | instance, |
| int32_t | height ) |
Set the Widget height.
| [in,out] | instance | pointer to the Widget instance to be modified |
| [in] | height | new height in pixels |
| void widget_set_height_content | ( | Widget * | instance | ) |
Set the height of a Widget to fit its content.
| [in,out] | instance | pointer to the Widget instance to be modified |
| void widget_set_ignore_layout | ( | Widget * | instance, |
| bool | ignore_layout ) |
Make widget ignore layout (e.g.
flex layout).
| [in,out] | instance | pointer to the Widget instance to be modified |
| [in] | ignore_layout | make the Widget instance ignore layout if true, otherwise acknowledge it |
| void widget_set_margin | ( | Widget * | instance, |
| int32_t | left, | ||
| int32_t | right, | ||
| int32_t | top, | ||
| int32_t | bottom ) |
Set the margin for a Widget instance.
| [in,out] | instance | pointer to the Widget instance to be modified |
| [in] | left | margin on the left side in pixels |
| [in] | right | margin on the right side in pixels |
| [in] | top | margin on the top side in pixels |
| [in] | bottom | margin on the bottom side in pixels |
| void widget_set_max_height | ( | Widget * | instance, |
| int32_t | max_height ) |
Set the maximum height of a Widget.
| [in,out] | instance | pointer to the Widget instance to be modified |
| [in] | max_height | new height in pixels |
| void widget_set_max_size | ( | Widget * | instance, |
| int32_t | max_width, | ||
| int32_t | max_height ) |
Set the maximum width and height of a Widget.
| [in,out] | instance | pointer to the Widget instance to be modified |
| [in] | max_width | new width in pixels |
| [in] | max_height | new height in pixels |
| void widget_set_max_width | ( | Widget * | instance, |
| int32_t | max_width ) |
Set the maximum width of a Widget.
| [in,out] | instance | pointer to the Widget instance to be modified |
| [in] | max_width | new width in pixels |
| void widget_set_opacity | ( | Widget * | instance, |
| uint8_t | opacity ) |
Set the global opacity of a Widget instance.
| [in,out] | instance | pointer to the Widget instance to be modified |
| [in] | opacity | new opacity value (0-255) |
| void widget_set_padding | ( | Widget * | instance, |
| int32_t | left, | ||
| int32_t | right, | ||
| int32_t | top, | ||
| int32_t | bottom ) |
Set the padding for a Widget instance.
| [in,out] | instance | pointer to the Widget instance to be modified |
| [in] | left | padding on the left side in pixels |
| [in] | right | padding on the right side in pixels |
| [in] | top | padding on the top side in pixels |
| [in] | bottom | padding on the bottom side in pixels |
| void widget_set_pos | ( | Widget * | instance, |
| int32_t | x, | ||
| int32_t | y ) |
Set both the x (horizontal) and y (vertical) positions of a Widget.
| [in,out] | instance | pointer to the Widget instance to be modified |
| [in] | x | new horizontal position in pixels |
| [in] | y | new vertical position in pixels |
| void widget_set_pos_x | ( | Widget * | instance, |
| int32_t | x ) |
Set the Widget x (horizontal) position.
| [in,out] | instance | pointer to the Widget instance to be modified |
| [in] | x | new horizontal position in pixels |
| void widget_set_pos_y | ( | Widget * | instance, |
| int32_t | y ) |
Set the Widget y (vertical) position.
| [in,out] | instance | pointer to the Widget instance to be modified |
| [in] | y | new vertical position in pixels |
| void widget_set_scrollbar_enabled | ( | Widget * | instance, |
| bool | is_enabled ) |
Set widget scrollbar mode.
| [in,out] | instance | pointer to the widget instance to be modified |
| [in] | is_enabled | enable the Widget instance scrollbar drawing if true, disable otherwise |
| void widget_set_size | ( | Widget * | instance, |
| int32_t | width, | ||
| int32_t | height ) |
Set both the width and height of a Widget.
| [in,out] | instance | pointer to the Widget instance to be modified |
| [in] | width | new width in pixels |
| [in] | height | new height in pixels |
| void widget_set_size_content | ( | Widget * | instance | ) |
Set both the width and height of a Widget to fit its content.
| [in,out] | instance | pointer to the Widget instance to be modified |
| void widget_set_visible | ( | Widget * | instance, |
| bool | visible ) |
Show or hide a Widget instance.
Widgets are shown by default.
| [in,out] | instance | pointer to the Widget instance to be modified |
| [in] | visible | make the Widget instance visible if true, otherwise invisible |
| void widget_set_width | ( | Widget * | instance, |
| int32_t | width ) |
Set the Widget width.
| [in,out] | instance | pointer to the Widget instance to be modified |
| [in] | width | new width in pixels |
| void widget_set_width_content | ( | Widget * | instance | ) |
Set the width of a Widget to fit its content.
| [in,out] | instance | pointer to the Widget instance to be modified |