Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
nbgl_page.c
Go to the documentation of this file.
1
6#ifdef NBGL_PAGE
7/*********************
8 * INCLUDES
9 *********************/
10#include <string.h>
11#include "nbgl_debug.h"
12#include "nbgl_page.h"
13#include "glyphs.h"
14#include "os_pic.h"
15
16/*********************
17 * DEFINES
18 *********************/
19
20/**********************
21 * TYPEDEFS
22 **********************/
23
24/**********************
25 * STATIC VARIABLES
26 **********************/
27
28/**********************
29 * STATIC PROTOTYPES
30 **********************/
31static void addEmptyHeader(nbgl_layout_t *layout, uint16_t height)
32{
33 nbgl_layoutHeader_t headerDesc
34 = {.type = HEADER_EMPTY, .separationLine = false, .emptySpace.height = height};
35 nbgl_layoutAddHeader(layout, &headerDesc);
36}
37
38static void addContent(nbgl_pageContent_t *content,
39 nbgl_layout_t *layout,
40 uint16_t availableHeight,
41 bool headerAdded)
42{
43 if (content->title != NULL) {
44 nbgl_layoutHeader_t headerDesc = {.type = HEADER_BACK_AND_TEXT,
45 .separationLine = true,
46 .backAndText.token = content->titleToken,
47 .backAndText.tuneId = content->tuneId,
48 .backAndText.text = content->title};
49 nbgl_layoutAddHeader(layout, &headerDesc);
50 headerAdded = true;
51 }
52 if (content->topRightIcon != NULL) {
53 nbgl_layoutAddTopRightButton(
54 layout, content->topRightIcon, content->topRightToken, content->tuneId);
55 }
56 switch (content->type) {
57 case INFO_LONG_PRESS: {
58 nbgl_contentCenter_t centeredInfo = {0};
59 centeredInfo.icon = content->infoLongPress.icon;
60 centeredInfo.title = content->infoLongPress.text;
61 centeredInfo.illustrType = ICON_ILLUSTRATION;
62 nbgl_layoutAddContentCenter(layout, &centeredInfo);
63 nbgl_layoutAddLongPressButton(layout,
66 content->infoLongPress.tuneId);
67 break;
68 }
69 case INFO_BUTTON: {
70 nbgl_contentCenter_t centeredInfo = {0};
71 nbgl_layoutButton_t buttonInfo = {0};
72
73 centeredInfo.icon = content->infoButton.icon;
74 centeredInfo.title = content->infoButton.text;
75 centeredInfo.illustrType = ICON_ILLUSTRATION;
76 nbgl_layoutAddContentCenter(layout, &centeredInfo);
77
78 buttonInfo.onBottom = true;
79 buttonInfo.style = BLACK_BACKGROUND;
80 buttonInfo.text = content->infoButton.buttonText;
81 buttonInfo.token = content->infoButton.buttonToken;
82 buttonInfo.tuneId = content->infoButton.tuneId;
83 nbgl_layoutAddButton(layout, &buttonInfo);
84 break;
85 }
86 case CENTERED_INFO:
87 if (!headerAdded) {
88 addEmptyHeader(layout, SMALL_CENTERING_HEADER);
89 }
91 break;
92
93 case EXTENDED_CENTER:
94 if (!headerAdded) {
95 addEmptyHeader(layout, SMALL_CENTERING_HEADER);
96 }
98 if (content->extendedCenter.tipBox.text != NULL) {
99 nbgl_layoutUpFooter_t upFooterDesc
100 = {.type = UP_FOOTER_TIP_BOX,
101 .tipBox.text = content->extendedCenter.tipBox.text,
102 .tipBox.icon = content->extendedCenter.tipBox.icon,
103 .tipBox.token = content->extendedCenter.tipBox.token,
104 .tipBox.tuneId = content->extendedCenter.tipBox.tuneId};
105 nbgl_layoutAddUpFooter(layout, &upFooterDesc);
106 }
107 break;
108
109 case TAG_VALUE_LIST:
110 // add a space of 32/40px if no header already added
111 if (!headerAdded) {
112 addEmptyHeader(layout, SMALL_CENTERING_HEADER);
113 }
114 nbgl_layoutAddTagValueList(layout, &content->tagValueList);
115 break;
116 case TAG_VALUE_DETAILS: {
117 // add a space of 32/40px if no header already added
118 if (!headerAdded) {
119 addEmptyHeader(layout, SMALL_CENTERING_HEADER);
120 }
121 // display a button under tag/value
122 nbgl_layoutButton_t buttonInfo = {0};
124 nbgl_layoutAddTagValueList(layout, &content->tagValueDetails.tagValueList);
125 buttonInfo.fittingContent = true;
126 buttonInfo.icon = content->tagValueDetails.detailsButtonIcon;
127 buttonInfo.style = WHITE_BACKGROUND;
128 buttonInfo.text = content->tagValueDetails.detailsButtonText;
129 buttonInfo.token = content->tagValueDetails.detailsButtonToken;
130 buttonInfo.tuneId = content->tagValueDetails.tuneId;
131 nbgl_layoutAddButton(layout, &buttonInfo);
132 break;
133 }
134 case TAG_VALUE_CONFIRM: {
135 nbgl_layoutButton_t buttonInfo = {0};
136 if (!headerAdded) {
137 addEmptyHeader(layout, SMALL_CENTERING_HEADER);
138 }
139 nbgl_layoutAddTagValueList(layout, &content->tagValueConfirm.tagValueList);
140 // Always display the details button as a normal button (full width),
141 // even if "Confirm" button is on the same page
142 if (content->tagValueConfirm.detailsButtonText != NULL) {
143 buttonInfo.fittingContent = true;
144 buttonInfo.icon = content->tagValueConfirm.detailsButtonIcon;
145 buttonInfo.style = WHITE_BACKGROUND;
146 buttonInfo.text = content->tagValueConfirm.detailsButtonText;
147 buttonInfo.token = content->tagValueConfirm.detailsButtonToken;
148 buttonInfo.tuneId = content->tagValueConfirm.tuneId;
149 nbgl_layoutAddButton(layout, &buttonInfo);
150 }
151 else if ((content->tagValueConfirm.detailsButtonIcon != NULL)
152 && (content->tagValueConfirm.confirmationText != NULL)) {
153 // On Flex, a small button with only the icon is displayed on the left
154 // of "Confirm"
155 nbgl_layoutHorizontalButtons_t choice
156 = {.leftIcon = content->tagValueConfirm.detailsButtonIcon,
157 .rightText = content->tagValueConfirm.confirmationText,
158 .leftToken = content->tagValueConfirm.detailsButtonToken,
159 .rightToken = content->tagValueConfirm.confirmationToken,
160 .tuneId = content->tagValueConfirm.tuneId};
161 nbgl_layoutAddHorizontalButtons(layout, &choice);
162 break;
163 }
164 if (content->tagValueConfirm.confirmationText != NULL) {
165 buttonInfo.fittingContent = false;
166 buttonInfo.icon = NULL;
167 buttonInfo.style = BLACK_BACKGROUND;
168 buttonInfo.text = content->tagValueConfirm.confirmationText;
169 buttonInfo.token = content->tagValueConfirm.confirmationToken;
170 buttonInfo.tuneId = content->tagValueConfirm.tuneId;
171 buttonInfo.onBottom = true;
172 nbgl_layoutAddButton(layout, &buttonInfo);
173 }
174 break;
175 }
176 case SWITCHES_LIST: {
177 uint8_t i;
178 for (i = 0; i < content->switchesList.nbSwitches; i++) {
179 availableHeight -= nbgl_layoutAddSwitch(layout, &content->switchesList.switches[i]);
180 // do not draw a separation line if too low in the container
181 if (availableHeight > 10) {
182 nbgl_layoutAddSeparationLine(layout);
183 }
184 }
185 break;
186 }
187 case INFOS_LIST: {
188 uint8_t i;
189 for (i = 0; i < content->infosList.nbInfos; i++) {
190 // if the extension is valid for this index, use a Text with Alias
191 if ((content->infosList.withExtensions == true)
192 && (content->infosList.infoExtensions != NULL)
193 && (content->infosList.infoExtensions[i].fullValue != NULL)) {
194 availableHeight
195 -= nbgl_layoutAddTextWithAlias(layout,
196 content->infosList.infoTypes[i],
197 content->infosList.infoContents[i],
198 content->infosList.token,
199 i);
200 }
201 else {
202 availableHeight -= nbgl_layoutAddText(layout,
203 content->infosList.infoTypes[i],
204 content->infosList.infoContents[i]);
205 }
206 // do not draw a separation line if too low in the container
207 if (availableHeight > 10) {
208 nbgl_layoutAddSeparationLine(layout);
209 }
210 }
211 break;
212 }
213 case CHOICES_LIST:
214 nbgl_layoutAddRadioChoice(layout, &content->choicesList);
215 break;
216 case BARS_LIST: {
217 uint8_t i;
218 for (i = 0; i < content->barsList.nbBars; i++) {
219 nbgl_layoutBar_t bar = {0};
220 bar.text = content->barsList.barTexts[i];
221 bar.iconRight = &PUSH_ICON;
222 bar.token = content->barsList.tokens[i];
223 bar.tuneId = content->barsList.tuneId;
224 availableHeight -= nbgl_layoutAddTouchableBar(layout, &bar);
225 // do not draw a separation line if too low in the container
226 if (availableHeight > 10) {
227 nbgl_layoutAddSeparationLine(layout);
228 }
229 }
230 break;
231 }
232 }
233}
234
235/**********************
236 * GLOBAL FUNCTIONS
237 **********************/
238
250 const char *text,
251 int tapActionToken)
252{
253 nbgl_layoutDescription_t layoutDescription = {0};
254 nbgl_layout_t *layout;
255 nbgl_layoutCenteredInfo_t centeredInfo = {.text1 = text,
256 .text2 = NULL,
257 .text3 = NULL,
258 .style = LARGE_CASE_INFO,
259 .icon = &CHECK_CIRCLE_ICON,
260 .offsetY = 0};
261
262 layoutDescription.withLeftBorder = true;
263
264 layoutDescription.onActionCallback = onActionCallback;
265 layoutDescription.tapActionText = "";
266 layoutDescription.tapActionToken = tapActionToken;
267 layoutDescription.tapTuneId = TUNE_TAP_CASUAL;
268
269 layoutDescription.ticker.tickerCallback = ticker->tickerCallback;
270 layoutDescription.ticker.tickerIntervale = ticker->tickerIntervale;
271 layoutDescription.ticker.tickerValue = ticker->tickerValue;
272 layout = nbgl_layoutGet(&layoutDescription);
273
274 nbgl_layoutAddCenteredInfo(layout, &centeredInfo);
275
276 nbgl_layoutDraw(layout);
277
278 return (nbgl_page_t *) layout;
279}
280
290nbgl_page_t *nbgl_pageDrawSpinner(const char *text, uint8_t initPosition)
291{
292 nbgl_layoutDescription_t layoutDescription = {0};
293 nbgl_layout_t *layout;
294
295 layoutDescription.withLeftBorder = true;
296
297 layout = nbgl_layoutGet(&layoutDescription);
298
299 nbgl_layoutAddSpinner(layout, text, NULL, initPosition);
300
301 nbgl_layoutDraw(layout);
302
303 return (nbgl_page_t *) layout;
304}
305
317 const nbgl_pageInfoDescription_t *info)
318{
319 nbgl_layoutDescription_t layoutDescription = {0};
320 nbgl_layout_t *layout;
321
322 layoutDescription.withLeftBorder = true;
323
324 layoutDescription.onActionCallback = onActionCallback;
325 if (!info->isSwipeable) {
326 layoutDescription.tapActionText = info->tapActionText;
327 layoutDescription.tapActionToken = info->tapActionToken;
328 layoutDescription.tapTuneId = info->tuneId;
329 }
330
331 if (ticker != NULL) {
332 layoutDescription.ticker.tickerCallback = ticker->tickerCallback;
333 layoutDescription.ticker.tickerIntervale = ticker->tickerIntervale;
334 layoutDescription.ticker.tickerValue = ticker->tickerValue;
335 }
336 layout = nbgl_layoutGet(&layoutDescription);
337 if (info->isSwipeable) {
338 nbgl_layoutAddSwipe(layout,
339 ((1 << SWIPED_LEFT) | (1 << SWIPED_RIGHT)),
340 info->tapActionText,
341 info->tapActionToken,
342 info->tuneId);
343 }
344 // add an empty header if a top-right button is used or if the tap text is not empty
345 if ((info->topRightStyle != NO_BUTTON_STYLE)
346 || (info->tapActionText && strlen(PIC(info->tapActionText)))) {
347 addEmptyHeader(layout, SMALL_CENTERING_HEADER);
348 }
350
351 // if action button but not QUIT_APP_TEXT bottom button, use a small black button
352 if ((info->actionButtonText != NULL) && (info->bottomButtonStyle != QUIT_APP_TEXT)) {
353 nbgl_layoutButton_t buttonInfo = {.fittingContent = true,
354 .icon = info->actionButtonIcon,
355 .onBottom = false,
356 .style = info->actionButtonStyle,
357 .text = info->actionButtonText,
358 .token = info->bottomButtonsToken,
359 .tuneId = info->tuneId};
360 nbgl_layoutAddButton(layout, &buttonInfo);
361 }
362
363 if (info->footerText != NULL) {
364 nbgl_layoutAddFooter(layout, PIC(info->footerText), info->footerToken, info->tuneId);
365 }
366 if (info->topRightStyle != NO_BUTTON_STYLE) {
367 const nbgl_icon_details_t *icon;
368 if (info->topRightStyle == SETTINGS_ICON) {
369 icon = &WHEEL_ICON;
370 }
371 else if (info->topRightStyle == INFO_ICON) {
372 icon = &INFO_I_ICON;
373 }
374 else if (info->topRightStyle == QUIT_ICON) {
375 icon = &CLOSE_ICON;
376 }
377 else {
378 return NULL;
379 }
380 nbgl_layoutAddTopRightButton(layout, PIC(icon), info->topRightToken, info->tuneId);
381 }
382 if (info->bottomButtonStyle == QUIT_APP_TEXT) {
383 // if action button and QUIT_APP_TEXT bottom button, use a pair of choice buttons
384 if ((info->actionButtonText != NULL)) {
385 nbgl_layoutChoiceButtons_t buttonsInfo = {.topText = info->actionButtonText,
386 .bottomText = "Quit app",
387 .token = info->bottomButtonsToken,
388 .tuneId = info->tuneId,
389 .topIcon = info->actionButtonIcon};
390 buttonsInfo.style = (info->actionButtonStyle == BLACK_BACKGROUND)
391 ? STRONG_ACTION_AND_FOOTER_STYLE
392 : SOFT_ACTION_AND_FOOTER_STYLE;
393 nbgl_layoutAddChoiceButtons(layout, &buttonsInfo);
394 }
395 else {
396 nbgl_layoutAddFooter(layout, "Quit app", info->bottomButtonsToken, info->tuneId);
397 }
398 }
399 else if (info->bottomButtonStyle != NO_BUTTON_STYLE) {
400 const nbgl_icon_details_t *icon;
401 if (info->bottomButtonStyle == SETTINGS_ICON) {
402 icon = &WHEEL_ICON;
403 }
404 else if (info->bottomButtonStyle == INFO_ICON) {
405 icon = &INFO_I_ICON;
406 }
407 else if (info->bottomButtonStyle == QUIT_ICON) {
408 icon = &CLOSE_ICON;
409 }
410 else {
411 return NULL;
412 }
413 nbgl_layoutAddBottomButton(
414 layout, PIC(icon), info->bottomButtonsToken, false, info->tuneId);
415 }
416 nbgl_layoutDraw(layout);
417
418 return (nbgl_page_t *) layout;
419}
420
431{
432 nbgl_layoutDescription_t layoutDescription = {0};
433 nbgl_layout_t *layout;
434 nbgl_layoutChoiceButtons_t buttonsInfo
435 = {.bottomText = (info->cancelText != NULL) ? PIC(info->cancelText) : "Cancel",
436 .token = info->confirmationToken,
437 .topText = PIC(info->confirmationText),
438 .style = ROUNDED_AND_FOOTER_STYLE,
439 .tuneId = info->tuneId};
440
441 layoutDescription.modal = info->modal;
442 layoutDescription.withLeftBorder = true;
443 layoutDescription.onActionCallback = onActionCallback;
444
445 layout = nbgl_layoutGet(&layoutDescription);
446
447 addEmptyHeader(layout, MEDIUM_CENTERING_HEADER);
448 nbgl_layoutAddChoiceButtons(layout, &buttonsInfo);
449
451
452 nbgl_layoutDraw(layout);
453
454 return (nbgl_page_t *) layout;
455}
456
468 const nbgl_pageNavigationInfo_t *nav,
469 nbgl_pageContent_t *content,
470 bool modal)
471{
472 nbgl_layoutDescription_t layoutDescription = {0};
473 nbgl_layout_t *layout;
474 uint16_t availableHeight = SCREEN_HEIGHT;
475 bool headerAdded = false;
476
477 layoutDescription.modal = modal;
478 layoutDescription.withLeftBorder = true;
479 layoutDescription.onActionCallback = onActionCallback;
480
481 if ((nav != NULL) && (nav->navType == NAV_WITH_TAP)) {
482 layoutDescription.tapActionText = nav->navWithTap.nextPageText;
483 layoutDescription.tapActionToken = nav->navWithTap.nextPageToken;
484 layoutDescription.tapTuneId = nav->tuneId;
485 }
486
487 layout = nbgl_layoutGet(&layoutDescription);
488 if (nav != NULL) {
489 if (nav->navType == NAV_WITH_TAP) {
490 if (nav->skipText == NULL) {
491 availableHeight -= nbgl_layoutAddFooter(
492 layout, nav->navWithTap.quitText, nav->quitToken, nav->tuneId);
493 }
494 else {
495 availableHeight -= nbgl_layoutAddSplitFooter(layout,
496 nav->navWithTap.quitText,
497 nav->quitToken,
498 nav->skipText,
499 nav->skipToken,
500 nav->tuneId);
501 }
502 if (nav->progressIndicator) {
503 availableHeight -= nbgl_layoutAddProgressIndicator(layout,
504 nav->activePage,
505 nav->nbPages,
508 nav->tuneId);
509 headerAdded = true;
510 }
511 }
512 else if (nav->navType == NAV_WITH_BUTTONS) {
513 nbgl_layoutFooter_t footerDesc = {0};
514 bool drawFooter = true;
515
516 if (nav->skipText != NULL) {
517 nbgl_layoutHeader_t headerDesc = {.type = HEADER_RIGHT_TEXT,
518 .separationLine = false,
519 .rightText.text = nav->skipText,
520 .rightText.token = nav->skipToken,
521 .rightText.tuneId = nav->tuneId};
522 availableHeight -= nbgl_layoutAddHeader(layout, &headerDesc);
523 headerAdded = true;
524 }
525 footerDesc.separationLine = true;
526 if (nav->nbPages > 1) {
527 if (nav->navWithButtons.quitText == NULL) {
528 footerDesc.type = FOOTER_NAV;
529 footerDesc.navigation.activePage = nav->activePage;
530 footerDesc.navigation.nbPages = nav->nbPages;
531 footerDesc.navigation.withExitKey = nav->navWithButtons.quitButton;
532 footerDesc.navigation.withBackKey = nav->navWithButtons.backButton;
533 footerDesc.navigation.token = nav->navWithButtons.navToken;
534 footerDesc.navigation.tuneId = nav->tuneId;
535 }
536 else {
537 footerDesc.type = FOOTER_TEXT_AND_NAV;
538 footerDesc.textAndNav.text = nav->navWithButtons.quitText;
539 footerDesc.textAndNav.tuneId = nav->tuneId;
540 footerDesc.textAndNav.token = nav->quitToken;
541 footerDesc.textAndNav.navigation.activePage = nav->activePage;
542 footerDesc.textAndNav.navigation.nbPages = nav->nbPages;
543 footerDesc.textAndNav.navigation.withBackKey = nav->navWithButtons.backButton;
544 footerDesc.textAndNav.navigation.visibleIndicator
546 footerDesc.textAndNav.navigation.withPageIndicator = true;
547 footerDesc.textAndNav.navigation.token = nav->navWithButtons.navToken;
548 footerDesc.textAndNav.navigation.tuneId = nav->tuneId;
549 }
550 }
551 else if (nav->navWithButtons.quitText != NULL) {
552 // simple footer
553 footerDesc.type = FOOTER_SIMPLE_TEXT;
554 footerDesc.simpleText.text = nav->navWithButtons.quitText;
555 footerDesc.simpleText.token = nav->quitToken;
556 footerDesc.simpleText.tuneId = nav->tuneId;
557 }
558 else {
559 drawFooter = false;
560 }
561 if (drawFooter) {
562 availableHeight -= nbgl_layoutAddExtendedFooter(layout, &footerDesc);
563 }
564
565#ifdef TARGET_STAX
566 if (nav->progressIndicator) {
567 availableHeight -= nbgl_layoutAddProgressIndicator(
568 layout, nav->activePage, nav->nbPages, false, 0, nav->tuneId);
569 headerAdded = true;
570 }
571#endif // TARGET_STAX
572 }
573 }
574 addContent(content, layout, availableHeight, headerAdded);
575 nbgl_layoutDraw(layout);
576
577 return (nbgl_page_t *) layout;
578}
579
590 const nbgl_pageNavigationInfo_t *nav,
591 nbgl_pageContent_t *content)
592{
593 return nbgl_pageDrawGenericContentExt(onActionCallback, nav, content, false);
594}
595
603{
604 int ret;
605
606 LOG_DEBUG(PAGE_LOGGER, "nbgl_pageRelease(): \n");
607 ret = nbgl_layoutRelease((nbgl_layout_t *) page);
608
609 return ret;
610}
611#endif // NBGL_PAGE
@ ICON_ILLUSTRATION
simple icon
@ 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
debug traces management
#define LOG_DEBUG(__logger,...)
Definition nbgl_debug.h:86
@ PAGE_LOGGER
Definition nbgl_debug.h:34
void(* nbgl_layoutTouchCallback_t)(int token, uint8_t index)
prototype of function to be called when an object is touched
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
int nbgl_layoutRelease(nbgl_layout_t *layout)
Release the layout obtained with nbgl_layoutGet()
API of the Advanced BOLOS Graphical Library, for predefined pages.
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
Definition nbgl_page.h:81
@ NAV_WITH_BUTTONS
move forward and backward with buttons in bottom nav bar
Definition nbgl_page.h:89
@ NAV_WITH_TAP
move forward with "tap" and possibly backward with top left arrow
Definition nbgl_page.h:88
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)
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)
Definition nbgl_page.h:40
@ INFO_ICON
info (i) icon in the button.
Definition nbgl_page.h:39
@ QUIT_ICON
quit (X) icon in the button.
Definition nbgl_page.h:38
@ NO_BUTTON_STYLE
no button.
Definition nbgl_page.h:36
@ SETTINGS_ICON
settings (wheel) icon in the button.
Definition nbgl_page.h:37
struct PACKED__ nbgl_screenTickerConfiguration_s nbgl_screenTickerConfiguration_t
struct to configure a screen layer
@ SWIPED_LEFT
Definition nbgl_types.h:274
@ SWIPED_RIGHT
Definition nbgl_types.h:273
#define SCREEN_HEIGHT
Definition nbgl_types.h:78
struct PACKED__ nbgl_icon_details_s nbgl_icon_details_t
Represents all information about an icon.
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
This structure contains info to build a centered (vertically and horizontally) area,...
const char * text1
first text (can be null)
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 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
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
if > 0, set the max number of lines for value field.
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
This structure contains info to build a single button.
const char * text
button text
const nbgl_icon_details_t * icon
a buffer containing the 1BPP icon for button
nbgl_layoutButtonStyle_t style
Structure containing all information when creating a layout. This structure must be passed as argumen...
nbgl_screenTickerConfiguration_t ticker
nbgl_layoutButtonCallback_t onActionCallback
the callback to be called on any action on the layout
Structure containing all specific information when creating a confirmation page.
Definition nbgl_page.h:149
const char * cancelText
the text used for cancel action, if NULL a simple X button is used
Definition nbgl_page.h:152
uint8_t confirmationToken
the token used as argument of the onActionCallback
Definition nbgl_page.h:153
bool modal
if true, page is open as a modal
Definition nbgl_page.h:158
const char * confirmationText
text of the confirmation button
Definition nbgl_page.h:151
nbgl_layoutCenteredInfo_t centeredInfo
description of the centered info to be used
Definition nbgl_page.h:150
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when button is pressed
Definition nbgl_page.h:157
This structure contains data to build a page in multi-pages mode (nbgl_pageDrawGenericContent)
Definition nbgl_flow.h:58
nbgl_contentTagValueDetails_t tagValueDetails
TAG_VALUE_DETAILS type
Definition nbgl_page.h:68
const char * title
text for the title of the page (if NULL, no title)
Definition nbgl_page.h:53
uint8_t topRightToken
token used when top-right button (if not NULL) is touched
Definition nbgl_page.h:58
nbgl_contentInfoLongPress_t infoLongPress
INFO_LONG_PRESS type
Definition nbgl_page.h:65
nbgl_contentRadioChoice_t choicesList
CHOICES_LIST type
Definition nbgl_flow.h:67
nbgl_contentSwitchesList_t switchesList
SWITCHES_LIST type
Definition nbgl_flow.h:65
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when title is touched
Definition nbgl_page.h:57
nbgl_contentBarsList_t barsList
BARS_LIST type
Definition nbgl_flow.h:68
nbgl_contentInfoButton_t infoButton
INFO_BUTTON type
Definition nbgl_flow.h:62
nbgl_contentInfoList_t infosList
INFOS_LIST type
Definition nbgl_flow.h:66
nbgl_contentTagValueList_t tagValueList
TAG_VALUE_LIST type
Definition nbgl_flow.h:63
const nbgl_icon_details_t * topRightIcon
Definition nbgl_page.h:59
nbgl_contentType_t type
type of page content in the following union
Definition nbgl_flow.h:59
nbgl_contentCenteredInfo_t centeredInfo
CENTERED_INFO type
Definition nbgl_flow.h:61
nbgl_contentTagValueConfirm_t tagValueConfirm
TAG_VALUE_CONFIRM type
Definition nbgl_flow.h:64
nbgl_contentExtendedCenter_t extendedCenter
EXTENDED_CENTER type
Definition nbgl_page.h:64
Structure containing all specific information when creating an information page.
Definition nbgl_page.h:185
nbgl_layoutButtonStyle_t actionButtonStyle
style of "action" button
Definition nbgl_page.h:202
const char * actionButtonText
if not NULL an "action" button is set under the centered info
Definition nbgl_page.h:200
const char * footerText
if not NULL, add a touchable footer
Definition nbgl_page.h:192
nbgl_pageButtonStyle_t topRightStyle
style to apply to the Top-Right button
Definition nbgl_page.h:187
uint8_t topRightToken
the token that will be used as argument of the onActionCallback
Definition nbgl_page.h:189
bool isSwipeable
if true, main area is swipeable
Definition nbgl_page.h:196
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when button/footer is pressed
Definition nbgl_page.h:204
uint8_t footerToken
the token that will be used as argument of the onActionCallback
Definition nbgl_page.h:193
const nbgl_icon_details_t * actionButtonIcon
potential icon of "action" button
Definition nbgl_page.h:201
nbgl_pageButtonStyle_t bottomButtonStyle
style to apply to the Bottom button
Definition nbgl_page.h:188
nbgl_layoutCenteredInfo_t centeredInfo
description of the centered info to be used
Definition nbgl_page.h:186
Structure containing all specific information when creating a multi-screens page.
Definition nbgl_page.h:127
uint8_t nbPages
the number of pages to display (if <2, no navigation bar)
Definition nbgl_page.h:129
uint8_t quitToken
the token used as argument of the actionCallback when the footer is touched
Definition nbgl_page.h:131
uint8_t skipToken
if skipText is NULL the token used when right part of footer is touched
Definition nbgl_page.h:139
nbgl_pageNavigationType_t navType
Definition nbgl_page.h:132
uint8_t activePage
the index of the page to display at start-up
Definition nbgl_page.h:128
bool progressIndicator
if set to true, display a progress indicator on top of the page
Definition nbgl_page.h:134
nbgl_pageNavWithButtons_t navWithButtons
structure used when navigation with buttons
Definition nbgl_page.h:142
nbgl_pageNavWithTap_t navWithTap
structure used when navigation with "tap"
Definition nbgl_page.h:141
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when next or back is pressed
Definition nbgl_page.h:136
bool visiblePageIndicator
if set to true, the page indicator will be visible in navigation
Definition nbgl_page.h:116
bool quitButton
if set to true, a quit button (X) is displayed in the nav bar
Definition nbgl_page.h:113
const char * quitText
the text displayed in footer (on the left), used to quit (only on Flex)
Definition nbgl_page.h:120
bool backButton
if set to true, a back button (<-) is displayed in the nav bar
Definition nbgl_page.h:114
const char * quitText
the text displayed in footer, used to quit
Definition nbgl_page.h:105
const char * nextPageText
Definition nbgl_page.h:103
uint8_t nbSwitches
number of elements in switches and tokens array
const nbgl_contentSwitch_t * switches
array of switches (nbSwitches items)