GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
gp_widget_uid.h
1//SPDX-License-Identifier: LGPL-2.0-or-later
2
3/*
4
5 Copyright (c) 2014-2022 Cyril Hrubis <metan@ucw.cz>
6
7 */
8
9#ifndef GP_WIDGET_UID_H
10#define GP_WIDGET_UID_H
11
12#include <utils/gp_htable.h>
13#include <widgets/gp_widget.h>
14
15typedef struct gp_widget_uid_map {
16 const char *uid;
17 enum gp_widget_type type;
18 enum gp_widget_class cls;
19 size_t offset;
20} gp_widget_uid_map;
21
22#define GP_WIDGET_UID(wuid, wtype, structure, member) \
23 {.uid = wuid, .type = wtype, .offset = offsetof(structure, member)}
24
25#define GP_WIDGET_CUID(wuid, wclass, structure, member) \
26 {.uid = wuid, .cls = wclass, .offset = offsetof(structure, member)}
27
28void gp_widgets_by_uids(gp_htable *uids, gp_widget_uid_map *uid_map, void *structure);
29
39gp_widget *gp_widget_by_uid(gp_htable *uids, const char *uid, enum gp_widget_type type);
40
50gp_widget *gp_widget_by_cuid(gp_htable *uids, const char *uid, enum gp_widget_class widget_class);
51
52#endif /* GP_WIDGET_UID_H */
Simple hash table implementation.
A hash table.
Definition gp_htable.h:40