22#define NB_LINES_FOR_DETAILS_BUTTON 3
38static void setChoiceButtonsBottomToken(
nbgl_layout_t *layout, uint8_t token)
42 if (layoutInt == NULL) {
48 layoutObj->
token = token;
53static void addEmptyHeader(
nbgl_layout_t *layout, uint16_t height)
55 nbgl_layoutHeader_t headerDesc
56 = {.type = HEADER_EMPTY, .separationLine =
false, .emptySpace.height = height};
57 nbgl_layoutAddHeader(layout, &headerDesc);
65 if (content->
title != NULL) {
66 nbgl_layoutHeader_t headerDesc = {.type = HEADER_BACK_AND_TEXT,
67 .separationLine =
true,
69 .backAndText.tuneId = content->
tuneId,
70 .backAndText.text = content->
title};
71 nbgl_layoutAddHeader(layout, &headerDesc);
75 nbgl_layoutAddTopRightButton(
78 switch (content->
type) {
85 nbgl_layoutAddLongPressButton(layout,
100 buttonInfo.onBottom =
true;
101 buttonInfo.
style = BLACK_BACKGROUND;
110 addEmptyHeader(layout, SMALL_CENTERING_HEADER);
117 addEmptyHeader(layout, SMALL_CENTERING_HEADER);
121 nbgl_layoutUpFooter_t upFooterDesc
122 = {.type = UP_FOOTER_TIP_BOX,
127 nbgl_layoutAddUpFooter(layout, &upFooterDesc);
134 addEmptyHeader(layout, SMALL_CENTERING_HEADER);
136 nbgl_layoutAddTagValueList(layout, &content->
tagValueList);
141 addEmptyHeader(layout, SMALL_CENTERING_HEADER);
160 nbgl_layoutAddTagValueList(layout, &tagValueList);
161 buttonInfo.fittingContent =
true;
173 addEmptyHeader(layout, SMALL_CENTERING_HEADER);
179 buttonInfo.fittingContent =
true;
191 nbgl_layoutHorizontalButtons_t choice
197 nbgl_layoutAddHorizontalButtons(layout, &choice);
201 buttonInfo.fittingContent =
false;
202 buttonInfo.
icon = NULL;
203 buttonInfo.
style = BLACK_BACKGROUND;
207 buttonInfo.onBottom =
true;
217 if (availableHeight > 10) {
218 nbgl_layoutAddSeparationLine(layout);
231 -= nbgl_layoutAddTextWithAlias(layout,
243 if (availableHeight > 10) {
244 nbgl_layoutAddSeparationLine(layout);
250 nbgl_layoutAddRadioChoice(layout, &content->
choicesList);
260 availableHeight -= nbgl_layoutAddTouchableBar(layout, &bar);
262 if (availableHeight > 10) {
263 nbgl_layoutAddSeparationLine(layout);
294 .style = LARGE_CASE_INFO,
298 layoutDescription.withLeftBorder =
true;
301 layoutDescription.tapActionText =
"";
302 layoutDescription.tapActionToken = tapActionToken;
303 layoutDescription.tapTuneId = TUNE_TAP_CASUAL;
305 layoutDescription.
ticker.tickerCallback = ticker->tickerCallback;
306 layoutDescription.
ticker.tickerIntervale = ticker->tickerIntervale;
307 layoutDescription.
ticker.tickerValue = ticker->tickerValue;
331 layoutDescription.withLeftBorder =
true;
335 nbgl_layoutAddSpinner(layout, text, NULL, initPosition);
358 layoutDescription.withLeftBorder =
true;
364 layoutDescription.tapTuneId = info->
tuneId;
367 if (ticker != NULL) {
368 layoutDescription.
ticker.tickerCallback = ticker->tickerCallback;
369 layoutDescription.
ticker.tickerIntervale = ticker->tickerIntervale;
370 layoutDescription.
ticker.tickerValue = ticker->tickerValue;
374 nbgl_layoutAddSwipe(layout,
383 addEmptyHeader(layout, SMALL_CENTERING_HEADER);
415 "nbgl_pageDrawInfo(): unknown topRightStyle %d\n",
424 nbgl_layoutChoiceButtons_t buttonsInfo = {.topText = info->
actionButtonText,
425 .bottomText =
"Quit app",
430 ? STRONG_ACTION_AND_FOOTER_STYLE
431 : SOFT_ACTION_AND_FOOTER_STYLE;
432 nbgl_layoutAddChoiceButtons(layout, &buttonsInfo);
451 "nbgl_pageDrawInfo(): unknown bottomButtonStyle %d\n",
455 nbgl_layoutAddBottomButton(
476 nbgl_layoutChoiceButtons_t buttonsInfo
480 .style = ROUNDED_AND_FOOTER_STYLE,
484 layoutDescription.withLeftBorder =
true;
489 addEmptyHeader(layout, MEDIUM_CENTERING_HEADER);
490 nbgl_layoutAddChoiceButtons(layout, &buttonsInfo);
492 setChoiceButtonsBottomToken(layout, info->
cancelToken);
519 bool headerAdded =
false;
521 layoutDescription.
modal = modal;
522 layoutDescription.withLeftBorder =
true;
528 layoutDescription.tapTuneId = nav->
tuneId;
535 availableHeight -= nbgl_layoutAddFooter(
539 availableHeight -= nbgl_layoutAddSplitFooter(layout,
547 availableHeight -= nbgl_layoutAddProgressIndicator(layout,
557 nbgl_layoutFooter_t footerDesc = {0};
558 bool drawFooter =
true;
561 nbgl_layoutHeader_t headerDesc = {.type = HEADER_RIGHT_TEXT,
562 .separationLine =
false,
565 .rightText.tuneId = nav->
tuneId};
566 availableHeight -= nbgl_layoutAddHeader(layout, &headerDesc);
569 footerDesc.separationLine =
true;
572 footerDesc.type = FOOTER_NAV;
573 footerDesc.navigation.activePage = nav->
activePage;
574 footerDesc.navigation.nbPages = nav->
nbPages;
578 footerDesc.navigation.tuneId = nav->
tuneId;
581 footerDesc.type = FOOTER_TEXT_AND_NAV;
583 footerDesc.textAndNav.tuneId = nav->
tuneId;
584 footerDesc.textAndNav.token = nav->
quitToken;
585 footerDesc.textAndNav.navigation.activePage = nav->
activePage;
586 footerDesc.textAndNav.navigation.nbPages = nav->
nbPages;
588 footerDesc.textAndNav.navigation.visibleIndicator
590 footerDesc.textAndNav.navigation.withPageIndicator =
true;
592 footerDesc.textAndNav.navigation.tuneId = nav->
tuneId;
597 footerDesc.type = FOOTER_SIMPLE_TEXT;
599 footerDesc.simpleText.token = nav->
quitToken;
600 footerDesc.simpleText.tuneId = nav->
tuneId;
606 availableHeight -= nbgl_layoutAddExtendedFooter(layout, &footerDesc);
611 availableHeight -= nbgl_layoutAddProgressIndicator(
618 addContent(content, layout, availableHeight, headerAdded);
@ ICON_ILLUSTRATION
simple icon
struct nbgl_contentTagValueList_s nbgl_contentTagValueList_t
This structure contains a list of [tag,value] pairs.
@ INFO_LONG_PRESS
a centered info and a long press button
@ EXTENDED_CENTER
a centered content and a possible tip-box
@ CHOICES_LIST
list of choices through radio buttons
@ CENTERED_INFO
a centered info
@ SWITCHES_LIST
list of switches with descriptions
@ TAG_VALUE_DETAILS
a tag/value pair and a small button to get details.
@ INFOS_LIST
list of infos with titles
@ TAG_VALUE_CONFIRM
tag/value pairs and a black button/footer to confirm/cancel.
@ TAG_VALUE_LIST
list of tag/value pairs
@ BARS_LIST
list of touchable bars (with > on the right to go to sub-pages)
@ INFO_BUTTON
a centered info and a simple black button
#define LOG_WARN(__logger,...)
#define LOG_DEBUG(__logger,...)
struct nbgl_pageContent_s nbgl_pageContent_t
This structure contains data to build a page in multi-pages mode (nbgl_pageDrawGenericContent).
#define CHECK_CIRCLE_ICON
int nbgl_layoutAddContentCenter(nbgl_layout_t *layout, const nbgl_contentCenter_t *info)
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_layoutAddText(nbgl_layout_t *layout, const char *text, const char *subText, nbgl_contentCenteredInfoStyle_t style)
Creates an area with given text and sub text, using the given style.
int nbgl_layoutDraw(nbgl_layout_t *layout)
Applies given layout. The screen will be redrawn.
@ WHITE_BACKGROUND
rounded bordered button, with text/icon in black, on white background
void * nbgl_layout_t
type shared externally
int nbgl_layoutAddSwitch(nbgl_layout_t *layout, const nbgl_layoutSwitch_t *switchLayout)
Creates an area in main panel to display a switch.
int nbgl_layoutAddButton(nbgl_layout_t *layout, const nbgl_layoutButton_t *buttonInfo)
Creates an area in main panel to display a button, with the given style.
nbgl_layout_t * nbgl_layoutGet(const nbgl_layoutDescription_t *description)
returns a layout of the given type. The layout is reset
struct nbgl_layoutDescription_s nbgl_layoutDescription_t
Structure containing all information when creating a layout. This structure must be passed as argumen...
int nbgl_layoutRelease(nbgl_layout_t *layout)
Release the layout obtained with nbgl_layoutGet().
nbgl_contentCenteredInfo_t nbgl_layoutCenteredInfo_t
Deprecated, kept for retro compatibility.
Internal functions/constants of NBGL layout layer.
struct nbgl_layoutInternal_s nbgl_layoutInternal_t
Structure containing all information about the current layout.
void(* nbgl_layoutTouchCallback_t)(int token, uint8_t index)
prototype of function to be called when an object is touched
API of the Advanced BOLOS Graphical Library, for predefined pages.
struct nbgl_pageInfoDescription_s nbgl_pageInfoDescription_t
Structure containing all specific information when creating an information page.
nbgl_page_t * nbgl_pageDrawGenericContent(nbgl_layoutTouchCallback_t onActionCallback, const nbgl_pageNavigationInfo_t *nav, nbgl_pageContent_t *content)
nbgl_page_t * nbgl_pageDrawInfo(nbgl_layoutTouchCallback_t onActionCallback, const nbgl_screenTickerConfiguration_t *ticker, const nbgl_pageInfoDescription_t *info)
void * nbgl_page_t
type shared externally
@ NAV_WITH_BUTTONS
move forward and backward with buttons in bottom nav bar
@ NAV_WITH_TAP
move forward with "tap" and possibly backward with top left arrow
struct nbgl_pageMultiScreensDescription_s nbgl_pageNavigationInfo_t
Structure containing all specific information when creating a multi-screens page.
nbgl_page_t * nbgl_pageDrawLedgerInfo(nbgl_layoutTouchCallback_t onActionCallback, const nbgl_screenTickerConfiguration_t *ticker, const char *text, int tapActionToken)
nbgl_page_t * nbgl_pageDrawConfirmation(nbgl_layoutTouchCallback_t onActionCallback, const nbgl_pageConfirmationDescription_t *info)
struct nbgl_pageConfirmationDescription_s nbgl_pageConfirmationDescription_t
Structure containing all specific information when creating a confirmation page.
int nbgl_pageRelease(nbgl_page_t *)
nbgl_page_t * nbgl_pageDrawSpinner(const char *text, uint8_t initPosition)
nbgl_page_t * nbgl_pageDrawGenericContentExt(nbgl_layoutTouchCallback_t onActionCallback, const nbgl_pageNavigationInfo_t *nav, nbgl_pageContent_t *content, bool modal)
@ QUIT_APP_TEXT
A full width button with "Quit app" text (only for bottom button).
@ INFO_ICON
info (i) icon in the button.
@ QUIT_ICON
quit (X) icon in the button.
@ NO_BUTTON_STYLE
no button.
@ SETTINGS_ICON
settings (wheel) icon in the button.
struct PACKED__ nbgl_screenTickerConfiguration_s nbgl_screenTickerConfiguration_t
struct to configure a screen layer
struct PACKED__ nbgl_icon_details_s nbgl_icon_details_t
Represents all information about an icon.
API of the Advanced BOLOS Graphical Library, for typical application use-cases.
#define NB_MAX_LINES_IN_REVIEW
maximum number of lines for value field in review pages
const uint8_t * tokens
array of tokens, one for each bar (nbBars items)
const char *const * barTexts
array of texts for each bar (nbBars items, in black/bold)
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when a bar is touched
uint8_t nbBars
number of elements in barTexts and tokens array
This structure contains info to build a centered (vertically and horizontally) area,...
const nbgl_icon_details_t * icon
the icon (can be null)
const char * title
title in black large (can be null)
nbgl_contentIllustrationType_t illustrType
nbgl_contentTipBox_t tipBox
if text field is NULL, no tip-box
nbgl_contentCenter_t contentCenter
centered content (icon + text(s))
const char * buttonText
text of the long press button
const nbgl_icon_details_t * icon
a buffer containing the 1BPP icon
const char * text
centered text in large case
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when button is touched
const char *const * infoContents
array of contents of infos (in black)
const char *const * infoTypes
array of types of infos (in black/bold)
const nbgl_contentValueExt_t * infoExtensions
uint8_t nbInfos
number of elements in infoTypes and infoContents array
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when button is touched
const char * longPressText
text of the long press button
const nbgl_icon_details_t * icon
a buffer containing the 1BPP icon
const char * text
centered text in large case
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when details button is touched
const char * confirmationText
text of the confirmation button, if NULL "It matches" is used
uint8_t detailsButtonToken
uint8_t confirmationToken
the token used as argument of the onActionCallback
nbgl_contentTagValueList_t tagValueList
list of tag/value pairs
const char * detailsButtonText
this text is used for "details" button (if NULL, no button)
const nbgl_icon_details_t * detailsButtonIcon
icon to use in details button
const nbgl_icon_details_t * detailsButtonIcon
icon to use in details button
uint8_t detailsButtonToken
const char * detailsButtonText
this text is used for "details" button
nbgl_contentTagValueList_t tagValueList
list of tag/value pairs
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when details button is touched
uint8_t nbMaxLinesForValue
const char * text
text of the tip-box
const nbgl_icon_details_t * icon
icon of the tip-box
uint8_t token
token used when tip-box is tapped
tune_index_e tuneId
tune played when tip-box is tapped
const char * fullValue
full string of the value when used as an alias
This structure contains info to build a clickable "bar" with a text and an icon.
const char * text
text (can be NULL)
uint8_t token
the token that will be used as argument of the callback
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played
const nbgl_icon_details_t * iconRight
nbgl_screenTickerConfiguration_t ticker
nbgl_layoutButtonCallback_t onActionCallback
the callback to be called on any action on the layout
uint8_t nbUsedCallbackObjs
layoutObj_t callbackObjPool[LAYOUT_OBJ_POOL_LEN]
const char * cancelText
the text used for cancel action, if NULL a simple X button is used
uint8_t confirmationToken
the token used as argument of the onActionCallback
bool modal
if true, page is open as a modal
const char * confirmationText
text of the confirmation button
nbgl_layoutCenteredInfo_t centeredInfo
description of the centered info to be used
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when button is pressed
nbgl_contentTagValueDetails_t tagValueDetails
TAG_VALUE_DETAILS type
const char * title
text for the title of the page (if NULL, no title)
uint8_t topRightToken
token used when top-right button (if not NULL) is touched
nbgl_contentInfoLongPress_t infoLongPress
INFO_LONG_PRESS type
nbgl_contentRadioChoice_t choicesList
CHOICES_LIST type
nbgl_contentSwitchesList_t switchesList
SWITCHES_LIST type
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when title is touched
nbgl_contentBarsList_t barsList
BARS_LIST type
nbgl_contentInfoButton_t infoButton
INFO_BUTTON type
nbgl_contentInfoList_t infosList
INFOS_LIST type
nbgl_contentTagValueList_t tagValueList
TAG_VALUE_LIST type
const nbgl_icon_details_t * topRightIcon
nbgl_contentType_t type
type of page content in the following union
nbgl_contentCenteredInfo_t centeredInfo
CENTERED_INFO type
nbgl_contentTagValueConfirm_t tagValueConfirm
TAG_VALUE_CONFIRM type
nbgl_contentExtendedCenter_t extendedCenter
EXTENDED_CENTER type
nbgl_layoutButtonStyle_t actionButtonStyle
style of "action" button
const char * actionButtonText
if not NULL an "action" button is set under the centered info
const char * tapActionText
uint8_t bottomButtonsToken
const char * footerText
if not NULL, add a touchable footer
nbgl_pageButtonStyle_t topRightStyle
style to apply to the Top-Right button
uint8_t topRightToken
the token that will be used as argument of the onActionCallback
bool isSwipeable
if true, main area is swipeable
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when button/footer is pressed
uint8_t footerToken
the token that will be used as argument of the onActionCallback
const nbgl_icon_details_t * actionButtonIcon
potential icon of "action" button
nbgl_pageButtonStyle_t bottomButtonStyle
style to apply to the Bottom button
nbgl_layoutCenteredInfo_t centeredInfo
description of the centered info to be used
uint8_t nbPages
the number of pages to display (if <2, no navigation bar)
uint8_t quitToken
the token used as argument of the actionCallback when the footer is touched
uint8_t skipToken
if skipText is NULL the token used when right part of footer is touched
nbgl_pageNavigationType_t navType
uint8_t activePage
the index of the page to display at start-up
bool progressIndicator
if set to true, display a progress indicator on top of the page
nbgl_pageNavWithButtons_t navWithButtons
structure used when navigation with buttons
nbgl_pageNavWithTap_t navWithTap
structure used when navigation with "tap"
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when next or back is pressed
bool visiblePageIndicator
if set to true, the page indicator will be visible in navigation
bool quitButton
if set to true, a quit button (X) is displayed in the nav bar
const char * quitText
the text displayed in footer (on the left), used to quit (only on Flex)
bool backButton
if set to true, a back button (<-) is displayed in the nav bar
const char * quitText
the text displayed in footer, used to quit
const char * nextPageText
uint8_t nbSwitches
number of elements in switches and tokens array
const nbgl_contentSwitch_t * switches
array of switches (nbSwitches items)