GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
gp_widget_json.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
18#ifndef GP_WIDGET_JSON_H
19#define GP_WIDGET_JSON_H
20
21#include <utils/gp_json.h>
22#include <utils/gp_htable.h>
23#include <widgets/gp_widget.h>
24
25extern const gp_json_obj *gp_widget_json_attrs;
26
43typedef struct gp_widget_json_addr {
44 union {
46 void *addr;
51 };
53 const char *id;
55
69
93
104
115 const gp_widget_json_callbacks *const callbacks,
116 gp_htable **uids);
117
128 const gp_widget_json_callbacks *const callbacks,
129 gp_htable **uids);
130
141void *gp_widget_callback_addr(const char *fn_name,
142 const gp_widget_json_ctx *ctx);
143
154void *gp_widget_struct_addr(const char *struct_name,
155 const gp_widget_json_ctx *ctx);
156
157#endif /* GP_WIDGET_JSON_H */
Simple hash table implementation.
Includes all JSON headers.
A widget implementation base.
gp_widget * gp_widget_from_json(gp_json_reader *json, gp_json_val *val, gp_widget_json_ctx *ctx)
Loads a widget layout given a JSON object.
gp_widget * gp_widget_layout_json(const char *fname, const gp_widget_json_callbacks *const callbacks, gp_htable **uids)
Loads a widget layout given a path to a JSON layout description.
void * gp_widget_callback_addr(const char *fn_name, const gp_widget_json_ctx *ctx)
Attempts to get a pointer to a function given it's name.
gp_widget * gp_widget_from_json_str(const char *str, const gp_widget_json_callbacks *const callbacks, gp_htable **uids)
Loads a widget layout given a string with JSON layout.
void * gp_widget_struct_addr(const char *struct_name, const gp_widget_json_ctx *ctx)
Attempts to get a pointer to a structure given it's name.
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.
Table operations, defined by the application.
A widget base.
Definition gp_widget.h:28