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
52#define BACKSPACE_KEY_INDEX 26
53#define VALIDATE_INDEX 27
54#define SHIFT_KEY_INDEX 28
55#endif // SCREEN_SIZE_WALLET
56#endif // NBGL_KEYBOARD
57
58// for Keypad
59#ifdef SCREEN_SIZE_WALLET
60#if defined(TARGET_STAX)
61#define KEYPAD_KEY_HEIGHT 104
62#elif defined(TARGET_FLEX)
63#define KEYPAD_KEY_HEIGHT 88
64#elif defined(TARGET_APEX)
65#define KEYPAD_KEY_HEIGHT 60
66#endif // TARGETS
67#else // SCREEN_SIZE_WALLET
68#define KEYPAD_WIDTH 114
69#define KEYPAD_HEIGHT 18
70#endif // SCREEN_SIZE_WALLET
71#define KEYPAD_MAX_DIGITS 12
72
73#ifdef SCREEN_SIZE_WALLET
74// external margin in pixels
75#if defined(TARGET_STAX)
76#define BORDER_MARGIN 24
77#define VERTICAL_BORDER_MARGIN 24
78#elif defined(TARGET_FLEX)
79#define BORDER_MARGIN 32
80#define VERTICAL_BORDER_MARGIN 24
81#elif defined(TARGET_APEX)
82#define BORDER_MARGIN 16
83#define VERTICAL_BORDER_MARGIN 24
84#endif // TARGETS
85
86// Back button header height
87#if defined(TARGET_STAX)
88#define BACK_BUTTON_HEADER_HEIGHT 88
89#elif defined(TARGET_FLEX)
90#define BACK_BUTTON_HEADER_HEIGHT 96
91#elif defined(TARGET_APEX)
92#define BACK_BUTTON_HEADER_HEIGHT 60
93#endif // TARGETS
94
95// common dimensions for buttons
96#if COMMON_RADIUS == 40
97#define BUTTON_RADIUS RADIUS_40_PIXELS
98#elif COMMON_RADIUS == 44
99#define BUTTON_RADIUS RADIUS_44_PIXELS
100#elif COMMON_RADIUS == 28
101#define BUTTON_RADIUS RADIUS_28_PIXELS
102#endif // COMMON_RADIUS
103#define BUTTON_DIAMETER (COMMON_RADIUS * 2)
104// on Apex, "round" buttons are not exactly round
105#if defined(TARGET_APEX)
106#define BUTTON_WIDTH (BUTTON_DIAMETER - 2)
107#else
108#define BUTTON_WIDTH BUTTON_DIAMETER
109#endif
110
111// width & height for spinner
112#if defined(TARGET_STAX)
113#define SPINNER_WIDTH 60
114#define SPINNER_HEIGHT 44
115#elif defined(TARGET_FLEX)
116#define SPINNER_WIDTH 64
117#define SPINNER_HEIGHT 48
118#elif defined(TARGET_APEX)
119#define SPINNER_WIDTH 40
120#define SPINNER_HEIGHT 32
121#endif // TARGETS
122
123// width for indicator
124#if defined(TARGET_STAX)
125#define STEPPER_2_PAGES_WIDTH 136
126#define STEPPER_N_PAGES_WIDTH 184
127#elif defined(TARGET_FLEX)
128#define STEPPER_2_PAGES_WIDTH 136
129#define STEPPER_N_PAGES_WIDTH 184
130#elif defined(TARGET_APEX)
131#define STEPPER_2_PAGES_WIDTH 108
132#define STEPPER_N_PAGES_WIDTH 104
133#endif // TARGETS
134
135// width & height for radio button
136#if defined(TARGET_STAX)
137#define RADIO_WIDTH 32
138#define RADIO_HEIGHT 32
139#elif defined(TARGET_FLEX)
140#define RADIO_WIDTH 40
141#define RADIO_HEIGHT 40
142#elif defined(TARGET_APEX)
143#define RADIO_WIDTH 24
144#define RADIO_HEIGHT 24
145#endif // TARGETS
146
147// common small icons
148#if SMALL_ICON_SIZE == 32
149#define SPACE_ICON C_Space_32px
150#define BACKSPACE_ICON C_Erase_32px
151#define SHIFT_ICON C_Maj_32px
152#define SHIFT_LOCKED_ICON C_Maj_Lock_32px
153#define VALIDATE_ICON C_Check_32px
154#define RADIO_OFF_ICON C_radio_inactive_32px
155#define RADIO_ON_ICON C_radio_active_32px
156#define PUSH_ICON C_Chevron_32px
157#define LEFT_ARROW_ICON C_Back_32px
158#define RIGHT_ARROW_ICON C_Next_32px
159#define CHEVRON_BACK_ICON C_Chevron_Back_32px
160#define CHEVRON_NEXT_ICON C_Chevron_Next_32px
161#define CLOSE_ICON C_Close_32px
162#define WHEEL_ICON C_Settings_32px
163#define INFO_I_ICON C_Info_32px
164#define QRCODE_ICON C_QRCode_32px
165#define MINI_PUSH_ICON C_Mini_Push_32px
166#define WARNING_ICON C_Warning_32px
167#define ROUND_WARN_ICON C_Important_Circle_32px
168#define PRIVACY_ICON C_Privacy_32px
169#define EXCLAMATION_ICON C_Exclamation_32px
170#define QUESTION_ICON C_Question_32px
171#define DIGIT_ICON C_round_24px
172#define QUESTION_CIRCLE_ICON C_Question_Mark_Circle_32px
173#define SEARCH_ICON C_Search_32px
174#define SWITCH_ICON C_switch_60_40
175#elif SMALL_ICON_SIZE == 40
176#define SPACE_ICON C_Space_40px
177#define BACKSPACE_ICON C_Erase_40px
178#define SHIFT_ICON C_Maj_40px
179#define SHIFT_LOCKED_ICON C_Maj_Lock_40px
180#define VALIDATE_ICON C_Check_40px
181#define RADIO_OFF_ICON C_radio_inactive_40px
182#define RADIO_ON_ICON C_radio_active_40px
183#define PUSH_ICON C_Chevron_40px
184#define LEFT_ARROW_ICON C_Back_40px
185#define RIGHT_ARROW_ICON C_Next_40px
186#define CHEVRON_BACK_ICON C_Chevron_Back_40px
187#define CHEVRON_NEXT_ICON C_Chevron_Next_40px
188#define CLOSE_ICON C_Close_40px
189#define WHEEL_ICON C_Settings_40px
190#define INFO_I_ICON C_Info_40px
191#define QRCODE_ICON C_QRCode_40px
192#define MINI_PUSH_ICON C_Mini_Push_40px
193#define WARNING_ICON C_Warning_40px
194#define ROUND_WARN_ICON C_Important_Circle_40px
195#define PRIVACY_ICON C_Privacy_40px
196#define EXCLAMATION_ICON C_Exclamation_40px
197#define QUESTION_ICON C_Question_40px
198#define DIGIT_ICON C_pin_24
199#define QUESTION_CIRCLE_ICON C_Question_Mark_Circle_40px
200#define SEARCH_ICON C_Search_40px
201#define SWITCH_ICON C_switch_60_40
202#elif SMALL_ICON_SIZE == 24
203#define SPACE_ICON C_Space_24px
204#define BACKSPACE_ICON C_Erase_24px
205#define SHIFT_ICON C_Maj_24px
206#define SHIFT_LOCKED_ICON C_Maj_Lock_24px
207#define VALIDATE_ICON C_Check_24px
208#define RADIO_OFF_ICON C_radio_inactive_24px
209#define RADIO_ON_ICON C_radio_active_24px
210#define PUSH_ICON C_Chevron_24px
211#define LEFT_ARROW_ICON C_Back_24px
212#define RIGHT_ARROW_ICON C_Next_24px
213#define CHEVRON_BACK_ICON C_Chevron_Back_24px
214#define CHEVRON_NEXT_ICON C_Chevron_Next_24px
215#define CLOSE_ICON C_Close_Tiny_24px
216#define WHEEL_ICON C_Settings_24px
217#define INFO_I_ICON C_Info_24px
218#define QRCODE_ICON C_QRCode_24px
219#define MINI_PUSH_ICON C_Mini_Push_24px
220#define WARNING_ICON C_Warning_24px
221#define ROUND_WARN_ICON C_Important_Circle_24px
222#define PRIVACY_ICON C_Privacy_24px
223#define EXCLAMATION_ICON C_Exclamation_24px
224#define DIGIT_ICON C_Dot_16px
225#define QUESTION_CIRCLE_ICON C_Question_Mark_Circle_24px
226#define SEARCH_ICON C_Search_24px
227#define SWITCH_ICON C_switch_on_24px
228#else // SMALL_ICON_SIZE
229#error Undefined SMALL_ICON_SIZE
230#endif // SMALL_ICON_SIZE
231
232// common large icons
233#if LARGE_ICON_SIZE == 64
234#define CHECK_CIRCLE_ICON C_Check_Circle_64px
235#define DENIED_CIRCLE_ICON C_Denied_Circle_64px
236#define IMPORTANT_CIRCLE_ICON C_Important_Circle_64px
237#define LARGE_WARNING_ICON C_Warning_64px
238#define INFO_CIRCLE_ICON C_Info_Circle_64px
239#define LARGE_REVIEW_ICON C_Review_64px
240#define LARGE_LOGIN_ICON C_Login_64px
241#define LARGE_TRASH_ICON C_Trash_64px
242#elif LARGE_ICON_SIZE == 48
243#define CHECK_CIRCLE_ICON C_Check_Circle_48px
244#define DENIED_CIRCLE_ICON C_Denied_Circle_48px
245#define IMPORTANT_CIRCLE_ICON C_Important_Circle_48px
246#define LARGE_WARNING_ICON C_Warning_48px
247#define INFO_CIRCLE_ICON C_Info_Circle_48px
248#define LARGE_REVIEW_ICON C_Review_48px
249#define LARGE_LOGIN_ICON C_Login_48px
250#define LARGE_TRASH_ICON C_Trash_48px
251#else // LARGE_ICON_SIZE
252#error Undefined LARGE_ICON_SIZE
253#endif // LARGE_ICON_SIZE
254
255// For backward compatibility, to be remove later
256#define C_warning64px _Pragma("GCC warning \"Deprecated constant!\"") C_Warning_64px
257#define C_round_warning_64px _Pragma("GCC warning \"Deprecated constant!\"") C_Important_Circle_64px
258#define C_round_check_64px _Pragma("GCC warning \"Deprecated constant!\"") C_Check_Circle_64px
259#define C_Message_64px _Pragma("GCC warning \"Deprecated constant!\"") C_Review_64px
260#define C_leftArrow32px _Pragma("GCC warning \"Deprecated constant!\"") C_Back_32px
261#define C_Next32px _Pragma("GCC warning \"Deprecated constant!\"") C_Next_32px
262#define C_round_cross_64px _Pragma("GCC warning \"Deprecated constant!\"") C_Denied_Circle_64px
263
264// max number of pages when nbgl_page_indicator_t uses dashes (above, it uses n / nb_pages)
265#define NB_MAX_PAGES_WITH_DASHES 6
266
267// number of spinner positions
268#define NB_SPINNER_POSITIONS 4
269#else // SCREEN_SIZE_WALLET
270#define WARNING_ICON C_icon_warning
271#define REVIEW_ICON C_icon_certificate
272#define LOGIN_ICON C_Login_14px
273#define TRASH_ICON C_Trash_14px
274#endif // SCREEN_SIZE_WALLET
275
276#if NB_COLOR_BITS == 1
277#define INACTIVE_COLOR WHITE
278#define INACTIVE_TEXT_COLOR BLACK
279#define INACTIVE_SMALL_FONT SMALL_REGULAR_FONT
280#define LIGHT_TEXT_COLOR BLACK
281#define BUTTON_STROKE 1
282#else
283#define INACTIVE_COLOR LIGHT_GRAY
284#define INACTIVE_TEXT_COLOR LIGHT_GRAY
285#define INACTIVE_SMALL_FONT SMALL_BOLD_FONT
286#define LIGHT_TEXT_COLOR DARK_GRAY
287#define BUTTON_STROKE 2
288#endif
289
290#define KEYPAD_REINIT_KEYS 0x1F
291
292/**********************
293 * TYPEDEFS
294 **********************/
295
296#define SWIPE_MASK \
297 ((1 << SWIPED_UP) | (1 << SWIPED_DOWN) | (1 << SWIPED_LEFT) | (1 << SWIPED_RIGHT))
298
303#define LEFT_BUTTON 0x01
304#define RIGHT_BUTTON 0x02
305#define BOTH_BUTTONS 0x03
306#define RELEASED_MASK 0x80
307#define CONTINUOUS_MASK \
308 0x40
310
322
329typedef void (*nbgl_buttonCallback_t)(void *obj, nbgl_buttonEvent_t buttonEvent);
330
335typedef struct {
337#ifdef HAVE_HW_TOUCH_SWIPE
339#endif // HAVE_HW_TOUCH_SWIPE
340 int16_t
342 int16_t y;
344
350typedef void (*nbgl_touchCallback_t)(void *obj, nbgl_touchType_t eventType);
351
371
385
399
406typedef nbgl_icon_details_t *(*onImageDrawCallback_t)(uint8_t token);
407
423
430 nbgl_obj_t obj; // common part
431 const uint8_t *buffer;
433
446
459
470
485
494
508
515typedef char *(*onTextDrawCallback_t)(uint8_t token);
516
538
560
571
577
588
594typedef void (*keyboardCallback_t)(char touchedKey);
595
600typedef enum {
601#ifdef HAVE_SE_TOUCH
605#else // HAVE_SE_TOUCH
606 MODE_LOWER_LETTERS,
607 MODE_UPPER_LETTERS,
608 MODE_DIGITS_AND_SPECIALS,
609 MODE_NONE
610#endif // HAVE_SE_TOUCH
612
622
627typedef struct PACKED__ nbgl_keyboard_s {
632#ifdef SCREEN_SIZE_WALLET
635#else // SCREEN_SIZE_WALLET
636 bool enableBackspace;
637 bool enableValidate;
638 uint8_t selectedCharIndex;
639#endif // SCREEN_SIZE_WALLET
641 uint32_t keyMask;
646
651typedef struct PACKED__ nbgl_keypad_s {
654#ifdef SCREEN_SIZE_WALLET
655 uint8_t softValidation : 1;
656 uint8_t enableDigits : 1;
657 uint8_t digitsChanged : 1;
658 uint8_t validateChanged : 1;
659 uint8_t enableBackspace : 1;
660 uint8_t enableValidate : 1;
661 uint8_t shuffled : 1;
662 uint8_t digitIndexes[5];
663#else // SCREEN_SIZE_WALLET
664 uint8_t selectedKey : 5;
665 uint8_t enableBackspace : 1;
666 uint8_t enableValidate : 1;
667 uint8_t shuffled : 1;
668#endif // SCREEN_SIZE_WALLET
670
675enum {
695 CONTROLS_ID, // when multiple controls in the same pages (buttons, switches, radios)
698
699/**********************
700 * GLOBAL VARIABLES
701 **********************/
702
703extern uint8_t ramBuffer[];
704
705/**********************
706 * GLOBAL PROTOTYPES
707 **********************/
708
709void nbgl_refresh(void);
714
715void nbgl_objInit(void);
717void nbgl_objAllowDrawing(bool enable);
718uint8_t *nbgl_objGetRAMBuffer(void);
720
721void nbgl_objPoolRelease(uint8_t layer);
725 uint8_t nbObjs,
726 uint8_t layer,
727 nbgl_obj_t **objArray);
728uint8_t nbgl_objPoolGetNbUsed(uint8_t layer);
729void nbgl_containerPoolRelease(uint8_t layer);
730nbgl_obj_t **nbgl_containerPoolGet(uint8_t nbObjs, uint8_t layer);
731uint8_t nbgl_containerPoolGetNbUsed(uint8_t layer);
732
733// for internal use
736#ifdef HAVE_SE_TOUCH
739
740bool nbgl_keyboardGetPosition(nbgl_keyboard_t *kbd, char index, uint16_t *x, uint16_t *y);
741bool nbgl_keypadGetPosition(nbgl_keypad_t *kbd, char index, uint16_t *x, uint16_t *y);
742#else // HAVE_SE_TOUCH
743void nbgl_keyboardCallback(nbgl_obj_t *obj, nbgl_buttonEvent_t buttonEvent);
744void nbgl_keypadCallback(nbgl_obj_t *obj, nbgl_buttonEvent_t buttonEvent);
745#endif // HAVE_SE_TOUCH
746
747/**********************
748 * MACROS
749 **********************/
750
751#ifdef __cplusplus
752} /* extern "C" */
753#endif
754
755#endif /* NBGL_OBJ_H */
nbgl_font_id_e
Definition nbgl_fonts.h:132
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)
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:350
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)
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:406
void nbgl_objDraw(nbgl_obj_t *obj)
void nbgl_refresh(void)
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)
nbgl_obj_t ** nbgl_containerPoolGet(uint8_t nbObjs, uint8_t layer)
struct PACKED__ nbgl_keypad_s nbgl_keypad_t
struct to represent a keypad (KEYPAD type)
void nbgl_refreshReset(void)
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:617
@ LOCKED_UPPER_CASE
locked upper case mode
Definition nbgl_obj.h:620
@ LOWER_CASE
lower case mode
Definition nbgl_obj.h:618
@ UPPER_CASE
upper case mode for one character
Definition nbgl_obj.h:619
nbgl_obj_t * nbgl_objPoolGet(nbgl_obj_type_t type, uint8_t layer)
void nbgl_objAllowDrawing(bool enable)
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)
bool nbgl_keyboardGetPosition(nbgl_keyboard_t *kbd, char index, uint16_t *x, uint16_t *y)
uint8_t ramBuffer[]
struct PACKED__ nbgl_keyboard_s nbgl_keyboard_t
struct to represent a keyboard (KEYBOARD type)
void nbgl_refreshSpecial(nbgl_refresh_mode_t mode)
nbgl_buttonEvent_t
Definition nbgl_obj.h:311
@ BUTTON_BOTH_TOUCHED
Sent when both buttons are touched.
Definition nbgl_obj.h:319
@ BUTTON_LEFT_CONTINUOUS_PRESSED
Definition nbgl_obj.h:314
@ BUTTON_BOTH_PRESSED
Sent when both buttons are released.
Definition nbgl_obj.h:318
@ BUTTON_RIGHT_CONTINUOUS_PRESSED
Definition nbgl_obj.h:316
@ BUTTON_LEFT_PRESSED
Sent when Left button is released.
Definition nbgl_obj.h:312
@ BUTTON_RIGHT_PRESSED
Send when Right button is released.
Definition nbgl_obj.h:313
@ INVALID_BUTTON_EVENT
Definition nbgl_obj.h:320
void nbgl_containerPoolRelease(uint8_t 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)
bool nbgl_objIsUx(nbgl_obj_t *obj)
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:515
uint8_t nbgl_objPoolGetId(nbgl_obj_t *obj)
bool nbgl_keypadGetPosition(nbgl_keypad_t *kbd, char index, uint16_t *x, uint16_t *y)
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:329
keyboardMode_t
Mode in which to open/set the keyboard.
Definition nbgl_obj.h:600
@ MODE_SPECIAL
extended special characters mode
Definition nbgl_obj.h:604
@ MODE_DIGITS
digits and some special characters mode
Definition nbgl_obj.h:603
@ MODE_LETTERS
letters mode
Definition nbgl_obj.h:602
void nbgl_objDrawKeyboard(nbgl_keyboard_t *kbd)
void nbgl_refreshSpecialWithPostRefresh(nbgl_refresh_mode_t mode, nbgl_post_refresh_t post_refresh)
@ CHOICE_1_ID
Definition nbgl_obj.h:684
@ TOP_RIGHT_BUTTON_ID
Definition nbgl_obj.h:680
@ LONG_PRESS_BUTTON_ID
Definition nbgl_obj.h:693
@ CONTROLS_ID
Definition nbgl_obj.h:695
@ ENTERED_TEXT_ID
Definition nbgl_obj.h:689
@ LEFT_BUTTON_ID
Definition nbgl_obj.h:677
@ VALUE_BUTTON_2_ID
Definition nbgl_obj.h:691
@ VALUE_BUTTON_3_ID
Definition nbgl_obj.h:692
@ RIGHT_BUTTON_ID
Definition nbgl_obj.h:678
@ WHOLE_SCREEN_ID
Definition nbgl_obj.h:679
@ BOTTOM_BUTTON_ID
Definition nbgl_obj.h:676
@ CHOICE_3_ID
Definition nbgl_obj.h:686
@ SINGLE_BUTTON_ID
Definition nbgl_obj.h:682
@ BACK_BUTTON_ID
Definition nbgl_obj.h:681
@ VALUE_BUTTON_1_ID
Definition nbgl_obj.h:690
@ KEYPAD_ID
Definition nbgl_obj.h:687
@ NB_CONTROL_IDS
Definition nbgl_obj.h:696
@ TIP_BOX_ID
Definition nbgl_obj.h:694
@ KEYBOARD_ID
Definition nbgl_obj.h:688
@ EXTRA_BUTTON_ID
Definition nbgl_obj.h:683
@ CHOICE_2_ID
Definition nbgl_obj.h:685
uint8_t nbgl_objPoolGetNbUsed(uint8_t layer)
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:594
void nbgl_objDrawKeypad(nbgl_keypad_t *kbd)
struct PACKED__ nbgl_container_s nbgl_container_t
struct to represent a container (CONTAINER type)
uint8_t * nbgl_objGetRAMBuffer(void)
nbgl_page_indicator_style_t
Style to apply to nbgl_page_indicator_t.
Definition nbgl_obj.h:490
@ CURRENT_INDICATOR
only current page dash is black
Definition nbgl_obj.h:492
@ PROGRESSIVE_INDICATOR
all dashes before active page are black
Definition nbgl_obj.h:491
void nbgl_objPoolRelease(uint8_t layer)
bool nbgl_refreshIsNeeded(void)
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)
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:382
nbgl_state_t
to represent a boolean state.
Definition nbgl_types.h:199
nbgl_post_refresh_t
Post refresh modes.
Definition nbgl_types.h:351
nbgl_radius_t
possible radius indexes for objects
Definition nbgl_types.h:362
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:325
struct to represent a button (BUTTON type) that can contain a text and/or an icon
Definition nbgl_obj.h:523
const char * text
single line UTF-8 text (NULL terminated)
Definition nbgl_obj.h:525
color_t foregroundColor
Definition nbgl_obj.h:530
onTextDrawCallback_t onDrawCallback
function called if not NULL, with above token as
Definition nbgl_obj.h:526
uint8_t token
token to use as param of onDrawCallback
Definition nbgl_obj.h:536
color_t borderColor
color set to button's border
Definition nbgl_obj.h:529
color_t innerColor
color set inside of the button
Definition nbgl_obj.h:528
nbgl_radius_t radius
radius of the corners, must be a multiple of 4.
Definition nbgl_obj.h:532
nbgl_font_id_e fontId
id of the font to use, if any
Definition nbgl_obj.h:533
nbgl_obj_t obj
common part
Definition nbgl_obj.h:524
const nbgl_icon_details_t * icon
buffer containing icons bitmap. Set to NULL when no icon
Definition nbgl_obj.h:527
struct to represent a container (CONTAINER type)
Definition nbgl_obj.h:378
nbgl_obj_t obj
common part
Definition nbgl_obj.h:379
nbgl_direction_t layout
layout of children inside this object
Definition nbgl_obj.h:381
bool forceClean
if set to true, a paint will be done with background color
Definition nbgl_obj.h:383
uint8_t nbChildren
Definition nbgl_obj.h:382
nbgl_obj_t ** children
children of this object (nbChildren size)
Definition nbgl_obj.h:380
struct to represent an image file object (IMAGE_FILE type) The source of the data is an image file wi...
Definition nbgl_obj.h:429
nbgl_obj_t obj
Definition nbgl_obj.h:430
const uint8_t * buffer
buffer containing image file
Definition nbgl_obj.h:431
struct to represent an image (IMAGE type)
Definition nbgl_obj.h:412
nbgl_transformation_t transformation
usually NO_TRANSFORMATION
Definition nbgl_obj.h:420
onImageDrawCallback_t onDrawCallback
Definition nbgl_obj.h:416
uint8_t token
token to use as param of onDrawCallback
Definition nbgl_obj.h:421
const nbgl_icon_details_t * buffer
Definition nbgl_obj.h:414
color_t foregroundColor
Definition nbgl_obj.h:418
nbgl_obj_t obj
Definition nbgl_obj.h:413
struct to represent a keyboard (KEYBOARD type)
Definition nbgl_obj.h:627
uint32_t keyMask
Definition nbgl_obj.h:641
color_t textColor
color set to letters.
Definition nbgl_obj.h:629
keyboardCase_t casing
keyboard casing mode (lower, upper once or upper locked)
Definition nbgl_obj.h:634
bool lettersOnly
if true, only display letter keys and Backspace
Definition nbgl_obj.h:631
nbgl_obj_t obj
common part
Definition nbgl_obj.h:628
keyboardMode_t mode
keyboard mode to start with
Definition nbgl_obj.h:640
color_t borderColor
color set to key borders
Definition nbgl_obj.h:630
keyboardCallback_t callback
function called when an active key is pressed
Definition nbgl_obj.h:644
bool needsRefresh
if true, means that the keyboard has been redrawn and needs a refresh
Definition nbgl_obj.h:633
struct to represent a keypad (KEYPAD type)
Definition nbgl_obj.h:651
uint8_t validateChanged
if true, means that validate key has changed
Definition nbgl_obj.h:658
uint8_t digitsChanged
if true, means that only digit keys have changed
Definition nbgl_obj.h:657
nbgl_obj_t obj
common part
Definition nbgl_obj.h:652
uint8_t enableDigits
if true, Digit keys are enabled
Definition nbgl_obj.h:656
uint8_t enableValidate
if true, Validate key is enabled
Definition nbgl_obj.h:660
uint8_t softValidation
if true, the "check icon" is replaced by an arrow
Definition nbgl_obj.h:655
uint8_t enableBackspace
if true, Backspace key is enabled
Definition nbgl_obj.h:659
uint8_t shuffled
if true, Digit keys are shuffled
Definition nbgl_obj.h:661
keyboardCallback_t callback
function called when an active key is pressed
Definition nbgl_obj.h:653
struct to represent a vertical or horizontal line
Definition nbgl_obj.h:390
nbgl_obj_t obj
common part
Definition nbgl_obj.h:391
nbgl_direction_t direction
direction of the line, e.g VERTICAL or HORIZONTAL
Definition nbgl_obj.h:392
color_t lineColor
color of the line
Definition nbgl_obj.h:393
uint8_t thickness
Definition nbgl_obj.h:394
uint8_t offset
Definition nbgl_obj.h:396
nbgl_obj_t obj
common part
Definition nbgl_obj.h:573
bool enableMasking
true: Enable masking of area / false: Disable masking of area
Definition nbgl_obj.h:574
uint8_t maskIndex
index of mask
Definition nbgl_obj.h:575
struct to represent a navigation bar (PAGE_INDICATOR type) There can be up to 5 page indicators,...
Definition nbgl_obj.h:502
nbgl_obj_t obj
common part
Definition nbgl_obj.h:503
nbgl_page_indicator_style_t style
Style to apply.
Definition nbgl_obj.h:506
uint8_t activePage
index of active page (from 0 to nbPages-1).
Definition nbgl_obj.h:505
uint8_t nbPages
number of pages.
Definition nbgl_obj.h:504
Common structure for all graphical objects.
Definition nbgl_obj.h:357
uint8_t objId
id of the obj in the screen (only used externally)
Definition nbgl_obj.h:369
uint16_t touchMask
bit mask to tell engine which touch events are handled by this object
Definition nbgl_obj.h:366
struct nbgl_obj_s * parent
parent of this object (automatically set)
Definition nbgl_obj.h:362
uint8_t touchId
Definition nbgl_obj.h:367
nbgl_obj_type_t type
type of the graphical object, must be explicitly set
Definition nbgl_obj.h:360
int16_t alignmentMarginY
vertical margin when aligning
Definition nbgl_obj.h:365
nbgl_area_t area
Definition nbgl_obj.h:358
struct nbgl_obj_s * alignTo
object to align to (parent if NULL)
Definition nbgl_obj.h:363
int16_t alignmentMarginX
horizontal margin when aligning
Definition nbgl_obj.h:364
nbgl_aligment_t alignment
type of alignment
Definition nbgl_obj.h:361
struct to represent a progress bar (PROGRESS_BAR type)
Definition nbgl_obj.h:475
color_t foregroundColor
color of the inner progress bar and border (if applicable)
Definition nbgl_obj.h:483
uint8_t withBorder
if set to true, a border in black surround the whole object
Definition nbgl_obj.h:480
uint16_t previousWidth
Definition nbgl_obj.h:477
uint8_t partialRedraw
set to true to redraw only partially the object (update state).
Definition nbgl_obj.h:479
uint8_t resetIfOverriden
Definition nbgl_obj.h:481
uint8_t state
state of the progress, in % (from 0 to 100).
Definition nbgl_obj.h:478
struct to represent a QR code (QR_CODE type), whose size is fixed
Definition nbgl_obj.h:438
nbgl_obj_t obj
Definition nbgl_obj.h:439
nbgl_qrcode_version_t version
Definition nbgl_obj.h:443
color_t foregroundColor
Definition nbgl_obj.h:441
const char * text
text single line (NULL terminated)
Definition nbgl_obj.h:440
struct to represent a radio button (RADIO_BUTTON type)
Definition nbgl_obj.h:453
color_t activeColor
color set to to inner circle, when active.
Definition nbgl_obj.h:455
color_t borderColor
color set to border.
Definition nbgl_obj.h:456
nbgl_state_t state
state of the radio button. Active is when state == ON_STATE
Definition nbgl_obj.h:457
nbgl_obj_t obj
Definition nbgl_obj.h:454
struct to represent a "spinner", represented by the Ledger corners, in gray, with one of the corners ...
Definition nbgl_obj.h:583
uint8_t position
Definition nbgl_obj.h:585
nbgl_obj_t obj
common part
Definition nbgl_obj.h:584
struct to represent a switch (size is fixed) (SWITCH type)
Definition nbgl_obj.h:464
color_t offColor
color set to border and knob, when OFF (knob on the left).
Definition nbgl_obj.h:467
color_t onColor
color set to border and knob, when ON (knob on the right).
Definition nbgl_obj.h:466
nbgl_obj_t obj
Definition nbgl_obj.h:465
nbgl_state_t state
state of the switch.
Definition nbgl_obj.h:468
struct to represent a text area (TEXT_AREA type)
Definition nbgl_obj.h:543
onTextDrawCallback_t onDrawCallback
function called if not NULL to get the text of the text area
Definition nbgl_obj.h:557
uint16_t len
number of bytes to write (if 0, max number of chars or strlen is used)
Definition nbgl_obj.h:555
nbgl_style_t style
to define the style of border
Definition nbgl_obj.h:547
uint8_t wrapping
if set to true, break lines on ' ' when possible
Definition nbgl_obj.h:551
uint8_t nbMaxLines
if >0, only display the nbMaxLines first lines
Definition nbgl_obj.h:553
color_t textColor
color set to '1' bits in text. '0' are set to backgroundColor color.
Definition nbgl_obj.h:545
uint8_t hideEndOfLastLine
if set to true, replace 3 last chars of last line by "..."
Definition nbgl_obj.h:552
bool autoHideLongLine
Definition nbgl_obj.h:549
uint8_t token
token to use as param of onDrawCallback
Definition nbgl_obj.h:558
nbgl_aligment_t textAlignment
alignment of text within the area
Definition nbgl_obj.h:546
nbgl_font_id_e fontId
id of the font to use
Definition nbgl_obj.h:548
nbgl_obj_t obj
common part
Definition nbgl_obj.h:544
const char * text
ASCII text to draw (NULL terminated). Can be NULL.
Definition nbgl_obj.h:554
struct to represent a text entry area (TEXT_ENTRY type)
Definition nbgl_obj.h:565
nbgl_font_id_e fontId
id of the font to use
Definition nbgl_obj.h:568
const char * text
text to display (up to nbChars chars).
Definition nbgl_obj.h:567
uint8_t nbChars
number of char placeholders to display (8 or 9 chars).
Definition nbgl_obj.h:569
nbgl_obj_t obj
common part
Definition nbgl_obj.h:566
The low level Touchscreen event, coming from driver.
Definition nbgl_obj.h:335
int16_t y
vertical position of the touch (or for a RELEASED the last touched point)
Definition nbgl_obj.h:342
int16_t x
horizontal position of the touch (or for a RELEASED the last touched point)
Definition nbgl_obj.h:341
nbgl_touchState_t state
state of the touch event, e.g PRESSED or RELEASED
Definition nbgl_obj.h:336