PatchworkOS  966e257
A non-POSIX operating system.
Loading...
Searching...
No Matches
widgets.h
Go to the documentation of this file.
1#ifndef PATCHWORK_WIDGETS_H
2#define PATCHWORK_WIDGETS_H 1
3
4#include <stdint.h>
5
6#include "drawable.h"
7#include "element.h"
8
9#if defined(__cplusplus)
10extern "C"
11{
12#endif
13
14/**
15 * @brief Widget element wrappers.
16 * @defgroup libpatchwork_widgets Widgets
17 * @ingroup libpatchwork
18 *
19 * These functions create common widget elements such as buttons and labels by creating elements with predefined
20 * procedures and private data.
21 *
22 * @{
23 */
24
25/**
26 * @brief Create a new button element.
27 *
28 * @param parent The parent element.
29 * @param id The element ID.
30 * @param rect The rectangle defining the button's position and size.
31 * @param text The button's text.
32 * @param flags Element flags.
33 * @return On success, a pointer to the newly created button element. On failure, `NULL` and `errno` is set.
34 */
35element_t* button_new(element_t* parent, element_id_t id, const rect_t* rect, const char* text, element_flags_t flags);
36
37/**
38 * @brief Create a new label element.
39 *
40 * @param parent The parent element.
41 * @param id The element ID.
42 * @param rect The rectangle defining the label's position and size.
43 * @param text The label's text.
44 * @param flags Element flags.
45 * @return On success, a pointer to the newly created label element. On failure, `NULL` and `errno` is set.
46 */
47element_t* label_new(element_t* parent, element_id_t id, const rect_t* rect, const char* text, element_flags_t flags);
48
49/** @} */
50
51#if defined(__cplusplus)
52}
53#endif
54
55#endif
uint64_t element_flags_t
Element flags type.
Definition element.h:41
uint64_t element_id_t
Element identifier type.
Definition element_id.h:23
element_t * button_new(element_t *parent, element_id_t id, const rect_t *rect, const char *text, element_flags_t flags)
Create a new button element.
Definition button.c:308
element_t * label_new(element_t *parent, element_id_t id, const rect_t *rect, const char *text, element_flags_t flags)
Create a new label element.
Definition label.c:45
static const path_flag_t flags[]
Definition path.c:42
Opaque element structure.
Definition internal.h:23
Definition rect.h:13