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) {
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) {
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);
66 content->infoLongPress.tuneId);
67 break;
68 }
69 case INFO_BUTTON: {
70 nbgl_contentCenter_t centeredInfo = {0};
71 nbgl_layoutButton_t buttonInfo;
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.fittingContent = false;
79 buttonInfo.icon = NULL;
80 buttonInfo.onBottom = true;
81 buttonInfo.style = BLACK_BACKGROUND;
82 buttonInfo.text = content->infoButton.buttonText;
83 buttonInfo.token = content->infoButton.buttonToken;
84 buttonInfo.tuneId = content->infoButton.tuneId;
85 nbgl_layoutAddButton(layout, &buttonInfo);
86 break;
87 }
88 case CENTERED_INFO:
89 if (!headerAdded) {
90 addEmptyHeader(layout, SMALL_CENTERING_HEADER);
91 }
93 break;
94
95 case EXTENDED_CENTER:
96 if (!headerAdded) {
97 addEmptyHeader(layout, SMALL_CENTERING_HEADER);
98 }
100 if (content->extendedCenter.tipBox.text != NULL) {
101 nbgl_layoutUpFooter_t upFooterDesc
103 .tipBox.text = content->extendedCenter.tipBox.text,
104 .tipBox.icon = content->extendedCenter.tipBox.icon,
105 .tipBox.token = content->extendedCenter.tipBox.token,
106 .tipBox.tuneId = content->extendedCenter.tipBox.tuneId};
107 nbgl_layoutAddUpFooter(layout, &upFooterDesc);
108 }
109 break;
110
111 case TAG_VALUE_LIST:
112 // add a space of 32/40px if no header already added
113 if (!headerAdded) {
114 addEmptyHeader(layout, SMALL_CENTERING_HEADER);
115 }
116 nbgl_layoutAddTagValueList(layout, &content->tagValueList);
117 break;
118 case TAG_VALUE_DETAILS: {
119 // add a space of 32/40px if no header already added
120 if (!headerAdded) {
121 addEmptyHeader(layout, SMALL_CENTERING_HEADER);
122 }
123 // display a button under tag/value
124 nbgl_layoutButton_t buttonInfo;
127 buttonInfo.fittingContent = true;
128 buttonInfo.icon = content->tagValueDetails.detailsButtonIcon;
129 buttonInfo.style = WHITE_BACKGROUND;
130 buttonInfo.text = content->tagValueDetails.detailsButtonText;
131 buttonInfo.token = content->tagValueDetails.detailsButtonToken;
132 buttonInfo.tuneId = content->tagValueDetails.tuneId;
133 buttonInfo.onBottom = false;
134 nbgl_layoutAddButton(layout, &buttonInfo);
135 break;
136 }
137 case TAG_VALUE_CONFIRM: {
138 nbgl_layoutButton_t buttonInfo;
139 if (!headerAdded) {
140 addEmptyHeader(layout, SMALL_CENTERING_HEADER);
141 }
143 // Always display the details button as a normal button (full width),
144 // even if "Confirm" button is on the same page
145 if (content->tagValueConfirm.detailsButtonText != NULL) {
146 buttonInfo.fittingContent = true;
147 buttonInfo.icon = content->tagValueConfirm.detailsButtonIcon;
148 buttonInfo.style = WHITE_BACKGROUND;
149 buttonInfo.text = content->tagValueConfirm.detailsButtonText;
150 buttonInfo.token = content->tagValueConfirm.detailsButtonToken;
151 buttonInfo.tuneId = content->tagValueConfirm.tuneId;
152 buttonInfo.onBottom = false;
153 nbgl_layoutAddButton(layout, &buttonInfo);
154 }
155 else if ((content->tagValueConfirm.detailsButtonIcon != NULL)
156 && (content->tagValueConfirm.confirmationText != NULL)) {
157 // On Flex, a small button with only the icon is displayed on the left
158 // of "Confirm"
161 .rightText = content->tagValueConfirm.confirmationText,
162 .leftToken = content->tagValueConfirm.detailsButtonToken,
163 .rightToken = content->tagValueConfirm.confirmationToken,
164 .tuneId = content->tagValueConfirm.tuneId};
165 nbgl_layoutAddHorizontalButtons(layout, &choice);
166 break;
167 }
168 if (content->tagValueConfirm.confirmationText != NULL) {
169 buttonInfo.fittingContent = false;
170 buttonInfo.icon = NULL;
171 buttonInfo.style = BLACK_BACKGROUND;
172 buttonInfo.text = content->tagValueConfirm.confirmationText;
173 buttonInfo.token = content->tagValueConfirm.confirmationToken;
174 buttonInfo.tuneId = content->tagValueConfirm.tuneId;
175 buttonInfo.onBottom = true;
176 nbgl_layoutAddButton(layout, &buttonInfo);
177 }
178 break;
179 }
180 case SWITCHES_LIST: {
181 uint8_t i;
182 for (i = 0; i < content->switchesList.nbSwitches; i++) {
183 availableHeight -= nbgl_layoutAddSwitch(layout, &content->switchesList.switches[i]);
184 // do not draw a separation line if too low in the container
185 if (availableHeight > 10) {
187 }
188 }
189 break;
190 }
191 case INFOS_LIST: {
192 uint8_t i;
193 for (i = 0; i < content->infosList.nbInfos; i++) {
194 // if the extension is valid for this index, use a Text with Alias
195 if ((content->infosList.withExtensions == true)
196 && (content->infosList.infoExtensions != NULL)
197 && (content->infosList.infoExtensions[i].fullValue != NULL)) {
198 availableHeight
200 content->infosList.infoTypes[i],
201 content->infosList.infoContents[i],
202 content->infosList.token,
203 i);
204 }
205 else {
206 availableHeight -= nbgl_layoutAddText(layout,
207 content->infosList.infoTypes[i],
208 content->infosList.infoContents[i]);
209 }
210 // do not draw a separation line if too low in the container
211 if (availableHeight > 10) {
213 }
214 }
215 break;
216 }
217 case CHOICES_LIST:
218 nbgl_layoutAddRadioChoice(layout, &content->choicesList);
219 break;
220 case BARS_LIST: {
221 uint8_t i;
222 for (i = 0; i < content->barsList.nbBars; i++) {
224 bar.text = content->barsList.barTexts[i];
225 bar.subText = NULL;
226 bar.iconRight = &PUSH_ICON;
227 bar.iconLeft = NULL;
228 bar.token = content->barsList.tokens[i];
229 bar.tuneId = content->barsList.tuneId;
230 bar.large = false;
231 bar.inactive = false;
232 availableHeight -= nbgl_layoutAddTouchableBar(layout, &bar);
233 // do not draw a separation line if too low in the container
234 if (availableHeight > 10) {
236 }
237 }
238 break;
239 }
240 }
241}
242
243/**********************
244 * GLOBAL FUNCTIONS
245 **********************/
246
258 const char *text,
259 int tapActionToken)
260{
261 nbgl_layoutDescription_t layoutDescription;
262 nbgl_layout_t *layout;
263 nbgl_layoutCenteredInfo_t centeredInfo = {.text1 = text,
264 .text2 = NULL,
265 .text3 = NULL,
266 .style = LARGE_CASE_INFO,
267 .icon = &CHECK_CIRCLE_ICON,
268 .offsetY = 0};
269
270 layoutDescription.modal = false;
271 layoutDescription.withLeftBorder = true;
272
273 layoutDescription.onActionCallback = onActionCallback;
274 layoutDescription.tapActionText = "";
275 layoutDescription.tapActionToken = tapActionToken;
276 layoutDescription.tapTuneId = TUNE_TAP_CASUAL;
277
278 layoutDescription.ticker.tickerCallback = ticker->tickerCallback;
279 layoutDescription.ticker.tickerIntervale = ticker->tickerIntervale;
280 layoutDescription.ticker.tickerValue = ticker->tickerValue;
281 layout = nbgl_layoutGet(&layoutDescription);
282
283 addEmptyHeader(layout, SIMPLE_FOOTER_HEIGHT);
284 nbgl_layoutAddCenteredInfo(layout, &centeredInfo);
285
286 nbgl_layoutDraw(layout);
287
288 return (nbgl_page_t *) layout;
289}
290
300nbgl_page_t *nbgl_pageDrawSpinner(const char *text, uint8_t initPosition)
301{
302 nbgl_layoutDescription_t layoutDescription = {0};
303 nbgl_layout_t *layout;
304
305 layoutDescription.withLeftBorder = true;
306
307 layout = nbgl_layoutGet(&layoutDescription);
308
309 nbgl_layoutAddSpinner(layout, text, NULL, initPosition);
310
311 nbgl_layoutDraw(layout);
312
313 return (nbgl_page_t *) layout;
314}
315
327 const nbgl_pageInfoDescription_t *info)
328{
329 nbgl_layoutDescription_t layoutDescription = {0};
330 nbgl_layout_t *layout;
331
332 layoutDescription.modal = false;
333 layoutDescription.withLeftBorder = true;
334
335 layoutDescription.onActionCallback = onActionCallback;
336 if (!info->isSwipeable) {
337 layoutDescription.tapActionText = info->tapActionText;
338 layoutDescription.tapActionToken = info->tapActionToken;
339 layoutDescription.tapTuneId = info->tuneId;
340 }
341
342 if (ticker != NULL) {
343 layoutDescription.ticker.tickerCallback = ticker->tickerCallback;
344 layoutDescription.ticker.tickerIntervale = ticker->tickerIntervale;
345 layoutDescription.ticker.tickerValue = ticker->tickerValue;
346 }
347 else {
348 layoutDescription.ticker.tickerCallback = NULL;
349 }
350 layout = nbgl_layoutGet(&layoutDescription);
351 if (info->isSwipeable) {
352 nbgl_layoutAddSwipe(layout,
353 ((1 << SWIPED_LEFT) | (1 << SWIPED_RIGHT)),
354 info->tapActionText,
355 info->tapActionToken,
356 info->tuneId);
357 }
358 // add an empty header if a top-right button is used
359 if (info->topRightStyle != NO_BUTTON_STYLE) {
360 addEmptyHeader(layout, SMALL_CENTERING_HEADER);
361 }
363
364 // if action button but not QUIT_APP_TEXT bottom button, use a small black button
365 if ((info->actionButtonText != NULL) && (info->bottomButtonStyle != QUIT_APP_TEXT)) {
366 nbgl_layoutButton_t buttonInfo = {.fittingContent = true,
367 .icon = info->actionButtonIcon,
368 .onBottom = false,
369 .style = info->actionButtonStyle,
370 .text = info->actionButtonText,
371 .token = info->bottomButtonsToken,
372 .tuneId = info->tuneId};
373 nbgl_layoutAddButton(layout, &buttonInfo);
374 }
375
376 if (info->footerText != NULL) {
377 nbgl_layoutAddFooter(layout, PIC(info->footerText), info->footerToken, info->tuneId);
378 }
379 if (info->topRightStyle != NO_BUTTON_STYLE) {
380 const nbgl_icon_details_t *icon;
381 if (info->topRightStyle == SETTINGS_ICON) {
382 icon = &WHEEL_ICON;
383 }
384 else if (info->topRightStyle == INFO_ICON) {
385 icon = &INFO_I_ICON;
386 }
387 else if (info->topRightStyle == QUIT_ICON) {
388 icon = &CLOSE_ICON;
389 }
390 else {
391 return NULL;
392 }
393 nbgl_layoutAddTopRightButton(layout, PIC(icon), info->topRightToken, info->tuneId);
394 }
395 if (info->bottomButtonStyle == QUIT_APP_TEXT) {
396 // if action button and QUIT_APP_TEXT bottom button, use a pair of choice buttons
397 if ((info->actionButtonText != NULL)) {
399 .bottomText = "Quit app",
400 .token = info->bottomButtonsToken,
401 .tuneId = info->tuneId,
402 .topIcon = info->actionButtonIcon};
403 buttonsInfo.style = (info->actionButtonStyle == BLACK_BACKGROUND)
406 nbgl_layoutAddChoiceButtons(layout, &buttonsInfo);
407 }
408 else {
409 nbgl_layoutAddFooter(layout, "Quit app", info->bottomButtonsToken, info->tuneId);
410 }
411 }
412 else if (info->bottomButtonStyle != NO_BUTTON_STYLE) {
413 const nbgl_icon_details_t *icon;
414 if (info->bottomButtonStyle == SETTINGS_ICON) {
415 icon = &WHEEL_ICON;
416 }
417 else if (info->bottomButtonStyle == INFO_ICON) {
418 icon = &INFO_I_ICON;
419 }
420 else if (info->bottomButtonStyle == QUIT_ICON) {
421 icon = &CLOSE_ICON;
422 }
423 else {
424 return NULL;
425 }
427 layout, PIC(icon), info->bottomButtonsToken, false, info->tuneId);
428 }
429 nbgl_layoutDraw(layout);
430
431 return (nbgl_page_t *) layout;
432}
433
444{
445 nbgl_layoutDescription_t layoutDescription;
446 nbgl_layout_t *layout;
448 = {.bottomText = (info->cancelText != NULL) ? PIC(info->cancelText) : "Cancel",
449 .token = info->confirmationToken,
450 .topText = PIC(info->confirmationText),
452 .tuneId = info->tuneId};
453
454 layoutDescription.modal = info->modal;
455 layoutDescription.withLeftBorder = true;
456
457 layoutDescription.onActionCallback = onActionCallback;
458 layoutDescription.tapActionText = NULL;
459
460 layoutDescription.ticker.tickerCallback = NULL;
461 layout = nbgl_layoutGet(&layoutDescription);
462
463 addEmptyHeader(layout, MEDIUM_CENTERING_HEADER);
464 nbgl_layoutAddChoiceButtons(layout, &buttonsInfo);
465
467
468 nbgl_layoutDraw(layout);
469
470 return (nbgl_page_t *) layout;
471}
472
484 const nbgl_pageNavigationInfo_t *nav,
485 nbgl_pageContent_t *content,
486 bool modal)
487{
488 nbgl_layoutDescription_t layoutDescription;
489 nbgl_layout_t *layout;
490 uint16_t availableHeight = SCREEN_HEIGHT;
491 bool headerAdded = false;
492
493 layoutDescription.modal = modal;
494 layoutDescription.withLeftBorder = true;
495 layoutDescription.onActionCallback = onActionCallback;
496 layoutDescription.ticker.tickerCallback = NULL;
497
498 if ((nav != NULL) && (nav->navType == NAV_WITH_TAP)) {
499 layoutDescription.tapActionText = nav->navWithTap.nextPageText;
500 layoutDescription.tapActionToken = nav->navWithTap.nextPageToken;
501 layoutDescription.tapTuneId = nav->tuneId;
502 }
503 else {
504 layoutDescription.tapActionText = NULL;
505 }
506
507 layout = nbgl_layoutGet(&layoutDescription);
508 if (nav != NULL) {
509 if (nav->navType == NAV_WITH_TAP) {
510 if (nav->skipText == NULL) {
511 availableHeight -= nbgl_layoutAddFooter(
512 layout, nav->navWithTap.quitText, nav->quitToken, nav->tuneId);
513 }
514 else {
515 availableHeight -= nbgl_layoutAddSplitFooter(layout,
516 nav->navWithTap.quitText,
517 nav->quitToken,
518 nav->skipText,
519 nav->skipToken,
520 nav->tuneId);
521 }
522 if (nav->progressIndicator) {
523 availableHeight -= nbgl_layoutAddProgressIndicator(layout,
524 nav->activePage,
525 nav->nbPages,
528 nav->tuneId);
529 headerAdded = true;
530 }
531 }
532 else if (nav->navType == NAV_WITH_BUTTONS) {
533 nbgl_layoutFooter_t footerDesc;
534 bool drawFooter = true;
535
536 if (nav->skipText != NULL) {
538 .separationLine = false,
539 .rightText.text = nav->skipText,
540 .rightText.token = nav->skipToken,
541 .rightText.tuneId = nav->tuneId};
542 availableHeight -= nbgl_layoutAddHeader(layout, &headerDesc);
543 headerAdded = true;
544 }
545 footerDesc.separationLine = true;
546 if (nav->nbPages > 1) {
547 if (nav->navWithButtons.quitText == NULL) {
548 footerDesc.type = FOOTER_NAV;
549 footerDesc.navigation.activePage = nav->activePage;
550 footerDesc.navigation.nbPages = nav->nbPages;
553 footerDesc.navigation.withPageIndicator = false;
554 footerDesc.navigation.token = nav->navWithButtons.navToken;
555 footerDesc.navigation.tuneId = nav->tuneId;
556 }
557 else {
558 footerDesc.type = FOOTER_TEXT_AND_NAV;
559 footerDesc.textAndNav.text = nav->navWithButtons.quitText;
560 footerDesc.textAndNav.tuneId = nav->tuneId;
561 footerDesc.textAndNav.token = nav->quitToken;
562 footerDesc.textAndNav.navigation.activePage = nav->activePage;
563 footerDesc.textAndNav.navigation.nbPages = nav->nbPages;
564 footerDesc.textAndNav.navigation.withExitKey = false;
568 footerDesc.textAndNav.navigation.withPageIndicator = true;
570 footerDesc.textAndNav.navigation.tuneId = nav->tuneId;
571 }
572 }
573 else if (nav->navWithButtons.quitText != NULL) {
574 // simple footer
575 footerDesc.type = FOOTER_SIMPLE_TEXT;
576 footerDesc.simpleText.text = nav->navWithButtons.quitText;
577 footerDesc.simpleText.mutedOut = false;
578 footerDesc.simpleText.token = nav->quitToken;
579 footerDesc.simpleText.tuneId = nav->tuneId;
580 }
581 else {
582 drawFooter = false;
583 }
584 if (drawFooter) {
585 availableHeight -= nbgl_layoutAddExtendedFooter(layout, &footerDesc);
586 }
587
588#ifdef TARGET_STAX
589 if (nav->progressIndicator) {
590 availableHeight -= nbgl_layoutAddProgressIndicator(
591 layout, nav->activePage, nav->nbPages, false, 0, nav->tuneId);
592 headerAdded = true;
593 }
594#endif // TARGET_STAX
595 }
596 }
597 addContent(content, layout, availableHeight, headerAdded);
598 nbgl_layoutDraw(layout);
599
600 return (nbgl_page_t *) layout;
601}
602
613 const nbgl_pageNavigationInfo_t *nav,
614 nbgl_pageContent_t *content)
615{
616 return nbgl_pageDrawGenericContentExt(onActionCallback, nav, content, false);
617}
618
626{
627 int ret;
628
629 LOG_DEBUG(PAGE_LOGGER, "nbgl_pageRelease(): \n");
630 ret = nbgl_layoutRelease((nbgl_layout_t *) page);
631
632 return ret;
633}
634#endif // NBGL_PAGE
@ ICON_ILLUSTRATION
simple icon
@ LARGE_CASE_INFO
text in BLACK and large case (INTER 32px), subText in black in Inter24px
@ 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_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.
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_layoutAddText(nbgl_layout_t *layout, const char *text, const char *subText)
Creates an area with given text (in bold) and sub text (in regular)
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 ...
int nbgl_layoutAddSeparationLine(nbgl_layout_t *layout)
adds a separation line on bottom of the last added item
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_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.
@ WHITE_BACKGROUND
rounded bordered button, with text/icon in black, on white background
@ 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.
@ UP_FOOTER_TIP_BOX
Tip-box.
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...
@ HEADER_EMPTY
empty space, to have a better vertical centering of centered info
@ HEADER_BACK_AND_TEXT
back key and optional text
@ HEADER_RIGHT_TEXT
touchable text on the right, with a vertical separation line
int nbgl_layoutAddButton(nbgl_layout_t *layout, const nbgl_layoutButton_t *buttonInfo)
Creates a rounded button in the main container.
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,...
@ SOFT_ACTION_AND_FOOTER_STYLE
A white button on top of a footer, with a separation line.
@ 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_layoutAddLongPressButton(nbgl_layout_t *layout, const char *text, uint8_t token, tune_index_e tuneId)
Creates a long press button in the main container.
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.
@ FOOTER_SIMPLE_TEXT
simple touchable text in bold
@ FOOTER_NAV
navigation bar
@ FOOTER_TEXT_AND_NAV
int nbgl_layoutRelease(nbgl_layout_t *layout)
Release the layout obtained with nbgl_layoutGet()
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...
nbgl_page_t * nbgl_pageDrawGenericContent(nbgl_layoutTouchCallback_t onActionCallback, const nbgl_pageNavigationInfo_t *nav, nbgl_pageContent_t *content)
draw a generic content page, with the given content, and if nav parameter is not NULL,...
Definition nbgl_page.c:612
int nbgl_pageRelease(nbgl_page_t *page)
Release the page obtained with any of the nbgl_pageDrawXXX() functions.
Definition nbgl_page.c:625
nbgl_page_t * nbgl_pageDrawInfo(nbgl_layoutTouchCallback_t onActionCallback, const nbgl_screenTickerConfiguration_t *ticker, const nbgl_pageInfoDescription_t *info)
draw a page with a centered info (icon and/or texts) with a touchable footer, in a potential "tapable...
Definition nbgl_page.c:325
nbgl_page_t * nbgl_pageDrawLedgerInfo(nbgl_layoutTouchCallback_t onActionCallback, const nbgl_screenTickerConfiguration_t *ticker, const char *text, int tapActionToken)
draw a page with a centered text in large case, with a round check icon
Definition nbgl_page.c:256
nbgl_page_t * nbgl_pageDrawConfirmation(nbgl_layoutTouchCallback_t onActionCallback, const nbgl_pageConfirmationDescription_t *info)
draw a confirmation page, with a centered info (icon and/or text), a button to confirm and a footer t...
Definition nbgl_page.c:442
nbgl_page_t * nbgl_pageDrawSpinner(const char *text, uint8_t initPosition)
draw a spinner page with the given parameters. The spinner will "rotate" automatically every 800 ms
Definition nbgl_page.c:300
nbgl_page_t * nbgl_pageDrawGenericContentExt(nbgl_layoutTouchCallback_t onActionCallback, const nbgl_pageNavigationInfo_t *nav, nbgl_pageContent_t *content, bool modal)
draw a generic content page, with the given content, and if nav parameter is not NULL,...
Definition nbgl_page.c:483
API of the Advanced BOLOS Graphical Library, for predefined pages.
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
@ 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:275
@ SWIPED_RIGHT
Definition nbgl_types.h:274
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
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.
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)
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 char * topText
up-button text (index 0)
const char * bottomText
bottom-button text (index 1)
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.
struct nbgl_layoutFooter_t::@19::@24 textAndNav
if type is FOOTER_TEXT_AND_NAV
bool separationLine
if true, a separation line is added at the top of this control
struct nbgl_layoutFooter_t::@19::@22 simpleText
if type is FOOTER_SIMPLE_TEXT
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 * text
tune_index_e tuneId
This structure contains info to build a header.
nbgl_layoutHeaderType_t type
type of header
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 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 an up-footer (area on top of footer).
nbgl_layoutUpFooterType_t type
type of up-footer
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:66
nbgl_contentSwitchesList_t switchesList
SWITCHES_LIST type
Definition nbgl_flow.h:64
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:67
nbgl_contentInfoButton_t infoButton
INFO_BUTTON type
Definition nbgl_flow.h:62
nbgl_contentInfoList_t infosList
INFOS_LIST type
Definition nbgl_flow.h:65
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_page.h:69
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)