Embedded SDK
Embedded SDK
nbgl_layout.h
Go to the documentation of this file.
1 
7 #ifndef NBGL_LAYOUT_H
8 #define NBGL_LAYOUT_H
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 #include "nbgl_obj.h"
15 #include "nbgl_screen.h"
16 #include "nbgl_types.h"
17 #include "nbgl_content.h"
18 #ifdef HAVE_PIEZO_SOUND
19 #include "os_io_seproxyhal.h"
20 #endif
21 
22 /*********************
23  * INCLUDES
24  *********************/
25 
26 /*********************
27  * DEFINES
28  *********************/
29 #define NBGL_NO_TUNE NB_TUNES
30 #define NBGL_NO_PROGRESS_INDICATOR 0xFF
31 
33 #define NBGL_INVALID_TOKEN 0xFF
34 
35 #ifdef HAVE_SE_TOUCH
38 #define EXIT_PAGE 0xFF
39 
40 #ifdef TARGET_STAX
41 #define NB_MAX_SUGGESTION_BUTTONS 12
42 // only 4 buttons are visible at the same time on Stax
43 #define NB_MAX_VISIBLE_SUGGESTION_BUTTONS 4
44 #define TOUCHABLE_HEADER_BAR_HEIGHT 88
45 #define TOUCHABLE_MAIN_BAR_HEIGHT 96
46 #define TOUCHABLE_BAR_HEIGHT 96
47 #define SMALL_FOOTER_HEIGHT 88
48 #define SIMPLE_FOOTER_HEIGHT 92
49 #define SMALL_CENTERING_HEADER 32
50 #define MEDIUM_CENTERING_HEADER 56
51 #define LONG_PRESS_BUTTON_HEIGHT 128
52 #else // TARGET_STAX
53 #define NB_MAX_SUGGESTION_BUTTONS 8
54 // only 2 buttons are visible at the same time on Flex
55 #define NB_MAX_VISIBLE_SUGGESTION_BUTTONS 2
56 #define TOUCHABLE_HEADER_BAR_HEIGHT 96
57 #define TOUCHABLE_MAIN_BAR_HEIGHT 100
58 #define TOUCHABLE_BAR_HEIGHT 92
59 #define SMALL_FOOTER_HEIGHT 96
60 #define SIMPLE_FOOTER_HEIGHT 96
61 #define SMALL_CENTERING_HEADER 40
62 #define MEDIUM_CENTERING_HEADER 64
63 #define LONG_PRESS_BUTTON_HEIGHT 152
64 #endif // TARGET_STAX
65 
66 #define AVAILABLE_WIDTH (SCREEN_WIDTH - 2 * BORDER_MARGIN)
67 
68 #define NB_MAX_LINES NB_MAX_LINES_IN_DETAILS
69 
70 #ifdef TARGET_STAX
71 #define PRE_TEXT_MARGIN 32
72 #define TEXT_SUBTEXT_MARGIN 16
73 #define POST_SUBTEXT_MARGIN 28
74 #else // TARGET_STAX
75 #define PRE_TEXT_MARGIN 28
76 #define TEXT_SUBTEXT_MARGIN 14
77 #define POST_SUBTEXT_MARGIN 26
78 #endif // TARGET_STAX
79 
80 #else // HAVE_SE_TOUCH
81 // 7 pixels on each side
82 #define AVAILABLE_WIDTH (SCREEN_WIDTH - 2 * 7)
83 // maximum number of lines in screen
84 #define NB_MAX_LINES 4
85 
86 #endif // HAVE_SE_TOUCH
87 
88 /**********************
89  * TYPEDEFS
90  **********************/
91 
96 typedef void *nbgl_layout_t;
97 
104 typedef void (*nbgl_layoutTouchCallback_t)(int token, uint8_t index);
105 
112 
118 typedef struct {
122  bool withExitKey;
123  bool withBackKey;
131 #ifdef HAVE_PIEZO_SOUND
132  tune_index_e tuneId;
133 #endif // HAVE_PIEZO_SOUND
135 
140 typedef enum {
142  VERTICAL_NAV
144 
149 typedef enum {
154 
160 typedef struct {
164 
171 typedef struct nbgl_layoutDescription_s {
172  bool modal;
174 #ifdef HAVE_SE_TOUCH
177  const char *tapActionText;
180 #ifdef HAVE_PIEZO_SOUND
181  tune_index_e tapTuneId;
183 #endif // HAVE_PIEZO_SOUND
186 #else // HAVE_SE_TOUCH
189 #endif // HAVE_SE_TOUCH
190  nbgl_screenTickerConfiguration_t ticker; // configuration of ticker (timeout)
192 
197 typedef struct {
198  const nbgl_icon_details_t
200  const char *text;
203  const char *subText;
204  bool large;
206  bool inactive;
207  bool centered;
208 #ifdef HAVE_PIEZO_SOUND
209  tune_index_e tuneId;
210 #endif // HAVE_PIEZO_SOUND
212 
218 
223 
229 typedef const char *(*nbgl_menuListCallback_t)(uint8_t choiceIndex);
230 
235 typedef struct {
239 
241 
246 
251 
257 
262 typedef struct {
264  const char *title;
265  const char **rowTexts;
268 
269 #ifdef HAVE_SE_TOUCH
270 
277 typedef struct {
278  const char *url;
279  const char *text1;
280  const char *text2;
282  bool centered;
283  bool largeText1;
285 
290 typedef enum {
295 
296 // for backward compatibility
297 #define BOTH_ROUNDED_STYLE SOFT_ACTION_AND_FOOTER_STYLE
298 
304 typedef struct {
305  const char *topText;
306  const char *bottomText;
310 #ifdef HAVE_PIEZO_SOUND
311  tune_index_e tuneId;
312 #endif // HAVE_PIEZO_SOUND
314 
321 typedef struct {
323  const char *rightText;
326 #ifdef HAVE_PIEZO_SOUND
327  tune_index_e tuneId;
328 #endif // HAVE_PIEZO_SOUND
330 
335 typedef enum {
337  = 0,
340  LONG_PRESS
342 
346 typedef struct {
347  const char *text;
352  bool onBottom;
354 #ifdef HAVE_PIEZO_SOUND
355  tune_index_e tuneId;
356 #endif // HAVE_PIEZO_SOUND
358 
363 typedef enum {
368 
372 typedef struct {
373  const char **buttons;
378 
382 typedef struct {
383  const char *text;
384  int token;
385  bool active;
387 
392 typedef struct {
394  const char *title;
395  const char *text;
396  bool numbered;
398  bool grayedOut;
399  int textToken;
401  union {
406  };
407 #ifdef HAVE_PIEZO_SOUND
408  tune_index_e tuneId;
409 #endif // HAVE_PIEZO_SOUND
411 
416 typedef enum {
425 
430 typedef struct {
433  union {
434  struct {
436  } emptySpace;
437  struct {
438  const char *text;
440  tune_index_e tuneId;
441  } backAndText;
442  struct {
446  bool withBack;
447  uint8_t token;
449  tune_index_e tuneId;
450  } progressAndBack;
451  struct {
452  const char *text;
453  } title;
454  struct {
455  const nbgl_icon_details_t *actionIcon;
456  const char *text;
459  uint8_t actionToken;
460  tune_index_e tuneId;
461  } extendedBack;
462  struct {
463  const char *text;
464  uint8_t token;
465  tune_index_e tuneId;
466  } rightText;
467  };
469 
474 typedef enum {
485 
490 typedef struct {
493  union {
494  struct {
496  } emptySpace;
497  struct {
498  const char *text;
499  bool mutedOut;
501  tune_index_e tuneId;
502  } simpleText;
503  struct {
504  const char *leftText;
505  const char *rightText;
508  tune_index_e tuneId;
509  } doubleText;
510  struct {
512  const char *text;
513  uint8_t token;
514  tune_index_e tuneId;
515  } textAndNav;
516  nbgl_layoutNavigationBar_t navigation;
519  };
521 
526 typedef enum {
534 
539 typedef struct {
541  union {
542  struct {
543  const char *text;
545  tune_index_e tuneId;
546  } longPress;
551  struct {
552  const char *text;
553  uint8_t token;
554  tune_index_e tuneId;
555  } text;
556  };
558 #endif // HAVE_SE_TOUCH
559 
565 typedef struct {
567  const char *text;
568  const char *subText;
570 
575 typedef struct {
576  uint32_t keyMask;
580  bool lettersOnly;
582 #ifdef HAVE_SE_TOUCH
584 #else // HAVE_SE_TOUCH
585  bool enableBackspace;
586  bool enableValidate;
587  uint8_t selectedCharIndex;
588 #endif // HAVE_SE_TOUCH
590 
591 /**********************
592  * GLOBAL PROTOTYPES
593  **********************/
599 
600 #ifdef HAVE_SE_TOUCH
602  const nbgl_icon_details_t *icon,
603  uint8_t token,
604  tune_index_e tuneId);
605 int nbgl_layoutAddTouchableBar(nbgl_layout_t *layout, const nbgl_layoutBar_t *barLayout);
606 int nbgl_layoutAddSwitch(nbgl_layout_t *layout, const nbgl_layoutSwitch_t *switchLayout);
607 int nbgl_layoutAddText(nbgl_layout_t *layout, const char *text, const char *subText);
609  const char *text,
610  const char *subText,
611  uint8_t token,
612  uint8_t index);
613 int nbgl_layoutAddSubHeaderText(nbgl_layout_t *layout, const char *text);
615 int nbgl_layoutAddQRCode(nbgl_layout_t *layout, const nbgl_layoutQRCode_t *info);
618  const nbgl_layoutHorizontalButtons_t *info);
620 int nbgl_layoutAddLargeCaseText(nbgl_layout_t *layout, const char *text, bool grayedOut);
622  const char *title,
623  const char *description,
624  const char *info);
626 
627 int nbgl_layoutAddButton(nbgl_layout_t *layout, const nbgl_layoutButton_t *buttonInfo);
629  const char *text,
630  uint8_t token,
631  tune_index_e tuneId);
633  const char *text,
634  uint8_t token,
635  tune_index_e tuneId);
637  const char *leftText,
638  uint8_t leftToken,
639  const char *rightText,
640  uint8_t rightToken,
641  tune_index_e tuneId);
642 int nbgl_layoutAddHeader(nbgl_layout_t *layout, const nbgl_layoutHeader_t *headerDesc);
643 int nbgl_layoutAddExtendedFooter(nbgl_layout_t *layout, const nbgl_layoutFooter_t *footerDesc);
644 int nbgl_layoutAddUpFooter(nbgl_layout_t *layout, const nbgl_layoutUpFooter_t *upFooterDesc);
647  const nbgl_icon_details_t *icon,
648  uint8_t token,
649  bool separationLine,
650  tune_index_e tuneId);
652  uint8_t activePage,
653  uint8_t nbPages,
654  bool withBack,
655  uint8_t backToken,
656  tune_index_e tuneId);
657 int nbgl_layoutAddSpinner(nbgl_layout_t *layout, const char *text, bool fixed);
659  uint16_t swipesMask,
660  const char *text,
661  uint8_t token,
662  tune_index_e tuneId);
663 #else // HAVE_SE_TOUCH
665  const char *text,
666  const char *subText,
668 int nbgl_layoutAddNavigation(nbgl_layout_t *layout, nbgl_layoutNavigation_t *info);
669 int nbgl_layoutAddMenuList(nbgl_layout_t *layout, nbgl_layoutMenuList_t *list);
670 #endif // HAVE_SE_TOUCH
671 
672 #ifdef NBGL_KEYBOARD
673 /* layout objects for page with keyboard */
674 int nbgl_layoutAddKeyboard(nbgl_layout_t *layout, const nbgl_layoutKbd_t *kbdInfo);
675 #ifdef HAVE_SE_TOUCH
677  uint8_t index,
678  uint32_t keyMask,
679  bool updateCasing,
680  keyboardCase_t casing);
682 DEPRECATED int nbgl_layoutAddSuggestionButtons(nbgl_layout_t *layout,
683  uint8_t nbUsedButtons,
684  const char *buttonTexts[NB_MAX_SUGGESTION_BUTTONS],
685  int firstButtonToken,
686  tune_index_e tuneId);
688  nbgl_layout_t *layout,
689  uint8_t index,
690  uint8_t nbUsedButtons,
691  const char *buttonTexts[NB_MAX_SUGGESTION_BUTTONS]);
692 DEPRECATED int nbgl_layoutAddEnteredText(nbgl_layout_t *layout,
693  bool numbered,
694  uint8_t number,
695  const char *text,
696  bool grayedOut,
697  int offsetY,
698  int token);
699 DEPRECATED int nbgl_layoutUpdateEnteredText(nbgl_layout_t *layout,
700  uint8_t index,
701  bool numbered,
702  uint8_t number,
703  const char *text,
704  bool grayedOut);
705 DEPRECATED int nbgl_layoutAddConfirmationButton(nbgl_layout_t *layout,
706  bool active,
707  const char *text,
708  int token,
709  tune_index_e tuneId);
711  uint8_t index,
712  bool active,
713  const char *text);
716 #else // HAVE_SE_TOUCH
717 int nbgl_layoutUpdateKeyboard(nbgl_layout_t *layout, uint8_t index, uint32_t keyMask);
718 int nbgl_layoutAddEnteredText(nbgl_layout_t *layout, const char *text, bool lettersOnly);
719 int nbgl_layoutUpdateEnteredText(nbgl_layout_t *layout, uint8_t index, const char *text);
720 #endif // HAVE_SE_TOUCH
721 #endif // NBGL_KEYBOARD
722 
723 #ifdef NBGL_KEYPAD
724 #ifdef HAVE_SE_TOUCH
725 /* layout objects for page with keypad (Stax) */
726 int nbgl_layoutAddKeypad(nbgl_layout_t *layout, keyboardCallback_t callback, bool shuffled);
728  uint8_t index,
729  bool enableValidate,
730  bool enableBackspace,
731  bool enableDigits);
732 DEPRECATED int nbgl_layoutAddHiddenDigits(nbgl_layout_t *layout, uint8_t nbDigits);
733 DEPRECATED int nbgl_layoutUpdateHiddenDigits(nbgl_layout_t *layout,
734  uint8_t index,
735  uint8_t nbActive);
737  const char *title,
738  bool hidden,
739  uint8_t nbDigits,
740  const char *text);
742  bool hidden,
743  uint8_t nbActiveDigits,
744  const char *text);
745 
746 #else // HAVE_SE_TOUCH
747 /* layout objects for pages with keypad (nanos) */
749  keyboardCallback_t callback,
750  const char *text,
751  bool shuffled);
753  uint8_t index,
754  bool enableValidate,
755  bool enableBackspace);
756 int nbgl_layoutAddHiddenDigits(nbgl_layout_t *layout, uint8_t nbDigits);
757 int nbgl_layoutUpdateHiddenDigits(nbgl_layout_t *layout, uint8_t index, uint8_t nbActive);
758 #endif // HAVE_SE_TOUCH
759 #endif // NBGL_KEYPAD
760 
761 /* generic functions */
762 int nbgl_layoutDraw(nbgl_layout_t *layout);
763 int nbgl_layoutRelease(nbgl_layout_t *layout);
764 
765 /**********************
766  * MACROS
767  **********************/
768 
769 #ifdef __cplusplus
770 } /* extern "C" */
771 #endif
772 
773 #endif /* NBGL_LAYOUT_H */
common content for Graphical Library
nbgl_contentCenteredInfoStyle_t
possible styles for Centered Info Area
Definition: nbgl_content.h:34
void(* nbgl_layoutTouchCallback_t)(int token, uint8_t index)
prototype of function to be called when an object is touched
Definition: nbgl_layout.h:104
int nbgl_layoutAddTagValueList(nbgl_layout_t *layout, const nbgl_layoutTagValueList_t *list)
Creates a list of [tag,value] pairs.
Definition: nbgl_layout.c:1960
int nbgl_layoutAddContentCenter(nbgl_layout_t *layout, const nbgl_contentCenter_t *info)
Creates an area on the center of the main panel, with a possible icon, and possible texts under it.
Definition: nbgl_layout.c:1673
DEPRECATED int nbgl_layoutAddEnteredText(nbgl_layout_t *layout, bool numbered, uint8_t number, const char *text, bool grayedOut, int offsetY, int token)
Adds a "text entry" area under the previously entered object. This area can be preceded (beginning of...
int nbgl_layoutAddUpFooter(nbgl_layout_t *layout, const nbgl_layoutUpFooter_t *upFooterDesc)
Creates a touchable area on top of the footer of the screen, containing various controls,...
Definition: nbgl_layout.c:3043
int nbgl_layoutUpdateKeyboard(nbgl_layout_t *layout, uint8_t index, uint32_t keyMask, bool updateCasing, keyboardCase_t casing)
Updates an existing keyboard on bottom of the screen, with the given configuration.
DEPRECATED int nbgl_layoutAddConfirmationButton(nbgl_layout_t *layout, bool active, const char *text, int token, tune_index_e tuneId)
Adds a black full width confirmation button on top of the previously added keyboard.
int nbgl_layoutAddKeyboard(nbgl_layout_t *layout, const nbgl_layoutKbd_t *kbdInfo)
Creates a keyboard on bottom of the screen, with the given configuration.
DEPRECATED int nbgl_layoutUpdateSuggestionButtons(nbgl_layout_t *layout, uint8_t index, uint8_t nbUsedButtons, const char *buttonTexts[NB_MAX_SUGGESTION_BUTTONS])
Updates the number and/or the text suggestion buttons created with nbgl_layoutAddSuggestionButtons()
int nbgl_layoutAddTextContent(nbgl_layout_t *layout, const char *title, const char *description, const char *info)
Creates in the main container three text areas:
Definition: nbgl_layout.c:1431
nbgl_layoutNavDirection_t
possible directions for Navigation arrows
Definition: nbgl_layout.h:140
@ VERTICAL_NAV
'\/' and '/\' are displayed, to navigate in a list (vertical scrolling)
Definition: nbgl_layout.h:142
@ HORIZONTAL_NAV
'<' and '>' are displayed, to navigate between pages and steps
Definition: nbgl_layout.h:141
int nbgl_layoutAddText(nbgl_layout_t *layout, const char *text, const char *subText)
Creates an area with given text (in bold) and sub text (in regular)
Definition: nbgl_layout.c:1301
nbgl_contentRadioChoice_t nbgl_layoutRadioChoice_t
Deprecated, kept for retro compatibility.
Definition: nbgl_layout.h:222
nbgl_layoutNavIndication_t
possible styles for Navigation arrows (it's a bit field)
Definition: nbgl_layout.h:149
@ NO_ARROWS
Definition: nbgl_layout.h:150
@ LEFT_ARROW
left arrow is used
Definition: nbgl_layout.h:151
@ RIGHT_ARROW
right arrow is used
Definition: nbgl_layout.h:152
int nbgl_layoutUpdateKeypad(nbgl_layout_t *layout, uint8_t index, bool enableValidate, bool enableBackspace, bool enableDigits)
Updates an existing keypad on bottom of the screen, with the given configuration.
int nbgl_layoutAddProgressIndicator(nbgl_layout_t *layout, uint8_t activePage, uint8_t nbPages, bool withBack, uint8_t backToken, tune_index_e tuneId)
Creates a kind of navigation bar with an optional <- arrow on the left. This widget is placed on top ...
Definition: nbgl_layout.c:3343
DEPRECATED int nbgl_layoutAddHiddenDigits(nbgl_layout_t *layout, uint8_t nbDigits)
Adds a placeholder for hidden digits on top of a keypad, to represent the entered digits,...
int nbgl_layoutAddNavigationBar(nbgl_layout_t *layout, const nbgl_layoutNavigationBar_t *info)
Creates a navigation bar on bottom of main container.
Definition: nbgl_layout.c:1170
int nbgl_layoutAddKeyboardContent(nbgl_layout_t *layout, nbgl_layoutKeyboardContent_t *content)
Adds an area containing a potential title, a text entry and either confirmation or suggestion buttons...
int nbgl_layoutAddSeparationLine(nbgl_layout_t *layout)
adds a separation line on bottom of the last added item
Definition: nbgl_layout.c:2183
int nbgl_layoutAddQRCode(nbgl_layout_t *layout, const nbgl_layoutQRCode_t *info)
Creates an area on the center of the main panel, with a QRCode, a possible text in black (bold) under...
Definition: nbgl_layout.c:1789
int nbgl_layoutAddRadioChoice(nbgl_layout_t *layout, const nbgl_layoutRadioChoice_t *choices)
Creates a list of radio buttons (on the right)
Definition: nbgl_layout.c:1513
int nbgl_layoutAddCenteredInfo(nbgl_layout_t *layout, const nbgl_layoutCenteredInfo_t *info)
Creates an area on the center of the main panel, with a possible icon/image, a possible text in black...
Definition: nbgl_layout.c:1610
nbgl_contentSwitch_t nbgl_layoutSwitch_t
Deprecated, kept for retro compatibility.
Definition: nbgl_layout.h:217
int nbgl_layoutAddSplitFooter(nbgl_layout_t *layout, const char *leftText, uint8_t leftToken, const char *rightText, uint8_t rightToken, tune_index_e tuneId)
Creates 2 touchable texts at the footer of the screen, separated with a thin line from the rest of th...
Definition: nbgl_layout.c:2360
int nbgl_layoutAddProgressBar(nbgl_layout_t *layout, const nbgl_layoutProgressBar_t *barLayout)
Creates an area in main panel to display a progress bar, with a title text and a description under th...
Definition: nbgl_layout.c:2112
int nbgl_layoutAddSubHeaderText(nbgl_layout_t *layout, const char *text)
Creates an area with given text in small regular font, under the header.
Definition: nbgl_layout.c:1335
int nbgl_layoutAddTextWithAlias(nbgl_layout_t *layout, const char *text, const char *subText, uint8_t token, uint8_t index)
Creates an area with given text (in bold) and sub text (in regular), with a icon on right of text to ...
Definition: nbgl_layout.c:1318
int nbgl_layoutDraw(nbgl_layout_t *layout)
Applies given layout. The screen will be redrawn.
Definition: nbgl_layout.c:3437
int nbgl_layoutAddTouchableBar(nbgl_layout_t *layout, const nbgl_layoutBar_t *barLayout)
Creates a touchable bar in main panel.
Definition: nbgl_layout.c:1222
nbgl_layoutButtonStyle_t
The different styles for a button.
Definition: nbgl_layout.h:335
@ WHITE_BACKGROUND
rounded bordered button, with text/icon in black, on white background
Definition: nbgl_layout.h:338
@ NO_BORDER
simple clickable text, in black
Definition: nbgl_layout.h:339
@ LONG_PRESS
long press button, with progress indicator
Definition: nbgl_layout.h:340
@ BLACK_BACKGROUND
rounded bordered button, with text/icon in white, on black background
Definition: nbgl_layout.h:336
int nbgl_layoutAddTopRightButton(nbgl_layout_t *layout, const nbgl_icon_details_t *icon, uint8_t token, tune_index_e tuneId)
Creates a Top-right button in the top right corner of the top panel.
Definition: nbgl_layout.c:1125
#define NB_MAX_SUGGESTION_BUTTONS
Definition: nbgl_layout.h:53
nbgl_layoutUpFooterType_t
The different types of area on top of footer.
Definition: nbgl_layout.h:526
@ UP_FOOTER_TEXT
grayed-out text, for example "Tap to continue"
Definition: nbgl_layout.h:531
@ NB_UP_FOOTER_TYPES
Definition: nbgl_layout.h:532
@ UP_FOOTER_BUTTON
simple button
Definition: nbgl_layout.h:528
@ UP_FOOTER_LONG_PRESS
long-press button
Definition: nbgl_layout.h:527
@ UP_FOOTER_TIP_BOX
Tip-box.
Definition: nbgl_layout.h:530
@ UP_FOOTER_HORIZONTAL_BUTTONS
2 buttons, on the same line
Definition: nbgl_layout.h:529
int nbgl_layoutAddSwipe(nbgl_layout_t *layout, uint16_t swipesMask, const char *text, uint8_t token, tune_index_e tuneId)
Creates a swipe interaction on the main container.
Definition: nbgl_layout.c:1084
void * nbgl_layout_t
type shared externally
Definition: nbgl_layout.h:96
const char *(* nbgl_menuListCallback_t)(uint8_t choiceIndex)
prototype of menu list item retrieval callback
Definition: nbgl_layout.h:229
int nbgl_layoutAddSwitch(nbgl_layout_t *layout, const nbgl_layoutSwitch_t *switchLayout)
Creates a switch with the given text and its state.
Definition: nbgl_layout.c:1261
int nbgl_layoutAddHorizontalButtons(nbgl_layout_t *layout, const nbgl_layoutHorizontalButtons_t *info)
Creates two buttons to make a choice. Both buttons are mandatory The left one contains only an icon a...
Definition: nbgl_layout.c:1939
nbgl_layoutHeaderType_t
The different types of extended header.
Definition: nbgl_layout.h:416
@ HEADER_TITLE
simple centered text
Definition: nbgl_layout.h:420
@ HEADER_BACK_AND_PROGRESS
optional back key and progress indicator (only on Stax)
Definition: nbgl_layout.h:419
@ HEADER_EMPTY
empty space, to have a better vertical centering of centered info
Definition: nbgl_layout.h:417
@ NB_HEADER_TYPES
Definition: nbgl_layout.h:423
@ HEADER_EXTENDED_BACK
back key, centered text and touchable key on the right
Definition: nbgl_layout.h:421
@ HEADER_BACK_AND_TEXT
back key and optional text
Definition: nbgl_layout.h:418
@ HEADER_RIGHT_TEXT
touchable text on the right, with a vertical separation line
Definition: nbgl_layout.h:422
int nbgl_layoutUpdateKeyboardContent(nbgl_layout_t *layout, nbgl_layoutKeyboardContent_t *content)
Updates an area containing a potential title, a text entry and either confirmation or suggestion butt...
DEPRECATED int nbgl_layoutUpdateHiddenDigits(nbgl_layout_t *layout, uint8_t index, uint8_t nbActive)
Updates an existing set of hidden digits, with the given configuration.
int nbgl_layoutAddKeypadContent(nbgl_layout_t *layout, const char *title, bool hidden, uint8_t nbDigits, const char *text)
Adds an area with a title and a placeholder for hidden digits on top of a keypad, to represent the en...
int nbgl_layoutAddButton(nbgl_layout_t *layout, const nbgl_layoutButton_t *buttonInfo)
Creates a rounded button in the main container.
Definition: nbgl_layout.c:2203
int nbgl_layoutUpdateKeypadContent(nbgl_layout_t *layout, bool hidden, uint8_t nbActiveDigits, const char *text)
Updates an existing set of hidden digits, with the given configuration.
int nbgl_layoutAddExtendedFooter(nbgl_layout_t *layout, const nbgl_layoutFooter_t *footerDesc)
Creates a touchable area at the footer of the screen, containing various controls,...
Definition: nbgl_layout.c:2649
int nbgl_layoutAddLeftContent(nbgl_layout_t *layout, const nbgl_layoutLeftContent_t *info)
Creates an area with a title, and rows of icon + text, left aligned.
Definition: nbgl_layout.c:1695
nbgl_layoutChoiceButtonsStyle_t
The different styles for a pair of buttons.
Definition: nbgl_layout.h:290
@ SOFT_ACTION_AND_FOOTER_STYLE
A white button on top of a footer, with a separation line.
Definition: nbgl_layout.h:293
@ ROUNDED_AND_FOOTER_STYLE
A black background button on top of a footer.
Definition: nbgl_layout.h:291
@ STRONG_ACTION_AND_FOOTER_STYLE
A black button on top of a footer, with a separation line.
Definition: nbgl_layout.h:292
int nbgl_layoutAddChoiceButtons(nbgl_layout_t *layout, const nbgl_layoutChoiceButtons_t *info)
Creates two buttons to make a choice. Both buttons are mandatory. Both buttons are full width,...
Definition: nbgl_layout.c:1916
int nbgl_layoutAddLongPressButton(nbgl_layout_t *layout, const char *text, uint8_t token, tune_index_e tuneId)
Creates a long press button in the main container.
Definition: nbgl_layout.c:2305
struct nbgl_layoutDescription_s nbgl_layoutDescription_t
Structure containing all information when creating a layout. This structure must be passed as argumen...
int nbgl_layoutAddHeader(nbgl_layout_t *layout, const nbgl_layoutHeader_t *headerDesc)
Creates a touchable (or not) area at the header of the screen, containing various controls,...
Definition: nbgl_layout.c:2386
int nbgl_layoutAddBottomButton(nbgl_layout_t *layout, const nbgl_icon_details_t *icon, uint8_t token, bool separationLine, tune_index_e tuneId)
Creates a centered button at bottom of main container.
Definition: nbgl_layout.c:1196
nbgl_layoutKeyboardContentType_t
The different types of keyboard contents.
Definition: nbgl_layout.h:363
@ KEYBOARD_WITH_BUTTON
text entry area + confirmation button
Definition: nbgl_layout.h:365
@ KEYBOARD_WITH_SUGGESTIONS
text entry area + suggestion buttons
Definition: nbgl_layout.h:364
@ NB_KEYBOARD_CONTENT_TYPES
Definition: nbgl_layout.h:366
void(* nbgl_layoutButtonCallback_t)(nbgl_layout_t *layout, nbgl_buttonEvent_t event)
prototype of function to be called when buttons are touched on a screen
Definition: nbgl_layout.h:111
nbgl_layoutFooterType_t
The different types of extended footer.
Definition: nbgl_layout.h:474
@ FOOTER_SIMPLE_TEXT
simple touchable text in bold
Definition: nbgl_layout.h:476
@ FOOTER_NAV
navigation bar
Definition: nbgl_layout.h:480
@ FOOTER_SIMPLE_BUTTON
simple black or white button (see nbgl_layoutButtonStyle_t)
Definition: nbgl_layout.h:481
@ FOOTER_TEXT_AND_NAV
Definition: nbgl_layout.h:478
@ FOOTER_DOUBLE_TEXT
2 touchable texts in bold, separated by a vertical line (only on Stax)
Definition: nbgl_layout.h:477
@ NB_FOOTER_TYPES
Definition: nbgl_layout.h:483
@ FOOTER_EMPTY
empty space, to have a better vertical centering of centered info
Definition: nbgl_layout.h:475
@ FOOTER_CHOICE_BUTTONS
double buttons (see nbgl_layoutChoiceButtonsStyle_t)
Definition: nbgl_layout.h:482
int nbgl_layoutRelease(nbgl_layout_t *layout)
Release the layout obtained with nbgl_layoutGet()
Definition: nbgl_layout.c:3468
DEPRECATED int nbgl_layoutAddSuggestionButtons(nbgl_layout_t *layout, uint8_t nbUsedButtons, const char *buttonTexts[NB_MAX_SUGGESTION_BUTTONS], int firstButtonToken, tune_index_e tuneId)
Adds up to 4 black suggestion buttons under the previously added object.
nbgl_contentTagValueList_t nbgl_layoutTagValueList_t
Deprecated, kept for retro compatibility.
Definition: nbgl_layout.h:250
DEPRECATED int nbgl_layoutUpdateEnteredText(nbgl_layout_t *layout, uint8_t index, bool numbered, uint8_t number, const char *text, bool grayedOut)
Updates an existing "text entry" area, created with nbgl_layoutAddEnteredText()
int nbgl_layoutAddFooter(nbgl_layout_t *layout, const char *text, uint8_t token, tune_index_e tuneId)
Creates a touchable text at the footer of the screen, separated with a thin line from the rest of the...
Definition: nbgl_layout.c:2333
int nbgl_layoutAddKeypad(nbgl_layout_t *layout, keyboardCallback_t callback, bool shuffled)
Adds a keypad on bottom of the screen, with the associated callback.
int nbgl_layoutAddLargeCaseText(nbgl_layout_t *layout, const char *text, bool grayedOut)
Creates an area with given text in 32px font (in Black or Light Gray)
Definition: nbgl_layout.c:1377
bool nbgl_layoutKeyboardNeedsRefresh(nbgl_layout_t *layout, uint8_t index)
function called to know whether the keyboard has been redrawn and needs a refresh
int nbgl_layoutAddSpinner(nbgl_layout_t *layout, const char *text, bool fixed)
Creates a centered (vertically & horizontally) spinner with a text under it.
Definition: nbgl_layout.c:3372
DEPRECATED int nbgl_layoutUpdateConfirmationButton(nbgl_layout_t *layout, uint8_t index, bool active, const char *text)
Updates an existing black full width confirmation button on top of the previously added keyboard.
nbgl_layout_t * nbgl_layoutGet(const nbgl_layoutDescription_t *description)
returns a layout of the given type. The layout is reset
Definition: nbgl_layout.c:995
nbgl_contentTagValue_t nbgl_layoutTagValue_t
Deprecated, kept for retro compatibility.
Definition: nbgl_layout.h:245
nbgl_contentCenteredInfo_t nbgl_layoutCenteredInfo_t
Deprecated, kept for retro compatibility.
Definition: nbgl_layout.h:256
API to draw all basic graphic objects.
keyboardCase_t
Letters casing in which to open/set the keyboard.
Definition: nbgl_obj.h:489
nbgl_buttonEvent_t
Definition: nbgl_obj.h:182
keyboardMode_t
Mode in which to open/set the keyboard.
Definition: nbgl_obj.h:472
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:466
API to manage screens.
struct PACKED__ nbgl_screenTickerConfiguration_s nbgl_screenTickerConfiguration_t
struct to configure a screen layer
common types for Graphical Library
struct PACKED__ nbgl_icon_details_s nbgl_icon_details_t
Represents all information about an icon.
This structure contains info to build a centered (vertically and horizontally) area,...
Definition: nbgl_content.h:81
This structure contains info to build a centered (vertically and horizontally) area,...
Definition: nbgl_content.h:57
This structure contains a list of names to build a list of radio buttons (on the right part of screen...
Definition: nbgl_content.h:286
This structure contains info to build a switch (on the right) with a description (on the left),...
Definition: nbgl_content.h:246
This structure contains a list of [tag,value] pairs.
Definition: nbgl_content.h:185
This structure contains a [tag,value] pair.
Definition: nbgl_content.h:148
This structure contains data to build a tip-box, on top of a footer, on bottom of a content center.
Definition: nbgl_content.h:319
This structure contains info to build a clickable "bar" with a text and an icon.
Definition: nbgl_layout.h:197
bool inactive
if set to true, the bar is grayed-out and cannot be touched
Definition: nbgl_layout.h:206
const char * text
text (can be NULL)
Definition: nbgl_layout.h:200
uint8_t token
the token that will be used as argument of the callback
Definition: nbgl_layout.h:205
bool large
set to true only for the main level of OS settings
Definition: nbgl_layout.h:204
const char * subText
sub text (can be NULL)
Definition: nbgl_layout.h:203
bool centered
DEPRECATED, not used.
Definition: nbgl_layout.h:207
const nbgl_icon_details_t * iconLeft
a buffer containing the 1BPP icon for icon on left (can be NULL)
Definition: nbgl_layout.h:199
const nbgl_icon_details_t * iconRight
Definition: nbgl_layout.h:201
This structure contains info to build a single button.
Definition: nbgl_layout.h:346
const char * text
button text
Definition: nbgl_layout.h:347
uint8_t token
the token that will be used as argument of the callback
Definition: nbgl_layout.h:349
const nbgl_icon_details_t * icon
a buffer containing the 1BPP icon for button
Definition: nbgl_layout.h:348
nbgl_layoutButtonStyle_t style
Definition: nbgl_layout.h:350
bool fittingContent
if set to true, fit the width of button to text, otherwise full width
Definition: nbgl_layout.h:351
This structure contains info to build a pair of buttons, one on top of the other.
Definition: nbgl_layout.h:304
nbgl_layoutChoiceButtonsStyle_t style
the style of the pair
Definition: nbgl_layout.h:309
const nbgl_icon_details_t * topIcon
icon of top button
Definition: nbgl_layout.h:307
uint8_t token
the token that will be used as argument of the callback
Definition: nbgl_layout.h:308
const char * topText
up-button text (index 0)
Definition: nbgl_layout.h:305
const char * bottomText
bottom-button text (index 1)
Definition: nbgl_layout.h:306
This structure contains info to build a confirmation button.
Definition: nbgl_layout.h:382
int token
token of the button
Definition: nbgl_layout.h:384
const char * text
text of the button
Definition: nbgl_layout.h:383
bool active
if true, button is active, otherwise inactive (grayed-out)
Definition: nbgl_layout.h:385
Structure containing all information when creating a layout. This structure must be passed as argumen...
Definition: nbgl_layout.h:171
nbgl_screenTickerConfiguration_t ticker
Definition: nbgl_layout.h:190
const char * tapActionText
Light gray text used when main container is "tapable".
Definition: nbgl_layout.h:177
nbgl_layoutTouchCallback_t onActionCallback
the callback to be called on any action on the layout
Definition: nbgl_layout.h:185
This structure contains info to build an extended footer.
Definition: nbgl_layout.h:490
nbgl_layoutChoiceButtons_t choiceButtons
if type is FOOTER_CHOICE_BUTTONS
Definition: nbgl_layout.h:518
bool separationLine
if true, a separation line is added at the top of this control
Definition: nbgl_layout.h:492
const char * leftText
Definition: nbgl_layout.h:504
nbgl_layoutButton_t button
if type is FOOTER_SIMPLE_BUTTON
Definition: nbgl_layout.h:517
bool mutedOut
if true, text is displayed in gray
Definition: nbgl_layout.h:499
nbgl_layoutFooterType_t type
type of footer
Definition: nbgl_layout.h:491
nbgl_layoutNavigationBar_t navigation
if type is FOOTER_NAV
Definition: nbgl_layout.h:511
const char * rightText
Definition: nbgl_layout.h:505
const char * text
Definition: nbgl_layout.h:498
tune_index_e tuneId
Definition: nbgl_layout.h:501
This structure contains info to build a header.
Definition: nbgl_layout.h:430
nbgl_layoutHeaderType_t type
type of header
Definition: nbgl_layout.h:431
uint8_t backToken
when back key is pressed
Definition: nbgl_layout.h:458
const nbgl_icon_details_t * actionIcon
right button icon
Definition: nbgl_layout.h:443
uint8_t actionToken
when optional right button is pressed
Definition: nbgl_layout.h:448
bool separationLine
if true, a separation line is added at the bottom of this control
Definition: nbgl_layout.h:432
tune_index_e tuneId
when back key is pressed
Definition: nbgl_layout.h:440
const char * text
can be NULL if no text
Definition: nbgl_layout.h:438
uint8_t textToken
when text is touched
Definition: nbgl_layout.h:457
uint8_t token
when back key is pressed
Definition: nbgl_layout.h:439
This structure contains info to build a pair of buttons, the small one, with icon,...
Definition: nbgl_layout.h:321
const nbgl_icon_details_t * leftIcon
a buffer containing the 1BPP icon for left button
Definition: nbgl_layout.h:322
uint8_t leftToken
the token used when left button is pressed
Definition: nbgl_layout.h:324
uint8_t rightToken
the token used when right button is pressed
Definition: nbgl_layout.h:325
const char * rightText
right-button text
Definition: nbgl_layout.h:323
This structure contains info to build a keyboard with nbgl_layoutAddKeyboard()
Definition: nbgl_layout.h:575
uint32_t keyMask
Definition: nbgl_layout.h:576
bool lettersOnly
if true, only display letter keys and Backspace
Definition: nbgl_layout.h:580
keyboardCallback_t callback
function called when an active key is pressed
Definition: nbgl_layout.h:579
keyboardMode_t mode
keyboard mode to start with
Definition: nbgl_layout.h:581
keyboardCase_t casing
keyboard casing mode (lower, upper once or upper locked)
Definition: nbgl_layout.h:583
This structure contains info to build a keyboard content (controls that are linked to keyboard)
Definition: nbgl_layout.h:392
uint8_t number
if numbered is true, number used to build 'number.' text
Definition: nbgl_layout.h:397
const char * text
already entered text
Definition: nbgl_layout.h:395
nbgl_layoutKeyboardContentType_t type
type of content
Definition: nbgl_layout.h:393
nbgl_layoutSuggestionButtons_t suggestionButtons
Definition: nbgl_layout.h:403
nbgl_layoutConfirmationButton_t confirmationButton
used if type is KEYBOARD_WITH_SUGGESTIONS
Definition: nbgl_layout.h:405
const char * title
centered title explaining the screen
Definition: nbgl_layout.h:394
bool numbered
if set to true, the text is preceded on the left by 'number.'
Definition: nbgl_layout.h:396
bool grayedOut
if true, the text is grayed out (but not the potential number)
Definition: nbgl_layout.h:398
This structure contains info to build a left content area.
Definition: nbgl_layout.h:262
uint8_t nbRows
number of rows in the area
Definition: nbgl_layout.h:263
const char * title
title of area in bold
Definition: nbgl_layout.h:264
const nbgl_icon_details_t ** rowIcons
array of nbRows icon
Definition: nbgl_layout.h:266
const char ** rowTexts
array of nbRows texts (displayed in regular)
Definition: nbgl_layout.h:265
This structure contains a list of names to build a menu list on Nanos, with for each item a descripti...
Definition: nbgl_layout.h:235
nbgl_menuListCallback_t callback
function to call to retrieve a menu list item text
Definition: nbgl_layout.h:236
uint8_t nbChoices
total number of choices in the menu list
Definition: nbgl_layout.h:237
uint8_t selectedChoice
index of the selected choice (centered, in bold)
Definition: nbgl_layout.h:238
This structure contains info to build a navigation bar at the bottom of the screen.
Definition: nbgl_layout.h:118
uint8_t activePage
index of active page (from 0 to nbPages-1).
Definition: nbgl_layout.h:121
bool withBackKey
if set to true, the "back" key is drawn
Definition: nbgl_layout.h:123
bool withExitKey
if set to true, an exit button is drawn (X on the left)
Definition: nbgl_layout.h:122
uint8_t token
the token that will be used as argument of the callback
Definition: nbgl_layout.h:119
uint8_t nbPages
number of pages. (if 0, no navigation)
Definition: nbgl_layout.h:120
This structure contains info to build a navigation bar at the bottom of the screen.
Definition: nbgl_layout.h:160
nbgl_layoutNavDirection_t direction
vertical or horizontal navigation
Definition: nbgl_layout.h:161
nbgl_layoutNavIndication_t indication
specifies which arrows to use (left or right)
Definition: nbgl_layout.h:162
This structure contains info to build a progress bar with info. The progress bar itself is 120px widt...
Definition: nbgl_layout.h:565
uint8_t percentage
percentage of completion, from 0 to 100.
Definition: nbgl_layout.h:566
const char * text
text in black, on top of progress bar
Definition: nbgl_layout.h:567
const char * subText
text in gray, under progress bar
Definition: nbgl_layout.h:568
This structure contains info to build a centered (vertically and horizontally) area,...
Definition: nbgl_layout.h:277
const char * text2
second text (can be null)
Definition: nbgl_layout.h:280
const char * text1
first text (can be null)
Definition: nbgl_layout.h:279
const char * url
URL for QR code.
Definition: nbgl_layout.h:278
bool largeText1
if set to true, use 32px font for text1
Definition: nbgl_layout.h:283
int16_t offsetY
vertical shift to apply to this info (if > 0, shift to bottom)
Definition: nbgl_layout.h:281
bool centered
if set to true, center vertically
Definition: nbgl_layout.h:282
This structure contains info to build suggestion buttons.
Definition: nbgl_layout.h:372
uint8_t nbUsedButtons
the number of actually used buttons
Definition: nbgl_layout.h:376
const char ** buttons
array of 4 strings for buttons (last ones can be NULL)
Definition: nbgl_layout.h:373
This structure contains info to build an up-footer (area on top of footer).
Definition: nbgl_layout.h:539
nbgl_layoutButton_t button
if type is UP_FOOTER_BUTTON
Definition: nbgl_layout.h:547
tune_index_e tuneId
tune played when button is long-pressed
Definition: nbgl_layout.h:545
nbgl_contentTipBox_t tipBox
if type is UP_FOOTER_TIP_BOX
Definition: nbgl_layout.h:550
const char * text
text in the long-press button
Definition: nbgl_layout.h:543
nbgl_layoutUpFooterType_t type
type of up-footer
Definition: nbgl_layout.h:540
uint8_t token
token used when button is long-pressed
Definition: nbgl_layout.h:544
nbgl_layoutHorizontalButtons_t horizontalButtons
if type is UP_FOOTER_HORIZONTAL_BUTTONS
Definition: nbgl_layout.h:549
signed short int16_t
Definition: usbd_conf.h:50
unsigned short uint16_t
Definition: usbd_conf.h:54
unsigned char uint8_t
Definition: usbd_conf.h:53