GFXprim
2D bitmap graphics library with emphasis on speed and correctness
|
A widget size units. More...
Go to the source code of this file.
Data Structures | |
struct | gp_widget_size |
A compound size. More... | |
Macros | |
#define | GP_WIDGET_SIZE(px_val, pad_val, asc_val) ((gp_widget_size){.px = px_val, .pad = pad_val, .asc = asc_val}) |
An initializer for gp_widget_size. | |
#define | GP_WIDGET_SIZE_DEFAULT ((gp_widget_size){0xffff, 0xff, 0xff}) |
An default size initializer. | |
#define | GP_WIDGET_SIZE_EQ(a, b) |
A gp_widget_size comparsion. | |
Functions | |
static unsigned int | gp_widget_size_units_get (gp_widget_size *size, const gp_widget_render_ctx *ctx) |
Returns size in pixel given gp_widget_size and rendering context. | |
int | gp_widget_size_units_parse (const char *size, gp_widget_size *ret) |
Parses widget size from a string. | |
A widget size units.
Definition in file gp_widget_size_units.h.
#define GP_WIDGET_SIZE | ( | px_val, | |
pad_val, | |||
asc_val | |||
) | ((gp_widget_size){.px = px_val, .pad = pad_val, .asc = asc_val}) |
An initializer for gp_widget_size.
Could be used to construct function parameters on the fly such as:
w = gp_pixmap_create(GP_WIDGET_SIZE(100, 0, 0), GP_WIDGET_SIZE(100, 0, 0), callback, NULL);
Definition at line 74 of file gp_widget_size_units.h.
#define GP_WIDGET_SIZE_DEFAULT ((gp_widget_size){0xffff, 0xff, 0xff}) |
An default size initializer.
Special value used in widget constructors. When size is set to this value the min size is set to a default for a given widget type.
Definition at line 83 of file gp_widget_size_units.h.
#define GP_WIDGET_SIZE_EQ | ( | a, | |
b | |||
) |
A gp_widget_size comparsion.
a | A gp_widget_size. |
b | A gp_widget_size. |
Definition at line 93 of file gp_widget_size_units.h.
|
inlinestatic |
Returns size in pixel given gp_widget_size and rendering context.
size | A gp_widget_size size. |
ctx | A render context. |
Definition at line 48 of file gp_widget_size_units.h.
References gp_widget_size::asc, gp_widget_render_ctx::font, gp_text_ascent(), gp_widget_size::pad, gp_widget_render_ctx::padd, and gp_widget_size::px.
int gp_widget_size_units_parse | ( | const char * | size, |
gp_widget_size * | ret | ||
) |
Parses widget size from a string.
size | A widget size string e.g. "10px 2pad 1asc" |
ret | A gp_widget_size to store the result to. |