GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
gp_widget_label.h
Go to the documentation of this file.
1//SPDX-License-Identifier: LGPL-2.0-or-later
2/*
3
4 Copyright (c) 2014-2024 Cyril Hrubis <metan@ucw.cz>
5
6 */
7
46#ifndef GP_WIDGET_LABEL_H
47#define GP_WIDGET_LABEL_H
48
49#include <stdlib.h>
50#include <core/gp_compiler.h>
51
57
64void gp_widget_label_set(gp_widget *self, const char *text);
65
72const char *gp_widget_label_get(gp_widget *self);
73
82void gp_widget_labe_fmt_set(gp_widget *self, const char *text_fmt);
83
91void gp_widget_label_fmt_var_set(gp_widget *self, const char *fmt, ...)
92 GP_FMT_PRINTF(2, 3);
93
100void gp_widget_label_append(gp_widget *self, const char *text);
101
110int gp_widget_label_printf(gp_widget *self, const char *fmt, ...)
111 __attribute__((format (printf, 2, 3)));
112
120void gp_widget_label_vprintf(gp_widget *self, const char *fmt, va_list ap);
121
129
137
144void gp_widget_label_width_set(gp_widget *self, unsigned int width);
145
154
162
170
197gp_widget *gp_widget_label_new(const char *text, gp_widget_tattr tattr, unsigned int width);
198
208 __attribute__((format (printf, 2, 3)));
209
210#endif /* GP_WIDGET_LABEL_H */
A compiler dependent macros.
#define GP_FMT_PRINTF(fmt, list)
Expands to format printf attribute when supported by the compiler.
Definition gp_compiler.h:31
void gp_widget_label_fmt_var_set(gp_widget *self, const char *fmt,...)
Sets label accordingly to text format string.
int void gp_widget_label_vprintf(gp_widget *self, const char *fmt, va_list ap)
VPrintf-like function to set label text.
gp_widget * gp_widget_label_new(const char *text, gp_widget_tattr tattr, unsigned int width)
Allocates a label widget.
gp_widget_tattr gp_widget_label_tattr_get(gp_widget *self)
Gets text attributes.
unsigned int gp_widget_label_width_get(gp_widget *self)
Returns widget minimal width.
void gp_widget_label_tattr_set(gp_widget *self, gp_widget_tattr tattr)
Changes text attributes.
void gp_widget_label_width_set(gp_widget *self, unsigned int width)
Changes widget minimal width.
void gp_widget_label_flags_set(gp_widget *self, enum gp_widget_label_flags flags)
Sets frame flags.
void gp_widget_labe_fmt_set(gp_widget *self, const char *text_fmt)
Sets the label text format.
void gp_widget_label_set(gp_widget *self, const char *text)
Sets the label text.
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.
const char * gp_widget_label_get(gp_widget *self)
Gets the label text.
int gp_widget_label_printf(gp_widget *self, const char *fmt,...) __attribute__((format(printf
Printf-like function to set label text.
gp_widget_label_flags
A label flags.
@ GP_WIDGET_LABEL_FRAME
Draws a frame around the label.
void gp_widget_label_append(gp_widget *self, const char *text)
Appends text to the label.
enum gp_widget_label_flags gp_widget_label_flags_get(gp_widget *self)
Gets frame flags.
gp_widget_tattr
Text attribute flags.
A widget base.
Definition gp_widget.h:28