1#ifndef PATCHWORK_ELEMENT_H
2#define PATCHWORK_ELEMENT_H 1
16#if defined(__cplusplus)
44#define ELEMENT_TOGGLE (1 << 0)
45#define ELEMENT_FLAT (1 << 1)
46#define ELEMENT_NO_BEZEL (1 << 2)
47#define ELEMENT_NO_OUTLINE (1 << 3)
382#if defined(__cplusplus)
image_t * element_get_image(element_t *elem)
Get the image of an element.
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.
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.
image_props_t * element_get_image_props(element_t *elem)
Get the image properties 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.
const char * element_get_text(element_t *elem)
Get the text of an element.
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.
element_flags_t element_get_flags(element_t *elem)
Get the flags of an element.
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.
action_type_t
Action type.
uint16_t event_type_t
Event type.
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)
Opaque element structure.
Element image properties structure.
Element text properties structure.