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#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#if defined(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 MEDIUM_CENTERING_FOOTER 88
52#define LONG_PRESS_BUTTON_HEIGHT 128
53
54#define PRE_TEXT_MARGIN 32
55#define TEXT_SUBTEXT_MARGIN 16
56#define PRE_SUBTEXT_MARGIN 24
57#define POST_SUBTEXT_MARGIN 28
58
59#define PRE_TAG_VALUE_MARGIN 24
60#define INTER_TAG_VALUE_MARGIN 12
61// width & height for progress bar
62#define PROGRESSBAR_WIDTH 120
63#define PROGRESSBAR_HEIGHT 12
64#define BACK_KEY_WIDTH 88
65#elif defined(TARGET_FLEX)
66#define NB_MAX_SUGGESTION_BUTTONS 8
67// only 2 buttons are visible at the same time on Flex
68#define NB_MAX_VISIBLE_SUGGESTION_BUTTONS 2
69#define TOUCHABLE_HEADER_BAR_HEIGHT 96
70#define TOUCHABLE_MAIN_BAR_HEIGHT 100
71#define TOUCHABLE_BAR_HEIGHT 92
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 MEDIUM_CENTERING_FOOTER 64
77#define LONG_PRESS_BUTTON_HEIGHT 152
78
79#define PRE_TEXT_MARGIN 28
80#define TEXT_SUBTEXT_MARGIN 14
81#define PRE_SUBTEXT_MARGIN 26
82#define POST_SUBTEXT_MARGIN 26
83
84#define PRE_TAG_VALUE_MARGIN 0
85#define INTER_TAG_VALUE_MARGIN 24
86// width & height for progress bar
87#define PROGRESSBAR_WIDTH 120
88#define PROGRESSBAR_HEIGHT 12
89#define BACK_KEY_WIDTH 104
90#else // TARGETS
91#error Undefined target
92#endif // TARGETS
93
94#define AVAILABLE_WIDTH (SCREEN_WIDTH - 2 * BORDER_MARGIN)
95
96// not really used
97#define NB_MAX_LINES 12
98
99#else // HAVE_SE_TOUCH
100// 7 pixels on each side
101#define AVAILABLE_WIDTH (SCREEN_WIDTH - 2 * 7)
102// maximum number of lines in screen
103#define NB_MAX_LINES 4
104
105#endif // HAVE_SE_TOUCH
106
107#define SPINNER_FIXED 0xFF
108
109/**********************
110 * TYPEDEFS
111 **********************/
112
117typedef void *nbgl_layout_t;
118
125typedef void (*nbgl_layoutTouchCallback_t)(int token, uint8_t index);
126
133
139typedef struct {
152#ifdef HAVE_PIEZO_SOUND
153 tune_index_e tuneId;
154#endif // HAVE_PIEZO_SOUND
156
165
175
185
193 bool modal;
195#ifdef HAVE_SE_TOUCH
198 const char *tapActionText;
201#ifdef HAVE_PIEZO_SOUND
202 tune_index_e tapTuneId;
204#endif // HAVE_PIEZO_SOUND
207#else // HAVE_SE_TOUCH
210#endif // HAVE_SE_TOUCH
211 nbgl_screenTickerConfiguration_t ticker; // configuration of ticker (timeout)
213
218typedef struct {
221 const char *text;
224 const char *subText;
225 bool large;
227 bool inactive;
228 bool centered;
229#ifdef HAVE_PIEZO_SOUND
230 tune_index_e tuneId;
231#endif // HAVE_PIEZO_SOUND
233
239
244
250typedef const char *(*nbgl_menuListCallback_t)(uint8_t choiceIndex);
251
262
267
272
278
283typedef struct {
285 const char *title;
286 const char **rowTexts;
289
290#ifdef HAVE_SE_TOUCH
291
298typedef struct {
299 const char *url;
300 const char *text1;
301 const char *text2;
303 bool centered;
306
317
323typedef struct {
324 const char *topText;
325 const char *bottomText;
329#ifdef HAVE_PIEZO_SOUND
330 tune_index_e tuneId;
331#endif // HAVE_PIEZO_SOUND
333
340typedef struct {
342 const char *rightText;
345#ifdef HAVE_PIEZO_SOUND
346 tune_index_e tuneId;
347#endif // HAVE_PIEZO_SOUND
349
361
365typedef struct {
366 const char *text;
371 bool onBottom;
373#ifdef HAVE_PIEZO_SOUND
374 tune_index_e tuneId;
375#endif // HAVE_PIEZO_SOUND
377
387
397
401typedef struct {
402 const char *text;
403 int token;
404 bool active;
406
411typedef struct {
413 const char *title;
414 const char *text;
415 bool numbered;
420 union {
425 };
426#ifdef HAVE_PIEZO_SOUND
427 tune_index_e tuneId;
428#endif // HAVE_PIEZO_SOUND
430
445
450typedef struct {
453 union {
454 struct {
456 } emptySpace;
457 struct {
460 const char *text;
462 tune_index_e tuneId;
463 } backAndText;
464 struct {
469 uint8_t token;
471 tune_index_e tuneId;
472 } progressAndBack;
473 struct {
474 const char *text;
475 } title;
476 struct {
477 const nbgl_icon_details_t *actionIcon;
478 const char *text;
481 uint8_t actionToken;
482 tune_index_e tuneId;
483 } extendedBack;
484 struct {
485 const char *text;
486 uint8_t token;
487 tune_index_e tuneId;
488 } rightText;
489 };
491
507
512typedef struct {
515 union {
516 struct {
518 } emptySpace;
519 struct {
520 const char *text;
521 bool mutedOut;
523 tune_index_e tuneId;
524 } simpleText;
525 struct {
526 const char *leftText;
527 const char *rightText;
530 tune_index_e tuneId;
531 } doubleText;
532 struct {
534 const char *text;
535 uint8_t token;
536 tune_index_e tuneId;
537 } textAndNav;
538 nbgl_layoutNavigationBar_t navigation;
541 };
543
556
561typedef struct {
563 union {
564 struct {
565 const char *text;
567 tune_index_e tuneId;
568 } longPress;
573 struct {
574 const char *text;
575 uint8_t token;
576 tune_index_e tuneId;
577 } text;
578 };
580#else // HAVE_SE_TOUCH
585typedef enum {
588
592typedef struct {
593 const char *text;
594 const nbgl_icon_details_t *icon;
597
598#endif // HAVE_SE_TOUCH
599
605typedef struct {
607 const char *text;
608 const char *subText;
610
615typedef struct {
616 uint32_t keyMask;
622#ifdef HAVE_SE_TOUCH
624#else // HAVE_SE_TOUCH
625 bool enableBackspace;
626 bool enableValidate;
627 uint8_t selectedCharIndex;
628#endif // HAVE_SE_TOUCH
630
631/**********************
632 * GLOBAL PROTOTYPES
633 **********************/
638
639#ifdef HAVE_SE_TOUCH
641 const nbgl_icon_details_t *icon,
642 uint8_t token,
643 tune_index_e tuneId);
644int nbgl_layoutAddTouchableBar(nbgl_layout_t *layout, const nbgl_layoutBar_t *barLayout);
645int nbgl_layoutAddSwitch(nbgl_layout_t *layout, const nbgl_layoutSwitch_t *switchLayout);
646int nbgl_layoutAddText(nbgl_layout_t *layout, const char *text, const char *subText);
648 const char *text,
649 const char *subText,
650 uint8_t token,
651 uint8_t index);
652int nbgl_layoutAddSubHeaderText(nbgl_layout_t *layout, const char *text);
659int nbgl_layoutAddLargeCaseText(nbgl_layout_t *layout, const char *text, bool grayedOut);
661 const char *title,
662 const char *description,
663 const char *info);
665
666int nbgl_layoutAddButton(nbgl_layout_t *layout, const nbgl_layoutButton_t *buttonInfo);
668 const char *text,
669 uint8_t token,
670 tune_index_e tuneId);
672 const char *text,
673 uint8_t token,
674 tune_index_e tuneId);
676 const char *leftText,
677 uint8_t leftToken,
678 const char *rightText,
679 uint8_t rightToken,
680 tune_index_e tuneId);
681int nbgl_layoutAddHeader(nbgl_layout_t *layout, const nbgl_layoutHeader_t *headerDesc);
683int nbgl_layoutAddUpFooter(nbgl_layout_t *layout, const nbgl_layoutUpFooter_t *upFooterDesc);
686 const nbgl_icon_details_t *icon,
687 uint8_t token,
688 bool separationLine,
689 tune_index_e tuneId);
691 uint8_t activePage,
692 uint8_t nbPages,
693 bool withBack,
694 uint8_t backToken,
695 tune_index_e tuneId);
697 const char *text,
698 const char *subText,
699 uint8_t percentage);
701 const char *text,
702 const char *subText,
703 uint8_t initPosition);
705 const char *text,
706 const char *subText,
707 uint8_t position);
709 uint16_t swipesMask,
710 const char *text,
711 uint8_t token,
712 tune_index_e tuneId);
713#else // HAVE_SE_TOUCH
715 const char *text,
716 const char *subText,
719int nbgl_layoutAddNavigation(nbgl_layout_t *layout, nbgl_layoutNavigation_t *info);
720int nbgl_layoutAddMenuList(nbgl_layout_t *layout, nbgl_layoutMenuList_t *list);
721int nbgl_layoutAddButton(nbgl_layout_t *layout, const nbgl_layoutButton_t *buttonInfo);
722int nbgl_layoutAddSwitch(nbgl_layout_t *layout, const nbgl_layoutSwitch_t *switchLayout);
723#endif // HAVE_SE_TOUCH
724
725#ifdef NBGL_KEYBOARD
726/* layout objects for page with keyboard */
727int nbgl_layoutAddKeyboard(nbgl_layout_t *layout, const nbgl_layoutKbd_t *kbdInfo);
728#ifdef HAVE_SE_TOUCH
730 uint8_t index,
731 uint32_t keyMask,
732 bool updateCasing,
733 keyboardCase_t casing);
736 uint8_t nbUsedButtons,
737 const char *buttonTexts[NB_MAX_SUGGESTION_BUTTONS],
738 int firstButtonToken,
739 tune_index_e tuneId);
741 nbgl_layout_t *layout,
742 uint8_t index,
743 uint8_t nbUsedButtons,
744 const char *buttonTexts[NB_MAX_SUGGESTION_BUTTONS]);
745DEPRECATED int nbgl_layoutAddEnteredText(nbgl_layout_t *layout,
746 bool numbered,
747 uint8_t number,
748 const char *text,
749 bool grayedOut,
750 int offsetY,
751 int token);
752DEPRECATED int nbgl_layoutUpdateEnteredText(nbgl_layout_t *layout,
753 uint8_t index,
754 bool numbered,
755 uint8_t number,
756 const char *text,
757 bool grayedOut);
759 bool active,
760 const char *text,
761 int token,
762 tune_index_e tuneId);
764 uint8_t index,
765 bool active,
766 const char *text);
769#else // HAVE_SE_TOUCH
770int nbgl_layoutUpdateKeyboard(nbgl_layout_t *layout, uint8_t index, uint32_t keyMask);
771int nbgl_layoutAddEnteredText(nbgl_layout_t *layout, const char *text, bool lettersOnly);
772int nbgl_layoutUpdateEnteredText(nbgl_layout_t *layout, uint8_t index, const char *text);
773#endif // HAVE_SE_TOUCH
774#endif // NBGL_KEYBOARD
775
776#ifdef NBGL_KEYPAD
777#ifdef HAVE_SE_TOUCH
778/* layout objects for page with keypad (Stax) */
779int nbgl_layoutAddKeypad(nbgl_layout_t *layout, keyboardCallback_t callback, bool shuffled);
781 uint8_t index,
782 bool enableValidate,
783 bool enableBackspace,
784 bool enableDigits);
785int nbgl_layoutUpdateKeypadValidation(nbgl_layout_t *layout, bool softValidation);
786DEPRECATED int nbgl_layoutAddHiddenDigits(nbgl_layout_t *layout, uint8_t nbDigits);
787DEPRECATED int nbgl_layoutUpdateHiddenDigits(nbgl_layout_t *layout,
788 uint8_t index,
789 uint8_t nbActive);
791 const char *title,
792 bool hidden,
793 uint8_t nbDigits,
794 const char *text);
796 bool hidden,
797 uint8_t nbActiveDigits,
798 const char *text);
799
800#else // HAVE_SE_TOUCH
801/* layout objects for pages with keypad (nanos) */
803 keyboardCallback_t callback,
804 const char *text,
805 bool shuffled);
807 uint8_t index,
808 bool enableValidate,
809 bool enableBackspace);
811int nbgl_layoutUpdateHiddenDigits(nbgl_layout_t *layout, uint8_t index, uint8_t nbActive);
813 bool hidden,
814 uint8_t nbDigits,
815 const char *text);
817 bool hidden,
818 uint8_t nbActiveDigits,
819 const char *text);
820#endif // HAVE_SE_TOUCH
821#endif // NBGL_KEYPAD
822
823/* generic functions */
824int nbgl_layoutDraw(nbgl_layout_t *layout);
826
827/**********************
828 * MACROS
829 **********************/
830
831#ifdef __cplusplus
832} /* extern "C" */
833#endif
834
835#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.
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:
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_layoutAddSubHeaderText(nbgl_layout_t *layout, const char *text)
Creates an area with given text in small regular font, under the header.
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.
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,...
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)
Adds up to 4 black suggestion buttons under the previously added object.
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:514
nbgl_buttonEvent_t
Definition nbgl_obj.h:207
keyboardMode_t
Mode in which to open/set the keyboard.
Definition nbgl_obj.h:497
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:491
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.
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.
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)
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 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,...
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
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
if true, the text is grayed out (but not the potential number)
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).
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 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
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