PatchworkOS
Loading...
Searching...
No Matches
element.c File Reference
#include "internal.h"
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Functions

static uint64_t element_send_init (element_t *elem)
 
static element_telement_new_raw (element_id_t id, const rect_t *rect, const char *text, element_flags_t flags, procedure_t procedure, void *private)
 
element_telement_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.
 
element_telement_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)
 
static void element_free_children (element_t *elem)
 
void element_free (element_t *elem)
 Deinitialize and free an element and all its children.
 
element_telement_find (element_t *elem, element_id_t id)
 Find a child element by its ID.
 
void element_set_private (element_t *elem, void *private)
 Set private data for an element.
 
void * element_get_private (element_t *elem)
 Get private data for an element.
 
element_id_t element_get_id (element_t *elem)
 Get the ID of an element.
 
void element_move (element_t *elem, const rect_t *rect)
 Move an element to a new rectangle in its parent's coordinate space.
 
rect_t element_get_rect (element_t *elem)
 Get the rectangle of an element in its parent's coordinate space.
 
rect_t element_get_content_rect (element_t *elem)
 Get the element's rectangle in local coordinates.
 
rect_t element_get_window_rect (element_t *elem)
 Get the rectangle of an element in window coordinates.
 
point_t element_get_window_point (element_t *elem)
 Get the top-left point of an element in window coordinates.
 
rect_t element_rect_to_window (element_t *elem, const rect_t *src)
 Convert a rectangle from element coordinates to window coordinates.
 
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.
 
point_t element_window_to_point (element_t *elem, const point_t *src)
 Convert a point from window coordinates to element coordinates.
 
element_flags_t element_flags_get (element_t *elem)
 
void element_set_flags (element_t *elem, element_flags_t flags)
 Set the flags of an element.
 
const char * element_text_get (element_t *elem)
 
uint64_t element_set_text (element_t *elem, const char *text)
 Set the text of an element.
 
text_props_telement_get_text_props (element_t *elem)
 Get the text properties of an element.
 
image_telement_image_get (element_t *elem)
 
void element_set_image (element_t *elem, image_t *image)
 Set the image of an element.
 
image_props_telement_image_props_get (element_t *elem)
 
theme_telement_get_theme (element_t *elem)
 Get the theme of an element.
 
void element_draw_begin (element_t *elem, drawable_t *draw)
 Begin drawing to an element.
 
void element_draw_end (element_t *elem, drawable_t *draw)
 End drawing to an element.
 
void element_redraw (element_t *elem, bool shouldPropagate)
 Redraw an element.
 
void element_force_action (element_t *elem, action_type_t action)
 Force an action on an element.
 
uint64_t element_dispatch (element_t *elem, const event_t *event)
 Dispatch an event to an element.
 
uint64_t element_emit (element_t *elem, event_type_t type, const void *data, uint64_t size)
 Emit an event to an element.
 

Function Documentation

◆ element_flags_get()

element_flags_t element_flags_get ( element_t elem)

Definition at line 313 of file element.c.

References ELEMENT_NONE, element_t::flags, and NULL.

◆ element_free_children()

static void element_free_children ( element_t elem)
static

Definition at line 102 of file element.c.

References element_t::children, element_free(), element_t::entry, LIST_FOR_EACH_SAFE, and list_remove().

Referenced by element_free().

◆ element_image_get()

image_t * element_image_get ( element_t elem)

Definition at line 371 of file element.c.

References element_t::image, and NULL.

◆ element_image_props_get()

image_props_t * element_image_props_get ( element_t elem)

Definition at line 391 of file element.c.

References element_t::imageProps, and NULL.

◆ element_new_raw()

◆ element_new_root()

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 
)

Definition at line 76 of file element.c.

References EINVAL, element_free(), element_new_raw(), element_send_init(), ENOMEM, ERR, errno, NULL, procedure(), and element_t::win.

Referenced by window_new().

◆ element_send_init()

static uint64_t element_send_init ( element_t elem)
static

◆ element_text_get()

const char * element_text_get ( element_t elem)

Definition at line 333 of file element.c.

References NULL, and element_t::text.