Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
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
11extern "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
19/*********************
20 * INCLUDES
21 *********************/
22
23/*********************
24 * DEFINES
25 *********************/
26#define NBGL_NO_TUNE NB_TUNES
27#define NBGL_NO_PROGRESS_INDICATOR 0xFF
28
30#define NBGL_INVALID_TOKEN 0xFF
31
32#ifdef HAVE_SE_TOUCH
35#define EXIT_PAGE 0xFF
36
37#if defined(TARGET_STAX)
38#define NB_MAX_SUGGESTION_BUTTONS 12
39// only 4 buttons are visible at the same time on Stax
40#define NB_MAX_VISIBLE_SUGGESTION_BUTTONS 4
41#define TOUCHABLE_HEADER_BAR_HEIGHT 88
42#define SMALL_FOOTER_HEIGHT 88
43#define SIMPLE_FOOTER_HEIGHT 92
44#define SMALL_CENTERING_HEADER 32
45#define MEDIUM_CENTERING_HEADER 56
46#define LARGE_CENTERING_HEADER 56
47#define MEDIUM_CENTERING_FOOTER 88
48#define LONG_PRESS_BUTTON_HEIGHT 128
49#define UP_FOOTER_BUTTON_HEIGHT 120
50#define ACTION_AND_FOOTER_FOOTER_HEIGHT 216
51#define BOTH_ROUNDED_FOOTER_HEIGHT 216
52
53#define LIST_ITEM_MIN_TEXT_HEIGHT 40
54#define LIST_ITEM_PRE_HEADING 28
55#define LIST_ITEM_PRE_HEADING_LARGE 28
56#define LIST_ITEM_HEADING_SUB_TEXT 12
57
58#define PRE_TAG_VALUE_MARGIN 24
59#define INTER_TAG_VALUE_MARGIN 12
60// width & height for progress bar
61#define PROGRESSBAR_WIDTH 120
62#define PROGRESSBAR_HEIGHT 12
63#define BACK_KEY_WIDTH 88
64#define ICON_TITLE_MARGIN 24
65#define TITLE_DESC_MARGIN 16
66
67#elif defined(TARGET_FLEX)
68#define NB_MAX_SUGGESTION_BUTTONS 8
69// only 2 buttons are visible at the same time on Flex
70#define NB_MAX_VISIBLE_SUGGESTION_BUTTONS 2
71#define TOUCHABLE_HEADER_BAR_HEIGHT 96
72#define SMALL_FOOTER_HEIGHT 96
73#define SIMPLE_FOOTER_HEIGHT 96
74#define SMALL_CENTERING_HEADER 40
75#define MEDIUM_CENTERING_HEADER 64
76#define LARGE_CENTERING_HEADER 64
77#define MEDIUM_CENTERING_FOOTER 64
78#define LONG_PRESS_BUTTON_HEIGHT 152
79#define UP_FOOTER_BUTTON_HEIGHT 136
80#define ACTION_AND_FOOTER_FOOTER_HEIGHT 232
81#define BOTH_ROUNDED_FOOTER_HEIGHT 232
82
83#define LIST_ITEM_MIN_TEXT_HEIGHT SMALL_ICON_SIZE
84#define LIST_ITEM_PRE_HEADING 26
85#define LIST_ITEM_PRE_HEADING_LARGE 30
86#define LIST_ITEM_HEADING_SUB_TEXT 12
87
88#define PRE_TAG_VALUE_MARGIN 0
89#define INTER_TAG_VALUE_MARGIN 24
90// width & height for progress bar
91#define PROGRESSBAR_WIDTH 120
92#define PROGRESSBAR_HEIGHT 12
93#define BACK_KEY_WIDTH 104
94#define ICON_TITLE_MARGIN 24
95#define TITLE_DESC_MARGIN 16
96
97#elif defined(TARGET_APEX)
98#define NB_MAX_SUGGESTION_BUTTONS 8
99// only 2 buttons are visible at the same time on Apex
100#define NB_MAX_VISIBLE_SUGGESTION_BUTTONS 2
101#define TOUCHABLE_HEADER_BAR_HEIGHT 60
102#define SMALL_FOOTER_HEIGHT 60
103#define SIMPLE_FOOTER_HEIGHT 60
104#define SMALL_CENTERING_HEADER 24
105#define MEDIUM_CENTERING_HEADER 40
106#define LARGE_CENTERING_HEADER 60
107#define MEDIUM_CENTERING_FOOTER 40
108#define LONG_PRESS_BUTTON_HEIGHT 88
109#define UP_FOOTER_BUTTON_HEIGHT 88
110#define ACTION_AND_FOOTER_FOOTER_HEIGHT 128
111#define BOTH_ROUNDED_FOOTER_HEIGHT 148
112
113#define LIST_ITEM_MIN_TEXT_HEIGHT SMALL_ICON_SIZE
114#define LIST_ITEM_PRE_HEADING 22
115#define LIST_ITEM_PRE_HEADING_LARGE 22
116#define LIST_ITEM_HEADING_SUB_TEXT 8
117
118#define PRE_TAG_VALUE_MARGIN 0
119#define INTER_TAG_VALUE_MARGIN 16
120// width & height for progress bar
121#define PROGRESSBAR_WIDTH 78
122#define PROGRESSBAR_HEIGHT 8
123#define BACK_KEY_WIDTH 56
124#define ICON_TITLE_MARGIN 16
125#define TITLE_DESC_MARGIN 12
126
127#else // TARGETS
128#error Undefined target
129#endif // TARGETS
130
131#define TAG_VALUE_INTERVALE 4
132#define VALUE_ICON_INTERVALE 12
133
134#define AVAILABLE_WIDTH (SCREEN_WIDTH - 2 * BORDER_MARGIN)
135
136// not really used
137#define NB_MAX_LINES 12
138
139#else // HAVE_SE_TOUCH
140// maximum suggestion buttons for keyboard
141#define NB_MAX_SUGGESTION_BUTTONS 8
142// 7 pixels on each side
143#define AVAILABLE_WIDTH (SCREEN_WIDTH - 2 * 7)
144// maximum number of lines in screen
145#define NB_MAX_LINES 4
146
147#endif // HAVE_SE_TOUCH
148
149#define SPINNER_FIXED 0xFF
150
151#define NB_MAX_DESCRIPTIONS 3
152
153/**********************
154 * TYPEDEFS
155 **********************/
156
161typedef void *nbgl_layout_t;
162
169typedef void (*nbgl_layoutTouchCallback_t)(int token, uint8_t index);
170
177
198
207
217
227
235 bool modal;
237#ifdef HAVE_SE_TOUCH
240 const char *tapActionText;
243 tune_index_e tapTuneId;
247#else // HAVE_SE_TOUCH
250#endif // HAVE_SE_TOUCH
251 nbgl_screenTickerConfiguration_t ticker; // configuration of ticker (timeout)
253
258typedef struct {
261 const char *text;
264 const char *subText;
265 bool large;
266 uint8_t token;
267 bool inactive;
268 bool centered;
269 tune_index_e tuneId;
271
277typedef struct {
278 const char *title;
279 const char *info;
280 const char *descriptions[NB_MAX_DESCRIPTIONS];
284
290
295
301typedef const char *(*nbgl_menuListCallback_t)(uint8_t choiceIndex);
302
313
318
323
329
334typedef struct {
335 uint8_t nbRows;
336 const char *title;
337 const char **rowTexts;
340
350
354typedef struct {
355 const char **buttons;
360
364typedef struct {
365 const char *text;
366 int token;
367 bool active;
369
393
394#ifdef HAVE_SE_TOUCH
395
402typedef struct {
403 const char *url;
404 const char *text1;
405 const char *text2;
406 int16_t offsetY;
407 bool centered;
410
421
435
442typedef struct {
444 const char *rightText;
445 uint8_t leftToken;
446 uint8_t rightToken;
447 tune_index_e tuneId;
449
461
475
490
495typedef struct {
498 union {
499 struct {
500 uint16_t height;
501 } emptySpace;
502 struct {
505 const char *text;
506 uint8_t token;
507 tune_index_e tuneId;
508 } backAndText;
509 struct {
511 uint8_t activePage;
512 uint8_t nbPages;
514 uint8_t token;
515 uint8_t actionToken;
516 tune_index_e tuneId;
517 } progressAndBack;
518 struct {
519 const char *text;
520 } title;
521 struct {
522 const nbgl_icon_details_t *actionIcon;
523 const char *text;
524 const char *subText;
525 uint8_t textToken;
526 uint8_t backToken;
527 uint8_t actionToken;
528 tune_index_e tuneId;
529 } extendedBack;
530 struct {
531 const char *text;
532 uint8_t token;
533 tune_index_e tuneId;
534 } rightText;
535 };
537
553
558typedef struct {
561 union {
562 struct {
563 uint16_t height;
564 } emptySpace;
565 struct {
566 const char *text;
567 bool mutedOut;
568 uint8_t token;
569 tune_index_e tuneId;
570 } simpleText;
571 struct {
572 const char *leftText;
573 const char *rightText;
574 uint8_t leftToken;
575 uint8_t rightToken;
576 tune_index_e tuneId;
577 } doubleText;
578 struct {
580 const char *text;
581 uint8_t token;
582 tune_index_e tuneId;
583 } textAndNav;
584 nbgl_layoutNavigationBar_t navigation;
587 };
589
602
607typedef struct {
609 union {
610 struct {
611 const char *text;
612 uint8_t token;
613 tune_index_e tuneId;
614 } longPress;
619 struct {
620 const char *text;
621 uint8_t token;
622 tune_index_e tuneId;
623 } text;
624 };
626#else // HAVE_SE_TOUCH
631typedef enum {
634
638typedef struct {
639 const char *text;
640 const nbgl_icon_details_t *icon;
643
644#endif // HAVE_SE_TOUCH
645
651typedef struct {
652 uint8_t percentage;
653 const char *text;
654 const char *subText;
656
661typedef struct {
662 uint32_t keyMask;
668#ifdef HAVE_SE_TOUCH
670#else // HAVE_SE_TOUCH
671 bool enableBackspace;
672 bool enableValidate;
673 uint8_t selectedCharIndex;
674#endif // HAVE_SE_TOUCH
676
677/**********************
678 * GLOBAL PROTOTYPES
679 **********************/
684
685#ifdef HAVE_SE_TOUCH
687 const nbgl_icon_details_t *icon,
688 uint8_t token,
689 tune_index_e tuneId);
690int nbgl_layoutAddTouchableBar(nbgl_layout_t *layout, const nbgl_layoutBar_t *barLayout);
691int nbgl_layoutAddSwitch(nbgl_layout_t *layout, const nbgl_layoutSwitch_t *switchLayout);
692int nbgl_layoutAddText(nbgl_layout_t *layout, const char *text, const char *subText);
694 const char *text,
695 const char *subText,
696 uint8_t token,
697 uint8_t index);
704int nbgl_layoutAddLargeCaseText(nbgl_layout_t *layout, const char *text, bool grayedOut);
707
708int nbgl_layoutAddButton(nbgl_layout_t *layout, const nbgl_layoutButton_t *buttonInfo);
710 const char *text,
711 uint8_t token,
712 tune_index_e tuneId);
714 const char *text,
715 uint8_t token,
716 tune_index_e tuneId);
718 const char *leftText,
719 uint8_t leftToken,
720 const char *rightText,
721 uint8_t rightToken,
722 tune_index_e tuneId);
723int nbgl_layoutAddHeader(nbgl_layout_t *layout, const nbgl_layoutHeader_t *headerDesc);
725int nbgl_layoutAddUpFooter(nbgl_layout_t *layout, const nbgl_layoutUpFooter_t *upFooterDesc);
728 const nbgl_icon_details_t *icon,
729 uint8_t token,
730 bool separationLine,
731 tune_index_e tuneId);
733 uint8_t activePage,
734 uint8_t nbPages,
735 bool withBack,
736 uint8_t backToken,
737 tune_index_e tuneId);
739 const char *text,
740 const char *subText,
741 uint8_t percentage);
743 const char *text,
744 const char *subText,
745 uint8_t initPosition);
747 const char *text,
748 const char *subText,
749 uint8_t position);
751 uint16_t swipesMask,
752 const char *text,
753 uint8_t token,
754 tune_index_e tuneId);
756#else // HAVE_SE_TOUCH
758 const char *text,
759 const char *subText,
762int nbgl_layoutAddNavigation(nbgl_layout_t *layout, nbgl_layoutNavigation_t *info);
763int nbgl_layoutAddMenuList(nbgl_layout_t *layout, nbgl_layoutMenuList_t *list);
764int nbgl_layoutAddButton(nbgl_layout_t *layout, const nbgl_layoutButton_t *buttonInfo);
765int nbgl_layoutAddSwitch(nbgl_layout_t *layout, const nbgl_layoutSwitch_t *switchLayout);
766#endif // HAVE_SE_TOUCH
767
768#ifdef NBGL_KEYBOARD
769/* layout objects for page with keyboard */
770int nbgl_layoutAddKeyboard(nbgl_layout_t *layout, const nbgl_layoutKbd_t *kbdInfo);
771#ifdef HAVE_SE_TOUCH
773 uint8_t index,
774 uint32_t keyMask,
775 bool updateCasing,
776 keyboardCase_t casing);
777bool nbgl_layoutKeyboardNeedsRefresh(nbgl_layout_t *layout, uint8_t index);
779 uint8_t nbUsedButtons,
780 const char *buttonTexts[NB_MAX_SUGGESTION_BUTTONS],
781 int firstButtonToken,
782 tune_index_e tuneId);
783DEPRECATED int nbgl_layoutAddEnteredText(nbgl_layout_t *layout,
784 bool numbered,
785 uint8_t number,
786 const char *text,
787 bool grayedOut,
788 int offsetY,
789 int token);
790DEPRECATED int nbgl_layoutUpdateEnteredText(nbgl_layout_t *layout,
791 uint8_t index,
792 bool numbered,
793 uint8_t number,
794 const char *text,
795 bool grayedOut);
797 bool active,
798 const char *text,
799 int token,
800 tune_index_e tuneId);
802 uint8_t index,
803 bool active,
804 const char *text);
807#else // HAVE_SE_TOUCH
808int nbgl_layoutUpdateKeyboard(nbgl_layout_t *layout, uint8_t index, uint32_t keyMask);
809int nbgl_layoutAddEnteredText(nbgl_layout_t *layout, const char *text, bool lettersOnly);
810int nbgl_layoutUpdateEnteredText(nbgl_layout_t *layout, uint8_t index, const char *text);
811#endif // HAVE_SE_TOUCH
812#endif // NBGL_KEYBOARD
813
814#ifdef NBGL_KEYPAD
815#ifdef HAVE_SE_TOUCH
816/* layout objects for page with keypad (Stax) */
817int nbgl_layoutAddKeypad(nbgl_layout_t *layout, keyboardCallback_t callback, bool shuffled);
819 uint8_t index,
820 bool enableValidate,
821 bool enableBackspace,
822 bool enableDigits);
823int nbgl_layoutUpdateKeypadValidation(nbgl_layout_t *layout, bool softValidation);
824DEPRECATED int nbgl_layoutAddHiddenDigits(nbgl_layout_t *layout, uint8_t nbDigits);
825DEPRECATED int nbgl_layoutUpdateHiddenDigits(nbgl_layout_t *layout,
826 uint8_t index,
827 uint8_t nbActive);
829 const char *title,
830 bool hidden,
831 uint8_t nbDigits,
832 const char *text);
834 bool hidden,
835 uint8_t nbActiveDigits,
836 const char *text);
837
838#else // HAVE_SE_TOUCH
839/* layout objects for pages with keypad (nanos) */
841 keyboardCallback_t callback,
842 const char *text,
843 bool shuffled);
845 uint8_t index,
846 bool enableValidate,
847 bool enableBackspace);
848int nbgl_layoutAddHiddenDigits(nbgl_layout_t *layout, uint8_t nbDigits);
849int nbgl_layoutUpdateHiddenDigits(nbgl_layout_t *layout, uint8_t index, uint8_t nbActive);
851 bool hidden,
852 uint8_t nbDigits,
853 const char *text);
855 bool hidden,
856 uint8_t nbActiveDigits,
857 const char *text);
858#endif // HAVE_SE_TOUCH
859#endif // NBGL_KEYPAD
860
861/* generic functions */
862int nbgl_layoutDraw(nbgl_layout_t *layout);
864
865/**********************
866 * MACROS
867 **********************/
868
869#ifdef __cplusplus
870} /* extern "C" */
871#endif
872
873#endif /* NBGL_LAYOUT_H */
common content for Graphical Library
nbgl_contentCenteredInfoStyle_t
possible styles for Centered Info Area
void(* nbgl_layoutTouchCallback_t)(int token, uint8_t index)
prototype of function to be called when an object is touched
int nbgl_layoutAddTagValueList(nbgl_layout_t *layout, const nbgl_layoutTagValueList_t *list)
Creates a list of [tag,value] pairs.
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.
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,...
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.
nbgl_layoutNavDirection_t
possible directions for Navigation arrows
@ VERTICAL_NAV
'\/' and '/\' are displayed, to navigate in a list (vertical scrolling)
@ HORIZONTAL_NAV
'<' and '>' are displayed, to navigate between pages and steps
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)
nbgl_contentRadioChoice_t nbgl_layoutRadioChoice_t
Deprecated, kept for retro compatibility.
nbgl_layoutNavIndication_t
possible styles for Navigation arrows (it's a bit field)
@ NO_ARROWS
@ LEFT_ARROW
left arrow is used
@ RIGHT_ARROW
right arrow is used
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 ...
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.
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
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...
int nbgl_layoutAddRadioChoice(nbgl_layout_t *layout, const nbgl_layoutRadioChoice_t *choices)
Creates a list of radio buttons (on the right)
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...
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.
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...
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...
int nbgl_layoutDraw(nbgl_layout_t *layout)
Applies given layout. The screen will be redrawn.
int nbgl_layoutAddTouchableBar(nbgl_layout_t *layout, const nbgl_layoutBar_t *barLayout)
Creates a touchable bar in main panel.
nbgl_layoutButtonStyle_t
The different styles for a button.
@ WHITE_BACKGROUND
rounded bordered button, with text/icon in black, on white background
@ NO_BORDER
simple clickable text, in black
@ LONG_PRESS
long press button, with progress indicator
@ BLACK_BACKGROUND
rounded bordered button, with text/icon in white, on black background
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.
int nbgl_layoutInvertBackground(nbgl_layout_t *layout)
Inverts the background color (black instead of white)
int nbgl_layoutAddTextContent(nbgl_layout_t *layout, nbgl_layoutTextContent_t *content)
Creates in the main container three text areas:
nbgl_layoutUpFooterType_t
The different types of area on top of footer.
@ UP_FOOTER_TEXT
grayed-out text, for example "Tap to continue"
@ NB_UP_FOOTER_TYPES
@ UP_FOOTER_BUTTON
simple button
@ UP_FOOTER_LONG_PRESS
long-press button
@ UP_FOOTER_TIP_BOX
Tip-box.
@ UP_FOOTER_HORIZONTAL_BUTTONS
2 buttons, on the same line
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.
void * nbgl_layout_t
type shared externally
int nbgl_layoutAddSwitch(nbgl_layout_t *layout, const nbgl_layoutSwitch_t *switchLayout)
Creates a switch with the given text and its state.
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...
nbgl_layoutHeaderType_t
The different types of extended header.
@ HEADER_TITLE
simple centered text
@ HEADER_BACK_AND_PROGRESS
optional back key and progress indicator (only on Stax)
@ HEADER_EMPTY
empty space, to have a better vertical centering of centered info
@ NB_HEADER_TYPES
@ HEADER_EXTENDED_BACK
back key, centered text and touchable key on the right
@ HEADER_BACK_AND_TEXT
back key and optional text
@ HEADER_RIGHT_TEXT
touchable text on the right, with a vertical separation line
@ HEADER_BACK_ICON_AND_TEXT
back key and optional icon and text
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.
const char *(* nbgl_menuListCallback_t)(uint8_t choiceIndex)
prototype of menu list item retrieval callback
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.
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.
nbgl_layout_t * nbgl_layoutGet(const nbgl_layoutDescription_t *description)
returns a layout of the given type. The layout is reset
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,...
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.
nbgl_layoutChoiceButtonsStyle_t
The different styles for a pair of buttons.
@ SOFT_ACTION_AND_FOOTER_STYLE
A white button on top of a footer, with a separation line.
@ BOTH_ROUNDED_STYLE
A black button on top of a white button.
@ ROUNDED_AND_FOOTER_STYLE
A black background button on top of a footer.
@ STRONG_ACTION_AND_FOOTER_STYLE
A black button on top of a footer, with a separation line.
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,...
int nbgl_layoutAddSpinner(nbgl_layout_t *layout, const char *text, const char *subText, uint8_t initPosition)
Creates a centered (vertically & horizontally) spinner with a text under it.
int nbgl_layoutUpdateSpinner(nbgl_layout_t *layout, const char *text, const char *subText, uint8_t position)
Update an existing spinner (must be the only object of the layout)
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.
struct nbgl_layoutDescription_s nbgl_layoutDescription_t
Structure containing all information when creating a layout. This structure must be passed as argumen...
int nbgl_layoutAddProgressBar(nbgl_layout_t *layout, const char *text, const char *subText, uint8_t percentage)
Creates an area in main panel to display a progress bar, with a title text and a subtext if needed.
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,...
#define NB_MAX_DESCRIPTIONS
max number of descriptions in nbgl_layoutTextContent_t
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.
nbgl_layoutKeyboardContentType_t
The different types of keyboard contents.
@ KEYBOARD_WITH_BUTTON
text entry area + confirmation button
@ KEYBOARD_WITH_SUGGESTIONS
text entry area + suggestion buttons
@ NB_KEYBOARD_CONTENT_TYPES
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
nbgl_layoutFooterType_t
The different types of extended footer.
@ FOOTER_SIMPLE_TEXT
simple touchable text in bold
@ FOOTER_NAV
navigation bar
@ FOOTER_SIMPLE_BUTTON
simple black or white button (see nbgl_layoutButtonStyle_t)
@ FOOTER_TEXT_AND_NAV
@ FOOTER_DOUBLE_TEXT
2 touchable texts in bold, separated by a vertical line (only on Stax)
@ NB_FOOTER_TYPES
@ FOOTER_EMPTY
empty space, to have a better vertical centering of centered info
@ FOOTER_CHOICE_BUTTONS
double buttons (see nbgl_layoutChoiceButtonsStyle_t)
int nbgl_layoutRelease(nbgl_layout_t *layout)
Release the layout obtained with nbgl_layoutGet()
DEPRECATED int nbgl_layoutAddSuggestionButtons(nbgl_layout_t *layout, uint8_t nbUsedButtons, const char *buttonTexts[NB_MAX_SUGGESTION_BUTTONS], int firstButtonToken, tune_index_e tuneId)
nbgl_contentTagValueList_t nbgl_layoutTagValueList_t
Deprecated, kept for retro compatibility.
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...
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)
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_contentTagValue_t nbgl_layoutTagValue_t
Deprecated, kept for retro compatibility.
nbgl_contentCenteredInfo_t nbgl_layoutCenteredInfo_t
Deprecated, kept for retro compatibility.
API to draw all basic graphic objects.
keyboardCase_t
Letters casing in which to open/set the keyboard.
Definition nbgl_obj.h:617
nbgl_buttonEvent_t
Definition nbgl_obj.h:311
keyboardMode_t
Mode in which to open/set the keyboard.
Definition nbgl_obj.h:600
void(* keyboardCallback_t)(char touchedKey)
prototype of function to be called when a valid key is pressed on keyboard Backspace is equal to 0x8 ...
Definition nbgl_obj.h:594
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,...
This structure contains info to build a centered (vertically and horizontally) area,...
This structure contains a list of names to build a list of radio buttons (on the right part of screen...
This structure contains info to build a switch (on the right) with a description (on the left),...
This structure contains a list of [tag,value] pairs.
This structure contains a [tag,value] pair and possible extensions.
This structure contains data to build a tip-box, on top of a footer, on bottom of a content center.
This structure contains info to build a clickable "bar" with a text and an icon.
bool inactive
if set to true, the bar is grayed-out and cannot be touched
const char * text
text (can be NULL)
uint8_t token
the token that will be used as argument of the callback
bool large
set to true only for the main level of OS settings
const char * subText
sub text (can be NULL)
bool centered
DEPRECATED, not used.
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played
const nbgl_icon_details_t * iconLeft
a buffer containing the 1BPP icon for icon on left (can be NULL)
const nbgl_icon_details_t * iconRight
This structure contains info to build a single button.
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played
const char * text
button text
uint8_t token
the token that will be used as argument of the callback
const nbgl_icon_details_t * icon
a buffer containing the 1BPP icon for button
nbgl_layoutButtonStyle_t style
bool fittingContent
if set to true, fit the width of button to text, otherwise full width
This structure contains info to build a pair of buttons, one on top of the other.
nbgl_layoutChoiceButtonsStyle_t style
the style of the pair
const nbgl_icon_details_t * topIcon
icon of top button
uint8_t token
the token that will be used as argument of the callback
const char * topText
up-button text (index 0)
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played
const char * bottomText
bottom-button text (index 1)
This structure contains info to build a confirmation button.
int token
token of the button
const char * text
text of the button
bool active
if true, button is active, otherwise inactive (grayed-out)
Structure containing all information when creating a layout. This structure must be passed as argumen...
nbgl_screenTickerConfiguration_t ticker
const char * tapActionText
Light gray text used when main container is "tapable".
nbgl_layoutTouchCallback_t onActionCallback
the callback to be called on any action on the layout
This structure contains info to build an extended footer.
nbgl_layoutChoiceButtons_t choiceButtons
if type is FOOTER_CHOICE_BUTTONS
bool separationLine
if true, a separation line is added at the top of this control
const char * leftText
nbgl_layoutButton_t button
if type is FOOTER_SIMPLE_BUTTON
bool mutedOut
if true, text is displayed in gray
nbgl_layoutFooterType_t type
type of footer
nbgl_layoutNavigationBar_t navigation
if type is FOOTER_NAV
const char * rightText
const char * text
tune_index_e tuneId
This structure contains info to build a header.
nbgl_layoutHeaderType_t type
type of header
const nbgl_icon_details_t * icon
icon on left of text (only if HEADER_BACK_ICON_AND_TEXT)
uint8_t backToken
when back key is pressed
const char * subText
text under the line (can be NULL)
const nbgl_icon_details_t * actionIcon
right button icon
uint8_t actionToken
when optional right button is pressed
bool separationLine
if true, a separation line is added at the bottom of this control
tune_index_e tuneId
when back key is pressed
const char * text
can be NULL if no text
uint8_t textToken
when text is touched
uint8_t token
when back key is pressed
This structure contains info to build a pair of buttons, the small one, with icon,...
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played
const nbgl_icon_details_t * leftIcon
a buffer containing the 1BPP icon for left button
uint8_t leftToken
the token used when left button is pressed
uint8_t rightToken
the token used when right button is pressed
const char * rightText
right-button text
This structure contains info to build a keyboard with nbgl_layoutAddKeyboard()
bool lettersOnly
if true, only display letter keys and Backspace
keyboardCallback_t callback
function called when an active key is pressed
keyboardMode_t mode
keyboard mode to start with
keyboardCase_t casing
keyboard casing mode (lower, upper once or upper locked)
This structure contains info to build a keyboard content (controls that are linked to keyboard)
uint8_t number
if numbered is true, number used to build 'number.' text
const char * text
already entered text
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played
nbgl_layoutKeyboardContentType_t type
type of content
nbgl_layoutSuggestionButtons_t suggestionButtons
nbgl_layoutConfirmationButton_t confirmationButton
used if type is KEYBOARD_WITH_SUGGESTIONS
const char * title
centered title explaining the screen
bool numbered
if set to true, the text is preceded on the left by 'number.'
bool grayedOut
(unused, kept for compatibility)
This structure contains info to build a left content area.
uint8_t nbRows
number of rows in the area
const char * title
title of area in bold
const nbgl_icon_details_t ** rowIcons
array of nbRows icon
const char ** rowTexts
array of nbRows texts (displayed in regular)
This structure contains a list of names to build a menu list on Nanos, with for each item a descripti...
nbgl_menuListCallback_t callback
function to call to retrieve a menu list item text
uint8_t nbChoices
total number of choices in the menu list
uint8_t selectedChoice
index of the selected choice (centered, in bold)
This structure contains info to build a navigation bar at the bottom of the screen.
uint8_t activePage
index of active page (from 0 to nbPages-1).
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when pressing keys)
bool withBackKey
if set to true, the "back" key is drawn
bool withExitKey
if set to true, an exit button is drawn (X on the left)
uint8_t token
the token that will be used as argument of the callback
uint8_t nbPages
number of pages. (if 0, no navigation)
This structure contains info to build a navigation bar at the bottom of the screen.
nbgl_layoutNavDirection_t direction
vertical or horizontal navigation
nbgl_layoutNavIndication_t indication
specifies which arrows to use (left or right)
This structure contains info to build a progress bar with info. The progress bar itself is 120px widt...
uint8_t percentage
percentage of completion, from 0 to 100.
const char * text
text in black, on top of progress bar
const char * subText
text in gray, under progress bar
This structure contains info to build a centered (vertically and horizontally) area,...
const char * text2
second text (can be null)
const char * text1
first text (can be null)
const char * url
URL for QR code.
bool largeText1
if set to true, use 32px font for text1
int16_t offsetY
vertical shift to apply to this info (if > 0, shift to bottom)
bool centered
if set to true, center vertically
This structure contains info to build suggestion buttons.
uint8_t nbUsedButtons
the number of actually used buttons
const char ** buttons
array of 4 strings for buttons (last ones can be NULL)
This structure contains info for Text content, to be set with nbgl_layoutAddTextContent.
uint8_t nbDescriptions
number of used descriptions in above array
const char * info
description at bottom (in small gray)
const char * title
main text (in large bold font)
This structure contains info to build an up-footer (area on top of footer).
nbgl_layoutButton_t button
if type is UP_FOOTER_BUTTON
tune_index_e tuneId
tune played when button is long-pressed
nbgl_contentTipBox_t tipBox
if type is UP_FOOTER_TIP_BOX
const char * text
text in the long-press button
nbgl_layoutUpFooterType_t type
type of up-footer
uint8_t token
token used when button is long-pressed
nbgl_layoutHorizontalButtons_t horizontalButtons
if type is UP_FOOTER_HORIZONTAL_BUTTONS