GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
gp_widget_uid.h
Go to the documentation of this file.
1//SPDX-License-Identifier: LGPL-2.0-or-later
2
3/*
4
5 Copyright (c) 2014-2024 Cyril Hrubis <metan@ucw.cz>
6
7 */
8
17#ifndef GP_WIDGET_UID_H
18#define GP_WIDGET_UID_H
19
20#include <utils/gp_htable.h>
21#include <widgets/gp_widget.h>
22
23typedef struct gp_widget_uid_map {
24 const char *uid;
25 enum gp_widget_type type;
26 enum gp_widget_class cls;
27 size_t offset;
28} gp_widget_uid_map;
29
30#define GP_WIDGET_UID(wuid, wtype, structure, member) \
31 {.uid = wuid, .type = wtype, .offset = offsetof(structure, member)}
32
33#define GP_WIDGET_CUID(wuid, wclass, structure, member) \
34 {.uid = wuid, .cls = wclass, .offset = offsetof(structure, member)}
35
36void gp_widgets_by_uids(gp_htable *uids, gp_widget_uid_map *uid_map, void *structure);
37
47gp_widget *gp_widget_by_uid(gp_htable *uids, const char *uid, enum gp_widget_type type);
48
58gp_widget *gp_widget_by_cuid(gp_htable *uids, const char *uid, enum gp_widget_class widget_class);
59
60#endif /* GP_WIDGET_UID_H */
Simple hash table implementation.
A widget implementation base.
gp_widget_class
Widget classes.
Definition gp_widget.h:249
gp_widget_type
Widget types.
Definition gp_widget.h:197
gp_widget * gp_widget_by_cuid(gp_htable *uids, const char *uid, enum gp_widget_class widget_class)
Gets a widget pointer given UIDs hash, an id and widget_class.
gp_widget * gp_widget_by_uid(gp_htable *uids, const char *uid, enum gp_widget_type type)
Gets a widget pointer given UIDs hash, an id and type.
A hash table.
Definition gp_htable.h:40
A widget base.
Definition gp_widget.h:28