GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
gp_widget_json.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_JSON_H
10#define GP_WIDGET_JSON_H
11
12#include <utils/gp_json.h>
13#include <utils/gp_htable.h>
14#include <widgets/gp_widget.h>
15
16extern const gp_json_obj *gp_widget_json_attrs;
17
21typedef struct gp_widget_json_addr {
22 union {
24 void *addr;
29 };
31 const char *id;
33
47
71
81gp_widget *gp_widget_from_json(gp_json_reader *json, gp_json_val *val, gp_widget_json_ctx *ctx);
82
92gp_widget *gp_widget_from_json_str(const char *str,
93 const gp_widget_json_callbacks *const callbacks,
94 gp_htable **uids);
95
105gp_widget *gp_widget_layout_json(const char *fname,
106 const gp_widget_json_callbacks *const callbacks,
107 gp_htable **uids);
108
119void *gp_widget_callback_addr(const char *fn_name,
120 const gp_widget_json_ctx *ctx);
121
132void *gp_widget_struct_addr(const char *struct_name,
133 const gp_widget_json_ctx *ctx);
134
135#endif /* GP_WIDGET_JSON_H */
Simple hash table implementation.
Includes all JSON headers.
A hash table.
Definition gp_htable.h:40
A JSON object description.
A JSON parser internal state.
A parsed JSON key value pair.
Event structure passed to widget event handler.
A structure to pass widget callbacks.
void * addr
A structure address.
const char * id
A callback name used to resolve the target widget on runtime.
const struct gp_widget_table_col_ops * table_col_ops
A table widget column ops.
int(* on_event)(gp_widget_event *)
A widget event handler.
Structure to pass callbacks to the JSON loader.
const gp_widget_json_addr * addrs
A NULL terminated array of callbacks.
void * default_priv
A default priv pointer passed to widgets when allocated.
A context to propagate values top down and bottom up.
const gp_widget_json_callbacks * callbacks
An optional table of widget callbacks.
gp_widget * focused
A widget that should be focused when layout is loaded.
gp_htable ** uids
A hash table to store the id -> widget mapping to.