121 elem->
proc(elem->
win, elem, &event);
154 if (grandChild !=
NULL)
243 while (parent !=
NULL)
262 .left = point.
x + src->
left,
263 .top = point.
y + src->
top,
264 .right = point.
x + src->
right,
265 .bottom = point.
y + src->
bottom,
278 .x = point.
x + src->
x,
279 .y = point.
y + src->
y,
292 .left = src->
left - point.
x,
293 .top = src->
top - point.
y,
294 .right = src->
right - point.
x,
295 .bottom = src->
bottom - point.
y,
308 .x = src->
x - point.
x,
309 .y = src->
y - point.
y,
350 char* newText =
strdup(text);
356 elem->
text = newText;
459 event.shouldPropagate = shouldPropagate;
472 event.action = action;
488 if (elem->
proc(elem->
win, elem, event) ==
ERR)
496 if (elem->
proc(elem->
win, elem, event) ==
ERR)
518 if (elem->
proc(elem->
win, elem, &movedEvent) ==
ERR)
535 if (elem->
proc(elem->
win, elem, event) ==
ERR)
image_t * element_image_get(element_t *elem)
const char * element_text_get(element_t *elem)
static uint64_t element_send_init(element_t *elem)
static void element_free_children(element_t *elem)
static element_t * element_new_raw(element_id_t id, const rect_t *rect, const char *text, element_flags_t flags, procedure_t procedure, void *private)
element_flags_t element_flags_get(element_t *elem)
element_t * element_new_root(window_t *win, element_id_t id, const rect_t *rect, const char *text, element_flags_t flags, procedure_t procedure, void *private)
image_props_t * element_image_props_get(element_t *elem)
void display_push(display_t *disp, surface_id_t target, event_type_t type, void *data, uint64_t size)
Push an event to the display's internal event queue.
text_props_t * element_get_text_props(element_t *elem)
Get the text properties of an element.
void element_set_image(element_t *elem, image_t *image)
Set the image of an element.
void element_set_flags(element_t *elem, element_flags_t flags)
Set the flags of an element.
void element_set_private(element_t *elem, void *private)
Set private data for an element.
element_t * element_find(element_t *elem, element_id_t id)
Find a child element by its ID.
#define ELEMENT_ID_NONE
Element ID indicating no element.
uint64_t element_emit(element_t *elem, event_type_t type, const void *data, uint64_t size)
Emit an event to an element.
theme_t * element_get_theme(element_t *elem)
Get the theme of an element.
point_t element_point_to_window(element_t *elem, const point_t *src)
Convert a point from element coordinates to window coordinates.
rect_t element_window_to_rect(element_t *elem, const rect_t *src)
Convert a rectangle from window coordinates to element coordinates.
uint64_t element_dispatch(element_t *elem, const event_t *event)
Dispatch an event to an element.
void element_draw_end(element_t *elem, drawable_t *draw)
End drawing to an element.
element_t * element_new(element_t *parent, element_id_t id, const rect_t *rect, const char *text, element_flags_t flags, procedure_t procedure, void *private)
Allocate and initialize a new element.
rect_t element_get_content_rect(element_t *elem)
Get the element's rectangle in local coordinates.
uint64_t element_flags_t
Element flags type.
void element_draw_begin(element_t *elem, drawable_t *draw)
Begin drawing to an element.
rect_t element_rect_to_window(element_t *elem, const rect_t *src)
Convert a rectangle from element coordinates to window coordinates.
uint64_t element_id_t
Element identifier type.
rect_t element_get_window_rect(element_t *elem)
Get the rectangle of an element in window coordinates.
void element_free(element_t *elem)
Deinitialize and free an element and all its children.
point_t element_get_window_point(element_t *elem)
Get the top-left point of an element in window coordinates.
void element_redraw(element_t *elem, bool shouldPropagate)
Redraw an element.
element_id_t element_get_id(element_t *elem)
Get the ID of an element.
uint64_t element_set_text(element_t *elem, const char *text)
Set the text of an element.
rect_t element_get_rect(element_t *elem)
Get the rectangle of an element in its parent's coordinate space.
point_t element_window_to_point(element_t *elem, const point_t *src)
Convert a point from window coordinates to element coordinates.
void element_move(element_t *elem, const rect_t *rect)
Move an element to a new rectangle in its parent's coordinate space.
void element_force_action(element_t *elem, action_type_t action)
Force an action on an element.
void * element_get_private(element_t *elem)
Get private data for an element.
#define LEVENT_FORCE_ACTION
#define EVENT_MAX_DATA
Maximum size of event data.
action_type_t
Action type.
uint16_t event_type_t
Event type.
theme_t * theme_global_get(void)
Get the global theme.
void window_invalidate(window_t *win, const rect_t *rect)
Invalidate a rectangle of the window.
#define EINVAL
Invalid argument.
#define ENOMEM
Out of memory.
#define errno
Error number variable.
#define LIST_FOR_EACH(elem, list, member)
Iterates over a list.
#define LIST_FOR_EACH_SAFE(elem, temp, list, member)
Safely iterates over a list, allowing for element removal during iteration.
static void list_remove(list_t *list, list_entry_t *entry)
Removes a list entry from its current list.
static void list_push(list_t *list, list_entry_t *entry)
Pushes an entry to the end of the list.
static void list_entry_init(list_entry_t *entry)
Initializes a list entry.
static void list_init(list_t *list)
Initializes a list.
#define NULL
Pointer error value.
#define ERR
Integer error value.
uint64_t(* procedure_t)(window_t *, element_t *, const event_t *)
static uint64_t procedure(window_t *win, element_t *elem, const event_t *event)
#define RECT_OVERLAP(rect, other)
#define RECT_INIT_DIM(x, y, width, height)
#define RECT_INIT(left, top, right, bottom)
#define RECT_HEIGHT(rect)
_PUBLIC void * malloc(size_t size)
_PUBLIC void free(void *ptr)
char * strdup(const char *src)
_PUBLIC void * memcpy(void *_RESTRICT s1, const void *_RESTRICT s2, size_t n)
Opaque element structure.
uint8_t raw[EVENT_MAX_DATA]
Element image properties structure.
Library Force Action event.
bool shouldPropagate
Whether the redraw event should be propagated to child elements.
Element text properties structure.