px-fwlib 0.10.0
Cross-platform embedded library and documentation for 8/16/32-bit microcontrollers generated with Doxygen 1.9.2
px_gfx_obj.h
1#ifndef __PX_GFX_OBJ_H__
2#define __PX_GFX_OBJ_H__
3/* =============================================================================
4 ____ ___ ____ ___ _ _ ___ __ __ ___ __ __ TM
5 | _ \ |_ _| / ___| / _ \ | \ | | / _ \ | \/ | |_ _| \ \/ /
6 | |_) | | | | | | | | | | \| | | | | | | |\/| | | | \ /
7 | __/ | | | |___ | |_| | | |\ | | |_| | | | | | | | / \
8 |_| |___| \____| \___/ |_| \_| \___/ |_| |_| |___| /_/\_\
9
10 Copyright (c) 2019 Pieter Conradie <https://piconomix.com>
11
12 License: MIT
13 https://github.com/piconomix/px-fwlib/blob/master/LICENSE.md
14
15 Title: px_gfx_obj.h : Graphical object layer on drawing layer
16 Author(s): Pieter Conradie
17 Creation Date: 2019-06-30
18
19============================================================================= */
20
21/**
22 * @ingroup GFX
23 * @defgroup PX_GFX_OBJ px_gfx_obj.h : Graphical object layer
24 *
25 * Graphical object layer on primitive drawing layer.
26 *
27 * File(s):
28 * - gfx/inc/px_gfx_obj.h
29 * - gfx/src/px_gfx_obj.c
30 *
31 * @{
32 */
33
34/* _____STANDARD INCLUDES____________________________________________________ */
35
36/* _____PROJECT INCLUDES_____________________________________________________ */
37#include "px_defs.h"
38#include "px_gfx.h"
39
40#ifdef __cplusplus
41extern "C"
42{
43#endif
44/* _____DEFINITIONS__________________________________________________________ */
45
46/* _____TYPE DEFINITIONS_____________________________________________________ */
47/**
48 * List of object types
49 */
50typedef enum
51{
52 PX_GFX_OBJ_TYPE_UNKNOWN = 0,
53 PX_GFX_OBJ_TYPE_WIN = 1,
54 PX_GFX_OBJ_TYPE_LABEL = 2,
55 PX_GFX_OBJ_TYPE_GRAPH = 3,
57
58/**
59 * Event types
60 */
61typedef enum
62{
63 PX_GFX_OBJ_EVENT_DRAW,
65
66/**
67 * Declaration of the object handle
68 */
69typedef struct px_gfx_obj_s * px_gfx_obj_handle_t;
70
71/**
72 * Definition of a pointer to the object's event handler function
73 *
74 * @param obj object handle
75 * @param event event that object must handle
76 * @param data (optional) event data
77 */
80 void * data);
81
82/// Object data structure
83typedef struct px_gfx_obj_s
84{
85 px_gfx_obj_type_t obj_type; ///< Object type
86 bool visible; ///< Flag to indicate if object is visible
87 bool update; ///< Flag to indicate if object has been updated and must be drawn
88 px_gfx_obj_event_handler_t event_handler; ///< Object event handler function
89 struct px_gfx_obj_s * obj_next; ///< Pointer to next object in linked list
91
92/* _____GLOBAL VARIABLES_____________________________________________________ */
93
94/* _____GLOBAL FUNCTION DECLARATIONS_________________________________________ */
95px_gfx_obj_handle_t _px_gfx_obj_create(px_gfx_obj_type_t obj_type,
96 size_t size,
97 px_gfx_obj_event_handler_t event_handler);
98
99bool px_gfx_obj_visible_get (px_gfx_obj_handle_t obj);
100void px_gfx_obj_visible_set (px_gfx_obj_handle_t obj, bool flag);
101
102bool px_gfx_obj_update_get (px_gfx_obj_handle_t obj);
103void px_gfx_obj_update_set (px_gfx_obj_handle_t obj, bool flag);
104
105void px_gfx_obj_draw (px_gfx_obj_handle_t obj);
106
107/* _____MACROS_______________________________________________________________ */
108
109#ifdef __cplusplus
110}
111#endif
112
113/// @}
114#endif
bool visible
Flag to indicate if object is visible.
Definition: px_gfx_obj.h:86
px_gfx_obj_event_handler_t event_handler
Object event handler function.
Definition: px_gfx_obj.h:88
struct px_gfx_obj_s * obj_next
Pointer to next object in linked list.
Definition: px_gfx_obj.h:89
px_gfx_obj_type_t obj_type
Object type.
Definition: px_gfx_obj.h:85
bool update
Flag to indicate if object has been updated and must be drawn.
Definition: px_gfx_obj.h:87
px_gfx_obj_event_t
Event types.
Definition: px_gfx_obj.h:62
void(* px_gfx_obj_event_handler_t)(px_gfx_obj_handle_t obj, px_gfx_obj_event_t event, void *data)
Definition of a pointer to the object's event handler function.
Definition: px_gfx_obj.h:78
struct px_gfx_obj_s * px_gfx_obj_handle_t
Declaration of the object handle.
Definition: px_gfx_obj.h:69
px_gfx_obj_type_t
List of object types.
Definition: px_gfx_obj.h:51
Object data structure.
Definition: px_gfx_obj.h:84