|
void | gp_widget_label_set (gp_widget *self, const char *text) |
| Sets the label text.
|
|
const char * | gp_widget_label_get (gp_widget *self) |
| Gets the label text.
|
|
void | gp_widget_labe_fmt_set (gp_widget *self, const char *text_fmt) |
| Sets the label text format.
|
|
void | gp_widget_label_fmt_var_set (gp_widget *self, const char *fmt,...) |
| Sets label accordingly to text format string.
|
|
void | gp_widget_label_append (gp_widget *self, const char *text) |
| Appends text to the label.
|
|
int | gp_widget_label_printf (gp_widget *self, const char *fmt,...) __attribute__((format(printf |
| Printf-like function to set label text.
|
|
int void | gp_widget_label_vprintf (gp_widget *self, const char *fmt, va_list ap) |
| VPrintf-like function to set label text.
|
|
static void | gp_widget_label_tattr_set (gp_widget *self, gp_widget_tattr tattr) |
| Changes text attributes.
|
|
static void | gp_widget_label_width_set (gp_widget *self, unsigned int width) |
| Changes widget minimal width.
|
|
gp_widget * | gp_widget_label_new (const char *text, gp_widget_tattr tattr, unsigned int width) |
| Allocates a label widget.
|
|
gp_widget * | gp_widget_label_printf_new (gp_widget_tattr tattr, const char *fmt,...) __attribute__((format(printf |
| Printf-like function to create a label widget.
|
|
A label widget.
A label widget is a single line of a text.
A note about the widget size
Unless widget 'size' is set the widget grows its size to fit the content without any limitations, which is only useful for cases where the label text is under your control and all possible values are known in advance.
If you have a label whose text is outside of your control, e.g. the value is a result of some system call, RPC call, etc, it's important to set the label size so that the label will not grow undefinitelly. The most useful combination is to set both label 'size' along with 'hfill' alignment in which case the label will fill all available horizontal space and the 'size' will function as a minimal widget size. The text inside of the label widget can be aligned with gp_widget_tattr text attributes.
Label JSON attributes
Attribute | Type | Default | Description |
text | string | | A label text. |
tattr | string | normal | Text attributes gp_widget_tattr, e.g. bold. |
width | uint | 0 | Label text size in characters. |
frame | bool | false | Draw frame around label, implies min padd = 1 |
padd | uint | 0 | Padd inside label on left and right. |
bg_color | string | "bg" | Background gp_widgets_color. |
text_color | string | "text" | Text gp_widgets_color. |
reverse_colors | bool | false | Reverse background and text color. |
Definition in file gp_widget_label.h.