mikroSDK Reference Manual
vtft_types.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2023 MikroElektronika d.o.o.
4 ** Contact: https://www.mikroe.com/contact
5 **
6 ** This file is part of the mikroSDK package
7 **
8 ** Commercial License Usage
9 **
10 ** Licensees holding valid commercial NECTO compilers AI licenses may use this
11 ** file in accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The MikroElektronika Company.
14 ** For licensing terms and conditions see
15 ** https://www.mikroe.com/legal/software-license-agreement.
16 ** For further information use the contact form at
17 ** https://www.mikroe.com/contact.
18 **
19 **
20 ** GNU Lesser General Public License Usage
21 **
22 ** Alternatively, this file may be used for
23 ** non-commercial projects under the terms of the GNU Lesser
24 ** General Public License version 3 as published by the Free Software
25 ** Foundation: https://www.gnu.org/licenses/lgpl-3.0.html.
26 **
27 ** The above copyright notice and this permission notice shall be
28 ** included in all copies or substantial portions of the Software.
29 **
30 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31 ** OF MERCHANTABILITY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
32 ** TO THE WARRANTIES FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
33 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
34 ** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
35 ** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
36 ** OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37 **
38 ****************************************************************************/
39 
43 #ifndef _VTFT_TYPES_H_
44 #define _VTFT_TYPES_H_
45 
46 #include "gl_types.h"
47 #include "generic_pointer.h"
48 #include "tp.h"
49 
50 // Scalar types.
51 typedef uint8_t vtft_bool_t;
52 typedef uint8_t vtft_byte_t;
53 typedef int16_t vtft_index_t;
55 typedef gl_uint_t vtft_ucoord_t;
57 // All possible component types.
61 typedef enum
62 {
78 }
80 
83 // Events
84 
85 typedef void (*vtft_event)();
93 typedef struct
94 {
95  vtft_event press_event;
96  vtft_event down_event;
97  vtft_event up_event;
98  vtft_event click_event;
99 }
101 
108 typedef struct
109 {
111  gl_color_t color;
112 }
113 vtft_pen;
114 
118 typedef enum
119 {
125 }
127 
134 typedef struct
135 {
136  vtft_bool_t transparent;
137  vtft_gradient_style gradient_style;
138  gl_color_t start_color;
139  gl_color_t end_color;
140 }
142 
150 typedef struct
151 {
152  vtft_bool_t transparent;
153  vtft_gradient_style gradient_style;
154  gl_color_t start_color;
155  gl_color_t end_color;
156  gl_color_t press_start_color;
157  gl_color_t press_end_color;
158 }
160 
161 // Text
162 
169 typedef struct
170 {
171  const vtft_byte_t *font_data;
172  gl_color_t color;
173 }
174 vtft_font;
175 
188 typedef struct
189 {
190  vtft_byte_t * __generic caption;
191  vtft_index_t max_length;
192  vtft_font font;
193 }
194 vtft_text;
195 
196 
200 typedef enum
201 {
208 }
210 
211 // Components
212 
219 typedef struct
220 {
222  vtft_index_t order;
223  vtft_bool_t visible;
224 }
226 
227 
234 typedef struct
235 {
237  vtft_index_t order;
238  vtft_bool_t visible;
240  vtft_coord_t top;
241 }
243 
244 
251 typedef struct
252 {
254  vtft_index_t order;
255  vtft_bool_t visible;
258  vtft_bool_t active;
259  vtft_event_set event_set;
260 }
262 
269 typedef struct
270 {
272  vtft_index_t order; // TODO: Nikola: Proveriti da li je ovo ustvari X-order koji odredjuje koliko je daleko od kamere, tj, koja je komponenta dublje.
273  vtft_bool_t visible;
276  vtft_bool_t active;
277  vtft_event_set event_set;
278  vtft_pen pen;
279  vtft_press_gradient press_gradient;
280 }
282 
283 // Basic Components
284 
291 typedef struct
292 {
294  vtft_index_t order;
295  vtft_bool_t visible;
298  vtft_bool_t active;
299  vtft_event_set event_set;
300  vtft_pen pen;
301  vtft_press_gradient press_gradient;
303  vtft_ucoord_t height;
304 }
305 vtft_box;
306 
313 typedef struct
314 {
316  vtft_index_t order;
317  vtft_bool_t visible;
320  vtft_bool_t active;
321  vtft_event_set event_set;
322  vtft_pen pen;
323  vtft_press_gradient press_gradient;
325  vtft_ucoord_t height;
326  vtft_ucoord_t corner_radius;
327 }
329 
336 typedef struct
337 {
339  vtft_index_t order;
340  vtft_bool_t visible;
343  vtft_bool_t active;
344  vtft_event_set event_set;
345  vtft_pen pen;
346  vtft_press_gradient press_gradient;
347  vtft_ucoord_t radius;
348 }
350 
357 typedef struct
358 {
360  vtft_index_t order;
361  vtft_bool_t visible;
364  vtft_bool_t active;
365  vtft_event_set event_set;
366  vtft_pen pen;
367  vtft_press_gradient press_gradient;
369  vtft_ucoord_t height;
370 }
372 
379 typedef struct
380 {
382  vtft_index_t order;
383  vtft_bool_t visible;
384  vtft_pen pen;
385  vtft_coord_t first_left;
386  vtft_coord_t first_top;
387  vtft_coord_t second_left;
388  vtft_coord_t second_top;
389 }
390 vtft_line;
391 
392 // Common Components
393 
400 typedef struct
401 {
403  vtft_index_t order;
404  vtft_bool_t visible;
407  vtft_bool_t active;
408  vtft_event_set event_set;
410  vtft_ucoord_t height;
411  vtft_text text;
412  vtft_bool_t vertical_text;
413 }
414 vtft_label;
415 
422 typedef struct
423 {
425  vtft_index_t order;
426  vtft_bool_t visible;
429  vtft_bool_t active;
430  vtft_event_set event_set;
431  vtft_pen pen;
432  vtft_press_gradient press_gradient;
434  vtft_ucoord_t height;
435  vtft_text text;
436  vtft_text_alignment text_align;
437  vtft_bool_t vertical_text;
438 }
440 
447 typedef struct
448 {
450  vtft_index_t order;
451  vtft_bool_t visible;
454  vtft_bool_t active;
455  vtft_event_set event_set;
456  vtft_pen pen;
457  vtft_press_gradient press_gradient;
459  vtft_ucoord_t height;
460  vtft_ucoord_t corner_radius;
461  vtft_text text;
462  vtft_text_alignment text_align;
463  vtft_bool_t vertical_text;
464 }
466 
473 typedef struct
474 {
476  vtft_index_t order;
477  vtft_bool_t visible;
480  vtft_bool_t active;
481  vtft_event_set event_set;
482  vtft_pen pen;
483  vtft_press_gradient press_gradient;
484  vtft_ucoord_t radius;
485  vtft_text text;
486  vtft_text_alignment text_align;
487  vtft_bool_t vertical_text;
488 }
490 
497 typedef struct
498 {
500  vtft_index_t order;
501  vtft_bool_t visible;
504  vtft_bool_t active;
505  vtft_event_set event_set;
507  vtft_ucoord_t height;
508  const vtft_byte_t *picture_data;
509  uint32_t ratio;
510 }
511 vtft_image;
512 
519 typedef struct
520 {
522  vtft_index_t order;
523  vtft_bool_t visible;
526  vtft_bool_t active;
527  vtft_event_set event_set;
528  vtft_pen pen;
529  vtft_press_gradient press_gradient;
531  vtft_ucoord_t height;
532  vtft_text text;
533  vtft_text_alignment text_align;
534  vtft_bool_t checked;
535 }
537 
544 typedef struct
545 {
547  vtft_index_t order;
548  vtft_bool_t visible;
551  vtft_bool_t active;
552  vtft_event_set event_set;
553  vtft_pen pen;
554  vtft_press_gradient press_gradient;
556  vtft_ucoord_t height;
557  vtft_text text;
558  vtft_text_alignment text_align; // NOTE: Nikola: Ovde ce tekst biti ili levo ili desno u odnosu na komponentu, ne unutar nje.
559  vtft_bool_t checked;
560  vtft_ucoord_t corner_radius;
561 }
563 
570 typedef struct
571 {
573  vtft_index_t order;
574  vtft_bool_t visible;
577  vtft_bool_t active;
578  vtft_event_set event_set;
579  vtft_pen pen;
580  vtft_press_gradient press_gradient;
582  vtft_ucoord_t height;
583  vtft_text text;
584  vtft_text_alignment text_align;
585  vtft_bool_t checked;
586  gl_color_t back_color;
587 }
589 
596 typedef struct
597 {
599  vtft_index_t order;
600  vtft_bool_t visible;
604  vtft_ucoord_t height;
605  vtft_ucoord_t corner_radius;
606  vtft_byte_t *caption;
607  vtft_font font;
608  vtft_pen pen;
609  vtft_gradient gradient;
610  gl_color_t back_color;
611  uint32_t position;
612  uint32_t prev_pos;
613  uint32_t min_position;
614  uint32_t max_position;
615  vtft_bool_t smooth;
616  vtft_bool_t show_percent;
617  vtft_bool_t show_position;
618 }
620 
621 // Screen
622 
630 typedef struct
631 {
633  vtft_ucoord_t height;
634  gl_color_t color;
636  vtft_event press_event; // TODO: Nikola: proveriti da li se ovo odnosi na svaki event (bilo u prazno bilo na komponentu koja pripada skrinu) i dodati informaciju za sva tri eventa ovde.
637  vtft_event down_event;
638  vtft_event up_event;
640  vtft_component *__generic * __generic components;
641  vtft_index_t component_count;
642 }
644 
645 // Drawing Functions
646 typedef void (*vtft_draw_handle)(struct vtft_s *instance, vtft_component * __generic component);
648 // VTFT Instance
649 
655 typedef struct vtft_s
656 {
657  tp_t * tp_instance;
662  vtft_bool_t pen_down; // NOTE: Nikola: Sta znaci ako je pen down? Dodati objasnjenje i proveriti.
667 }
668 vtft_t;
669 
670 #endif // _VTFT_TYPES_H_
671 // ------------------------------------------------------------------------- END
vtft_screen
Structure representig a screen.
Definition: vtft_types.h:629
tp_t
Touch Panel Context Object.
Definition: tp.h:222
VTFT_COMPONENT_ELLIPSE
Definition: vtft_types.h:66
VTFT_GRADIENT_BOTTOM_TOP
Definition: vtft_types.h:121
vtft_press_gradient
The structure used for information about the gradient displayed when an object is pressed and when it...
Definition: vtft_types.h:149
vtft_t
struct vtft_s vtft_t
Structure representig a VTFT library instance.
vtft_byte_t
uint8_t vtft_byte_t
Definition: vtft_types.h:51
vtft_s::pen_down
vtft_bool_t pen_down
Definition: vtft_types.h:661
vtft_line
Structure for a componet drawn like a line.
Definition: vtft_types.h:378
vtft_image
Structure for an image component.
Definition: vtft_types.h:496
vtft_s::current_active_component
vtft_active_component *__generic current_active_component
Definition: vtft_types.h:664
VTFT_GRADIENT_TOP_BOTTOM
Definition: vtft_types.h:120
tp.h
Touch Panel API Library.
vtft_text_alignment
vtft_text_alignment
Enum containing possible text alignment options.
Definition: vtft_types.h:199
vtft_s
Structure representig a VTFT library instance.
Definition: vtft_types.h:654
gl_types.h
Declaration of types for Graphic Library.
VTFT_COMPONENT_CIRCLE_BUTTON
Definition: vtft_types.h:71
vtft_component_type
vtft_component_type
Enum containing all VTFT component types.
Definition: vtft_types.h:60
vtft_circle_button
Structure for a circular button component.
Definition: vtft_types.h:472
VTFT_COMPONENT_NONE
Definition: vtft_types.h:62
vtft_comp_type_t
vtft_component_type vtft_comp_type_t
Definition: vtft_types.h:80
vtft_coord_t
gl_int_t vtft_coord_t
Definition: vtft_types.h:53
VTFT_COMPONENT_ROUNDED_BOX
Definition: vtft_types.h:64
vtft_draw_handle
void(* vtft_draw_handle)(struct vtft_s *instance, vtft_component *__generic component)
Definition: vtft_types.h:645
vtft_radio_button
Structure for a radio button component.
Definition: vtft_types.h:569
vtft_event_set
Structure representing an event set, all posible event types and their functions that can be triggere...
Definition: vtft_types.h:92
vtft_gradient
The structure used for information about the gradient.
Definition: vtft_types.h:133
vtft_pen
The context structure for storing pen's size and color.
Definition: vtft_types.h:107
vtft_event
void(* vtft_event)()
Definition: vtft_types.h:84
VTFT_COMPONENT_COUNT
Definition: vtft_types.h:76
vtft_gradient_style
vtft_gradient_style
Definition: vtft_types.h:117
vtft_ucoord_t
gl_uint_t vtft_ucoord_t
Definition: vtft_types.h:54
vtft_label
Structure for a label component.
Definition: vtft_types.h:399
vtft_component
Generic component structure, holding key information about that component.
Definition: vtft_types.h:218
vtft_text
The structure used for information about the font bitmap and color.
Definition: vtft_types.h:187
VTFT_COMPONENT_BOX
Definition: vtft_types.h:63
vtft_ellipse
Structure for a componet drawn like a ellipse.
Definition: vtft_types.h:356
vtft_progress_bar
Structure for a radio button component.
Definition: vtft_types.h:595
VTFT_COMPONENT_ROUNDED_BUTTON
Definition: vtft_types.h:70
gl_color_t
uint16_t gl_color_t
Definition: gl_colors.h:55
vtft_abstract_check_box
Abstract structure for check box component.
Definition: vtft_types.h:518
VTFT_TEXT_ALIGNMENT_MIDDLE
Definition: vtft_types.h:205
vtft_font
The structure used for information about the font bitmap and color.
Definition: vtft_types.h:168
gl_int_t
int16_t gl_int_t
Definition: gl_types.h:90
vtft_circle
Structure for a componet drawn like a circle.
Definition: vtft_types.h:335
vtft_check_box
Structure for a check box component.
Definition: vtft_types.h:543
vtft_positioned_component
Structure for a componet characterized by position.
Definition: vtft_types.h:233
VTFT_GRADIENT_LEFT_RIGHT
Definition: vtft_types.h:122
VTFT_TEXT_ALIGNMENT_BOTTOM
Definition: vtft_types.h:206
VTFT_GRADIENT_RIGHT_LEFT
Definition: vtft_types.h:123
VTFT_COMPONENT_LABEL
Definition: vtft_types.h:68
vtft_bool_t
uint8_t vtft_bool_t
Definition: vtft_types.h:50
gl_uint_t
uint16_t gl_uint_t
Definition: gl_types.h:91
vtft_index_t
int16_t vtft_index_t
Definition: vtft_types.h:52
VTFT_COMPONENT_RADIO_BUTTON
Definition: vtft_types.h:74
VTFT_TEXT_ALIGNMENT_RIGHT
Definition: vtft_types.h:203
vtft_s::current_screen
vtft_screen * current_screen
Definition: vtft_types.h:659
vtft_s::screen_changed
vtft_bool_t screen_changed
Definition: vtft_types.h:662
vtft_box
Structure for a componet drawn like a box.
Definition: vtft_types.h:290
VTFT_COMPONENT_CHECK_BOX
Definition: vtft_types.h:73
vtft_rounded_button
Structure for a button component with rounded corners.
Definition: vtft_types.h:446
VTFT_COMPONENT_BUTTON
Definition: vtft_types.h:69
vtft_s::pressed_component
vtft_active_component *__generic pressed_component
Definition: vtft_types.h:665
vtft_colored_component
Structure for a componet characterized by color used for drawing it.
Definition: vtft_types.h:268
VTFT_COMPONENT_IMAGE
Definition: vtft_types.h:72
vtft_button
Structure for a button component.
Definition: vtft_types.h:421
VTFT_COMPONENT_LINE
Definition: vtft_types.h:67
vtft_active_component
Structure for a componet characterized by active and inactive state.
Definition: vtft_types.h:250
VTFT_TEXT_ALIGNMENT_TOP
Definition: vtft_types.h:204
VTFT_COMPONENT_PROGRESS_BAR
Definition: vtft_types.h:75
VTFT_GRADIENT_NONE
Definition: vtft_types.h:119
VTFT_TEXT_ALIGNMENT_CENTER
Definition: vtft_types.h:202
vtft_s::tp_instance
tp_t * tp_instance
Definition: vtft_types.h:656
vtft_rounded_box
Structure for a componet drawn like a box with rounded corners.
Definition: vtft_types.h:312
VTFT_COMPONENT_CIRCLE
Definition: vtft_types.h:65
VTFT_TEXT_ALIGNMENT_LEFT
Definition: vtft_types.h:201
vtft_s::draw_handles
vtft_draw_handle draw_handles[VTFT_COMPONENT_COUNT]
Definition: vtft_types.h:658