![]() |
BSB Developer Docs
|
A simple text label widget. More...
#include <gui/widget.h>#include <gui/gui.h>#include <toolbox/color.h>#include <font_registry/fonts.h>Go to the source code of this file.
Typedefs | |
| typedef struct Label | Label |
| Label opaque structure. | |
Enumerations | |
| enum | TextAlign { TextAlignAuto , TextAlignLeft , TextAlignCenter , TextAlignRight , TextAlignMax } |
| Enumeration of possible text alignment types. More... | |
| enum | LabelLongContentMode { LabelLongContentModeWrap , LabelLongContentModeDots , LabelLongContentModeScroll , LabelLongContentModeScrollCircular , LabelLongContentModeClip , LabelLongContentModeCount } |
| Enumeration of possible behaviour with long content. More... | |
| enum | LabelFontSize { LabelFontSizeSmall , LabelFontSizeNormal , LabelFontSizeLarge } |
Functions | |
| Label * | label_alloc (Widget *parent) |
| Create a new Label instance. | |
| void | label_free (Label *instance) |
| Delete a Label instance. | |
| Widget * | label_get_base (Label *instance) |
| Get a pointer to the base class instance. | |
| void | label_set_text (Label *instance, const char *text) |
| Set the label text. | |
| void | label_set_text_color (Label *instance, Color color) |
| Set the label text color. | |
| void | label_set_inline_text_color_formatting (Label *instance, bool enable) |
| Enable or disable inline text color formatting Example: "This is a #ff0000 red# word". | |
| void | label_set_text_font_size (Label *instance, LabelFontSize size) |
| Set the label font size. | |
| void | label_set_text_fmt (Label *instance, const char *fmt,...) __attribute__((__format__(__printf__ |
| Set the label text with printf-like formatting. | |
| void void | label_set_line_spacing (Label *instance, int32_t spacing) |
| Set the label line spacing. | |
| void | label_set_text_align (Label *instance, TextAlign align) |
| Set the label text alignment. | |
| void | label_set_long_content_mode (Label *instance, LabelLongContentMode mode) |
| Set label long content mode. | |
| void | label_set_long_content_anim_start_delay (Label *instance, uint32_t delay) |
| Set the initial delay before the long content animation starts. | |
| void | label_set_long_content_anim_repeat_delay (Label *instance, uint32_t delay) |
| Set the pause duration between the long content animation repetitions. | |
| void | label_set_long_content_anim_speed (Label *instance, uint32_t speed) |
| Set the scroll animation speed for a label. | |
| void | label_set_font (Label *instance, const char *font_path) |
| Set font of label text. | |
A simple text label widget.
| enum LabelLongContentMode |
Enumeration of possible behaviour with long content.
| enum TextAlign |
Create a new Label instance.
| [in,out] | parent | pointer to the parent Widget instance |
| void label_free | ( | Label * | instance | ) |
Delete a Label instance.
| [in,out] | instance | pointer to the Label instance to be deleted |
Get a pointer to the base class instance.
The return value can be used in all Widget methods.
| [in,out] | instance | pointer to the Label instance to be queried |
| void label_set_font | ( | Label * | instance, |
| const char * | font_path ) |
Set font of label text.
| [in,out] | instance | pointer to the Label instance to be modified |
| [in] | font_path | path to font file |
| void label_set_inline_text_color_formatting | ( | Label * | instance, |
| bool | enable ) |
Enable or disable inline text color formatting Example: "This is a #ff0000 red# word".
| [in,out] | instance | pointer to the Label instance to be modified |
| [in] | enable | true to enable recoloring, false otherwise |
| void void label_set_line_spacing | ( | Label * | instance, |
| int32_t | spacing ) |
Set the label line spacing.
| [in,out] | instance | pointer to the Label instance to be modified |
| [in] | spacing | spacing value in pixels |
| void label_set_long_content_anim_repeat_delay | ( | Label * | instance, |
| uint32_t | delay ) |
Set the pause duration between the long content animation repetitions.
Only applies to scrollable modes (LabelLongContentModeScroll, LabelLongContentModeScrollCircular).
| [in,out] | instance | pointer to the Label instance to be modified |
| [in] | delay | pause duration in milliseconds between successive scroll cycles |
| void label_set_long_content_anim_speed | ( | Label * | instance, |
| uint32_t | speed ) |
Set the scroll animation speed for a label.
LabelLongContentModeScrollCircular.| [in,out] | instance | pointer to the Label instance |
| [in] | speed | scroll speed in pixels per minute (must be > 0) |
| void label_set_long_content_anim_start_delay | ( | Label * | instance, |
| uint32_t | delay ) |
Set the initial delay before the long content animation starts.
Only applies to scrollable modes (LabelLongContentModeScroll, LabelLongContentModeScrollCircular).
| [in,out] | instance | pointer to the Label instance to be modified |
| [in] | delay | delay in milliseconds before the animation begins |
| void label_set_long_content_mode | ( | Label * | instance, |
| LabelLongContentMode | mode ) |
Set label long content mode.
| [in,out] | instance | pointer to the Label instance to be modified |
| [in] | mode | new long content mode for label |
| void label_set_text | ( | Label * | instance, |
| const char * | text ) |
Set the label text.
| [in,out] | instance | pointer to the Label instance to be modified |
| [in] | text | zero-terminated string containing the text to be shown |
Set the label text alignment.
| [in,out] | instance | pointer to the Label instance to be modified |
| [in] | align | enum value to determine the alignment type |
Set the label text color.
| [in,out] | instance | pointer to the Label instance to be modified |
| [in] | color | text color |
| void label_set_text_fmt | ( | Label * | instance, |
| const char * | fmt, | ||
| ... ) |
Set the label text with printf-like formatting.
| [in,out] | instance | pointer to the Label instance to be modified |
| [in] | fmt | zero-terminated format string |
| [in] | ... | variadic list of arguments according to the format string |
| void label_set_text_font_size | ( | Label * | instance, |
| LabelFontSize | size ) |
Set the label font size.
| [in,out] | instance | pointer to the Label instance to be modified |
| [in] | size | font size |