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