Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
nbgl_obj.h
Go to the documentation of this file.
1
7#ifndef NBGL_OBJ_H
8#define NBGL_OBJ_H
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14#include "nbgl_types.h"
15#include "nbgl_fonts.h"
16#include "ux_loc.h"
17
18/*********************
19 * INCLUDES
20 *********************/
21
22/*********************
23 * DEFINES
24 *********************/
25// Keypad special key values
26#define BACKSPACE_KEY 8
27#define VALIDATE_KEY '\r'
28
29// for Keyboard
30#ifdef NBGL_KEYBOARD
31#ifdef SCREEN_SIZE_WALLET
32#if defined(TARGET_STAX)
33#define KEYBOARD_KEY_HEIGHT 60
34#elif defined(TARGET_FLEX)
35#define KEYBOARD_KEY_HEIGHT 72
36#elif defined(TARGET_APEX)
37#define KEYBOARD_KEY_HEIGHT 51
38#endif // TARGETS
39
40// index of keys for keyMask field of nbgl_keyboard_t
41#define SHIFT_KEY_INDEX 26
42#define DIGITS_SWITCH_KEY_INDEX 27
43#define BACKSPACE_KEY_INDEX 28
44#define SPACE_KEY_INDEX 29
45#define SPECIAL_KEYS_INDEX 30
46
47#else // SCREEN_SIZE_WALLET
48#define KEYBOARD_KEY_WIDTH 14
49#define KEYBOARD_KEY_HEIGHT 14
50#define KEYBOARD_WIDTH (5 * KEYBOARD_KEY_WIDTH)
51#endif // SCREEN_SIZE_WALLET
52#endif // NBGL_KEYBOARD
53
54// for Keypad
55#ifdef SCREEN_SIZE_WALLET
56#if defined(TARGET_STAX)
57#define KEYPAD_KEY_HEIGHT 104
58#elif defined(TARGET_FLEX)
59#define KEYPAD_KEY_HEIGHT 88
60#elif defined(TARGET_APEX)
61#define KEYPAD_KEY_HEIGHT 60
62#endif // TARGETS
63#else // SCREEN_SIZE_WALLET
64#define KEYPAD_WIDTH 114
65#define KEYPAD_HEIGHT 18
66#endif // SCREEN_SIZE_WALLET
67#define KEYPAD_MAX_DIGITS 12
68
69#ifdef SCREEN_SIZE_WALLET
70// external margin in pixels
71#if defined(TARGET_STAX)
72#define BORDER_MARGIN 24
73#define VERTICAL_BORDER_MARGIN 24
74#elif defined(TARGET_FLEX)
75#define BORDER_MARGIN 32
76#define VERTICAL_BORDER_MARGIN 24
77#elif defined(TARGET_APEX)
78#define BORDER_MARGIN 16
79#define VERTICAL_BORDER_MARGIN 24
80#endif // TARGETS
81
82// Back button header height
83#if defined(TARGET_STAX)
84#define BACK_BUTTON_HEADER_HEIGHT 88
85#elif defined(TARGET_FLEX)
86#define BACK_BUTTON_HEADER_HEIGHT 96
87#elif defined(TARGET_APEX)
88#define BACK_BUTTON_HEADER_HEIGHT 60
89#endif // TARGETS
90
91// common dimensions for buttons
92#if COMMON_RADIUS == 40
93#define BUTTON_RADIUS RADIUS_40_PIXELS
94#elif COMMON_RADIUS == 44
95#define BUTTON_RADIUS RADIUS_44_PIXELS
96#elif COMMON_RADIUS == 28
97#define BUTTON_RADIUS RADIUS_28_PIXELS
98#endif // COMMON_RADIUS
99#define BUTTON_DIAMETER (COMMON_RADIUS * 2)
100// on Apex, "round" buttons are not exactly round
101#if defined(TARGET_APEX)
102#define BUTTON_WIDTH (BUTTON_DIAMETER - 2)
103#else
104#define BUTTON_WIDTH BUTTON_DIAMETER
105#endif
106
107// width & height for spinner
108#if defined(TARGET_STAX)
109#define SPINNER_WIDTH 60
110#define SPINNER_HEIGHT 44
111#elif defined(TARGET_FLEX)
112#define SPINNER_WIDTH 64
113#define SPINNER_HEIGHT 48
114#elif defined(TARGET_APEX)
115#define SPINNER_WIDTH 40
116#define SPINNER_HEIGHT 32
117#endif // TARGETS
118
119// width for indicator
120#if defined(TARGET_STAX)
121#define STEPPER_2_PAGES_WIDTH 136
122#define STEPPER_N_PAGES_WIDTH 184
123#elif defined(TARGET_FLEX)
124#define STEPPER_2_PAGES_WIDTH 136
125#define STEPPER_N_PAGES_WIDTH 184
126#elif defined(TARGET_APEX)
127#define STEPPER_2_PAGES_WIDTH 108
128#define STEPPER_N_PAGES_WIDTH 104
129#endif // TARGETS
130
131// width & height for radio button
132#if defined(TARGET_STAX)
133#define RADIO_WIDTH 32
134#define RADIO_HEIGHT 32
135#elif defined(TARGET_FLEX)
136#define RADIO_WIDTH 40
137#define RADIO_HEIGHT 40
138#elif defined(TARGET_APEX)
139#define RADIO_WIDTH 24
140#define RADIO_HEIGHT 24
141#endif // TARGETS
142
143// common small icons
144#if SMALL_ICON_SIZE == 32
145#define SPACE_ICON C_Space_32px
146#define BACKSPACE_ICON C_Erase_32px
147#define SHIFT_ICON C_Maj_32px
148#define SHIFT_LOCKED_ICON C_Maj_Lock_32px
149#define VALIDATE_ICON C_Check_32px
150#define RADIO_OFF_ICON C_radio_inactive_32px
151#define RADIO_ON_ICON C_radio_active_32px
152#define PUSH_ICON C_Chevron_32px
153#define LEFT_ARROW_ICON C_Back_32px
154#define RIGHT_ARROW_ICON C_Next_32px
155#define CHEVRON_BACK_ICON C_Chevron_Back_32px
156#define CHEVRON_NEXT_ICON C_Chevron_Next_32px
157#define CLOSE_ICON C_Close_32px
158#define WHEEL_ICON C_Settings_32px
159#define INFO_I_ICON C_Info_32px
160#define QRCODE_ICON C_QRCode_32px
161#define MINI_PUSH_ICON C_Mini_Push_32px
162#define WARNING_ICON C_Warning_32px
163#define ROUND_WARN_ICON C_Important_Circle_32px
164#define PRIVACY_ICON C_Privacy_32px
165#define EXCLAMATION_ICON C_Exclamation_32px
166#define QUESTION_ICON C_Question_32px
167#define DIGIT_ICON C_round_24px
168#define QUESTION_CIRCLE_ICON C_Question_Mark_Circle_32px
169#define SEARCH_ICON C_Search_32px
170#define SWITCH_ICON C_switch_60_40
171#elif SMALL_ICON_SIZE == 40
172#define SPACE_ICON C_Space_40px
173#define BACKSPACE_ICON C_Erase_40px
174#define SHIFT_ICON C_Maj_40px
175#define SHIFT_LOCKED_ICON C_Maj_Lock_40px
176#define VALIDATE_ICON C_Check_40px
177#define RADIO_OFF_ICON C_radio_inactive_40px
178#define RADIO_ON_ICON C_radio_active_40px
179#define PUSH_ICON C_Chevron_40px
180#define LEFT_ARROW_ICON C_Back_40px
181#define RIGHT_ARROW_ICON C_Next_40px
182#define CHEVRON_BACK_ICON C_Chevron_Back_40px
183#define CHEVRON_NEXT_ICON C_Chevron_Next_40px
184#define CLOSE_ICON C_Close_40px
185#define WHEEL_ICON C_Settings_40px
186#define INFO_I_ICON C_Info_40px
187#define QRCODE_ICON C_QRCode_40px
188#define MINI_PUSH_ICON C_Mini_Push_40px
189#define WARNING_ICON C_Warning_40px
190#define ROUND_WARN_ICON C_Important_Circle_40px
191#define PRIVACY_ICON C_Privacy_40px
192#define EXCLAMATION_ICON C_Exclamation_40px
193#define QUESTION_ICON C_Question_40px
194#define DIGIT_ICON C_pin_24
195#define QUESTION_CIRCLE_ICON C_Question_Mark_Circle_40px
196#define SEARCH_ICON C_Search_40px
197#define SWITCH_ICON C_switch_60_40
198#elif SMALL_ICON_SIZE == 24
199#define SPACE_ICON C_Space_24px
200#define BACKSPACE_ICON C_Erase_24px
201#define SHIFT_ICON C_Maj_24px
202#define SHIFT_LOCKED_ICON C_Maj_Lock_24px
203#define VALIDATE_ICON C_Check_24px
204#define RADIO_OFF_ICON C_radio_inactive_24px
205#define RADIO_ON_ICON C_radio_active_24px
206#define PUSH_ICON C_Chevron_24px
207#define LEFT_ARROW_ICON C_Back_24px
208#define RIGHT_ARROW_ICON C_Next_24px
209#define CHEVRON_BACK_ICON C_Chevron_Back_24px
210#define CHEVRON_NEXT_ICON C_Chevron_Next_24px
211#define CLOSE_ICON C_Close_24px
212#define WHEEL_ICON C_Settings_24px
213#define INFO_I_ICON C_Info_24px
214#define QRCODE_ICON C_QRCode_24px
215#define MINI_PUSH_ICON C_Mini_Push_24px
216#define WARNING_ICON C_Warning_24px
217#define ROUND_WARN_ICON C_Important_Circle_24px
218#define PRIVACY_ICON C_Privacy_24px
219#define EXCLAMATION_ICON C_Exclamation_24px
220#define DIGIT_ICON C_Dot_16px
221#define QUESTION_CIRCLE_ICON C_Question_Mark_Circle_24px
222#define SEARCH_ICON C_Search_24px
223#define SWITCH_ICON C_switch_on_24px
224#else // SMALL_ICON_SIZE
225#error Undefined SMALL_ICON_SIZE
226#endif // SMALL_ICON_SIZE
227
228// common large icons
229#if LARGE_ICON_SIZE == 64
230#define CHECK_CIRCLE_ICON C_Check_Circle_64px
231#define DENIED_CIRCLE_ICON C_Denied_Circle_64px
232#define IMPORTANT_CIRCLE_ICON C_Important_Circle_64px
233#define LARGE_WARNING_ICON C_Warning_64px
234#define INFO_CIRCLE_ICON C_Info_Circle_64px
235#elif LARGE_ICON_SIZE == 48
236#define CHECK_CIRCLE_ICON C_Check_Circle_48px
237#define DENIED_CIRCLE_ICON C_Denied_Circle_48px
238#define IMPORTANT_CIRCLE_ICON C_Important_Circle_48px
239#define LARGE_WARNING_ICON C_Warning_48px
240#define INFO_CIRCLE_ICON C_Info_Circle_48px
241#else // LARGE_ICON_SIZE
242#error Undefined LARGE_ICON_SIZE
243#endif // LARGE_ICON_SIZE
244
245// For backward compatibility, to be remove later
246#define C_warning64px _Pragma("GCC warning \"Deprecated constant!\"") C_Warning_64px
247#define C_round_warning_64px _Pragma("GCC warning \"Deprecated constant!\"") C_Important_Circle_64px
248#define C_round_check_64px _Pragma("GCC warning \"Deprecated constant!\"") C_Check_Circle_64px
249#define C_Message_64px _Pragma("GCC warning \"Deprecated constant!\"") C_Review_64px
250#define C_leftArrow32px _Pragma("GCC warning \"Deprecated constant!\"") C_Back_32px
251#define C_Next32px _Pragma("GCC warning \"Deprecated constant!\"") C_Next_32px
252#define C_round_cross_64px _Pragma("GCC warning \"Deprecated constant!\"") C_Denied_Circle_64px
253
254// max number of pages when nbgl_page_indicator_t uses dashes (above, it uses n / nb_pages)
255#define NB_MAX_PAGES_WITH_DASHES 6
256
257// number of spinner positions
258#define NB_SPINNER_POSITIONS 4
259#endif // SCREEN_SIZE_WALLET
260
261#if NB_COLOR_BITS == 1
262#define INACTIVE_COLOR WHITE
263#define INACTIVE_TEXT_COLOR BLACK
264#define INACTIVE_SMALL_FONT SMALL_REGULAR_FONT
265#define LIGHT_TEXT_COLOR BLACK
266#define BUTTON_STROKE 1
267#else
268#define INACTIVE_COLOR LIGHT_GRAY
269#define INACTIVE_TEXT_COLOR LIGHT_GRAY
270#define INACTIVE_SMALL_FONT SMALL_BOLD_FONT
271#define LIGHT_TEXT_COLOR DARK_GRAY
272#define BUTTON_STROKE 2
273#endif
274
275#define KEYPAD_REINIT_KEYS 0x1F
276
277/**********************
278 * TYPEDEFS
279 **********************/
280
281#define SWIPE_MASK \
282 ((1 << SWIPED_UP) | (1 << SWIPED_DOWN) | (1 << SWIPED_LEFT) | (1 << SWIPED_RIGHT))
283
288#define LEFT_BUTTON 0x01
289#define RIGHT_BUTTON 0x02
290#define BOTH_BUTTONS 0x03
291#define RELEASED_MASK 0x80
292#define CONTINUOUS_MASK \
293 0x40
295
307
314typedef void (*nbgl_buttonCallback_t)(void *obj, nbgl_buttonEvent_t buttonEvent);
315
320typedef struct {
322#ifdef HAVE_HW_TOUCH_SWIPE
324#endif // HAVE_HW_TOUCH_SWIPE
325 int16_t
327 int16_t y;
329
335typedef void (*nbgl_touchCallback_t)(void *obj, nbgl_touchType_t eventType);
336
359
373
387
394typedef nbgl_icon_details_t *(*onImageDrawCallback_t)(uint8_t token);
395
411
418 nbgl_obj_t obj; // common part
419 const uint8_t *buffer;
421
434
447
458
473
482
496
503typedef char *(*onTextDrawCallback_t)(uint8_t token);
504
526
548
559
565
576
582typedef void (*keyboardCallback_t)(char touchedKey);
583
588typedef enum {
589#ifdef HAVE_SE_TOUCH
593#else // HAVE_SE_TOUCH
594 MODE_LOWER_LETTERS,
595 MODE_UPPER_LETTERS,
596 MODE_DIGITS_AND_SPECIALS,
597 MODE_NONE
598#endif // HAVE_SE_TOUCH
600
610
615typedef struct PACKED__ nbgl_keyboard_s {
620#ifdef SCREEN_SIZE_WALLET
623#else // SCREEN_SIZE_WALLET
624 bool enableBackspace;
625 bool enableValidate;
626 uint8_t selectedCharIndex;
627#endif // SCREEN_SIZE_WALLET
629 uint32_t keyMask;
634
639typedef struct PACKED__ nbgl_keypad_s {
642#ifdef SCREEN_SIZE_WALLET
643 uint8_t softValidation : 1;
644 uint8_t enableDigits : 1;
645 uint8_t digitsChanged : 1;
646 uint8_t validateChanged : 1;
647 uint8_t enableBackspace : 1;
648 uint8_t enableValidate : 1;
649 uint8_t shuffled : 1;
650 uint8_t digitIndexes[5];
651#else // SCREEN_SIZE_WALLET
652 uint8_t selectedKey : 5;
653 uint8_t enableBackspace : 1;
654 uint8_t enableValidate : 1;
655 uint8_t shuffled : 1;
656#endif // SCREEN_SIZE_WALLET
658
663enum {
683 CONTROLS_ID, // when multiple controls in the same pages (buttons, switches, radios)
686
687/**********************
688 * GLOBAL PROTOTYPES
689 **********************/
690
691void nbgl_refresh(void);
694bool nbgl_refreshIsNeeded(void);
695void nbgl_refreshReset(void);
696
697void nbgl_objInit(void);
698void nbgl_objDraw(nbgl_obj_t *obj);
699void nbgl_objAllowDrawing(bool enable);
700uint8_t *nbgl_objGetRAMBuffer(void);
701bool nbgl_objIsUx(nbgl_obj_t *obj);
702
703void nbgl_objPoolRelease(uint8_t layer);
704nbgl_obj_t *nbgl_objPoolGet(nbgl_obj_type_t type, uint8_t layer);
705nbgl_obj_t *nbgl_objPoolGetPrevious(nbgl_obj_t *obj, uint8_t layer);
706uint8_t nbgl_objPoolGetId(nbgl_obj_t *obj);
708 uint8_t nbObjs,
709 uint8_t layer,
710 nbgl_obj_t **objArray);
711uint8_t nbgl_objPoolGetNbUsed(uint8_t layer);
712void nbgl_containerPoolRelease(uint8_t layer);
713nbgl_obj_t **nbgl_containerPoolGet(uint8_t nbObjs, uint8_t layer);
714uint8_t nbgl_containerPoolGetNbUsed(uint8_t layer);
715
716// for internal use
719#ifdef HAVE_SE_TOUCH
722
723bool nbgl_keyboardGetPosition(nbgl_keyboard_t *kbd, char index, uint16_t *x, uint16_t *y);
724bool nbgl_keypadGetPosition(nbgl_keypad_t *kbd, char index, uint16_t *x, uint16_t *y);
725#else // HAVE_SE_TOUCH
726void nbgl_keyboardCallback(nbgl_obj_t *obj, nbgl_buttonEvent_t buttonEvent);
727void nbgl_keypadCallback(nbgl_obj_t *obj, nbgl_buttonEvent_t buttonEvent);
728#endif // HAVE_SE_TOUCH
729
730/**********************
731 * MACROS
732 **********************/
733
734#ifdef __cplusplus
735} /* extern "C" */
736#endif
737
738#endif /* NBGL_OBJ_H */
nbgl_font_id_e
Definition nbgl_fonts.h:143
struct PACKED__ nbgl_line_s nbgl_line_t
struct to represent a vertical or horizontal line
struct PACKED__ nbgl_navigation_bar_s nbgl_page_indicator_t
struct to represent a navigation bar (PAGE_INDICATOR type) There can be up to 5 page indicators,...
struct PACKED__ nbgl_radio_s nbgl_radio_t
struct to represent a radio button (RADIO_BUTTON type)
nbgl_obj_t * nbgl_objPoolGetPrevious(nbgl_obj_t *obj, uint8_t layer)
Gets a link to the previous object in the pool, for the given layer. (to be used with care)
void(* nbgl_touchCallback_t)(void *obj, nbgl_touchType_t eventType)
prototype of function to be called when a touch event is received by an object
Definition nbgl_obj.h:335
struct PACKED__ nbgl_text_area_s nbgl_text_area_t
struct to represent a text area (TEXT_AREA type)
uint8_t nbgl_containerPoolGetNbUsed(uint8_t layer)
returns the number of containers currently used in the pool
nbgl_icon_details_t *(* onImageDrawCallback_t)(uint8_t token)
prototype of function to be called when a IMAGE object is drawned, and no buffer was provided
Definition nbgl_obj.h:394
void nbgl_objDraw(nbgl_obj_t *obj)
This function draws or redraws the given object and its children (recursive version)
Definition nbgl_obj.c:1622
void nbgl_refresh(void)
This functions refreshes the actual screen on display with what has changed since the last refresh.
Definition nbgl_obj.c:1665
struct PACKED__ nbgl_progress_bar_s nbgl_progress_bar_t
struct to represent a progress bar (PROGRESS_BAR type)
void nbgl_keyboardTouchCallback(nbgl_obj_t *obj, nbgl_touchType_t eventType)
function to be called when the keyboard object is touched
nbgl_obj_t ** nbgl_containerPoolGet(uint8_t nbObjs, uint8_t layer)
Gets a new container from the pool, with the given number of obj pointers.
struct PACKED__ nbgl_keypad_s nbgl_keypad_t
struct to represent a keypad (KEYPAD type)
void nbgl_refreshReset(void)
This functions resets all changes since the last refresh.
Definition nbgl_obj.c:1723
struct PACKED__ nbgl_mask_control_s nbgl_mask_control_t
keyboardCase_t
Letters casing in which to open/set the keyboard.
Definition nbgl_obj.h:605
@ LOCKED_UPPER_CASE
locked upper case mode
Definition nbgl_obj.h:608
@ LOWER_CASE
lower case mode
Definition nbgl_obj.h:606
@ UPPER_CASE
upper case mode for one character
Definition nbgl_obj.h:607
nbgl_obj_t * nbgl_objPoolGet(nbgl_obj_type_t type, uint8_t layer)
Gets a new graphic object from the pool, with the given type. The type field of the object is set.
void nbgl_objAllowDrawing(bool enable)
This functions enables or disables drawing/refresh for all further calls.
Definition nbgl_obj.c:1755
struct PACKED__ nbgl_text_entry_s nbgl_text_entry_t
struct to represent a text entry area (TEXT_ENTRY type)
void nbgl_keypadTouchCallback(nbgl_obj_t *obj, nbgl_touchType_t eventType)
function to be called when the keypad object is touched
bool nbgl_keyboardGetPosition(nbgl_keyboard_t *kbd, char index, uint16_t *x, uint16_t *y)
This function gets the position (top-left corner) of the key at the given index. (to be used for Test...
struct PACKED__ nbgl_keyboard_s nbgl_keyboard_t
struct to represent a keyboard (KEYBOARD type)
void nbgl_refreshSpecial(nbgl_refresh_mode_t mode)
This functions refreshes the actual screen on display with what has changed since the last refresh,...
Definition nbgl_obj.c:1675
nbgl_buttonEvent_t
Definition nbgl_obj.h:296
@ BUTTON_BOTH_TOUCHED
Sent when both buttons are touched.
Definition nbgl_obj.h:304
@ BUTTON_LEFT_CONTINUOUS_PRESSED
Definition nbgl_obj.h:299
@ BUTTON_BOTH_PRESSED
Sent when both buttons are released.
Definition nbgl_obj.h:303
@ BUTTON_RIGHT_CONTINUOUS_PRESSED
Definition nbgl_obj.h:301
@ BUTTON_LEFT_PRESSED
Sent when Left button is released.
Definition nbgl_obj.h:297
@ BUTTON_RIGHT_PRESSED
Send when Right button is released.
Definition nbgl_obj.h:298
@ INVALID_BUTTON_EVENT
Definition nbgl_obj.h:305
void nbgl_containerPoolRelease(uint8_t layer)
Release the objects pointers from the pool for the given layer.
struct PACKED__ nbgl_image_s nbgl_image_t
struct to represent an image (IMAGE type)
int nbgl_objPoolGetArray(nbgl_obj_type_t type, uint8_t nbObjs, uint8_t layer, nbgl_obj_t **objArray)
Gets nbObjects new graphic object from the pool, with the given type, for the given layer (screen)....
bool nbgl_objIsUx(nbgl_obj_t *obj)
This function returns true if the object belongs to a UxScreen.
Definition nbgl_obj.c:1775
char *(* onTextDrawCallback_t)(uint8_t token)
prototype of function to be called when a TEXT_AREA object is drawned, and no text was provided
Definition nbgl_obj.h:503
uint8_t nbgl_objPoolGetId(nbgl_obj_t *obj)
Gets a unique index for the given object, in the pool.
bool nbgl_keypadGetPosition(nbgl_keypad_t *kbd, char index, uint16_t *x, uint16_t *y)
This function gets the position (top-left corner) of the key at the given index. (to be used for Test...
struct PACKED__ nbgl_button_s nbgl_button_t
struct to represent a button (BUTTON type) that can contain a text and/or an icon
void(* nbgl_buttonCallback_t)(void *obj, nbgl_buttonEvent_t buttonEvent)
prototype of function to be called when a button event is received by an object (TODO: change to scre...
Definition nbgl_obj.h:314
keyboardMode_t
Mode in which to open/set the keyboard.
Definition nbgl_obj.h:588
@ MODE_SPECIAL
extended special characters mode
Definition nbgl_obj.h:592
@ MODE_DIGITS
digits and some special characters mode
Definition nbgl_obj.h:591
@ MODE_LETTERS
letters mode
Definition nbgl_obj.h:590
void nbgl_objDrawKeyboard(nbgl_keyboard_t *kbd)
This function draws a keyboard object.
void nbgl_refreshSpecialWithPostRefresh(nbgl_refresh_mode_t mode, nbgl_post_refresh_t post_refresh)
Definition nbgl_obj.c:1691
@ CHOICE_1_ID
Definition nbgl_obj.h:672
@ TOP_RIGHT_BUTTON_ID
Definition nbgl_obj.h:668
@ LONG_PRESS_BUTTON_ID
Definition nbgl_obj.h:681
@ CONTROLS_ID
Definition nbgl_obj.h:683
@ ENTERED_TEXT_ID
Definition nbgl_obj.h:677
@ LEFT_BUTTON_ID
Definition nbgl_obj.h:665
@ VALUE_BUTTON_2_ID
Definition nbgl_obj.h:679
@ VALUE_BUTTON_3_ID
Definition nbgl_obj.h:680
@ RIGHT_BUTTON_ID
Definition nbgl_obj.h:666
@ WHOLE_SCREEN_ID
Definition nbgl_obj.h:667
@ BOTTOM_BUTTON_ID
Definition nbgl_obj.h:664
@ CHOICE_3_ID
Definition nbgl_obj.h:674
@ SINGLE_BUTTON_ID
Definition nbgl_obj.h:670
@ BACK_BUTTON_ID
Definition nbgl_obj.h:669
@ VALUE_BUTTON_1_ID
Definition nbgl_obj.h:678
@ KEYPAD_ID
Definition nbgl_obj.h:675
@ NB_CONTROL_IDS
Definition nbgl_obj.h:684
@ TIP_BOX_ID
Definition nbgl_obj.h:682
@ KEYBOARD_ID
Definition nbgl_obj.h:676
@ EXTRA_BUTTON_ID
Definition nbgl_obj.h:671
@ CHOICE_2_ID
Definition nbgl_obj.h:673
uint8_t nbgl_objPoolGetNbUsed(uint8_t layer)
returns the number of objects currently used in the pool
void(* keyboardCallback_t)(char touchedKey)
prototype of function to be called when a valid key is pressed on keyboard Backspace is equal to 0x8 ...
Definition nbgl_obj.h:582
void nbgl_objDrawKeypad(nbgl_keypad_t *kbd)
This function draws a keypad object.
struct PACKED__ nbgl_container_s nbgl_container_t
struct to represent a container (CONTAINER type)
uint8_t * nbgl_objGetRAMBuffer(void)
This function is used to get the all purpose RAM buffer.
Definition nbgl_obj.c:1765
nbgl_page_indicator_style_t
Style to apply to nbgl_page_indicator_t.
Definition nbgl_obj.h:478
@ CURRENT_INDICATOR
only current page dash is black
Definition nbgl_obj.h:480
@ PROGRESSIVE_INDICATOR
all dashes before active page are black
Definition nbgl_obj.h:479
void nbgl_objPoolRelease(uint8_t layer)
Release the objects from the pool for the given layer.
bool nbgl_refreshIsNeeded(void)
This functions returns true if there is something to refresh.
Definition nbgl_obj.c:1711
struct PACKED__ nbgl_switch_s nbgl_switch_t
struct to represent a switch (size is fixed) (SWITCH type)
struct PACKED__ nbgl_obj_s nbgl_obj_t
Common structure for all graphical objects.
struct PACKED__ nbgl_spinner_s nbgl_spinner_t
struct to represent a "spinner", represented by the Ledger corners, in gray, with one of the corners ...
void nbgl_objInit(void)
This functions inits all internal of nbgl objects layer.
Definition nbgl_obj.c:1740
struct PACKED__ nbgl_image_file_s nbgl_image_file_t
struct to represent an image file object (IMAGE_FILE type) The source of the data is an image file wi...
struct PACKED__ nbgl_qrcode_s nbgl_qrcode_t
struct to represent a QR code (QR_CODE type), whose size is fixed
common types for Graphical Library
color_t
Definition nbgl_types.h:140
uint8_t nbgl_transformation_t
Represents the transformation to be applied on the bitmap before rendering This is a bitfield using m...
Definition nbgl_types.h:383
nbgl_state_t
to represent a boolean state.
Definition nbgl_types.h:199
nbgl_post_refresh_t
Post refresh modes.
Definition nbgl_types.h:352
nbgl_radius_t
possible radius indexes for objects
Definition nbgl_types.h:363
nbgl_touchType_t
The different types of Touchscreen events.
Definition nbgl_types.h:259
nbgl_qrcode_version_t
possible modes for QR Code
Definition nbgl_types.h:229
nbgl_direction_t
Directions for layout or lines.
Definition nbgl_types.h:208
struct PACKED__ nbgl_icon_details_s nbgl_icon_details_t
Represents all information about an icon.
nbgl_aligment_t
All types of alignments.
Definition nbgl_types.h:179
nbgl_hardwareSwipe_t
Hardware powered detected swipe states.
Definition nbgl_types.h:247
nbgl_obj_type_t
All types of graphical objects.
Definition nbgl_types.h:154
nbgl_touchState_t
the 2 possible states of a finger on the Touchscreen
Definition nbgl_types.h:239
nbgl_style_t
possible styles for text area border
Definition nbgl_types.h:217
#define PACKED__
Definition nbgl_types.h:127
struct PACKED__ nbgl_area_s nbgl_area_t
Represents a rectangle area of the screen.
nbgl_refresh_mode_t
different modes of refresh for nbgl_refreshSpecial()
Definition nbgl_types.h:326
struct to represent a button (BUTTON type) that can contain a text and/or an icon
Definition nbgl_obj.h:511
const char * text
single line UTF-8 text (NULL terminated)
Definition nbgl_obj.h:520
color_t foregroundColor
Definition nbgl_obj.h:515
onTextDrawCallback_t onDrawCallback
Definition nbgl_obj.h:521
uint8_t token
token to use as param of onDrawCallback
Definition nbgl_obj.h:523
color_t borderColor
color set to button's border
Definition nbgl_obj.h:514
color_t innerColor
color set inside of the button
Definition nbgl_obj.h:513
nbgl_radius_t radius
radius of the corners, must be a multiple of 4.
Definition nbgl_obj.h:517
nbgl_font_id_e fontId
id of the font to use, if any
Definition nbgl_obj.h:518
nbgl_obj_t obj
common part
Definition nbgl_obj.h:512
bool localized
unused, kept for compatibility
Definition nbgl_obj.h:519
const nbgl_icon_details_t * icon
buffer containing icons bitmap. Set to NULL when no icon
Definition nbgl_obj.h:524
struct to represent a container (CONTAINER type)
Definition nbgl_obj.h:366
nbgl_obj_t obj
common part
Definition nbgl_obj.h:367
struct nbgl_obj_s ** children
children of this object (nbChildren size)
Definition nbgl_obj.h:371
nbgl_direction_t layout
layout of children inside this object
Definition nbgl_obj.h:368
bool forceClean
if set to true, a paint will be done with background color
Definition nbgl_obj.h:370
uint8_t nbChildren
Definition nbgl_obj.h:369
struct to represent an image file object (IMAGE_FILE type) The source of the data is an image file wi...
Definition nbgl_obj.h:417
nbgl_obj_t obj
Definition nbgl_obj.h:418
const uint8_t * buffer
buffer containing image file
Definition nbgl_obj.h:419
struct to represent an image (IMAGE type)
Definition nbgl_obj.h:400
nbgl_transformation_t transformation
usually NO_TRANSFORMATION
Definition nbgl_obj.h:404
onImageDrawCallback_t onDrawCallback
Definition nbgl_obj.h:407
uint8_t token
token to use as param of onDrawCallback
Definition nbgl_obj.h:409
const nbgl_icon_details_t * buffer
Definition nbgl_obj.h:405
color_t foregroundColor
Definition nbgl_obj.h:402
nbgl_obj_t obj
Definition nbgl_obj.h:401
struct to represent a keyboard (KEYBOARD type)
Definition nbgl_obj.h:615
uint32_t keyMask
Definition nbgl_obj.h:629
color_t textColor
color set to letters.
Definition nbgl_obj.h:617
keyboardCase_t casing
keyboard casing mode (lower, upper once or upper locked)
Definition nbgl_obj.h:622
bool lettersOnly
if true, only display letter keys and Backspace
Definition nbgl_obj.h:619
nbgl_obj_t obj
common part
Definition nbgl_obj.h:616
keyboardMode_t mode
keyboard mode to start with
Definition nbgl_obj.h:628
color_t borderColor
color set to key borders
Definition nbgl_obj.h:618
keyboardCallback_t callback
function called when an active key is pressed
Definition nbgl_obj.h:632
bool needsRefresh
if true, means that the keyboard has been redrawn and needs a refresh
Definition nbgl_obj.h:621
struct to represent a keypad (KEYPAD type)
Definition nbgl_obj.h:639
uint8_t validateChanged
if true, means that validate key has changed
Definition nbgl_obj.h:646
uint8_t digitsChanged
if true, means that only digit keys have changed
Definition nbgl_obj.h:645
nbgl_obj_t obj
common part
Definition nbgl_obj.h:640
uint8_t enableDigits
if true, Digit keys are enabled
Definition nbgl_obj.h:644
uint8_t enableValidate
if true, Validate key is enabled
Definition nbgl_obj.h:648
uint8_t softValidation
if true, the "check icon" is replaced by an arrow
Definition nbgl_obj.h:643
uint8_t enableBackspace
if true, Backspace key is enabled
Definition nbgl_obj.h:647
uint8_t shuffled
if true, Digit keys are shuffled
Definition nbgl_obj.h:649
keyboardCallback_t callback
function called when an active key is pressed
Definition nbgl_obj.h:641
struct to represent a vertical or horizontal line
Definition nbgl_obj.h:378
nbgl_obj_t obj
common part
Definition nbgl_obj.h:379
nbgl_direction_t direction
direction of the line, e.g VERTICAL or HORIZONTAL
Definition nbgl_obj.h:380
color_t lineColor
color of the line
Definition nbgl_obj.h:381
uint8_t thickness
Definition nbgl_obj.h:382
uint8_t offset
Definition nbgl_obj.h:384
nbgl_obj_t obj
common part
Definition nbgl_obj.h:561
bool enableMasking
true: Enable masking of area / false: Disable masking of area
Definition nbgl_obj.h:562
uint8_t maskIndex
index of mask
Definition nbgl_obj.h:563
struct to represent a navigation bar (PAGE_INDICATOR type) There can be up to 5 page indicators,...
Definition nbgl_obj.h:490
nbgl_obj_t obj
common part
Definition nbgl_obj.h:491
nbgl_page_indicator_style_t style
Style to apply.
Definition nbgl_obj.h:494
uint8_t activePage
index of active page (from 0 to nbPages-1).
Definition nbgl_obj.h:493
uint8_t nbPages
number of pages.
Definition nbgl_obj.h:492
Common structure for all graphical objects.
Definition nbgl_obj.h:342
uint16_t touchMask
bit mask to tell engine which touch events are handled by this object
Definition nbgl_obj.h:355
struct nbgl_obj_s * parent
parent of this object
Definition nbgl_obj.h:349
uint8_t touchId
Definition nbgl_obj.h:356
nbgl_obj_type_t type
type of the graphical object, must be explicitly set
Definition nbgl_obj.h:354
int16_t rel_x0
horizontal position of top-left corner relative to parent's top-left corner
Definition nbgl_obj.h:346
int16_t alignmentMarginY
vertical margin when aligning
Definition nbgl_obj.h:353
nbgl_area_t area
Definition nbgl_obj.h:343
int16_t rel_y0
Definition nbgl_obj.h:347
struct nbgl_obj_s * alignTo
object to align to (parent by default)
Definition nbgl_obj.h:350
int16_t alignmentMarginX
horizontal margin when aligning
Definition nbgl_obj.h:352
nbgl_aligment_t alignment
type of alignment
Definition nbgl_obj.h:351
struct to represent a progress bar (PROGRESS_BAR type)
Definition nbgl_obj.h:463
color_t foregroundColor
color of the inner progress bar and border (if applicable)
Definition nbgl_obj.h:471
uint8_t withBorder
if set to true, a border in black surround the whole object
Definition nbgl_obj.h:468
uint16_t previousWidth
Definition nbgl_obj.h:465
uint8_t partialRedraw
set to true to redraw only partially the object (update state).
Definition nbgl_obj.h:467
uint8_t resetIfOverriden
Definition nbgl_obj.h:469
uint8_t state
state of the progress, in % (from 0 to 100).
Definition nbgl_obj.h:466
struct to represent a QR code (QR_CODE type), whose size is fixed
Definition nbgl_obj.h:426
nbgl_obj_t obj
Definition nbgl_obj.h:427
nbgl_qrcode_version_t version
Definition nbgl_obj.h:430
color_t foregroundColor
Definition nbgl_obj.h:428
const char * text
text single line (NULL terminated)
Definition nbgl_obj.h:432
struct to represent a radio button (RADIO_BUTTON type)
Definition nbgl_obj.h:441
color_t activeColor
color set to to inner circle, when active.
Definition nbgl_obj.h:443
color_t borderColor
color set to border.
Definition nbgl_obj.h:444
nbgl_state_t state
state of the radio button. Active is when state == ON_STATE
Definition nbgl_obj.h:445
nbgl_obj_t obj
Definition nbgl_obj.h:442
struct to represent a "spinner", represented by the Ledger corners, in gray, with one of the corners ...
Definition nbgl_obj.h:571
uint8_t position
Definition nbgl_obj.h:573
nbgl_obj_t obj
common part
Definition nbgl_obj.h:572
struct to represent a switch (size is fixed) (SWITCH type)
Definition nbgl_obj.h:452
color_t offColor
color set to border and knob, when OFF (knob on the left).
Definition nbgl_obj.h:455
color_t onColor
color set to border and knob, when ON (knob on the right).
Definition nbgl_obj.h:454
nbgl_obj_t obj
Definition nbgl_obj.h:453
nbgl_state_t state
state of the switch.
Definition nbgl_obj.h:456
struct to represent a text area (TEXT_AREA type)
Definition nbgl_obj.h:531
bool wrapping
if set to true, break lines on ' ' when possible
Definition nbgl_obj.h:539
onTextDrawCallback_t onDrawCallback
function called if not NULL to get the text of the text area
Definition nbgl_obj.h:545
uint16_t len
number of bytes to write (if 0, max number of chars or strlen is used)
Definition nbgl_obj.h:543
nbgl_style_t style
to define the style of border
Definition nbgl_obj.h:535
uint8_t nbMaxLines
Definition nbgl_obj.h:540
color_t textColor
color set to '1' bits in text. '0' are set to backgroundColor color.
Definition nbgl_obj.h:533
bool autoHideLongLine
Definition nbgl_obj.h:537
uint8_t token
token to use as param of onDrawCallback
Definition nbgl_obj.h:546
nbgl_aligment_t textAlignment
alignment of text within the area
Definition nbgl_obj.h:534
nbgl_font_id_e fontId
id of the font to use
Definition nbgl_obj.h:536
nbgl_obj_t obj
common part
Definition nbgl_obj.h:532
const char * text
ASCII text to draw (NULL terminated). Can be NULL.
Definition nbgl_obj.h:542
struct to represent a text entry area (TEXT_ENTRY type)
Definition nbgl_obj.h:553
nbgl_font_id_e fontId
id of the font to use
Definition nbgl_obj.h:555
const char * text
text to display (up to nbChars chars).
Definition nbgl_obj.h:557
uint8_t nbChars
number of char placeholders to display (8 or 9 chars).
Definition nbgl_obj.h:556
nbgl_obj_t obj
common part
Definition nbgl_obj.h:554
The low level Touchscreen event, coming from driver.
Definition nbgl_obj.h:320
int16_t y
vertical position of the touch (or for a RELEASED the last touched point)
Definition nbgl_obj.h:327
int16_t x
horizontal position of the touch (or for a RELEASED the last touched point)
Definition nbgl_obj.h:326
nbgl_touchState_t state
state of the touch event, e.g PRESSED or RELEASED
Definition nbgl_obj.h:321