PatchworkOS
Loading...
Searching...
No Matches
element.h File Reference
#include "cmd.h"
#include "drawable.h"
#include "element_id.h"
#include "font.h"
#include "procedure.h"
#include "rect.h"
#include "theme.h"
#include <stdbool.h>
#include <stdint.h>
#include <sys/proc.h>

Go to the source code of this file.

Data Structures

struct  text_props_t
 Element text properties structure. More...
 
struct  image_props_t
 Element image properties structure. More...
 

Macros

#define ELEMENT_NONE   0
 
#define ELEMENT_TOGGLE   (1 << 0)
 
#define ELEMENT_FLAT   (1 << 1)
 
#define ELEMENT_NO_BEZEL   (1 << 2)
 
#define ELEMENT_NO_OUTLINE   (1 << 3)
 

Typedefs

typedef uint64_t element_flags_t
 Element flags type.
 
typedef struct element element_t
 

Functions

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.
 
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_get_flags (element_t *elem)
 Get the flags of an element.
 
void element_set_flags (element_t *elem, element_flags_t flags)
 Set the flags of an element.
 
const char * element_get_text (element_t *elem)
 Get the text of an element.
 
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_get_image (element_t *elem)
 Get the image of an element.
 
void element_set_image (element_t *elem, image_t *image)
 Set the image of an element.
 
image_props_telement_get_image_props (element_t *elem)
 Get the image properties of an element.
 
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.