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 
258 #ifdef HAVE_SE_TOUCH
259 
266 typedef struct {
267  const char *url;
268  const char *text1;
269  const char *text2;
271  bool centered;
272  bool largeText1;
274 
279 typedef enum {
284 
285 // for backward compatibility
286 #define BOTH_ROUNDED_STYLE SOFT_ACTION_AND_FOOTER_STYLE
287 
293 typedef struct {
294  const char *topText;
295  const char *bottomText;
299 #ifdef HAVE_PIEZO_SOUND
300  tune_index_e tuneId;
301 #endif // HAVE_PIEZO_SOUND
303 
310 typedef struct {
312  const char *rightText;
315 #ifdef HAVE_PIEZO_SOUND
316  tune_index_e tuneId;
317 #endif // HAVE_PIEZO_SOUND
319 
324 typedef enum {
326  = 0,
329  LONG_PRESS
331 
335 typedef struct {
336  const char *text;
341  bool onBottom;
343 #ifdef HAVE_PIEZO_SOUND
344  tune_index_e tuneId;
345 #endif // HAVE_PIEZO_SOUND
347 
352 typedef enum {
357 
361 typedef struct {
362  const char **buttons;
367 
371 typedef struct {
372  const char *text;
373  int token;
374  bool active;
376 
381 typedef struct {
383  const char *title;
384  const char *text;
385  bool numbered;
387  bool grayedOut;
388  int textToken;
390  union {
395  };
396 #ifdef HAVE_PIEZO_SOUND
397  tune_index_e tuneId;
398 #endif // HAVE_PIEZO_SOUND
400 
405 typedef enum {
414 
419 typedef struct {
422  union {
423  struct {
425  } emptySpace;
426  struct {
427  const char *text;
429  tune_index_e tuneId;
430  } backAndText;
431  struct {
435  bool withBack;
436  uint8_t token;
438  tune_index_e tuneId;
439  } progressAndBack;
440  struct {
441  const char *text;
442  } title;
443  struct {
444  const nbgl_icon_details_t *actionIcon;
445  const char *text;
448  uint8_t actionToken;
449  tune_index_e tuneId;
450  } extendedBack;
451  struct {
452  const char *text;
453  uint8_t token;
454  tune_index_e tuneId;
455  } rightText;
456  };
458 
463 typedef enum {
474 
479 typedef struct {
482  union {
483  struct {
485  } emptySpace;
486  struct {
487  const char *text;
488  bool mutedOut;
490  tune_index_e tuneId;
491  } simpleText;
492  struct {
493  const char *leftText;
494  const char *rightText;
497  tune_index_e tuneId;
498  } doubleText;
499  struct {
501  const char *text;
502  uint8_t token;
503  tune_index_e tuneId;
504  } textAndNav;
505  nbgl_layoutNavigationBar_t navigation;
508  };
510 
515 typedef enum {
523 
528 typedef struct {
530  union {
531  struct {
532  const char *text;
534  tune_index_e tuneId;
535  } longPress;
540  struct {
541  const char *text;
542  uint8_t token;
543  tune_index_e tuneId;
544  } text;
545  };
547 #endif // HAVE_SE_TOUCH
548 
554 typedef struct {
556  const char *text;
557  const char *subText;
559 
564 typedef struct {
565  uint32_t keyMask;
569  bool lettersOnly;
571 #ifdef HAVE_SE_TOUCH
573 #else // HAVE_SE_TOUCH
574  bool enableBackspace;
575  bool enableValidate;
576  uint8_t selectedCharIndex;
577 #endif // HAVE_SE_TOUCH
579 
580 /**********************
581  * GLOBAL PROTOTYPES
582  **********************/
587 
588 #ifdef HAVE_SE_TOUCH
590  const nbgl_icon_details_t *icon,
591  uint8_t token,
592  tune_index_e tuneId);
593 int nbgl_layoutAddTouchableBar(nbgl_layout_t *layout, const nbgl_layoutBar_t *barLayout);
594 int nbgl_layoutAddSwitch(nbgl_layout_t *layout, const nbgl_layoutSwitch_t *switchLayout);
595 int nbgl_layoutAddText(nbgl_layout_t *layout, const char *text, const char *subText);
597  const char *text,
598  const char *subText,
599  uint8_t token,
600  uint8_t index);
601 int nbgl_layoutAddSubHeaderText(nbgl_layout_t *layout, const char *text);
603 int nbgl_layoutAddQRCode(nbgl_layout_t *layout, const nbgl_layoutQRCode_t *info);
606  const nbgl_layoutHorizontalButtons_t *info);
608 int nbgl_layoutAddLargeCaseText(nbgl_layout_t *layout, const char *text);
610  const char *title,
611  const char *description,
612  const char *info);
614 
615 int nbgl_layoutAddButton(nbgl_layout_t *layout, const nbgl_layoutButton_t *buttonInfo);
617  const char *text,
618  uint8_t token,
619  tune_index_e tuneId);
621  const char *text,
622  uint8_t token,
623  tune_index_e tuneId);
625  const char *leftText,
626  uint8_t leftToken,
627  const char *rightText,
628  uint8_t rightToken,
629  tune_index_e tuneId);
630 int nbgl_layoutAddHeader(nbgl_layout_t *layout, const nbgl_layoutHeader_t *headerDesc);
631 int nbgl_layoutAddExtendedFooter(nbgl_layout_t *layout, const nbgl_layoutFooter_t *footerDesc);
632 int nbgl_layoutAddUpFooter(nbgl_layout_t *layout, const nbgl_layoutUpFooter_t *upFooterDesc);
635  const nbgl_icon_details_t *icon,
636  uint8_t token,
637  bool separationLine,
638  tune_index_e tuneId);
640  uint8_t activePage,
641  uint8_t nbPages,
642  bool withBack,
643  uint8_t backToken,
644  tune_index_e tuneId);
645 int nbgl_layoutAddSpinner(nbgl_layout_t *layout, const char *text, bool fixed);
647  uint16_t swipesMask,
648  const char *text,
649  uint8_t token,
650  tune_index_e tuneId);
651 #else // HAVE_SE_TOUCH
653  const char *text,
654  const char *subText,
656 int nbgl_layoutAddNavigation(nbgl_layout_t *layout, nbgl_layoutNavigation_t *info);
657 int nbgl_layoutAddMenuList(nbgl_layout_t *layout, nbgl_layoutMenuList_t *list);
658 #endif // HAVE_SE_TOUCH
659 
660 #ifdef NBGL_KEYBOARD
661 /* layout objects for page with keyboard */
662 int nbgl_layoutAddKeyboard(nbgl_layout_t *layout, const nbgl_layoutKbd_t *kbdInfo);
663 #ifdef HAVE_SE_TOUCH
665  uint8_t index,
666  uint32_t keyMask,
667  bool updateCasing,
668  keyboardCase_t casing);
670 DEPRECATED int nbgl_layoutAddSuggestionButtons(nbgl_layout_t *layout,
671  uint8_t nbUsedButtons,
672  const char *buttonTexts[NB_MAX_SUGGESTION_BUTTONS],
673  int firstButtonToken,
674  tune_index_e tuneId);
676  nbgl_layout_t *layout,
677  uint8_t index,
678  uint8_t nbUsedButtons,
679  const char *buttonTexts[NB_MAX_SUGGESTION_BUTTONS]);
680 DEPRECATED int nbgl_layoutAddEnteredText(nbgl_layout_t *layout,
681  bool numbered,
682  uint8_t number,
683  const char *text,
684  bool grayedOut,
685  int offsetY,
686  int token);
687 DEPRECATED int nbgl_layoutUpdateEnteredText(nbgl_layout_t *layout,
688  uint8_t index,
689  bool numbered,
690  uint8_t number,
691  const char *text,
692  bool grayedOut);
693 DEPRECATED int nbgl_layoutAddConfirmationButton(nbgl_layout_t *layout,
694  bool active,
695  const char *text,
696  int token,
697  tune_index_e tuneId);
699  uint8_t index,
700  bool active,
701  const char *text);
704 #else // HAVE_SE_TOUCH
705 int nbgl_layoutUpdateKeyboard(nbgl_layout_t *layout, uint8_t index, uint32_t keyMask);
706 int nbgl_layoutAddEnteredText(nbgl_layout_t *layout, const char *text, bool lettersOnly);
707 int nbgl_layoutUpdateEnteredText(nbgl_layout_t *layout, uint8_t index, const char *text);
708 #endif // HAVE_SE_TOUCH
709 #endif // NBGL_KEYBOARD
710 
711 #ifdef NBGL_KEYPAD
712 #ifdef HAVE_SE_TOUCH
713 /* layout objects for page with keypad (Stax) */
714 int nbgl_layoutAddKeypad(nbgl_layout_t *layout, keyboardCallback_t callback, bool shuffled);
716  uint8_t index,
717  bool enableValidate,
718  bool enableBackspace,
719  bool enableDigits);
720 DEPRECATED int nbgl_layoutAddHiddenDigits(nbgl_layout_t *layout, uint8_t nbDigits);
721 DEPRECATED int nbgl_layoutUpdateHiddenDigits(nbgl_layout_t *layout,
722  uint8_t index,
723  uint8_t nbActive);
725  const char *title,
726  bool hidden,
727  uint8_t nbDigits,
728  const char *text);
730  bool hidden,
731  uint8_t nbActiveDigits,
732  const char *text);
733 
734 #else // HAVE_SE_TOUCH
735 /* layout objects for pages with keypad (nanos) */
737  keyboardCallback_t callback,
738  const char *text,
739  bool shuffled);
741  uint8_t index,
742  bool enableValidate,
743  bool enableBackspace);
744 int nbgl_layoutAddHiddenDigits(nbgl_layout_t *layout, uint8_t nbDigits);
745 int nbgl_layoutUpdateHiddenDigits(nbgl_layout_t *layout, uint8_t index, uint8_t nbActive);
746 #endif // HAVE_SE_TOUCH
747 #endif // NBGL_KEYPAD
748 
749 /* generic functions */
750 int nbgl_layoutDraw(nbgl_layout_t *layout);
751 int nbgl_layoutRelease(nbgl_layout_t *layout);
752 
753 /**********************
754  * MACROS
755  **********************/
756 
757 #ifdef __cplusplus
758 } /* extern "C" */
759 #endif
760 
761 #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:1859
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:1664
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:2942
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:1422
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:1300
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:3242
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:1169
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:2082
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:1688
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:1504
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:1601
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:2259
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:2011
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:1334
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:1317
int nbgl_layoutDraw(nbgl_layout_t *layout)
Applies given layout. The screen will be redrawn.
Definition: nbgl_layout.c:3336
int nbgl_layoutAddTouchableBar(nbgl_layout_t *layout, const nbgl_layoutBar_t *barLayout)
Creates a touchable bar in main panel.
Definition: nbgl_layout.c:1221
nbgl_layoutButtonStyle_t
The different styles for a button.
Definition: nbgl_layout.h:324
@ WHITE_BACKGROUND
rounded bordered button, with text/icon in black, on white background
Definition: nbgl_layout.h:327
@ NO_BORDER
simple clickable text, in black
Definition: nbgl_layout.h:328
@ LONG_PRESS
long press button, with progress indicator
Definition: nbgl_layout.h:329
@ BLACK_BACKGROUND
rounded bordered button, with text/icon in white, on black background
Definition: nbgl_layout.h:325
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:1124
#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:515
@ UP_FOOTER_TEXT
grayed-out text, for example "Tap to continue"
Definition: nbgl_layout.h:520
@ NB_UP_FOOTER_TYPES
Definition: nbgl_layout.h:521
@ UP_FOOTER_BUTTON
simple button
Definition: nbgl_layout.h:517
@ UP_FOOTER_LONG_PRESS
long-press button
Definition: nbgl_layout.h:516
@ UP_FOOTER_TIP_BOX
Tip-box.
Definition: nbgl_layout.h:519
@ UP_FOOTER_HORIZONTAL_BUTTONS
2 buttons, on the same line
Definition: nbgl_layout.h:518
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:1083
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:1260
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:1838
nbgl_layoutHeaderType_t
The different types of extended header.
Definition: nbgl_layout.h:405
@ HEADER_TITLE
simple centered text
Definition: nbgl_layout.h:409
@ HEADER_BACK_AND_PROGRESS
optional back key and progress indicator (only on Stax)
Definition: nbgl_layout.h:408
@ HEADER_EMPTY
empty space, to have a better vertical centering of centered info
Definition: nbgl_layout.h:406
@ NB_HEADER_TYPES
Definition: nbgl_layout.h:412
@ HEADER_EXTENDED_BACK
back key, centered text and touchable key on the right
Definition: nbgl_layout.h:410
@ HEADER_BACK_AND_TEXT
back key and optional text
Definition: nbgl_layout.h:407
@ HEADER_RIGHT_TEXT
touchable text on the right, with a vertical separation line
Definition: nbgl_layout.h:411
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:2102
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:2548
nbgl_layoutChoiceButtonsStyle_t
The different styles for a pair of buttons.
Definition: nbgl_layout.h:279
@ SOFT_ACTION_AND_FOOTER_STYLE
A white button on top of a footer, with a separation line.
Definition: nbgl_layout.h:282
@ ROUNDED_AND_FOOTER_STYLE
A black background button on top of a footer.
Definition: nbgl_layout.h:280
@ STRONG_ACTION_AND_FOOTER_STYLE
A black button on top of a footer, with a separation line.
Definition: nbgl_layout.h:281
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:1815
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:2204
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:2285
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:1195
nbgl_layoutKeyboardContentType_t
The different types of keyboard contents.
Definition: nbgl_layout.h:352
@ KEYBOARD_WITH_BUTTON
text entry area + confirmation button
Definition: nbgl_layout.h:354
@ KEYBOARD_WITH_SUGGESTIONS
text entry area + suggestion buttons
Definition: nbgl_layout.h:353
@ NB_KEYBOARD_CONTENT_TYPES
Definition: nbgl_layout.h:355
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:463
@ FOOTER_SIMPLE_TEXT
simple touchable text in bold
Definition: nbgl_layout.h:465
@ FOOTER_NAV
navigation bar
Definition: nbgl_layout.h:469
@ FOOTER_SIMPLE_BUTTON
simple black or white button (see nbgl_layoutButtonStyle_t)
Definition: nbgl_layout.h:470
@ FOOTER_TEXT_AND_NAV
Definition: nbgl_layout.h:467
@ FOOTER_DOUBLE_TEXT
2 touchable texts in bold, separated by a vertical line (only on Stax)
Definition: nbgl_layout.h:466
@ NB_FOOTER_TYPES
Definition: nbgl_layout.h:472
@ FOOTER_EMPTY
empty space, to have a better vertical centering of centered info
Definition: nbgl_layout.h:464
@ FOOTER_CHOICE_BUTTONS
double buttons (see nbgl_layoutChoiceButtonsStyle_t)
Definition: nbgl_layout.h:471
int nbgl_layoutAddLargeCaseText(nbgl_layout_t *layout, const char *text)
Creates an area with given text in 32px font (in Black)
Definition: nbgl_layout.c:1375
int nbgl_layoutRelease(nbgl_layout_t *layout)
Release the layout obtained with nbgl_layoutGet()
Definition: nbgl_layout.c:3367
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:2232
int nbgl_layoutAddKeypad(nbgl_layout_t *layout, keyboardCallback_t callback, bool shuffled)
Adds a keypad on bottom of the screen, with the associated callback.
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:3271
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:994
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:335
const char * text
button text
Definition: nbgl_layout.h:336
uint8_t token
the token that will be used as argument of the callback
Definition: nbgl_layout.h:338
const nbgl_icon_details_t * icon
a buffer containing the 1BPP icon for button
Definition: nbgl_layout.h:337
nbgl_layoutButtonStyle_t style
Definition: nbgl_layout.h:339
bool fittingContent
if set to true, fit the width of button to text, otherwise full width
Definition: nbgl_layout.h:340
This structure contains info to build a pair of buttons, one on top of the other.
Definition: nbgl_layout.h:293
nbgl_layoutChoiceButtonsStyle_t style
the style of the pair
Definition: nbgl_layout.h:298
const nbgl_icon_details_t * topIcon
icon of top button
Definition: nbgl_layout.h:296
uint8_t token
the token that will be used as argument of the callback
Definition: nbgl_layout.h:297
const char * topText
up-button text (index 0)
Definition: nbgl_layout.h:294
const char * bottomText
bottom-button text (index 1)
Definition: nbgl_layout.h:295
This structure contains info to build a confirmation button.
Definition: nbgl_layout.h:371
int token
token of the button
Definition: nbgl_layout.h:373
const char * text
text of the button
Definition: nbgl_layout.h:372
bool active
if true, button is active, otherwise inactive (grayed-out)
Definition: nbgl_layout.h:374
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:479
nbgl_layoutChoiceButtons_t choiceButtons
if type is FOOTER_CHOICE_BUTTONS
Definition: nbgl_layout.h:507
bool separationLine
if true, a separation line is added at the top of this control
Definition: nbgl_layout.h:481
const char * leftText
Definition: nbgl_layout.h:493
nbgl_layoutButton_t button
if type is FOOTER_SIMPLE_BUTTON
Definition: nbgl_layout.h:506
bool mutedOut
if true, text is displayed in gray
Definition: nbgl_layout.h:488
nbgl_layoutFooterType_t type
type of footer
Definition: nbgl_layout.h:480
nbgl_layoutNavigationBar_t navigation
if type is FOOTER_NAV
Definition: nbgl_layout.h:500
const char * rightText
Definition: nbgl_layout.h:494
const char * text
Definition: nbgl_layout.h:487
tune_index_e tuneId
Definition: nbgl_layout.h:490
This structure contains info to build a header.
Definition: nbgl_layout.h:419
nbgl_layoutHeaderType_t type
type of header
Definition: nbgl_layout.h:420
uint8_t backToken
when back key is pressed
Definition: nbgl_layout.h:447
const nbgl_icon_details_t * actionIcon
right button icon
Definition: nbgl_layout.h:432
uint8_t actionToken
when optional right button is pressed
Definition: nbgl_layout.h:437
bool separationLine
if true, a separation line is added at the bottom of this control
Definition: nbgl_layout.h:421
tune_index_e tuneId
when back key is pressed
Definition: nbgl_layout.h:429
const char * text
can be NULL if no text
Definition: nbgl_layout.h:427
uint8_t textToken
when text is touched
Definition: nbgl_layout.h:446
uint8_t token
when back key is pressed
Definition: nbgl_layout.h:428
This structure contains info to build a pair of buttons, the small one, with icon,...
Definition: nbgl_layout.h:310
const nbgl_icon_details_t * leftIcon
a buffer containing the 1BPP icon for left button
Definition: nbgl_layout.h:311
uint8_t leftToken
the token used when left button is pressed
Definition: nbgl_layout.h:313
uint8_t rightToken
the token used when right button is pressed
Definition: nbgl_layout.h:314
const char * rightText
right-button text
Definition: nbgl_layout.h:312
This structure contains info to build a keyboard with nbgl_layoutAddKeyboard()
Definition: nbgl_layout.h:564
uint32_t keyMask
Definition: nbgl_layout.h:565
bool lettersOnly
if true, only display letter keys and Backspace
Definition: nbgl_layout.h:569
keyboardCallback_t callback
function called when an active key is pressed
Definition: nbgl_layout.h:568
keyboardMode_t mode
keyboard mode to start with
Definition: nbgl_layout.h:570
keyboardCase_t casing
keyboard casing mode (lower, upper once or upper locked)
Definition: nbgl_layout.h:572
This structure contains info to build a keyboard content (controls that are linked to keyboard)
Definition: nbgl_layout.h:381
uint8_t number
if numbered is true, number used to build 'number.' text
Definition: nbgl_layout.h:386
const char * text
already entered text
Definition: nbgl_layout.h:384
nbgl_layoutKeyboardContentType_t type
type of content
Definition: nbgl_layout.h:382
nbgl_layoutSuggestionButtons_t suggestionButtons
Definition: nbgl_layout.h:392
nbgl_layoutConfirmationButton_t confirmationButton
used if type is KEYBOARD_WITH_SUGGESTIONS
Definition: nbgl_layout.h:394
const char * title
centered title explaining the screen
Definition: nbgl_layout.h:383
bool numbered
if set to true, the text is preceded on the left by 'number.'
Definition: nbgl_layout.h:385
bool grayedOut
if true, the text is grayed out (but not the potential number)
Definition: nbgl_layout.h:387
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:554
uint8_t percentage
percentage of completion, from 0 to 100.
Definition: nbgl_layout.h:555
const char * text
text in black, on top of progress bar
Definition: nbgl_layout.h:556
const char * subText
text in gray, under progress bar
Definition: nbgl_layout.h:557
This structure contains info to build a centered (vertically and horizontally) area,...
Definition: nbgl_layout.h:266
const char * text2
second text (can be null)
Definition: nbgl_layout.h:269
const char * text1
first text (can be null)
Definition: nbgl_layout.h:268
const char * url
URL for QR code.
Definition: nbgl_layout.h:267
bool largeText1
if set to true, use 32px font for text1
Definition: nbgl_layout.h:272
int16_t offsetY
vertical shift to apply to this info (if > 0, shift to bottom)
Definition: nbgl_layout.h:270
bool centered
if set to true, center vertically
Definition: nbgl_layout.h:271
This structure contains info to build suggestion buttons.
Definition: nbgl_layout.h:361
uint8_t nbUsedButtons
the number of actually used buttons
Definition: nbgl_layout.h:365
const char ** buttons
array of 4 strings for buttons (last ones can be NULL)
Definition: nbgl_layout.h:362
This structure contains info to build an up-footer (area on top of footer).
Definition: nbgl_layout.h:528
nbgl_layoutButton_t button
if type is UP_FOOTER_BUTTON
Definition: nbgl_layout.h:536
tune_index_e tuneId
tune played when button is long-pressed
Definition: nbgl_layout.h:534
nbgl_contentTipBox_t tipBox
if type is UP_FOOTER_TIP_BOX
Definition: nbgl_layout.h:539
const char * text
text in the long-press button
Definition: nbgl_layout.h:532
nbgl_layoutUpFooterType_t type
type of up-footer
Definition: nbgl_layout.h:529
uint8_t token
token used when button is long-pressed
Definition: nbgl_layout.h:533
nbgl_layoutHorizontalButtons_t horizontalButtons
if type is UP_FOOTER_HORIZONTAL_BUTTONS
Definition: nbgl_layout.h:538
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