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 {
296 
302 typedef struct {
303  const char *topText;
304  const char *bottomText;
308 #ifdef HAVE_PIEZO_SOUND
309  tune_index_e tuneId;
310 #endif // HAVE_PIEZO_SOUND
312 
319 typedef struct {
321  const char *rightText;
324 #ifdef HAVE_PIEZO_SOUND
325  tune_index_e tuneId;
326 #endif // HAVE_PIEZO_SOUND
328 
333 typedef enum {
335  = 0,
338  LONG_PRESS
340 
344 typedef struct {
345  const char *text;
350  bool onBottom;
352 #ifdef HAVE_PIEZO_SOUND
353  tune_index_e tuneId;
354 #endif // HAVE_PIEZO_SOUND
356 
361 typedef enum {
366 
370 typedef struct {
371  const char **buttons;
376 
380 typedef struct {
381  const char *text;
382  int token;
383  bool active;
385 
390 typedef struct {
392  const char *title;
393  const char *text;
394  bool numbered;
396  bool grayedOut;
397  int textToken;
399  union {
404  };
405 #ifdef HAVE_PIEZO_SOUND
406  tune_index_e tuneId;
407 #endif // HAVE_PIEZO_SOUND
409 
414 typedef enum {
424 
429 typedef struct {
432  union {
433  struct {
435  } emptySpace;
436  struct {
437  const nbgl_icon_details_t
438  *icon;
439  const char *text;
441  tune_index_e tuneId;
442  } backAndText;
443  struct {
447  bool withBack;
448  uint8_t token;
450  tune_index_e tuneId;
451  } progressAndBack;
452  struct {
453  const char *text;
454  } title;
455  struct {
456  const nbgl_icon_details_t *actionIcon;
457  const char *text;
460  uint8_t actionToken;
461  tune_index_e tuneId;
462  } extendedBack;
463  struct {
464  const char *text;
465  uint8_t token;
466  tune_index_e tuneId;
467  } rightText;
468  };
470 
475 typedef enum {
486 
491 typedef struct {
494  union {
495  struct {
497  } emptySpace;
498  struct {
499  const char *text;
500  bool mutedOut;
502  tune_index_e tuneId;
503  } simpleText;
504  struct {
505  const char *leftText;
506  const char *rightText;
509  tune_index_e tuneId;
510  } doubleText;
511  struct {
513  const char *text;
514  uint8_t token;
515  tune_index_e tuneId;
516  } textAndNav;
517  nbgl_layoutNavigationBar_t navigation;
520  };
522 
527 typedef enum {
535 
540 typedef struct {
542  union {
543  struct {
544  const char *text;
546  tune_index_e tuneId;
547  } longPress;
552  struct {
553  const char *text;
554  uint8_t token;
555  tune_index_e tuneId;
556  } text;
557  };
559 #endif // HAVE_SE_TOUCH
560 
566 typedef struct {
568  const char *text;
569  const char *subText;
571 
576 typedef struct {
577  uint32_t keyMask;
581  bool lettersOnly;
583 #ifdef HAVE_SE_TOUCH
585 #else // HAVE_SE_TOUCH
586  bool enableBackspace;
587  bool enableValidate;
588  uint8_t selectedCharIndex;
589 #endif // HAVE_SE_TOUCH
591 
592 /**********************
593  * GLOBAL PROTOTYPES
594  **********************/
600 
601 #ifdef HAVE_SE_TOUCH
603  const nbgl_icon_details_t *icon,
604  uint8_t token,
605  tune_index_e tuneId);
606 int nbgl_layoutAddTouchableBar(nbgl_layout_t *layout, const nbgl_layoutBar_t *barLayout);
607 int nbgl_layoutAddSwitch(nbgl_layout_t *layout, const nbgl_layoutSwitch_t *switchLayout);
608 int nbgl_layoutAddText(nbgl_layout_t *layout, const char *text, const char *subText);
610  const char *text,
611  const char *subText,
612  uint8_t token,
613  uint8_t index);
614 int nbgl_layoutAddSubHeaderText(nbgl_layout_t *layout, const char *text);
616 int nbgl_layoutAddQRCode(nbgl_layout_t *layout, const nbgl_layoutQRCode_t *info);
619  const nbgl_layoutHorizontalButtons_t *info);
621 int nbgl_layoutAddLargeCaseText(nbgl_layout_t *layout, const char *text, bool grayedOut);
623  const char *title,
624  const char *description,
625  const char *info);
627 
628 int nbgl_layoutAddButton(nbgl_layout_t *layout, const nbgl_layoutButton_t *buttonInfo);
630  const char *text,
631  uint8_t token,
632  tune_index_e tuneId);
634  const char *text,
635  uint8_t token,
636  tune_index_e tuneId);
638  const char *leftText,
639  uint8_t leftToken,
640  const char *rightText,
641  uint8_t rightToken,
642  tune_index_e tuneId);
643 int nbgl_layoutAddHeader(nbgl_layout_t *layout, const nbgl_layoutHeader_t *headerDesc);
644 int nbgl_layoutAddExtendedFooter(nbgl_layout_t *layout, const nbgl_layoutFooter_t *footerDesc);
645 int nbgl_layoutAddUpFooter(nbgl_layout_t *layout, const nbgl_layoutUpFooter_t *upFooterDesc);
648  const nbgl_icon_details_t *icon,
649  uint8_t token,
650  bool separationLine,
651  tune_index_e tuneId);
653  uint8_t activePage,
654  uint8_t nbPages,
655  bool withBack,
656  uint8_t backToken,
657  tune_index_e tuneId);
658 int nbgl_layoutAddSpinner(nbgl_layout_t *layout, const char *text, const char *subText, bool fixed);
660  uint16_t swipesMask,
661  const char *text,
662  uint8_t token,
663  tune_index_e tuneId);
664 #else // HAVE_SE_TOUCH
666  const char *text,
667  const char *subText,
669 int nbgl_layoutAddNavigation(nbgl_layout_t *layout, nbgl_layoutNavigation_t *info);
670 int nbgl_layoutAddMenuList(nbgl_layout_t *layout, nbgl_layoutMenuList_t *list);
671 #endif // HAVE_SE_TOUCH
672 
673 #ifdef NBGL_KEYBOARD
674 /* layout objects for page with keyboard */
675 int nbgl_layoutAddKeyboard(nbgl_layout_t *layout, const nbgl_layoutKbd_t *kbdInfo);
676 #ifdef HAVE_SE_TOUCH
678  uint8_t index,
679  uint32_t keyMask,
680  bool updateCasing,
681  keyboardCase_t casing);
683 DEPRECATED int nbgl_layoutAddSuggestionButtons(nbgl_layout_t *layout,
684  uint8_t nbUsedButtons,
685  const char *buttonTexts[NB_MAX_SUGGESTION_BUTTONS],
686  int firstButtonToken,
687  tune_index_e tuneId);
689  nbgl_layout_t *layout,
690  uint8_t index,
691  uint8_t nbUsedButtons,
692  const char *buttonTexts[NB_MAX_SUGGESTION_BUTTONS]);
693 DEPRECATED int nbgl_layoutAddEnteredText(nbgl_layout_t *layout,
694  bool numbered,
695  uint8_t number,
696  const char *text,
697  bool grayedOut,
698  int offsetY,
699  int token);
700 DEPRECATED int nbgl_layoutUpdateEnteredText(nbgl_layout_t *layout,
701  uint8_t index,
702  bool numbered,
703  uint8_t number,
704  const char *text,
705  bool grayedOut);
706 DEPRECATED int nbgl_layoutAddConfirmationButton(nbgl_layout_t *layout,
707  bool active,
708  const char *text,
709  int token,
710  tune_index_e tuneId);
712  uint8_t index,
713  bool active,
714  const char *text);
717 #else // HAVE_SE_TOUCH
718 int nbgl_layoutUpdateKeyboard(nbgl_layout_t *layout, uint8_t index, uint32_t keyMask);
719 int nbgl_layoutAddEnteredText(nbgl_layout_t *layout, const char *text, bool lettersOnly);
720 int nbgl_layoutUpdateEnteredText(nbgl_layout_t *layout, uint8_t index, const char *text);
721 #endif // HAVE_SE_TOUCH
722 #endif // NBGL_KEYBOARD
723 
724 #ifdef NBGL_KEYPAD
725 #ifdef HAVE_SE_TOUCH
726 /* layout objects for page with keypad (Stax) */
727 int nbgl_layoutAddKeypad(nbgl_layout_t *layout, keyboardCallback_t callback, bool shuffled);
729  uint8_t index,
730  bool enableValidate,
731  bool enableBackspace,
732  bool enableDigits);
733 int nbgl_layoutUpdateKeypadValidation(nbgl_layout_t *layout, bool softValidation);
734 DEPRECATED int nbgl_layoutAddHiddenDigits(nbgl_layout_t *layout, uint8_t nbDigits);
735 DEPRECATED int nbgl_layoutUpdateHiddenDigits(nbgl_layout_t *layout,
736  uint8_t index,
737  uint8_t nbActive);
739  const char *title,
740  bool hidden,
741  uint8_t nbDigits,
742  const char *text);
744  bool hidden,
745  uint8_t nbActiveDigits,
746  const char *text);
747 
748 #else // HAVE_SE_TOUCH
749 /* layout objects for pages with keypad (nanos) */
751  keyboardCallback_t callback,
752  const char *text,
753  bool shuffled);
755  uint8_t index,
756  bool enableValidate,
757  bool enableBackspace);
758 int nbgl_layoutAddHiddenDigits(nbgl_layout_t *layout, uint8_t nbDigits);
759 int nbgl_layoutUpdateHiddenDigits(nbgl_layout_t *layout, uint8_t index, uint8_t nbActive);
760 #endif // HAVE_SE_TOUCH
761 #endif // NBGL_KEYPAD
762 
763 /* generic functions */
764 int nbgl_layoutDraw(nbgl_layout_t *layout);
765 int nbgl_layoutRelease(nbgl_layout_t *layout);
766 
767 /**********************
768  * MACROS
769  **********************/
770 
771 #ifdef __cplusplus
772 } /* extern "C" */
773 #endif
774 
775 #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:2048
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:1761
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:3163
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:1522
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:1392
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:3463
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:1261
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:2271
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:1877
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:1604
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:1701
int nbgl_layoutUpdateKeypadValidation(nbgl_layout_t *layout, bool softValidation)
Updates an existing keypad on bottom of the screen, with the given configuration, without redraw.
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:2448
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:2200
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:1426
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:1409
int nbgl_layoutDraw(nbgl_layout_t *layout)
Applies given layout. The screen will be redrawn.
Definition: nbgl_layout.c:3600
int nbgl_layoutAddTouchableBar(nbgl_layout_t *layout, const nbgl_layoutBar_t *barLayout)
Creates a touchable bar in main panel.
Definition: nbgl_layout.c:1313
nbgl_layoutButtonStyle_t
The different styles for a button.
Definition: nbgl_layout.h:333
@ WHITE_BACKGROUND
rounded bordered button, with text/icon in black, on white background
Definition: nbgl_layout.h:336
@ NO_BORDER
simple clickable text, in black
Definition: nbgl_layout.h:337
@ LONG_PRESS
long press button, with progress indicator
Definition: nbgl_layout.h:338
@ BLACK_BACKGROUND
rounded bordered button, with text/icon in white, on black background
Definition: nbgl_layout.h:334
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:1216
#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:527
@ UP_FOOTER_TEXT
grayed-out text, for example "Tap to continue"
Definition: nbgl_layout.h:532
@ NB_UP_FOOTER_TYPES
Definition: nbgl_layout.h:533
@ UP_FOOTER_BUTTON
simple button
Definition: nbgl_layout.h:529
@ UP_FOOTER_LONG_PRESS
long-press button
Definition: nbgl_layout.h:528
@ UP_FOOTER_TIP_BOX
Tip-box.
Definition: nbgl_layout.h:531
@ UP_FOOTER_HORIZONTAL_BUTTONS
2 buttons, on the same line
Definition: nbgl_layout.h:530
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:1175
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_layoutAddSpinner(nbgl_layout_t *layout, const char *text, const char *subText, bool fixed)
Creates a centered (vertically & horizontally) spinner with a text under it.
Definition: nbgl_layout.c:3493
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:1352
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:2027
nbgl_layoutHeaderType_t
The different types of extended header.
Definition: nbgl_layout.h:414
@ HEADER_TITLE
simple centered text
Definition: nbgl_layout.h:419
@ HEADER_BACK_AND_PROGRESS
optional back key and progress indicator (only on Stax)
Definition: nbgl_layout.h:418
@ HEADER_EMPTY
empty space, to have a better vertical centering of centered info
Definition: nbgl_layout.h:415
@ NB_HEADER_TYPES
Definition: nbgl_layout.h:422
@ HEADER_EXTENDED_BACK
back key, centered text and touchable key on the right
Definition: nbgl_layout.h:420
@ HEADER_BACK_AND_TEXT
back key and optional text
Definition: nbgl_layout.h:416
@ HEADER_RIGHT_TEXT
touchable text on the right, with a vertical separation line
Definition: nbgl_layout.h:421
@ HEADER_BACK_ICON_AND_TEXT
back key and optional icon and text
Definition: nbgl_layout.h:417
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:2291
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:2761
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:1783
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
@ BOTH_ROUNDED_STYLE
A black button on top of a white button.
Definition: nbgl_layout.h:294
@ 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:2004
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:2393
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:2474
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:1287
nbgl_layoutKeyboardContentType_t
The different types of keyboard contents.
Definition: nbgl_layout.h:361
@ KEYBOARD_WITH_BUTTON
text entry area + confirmation button
Definition: nbgl_layout.h:363
@ KEYBOARD_WITH_SUGGESTIONS
text entry area + suggestion buttons
Definition: nbgl_layout.h:362
@ NB_KEYBOARD_CONTENT_TYPES
Definition: nbgl_layout.h:364
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:475
@ FOOTER_SIMPLE_TEXT
simple touchable text in bold
Definition: nbgl_layout.h:477
@ FOOTER_NAV
navigation bar
Definition: nbgl_layout.h:481
@ FOOTER_SIMPLE_BUTTON
simple black or white button (see nbgl_layoutButtonStyle_t)
Definition: nbgl_layout.h:482
@ FOOTER_TEXT_AND_NAV
Definition: nbgl_layout.h:479
@ FOOTER_DOUBLE_TEXT
2 touchable texts in bold, separated by a vertical line (only on Stax)
Definition: nbgl_layout.h:478
@ NB_FOOTER_TYPES
Definition: nbgl_layout.h:484
@ FOOTER_EMPTY
empty space, to have a better vertical centering of centered info
Definition: nbgl_layout.h:476
@ FOOTER_CHOICE_BUTTONS
double buttons (see nbgl_layoutChoiceButtonsStyle_t)
Definition: nbgl_layout.h:483
int nbgl_layoutRelease(nbgl_layout_t *layout)
Release the layout obtained with nbgl_layoutGet()
Definition: nbgl_layout.c:3631
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:2421
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:1468
bool nbgl_layoutKeyboardNeedsRefresh(nbgl_layout_t *layout, uint8_t index)
function called to know whether the keyboard has been redrawn and needs a refresh
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:1086
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:90
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:300
This structure contains info to build a switch (on the right) with a description (on the left),...
Definition: nbgl_content.h:260
This structure contains a list of [tag,value] pairs.
Definition: nbgl_content.h:199
This structure contains a [tag,value] pair.
Definition: nbgl_content.h:162
This structure contains data to build a tip-box, on top of a footer, on bottom of a content center.
Definition: nbgl_content.h:333
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:344
const char * text
button text
Definition: nbgl_layout.h:345
uint8_t token
the token that will be used as argument of the callback
Definition: nbgl_layout.h:347
const nbgl_icon_details_t * icon
a buffer containing the 1BPP icon for button
Definition: nbgl_layout.h:346
nbgl_layoutButtonStyle_t style
Definition: nbgl_layout.h:348
bool fittingContent
if set to true, fit the width of button to text, otherwise full width
Definition: nbgl_layout.h:349
This structure contains info to build a pair of buttons, one on top of the other.
Definition: nbgl_layout.h:302
nbgl_layoutChoiceButtonsStyle_t style
the style of the pair
Definition: nbgl_layout.h:307
const nbgl_icon_details_t * topIcon
icon of top button
Definition: nbgl_layout.h:305
uint8_t token
the token that will be used as argument of the callback
Definition: nbgl_layout.h:306
const char * topText
up-button text (index 0)
Definition: nbgl_layout.h:303
const char * bottomText
bottom-button text (index 1)
Definition: nbgl_layout.h:304
This structure contains info to build a confirmation button.
Definition: nbgl_layout.h:380
int token
token of the button
Definition: nbgl_layout.h:382
const char * text
text of the button
Definition: nbgl_layout.h:381
bool active
if true, button is active, otherwise inactive (grayed-out)
Definition: nbgl_layout.h:383
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:491
nbgl_layoutChoiceButtons_t choiceButtons
if type is FOOTER_CHOICE_BUTTONS
Definition: nbgl_layout.h:519
bool separationLine
if true, a separation line is added at the top of this control
Definition: nbgl_layout.h:493
const char * leftText
Definition: nbgl_layout.h:505
nbgl_layoutButton_t button
if type is FOOTER_SIMPLE_BUTTON
Definition: nbgl_layout.h:518
bool mutedOut
if true, text is displayed in gray
Definition: nbgl_layout.h:500
nbgl_layoutFooterType_t type
type of footer
Definition: nbgl_layout.h:492
nbgl_layoutNavigationBar_t navigation
if type is FOOTER_NAV
Definition: nbgl_layout.h:512
const char * rightText
Definition: nbgl_layout.h:506
const char * text
Definition: nbgl_layout.h:499
tune_index_e tuneId
Definition: nbgl_layout.h:502
This structure contains info to build a header.
Definition: nbgl_layout.h:429
nbgl_layoutHeaderType_t type
type of header
Definition: nbgl_layout.h:430
const nbgl_icon_details_t * icon
icon on left of text (only if HEADER_BACK_ICON_AND_TEXT)
Definition: nbgl_layout.h:438
uint8_t backToken
when back key is pressed
Definition: nbgl_layout.h:459
const nbgl_icon_details_t * actionIcon
right button icon
Definition: nbgl_layout.h:444
uint8_t actionToken
when optional right button is pressed
Definition: nbgl_layout.h:449
bool separationLine
if true, a separation line is added at the bottom of this control
Definition: nbgl_layout.h:431
tune_index_e tuneId
when back key is pressed
Definition: nbgl_layout.h:441
const char * text
can be NULL if no text
Definition: nbgl_layout.h:439
uint8_t textToken
when text is touched
Definition: nbgl_layout.h:458
uint8_t token
when back key is pressed
Definition: nbgl_layout.h:440
This structure contains info to build a pair of buttons, the small one, with icon,...
Definition: nbgl_layout.h:319
const nbgl_icon_details_t * leftIcon
a buffer containing the 1BPP icon for left button
Definition: nbgl_layout.h:320
uint8_t leftToken
the token used when left button is pressed
Definition: nbgl_layout.h:322
uint8_t rightToken
the token used when right button is pressed
Definition: nbgl_layout.h:323
const char * rightText
right-button text
Definition: nbgl_layout.h:321
This structure contains info to build a keyboard with nbgl_layoutAddKeyboard()
Definition: nbgl_layout.h:576
uint32_t keyMask
Definition: nbgl_layout.h:577
bool lettersOnly
if true, only display letter keys and Backspace
Definition: nbgl_layout.h:581
keyboardCallback_t callback
function called when an active key is pressed
Definition: nbgl_layout.h:580
keyboardMode_t mode
keyboard mode to start with
Definition: nbgl_layout.h:582
keyboardCase_t casing
keyboard casing mode (lower, upper once or upper locked)
Definition: nbgl_layout.h:584
This structure contains info to build a keyboard content (controls that are linked to keyboard)
Definition: nbgl_layout.h:390
uint8_t number
if numbered is true, number used to build 'number.' text
Definition: nbgl_layout.h:395
const char * text
already entered text
Definition: nbgl_layout.h:393
nbgl_layoutKeyboardContentType_t type
type of content
Definition: nbgl_layout.h:391
nbgl_layoutSuggestionButtons_t suggestionButtons
Definition: nbgl_layout.h:401
nbgl_layoutConfirmationButton_t confirmationButton
used if type is KEYBOARD_WITH_SUGGESTIONS
Definition: nbgl_layout.h:403
const char * title
centered title explaining the screen
Definition: nbgl_layout.h:392
bool numbered
if set to true, the text is preceded on the left by 'number.'
Definition: nbgl_layout.h:394
bool grayedOut
if true, the text is grayed out (but not the potential number)
Definition: nbgl_layout.h:396
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:566
uint8_t percentage
percentage of completion, from 0 to 100.
Definition: nbgl_layout.h:567
const char * text
text in black, on top of progress bar
Definition: nbgl_layout.h:568
const char * subText
text in gray, under progress bar
Definition: nbgl_layout.h:569
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:370
uint8_t nbUsedButtons
the number of actually used buttons
Definition: nbgl_layout.h:374
const char ** buttons
array of 4 strings for buttons (last ones can be NULL)
Definition: nbgl_layout.h:371
This structure contains info to build an up-footer (area on top of footer).
Definition: nbgl_layout.h:540
nbgl_layoutButton_t button
if type is UP_FOOTER_BUTTON
Definition: nbgl_layout.h:548
tune_index_e tuneId
tune played when button is long-pressed
Definition: nbgl_layout.h:546
nbgl_contentTipBox_t tipBox
if type is UP_FOOTER_TIP_BOX
Definition: nbgl_layout.h:551
const char * text
text in the long-press button
Definition: nbgl_layout.h:544
nbgl_layoutUpFooterType_t type
type of up-footer
Definition: nbgl_layout.h:541
uint8_t token
token used when button is long-pressed
Definition: nbgl_layout.h:545
nbgl_layoutHorizontalButtons_t horizontalButtons
if type is UP_FOOTER_HORIZONTAL_BUTTONS
Definition: nbgl_layout.h:550
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