Embedded SDK
Embedded SDK
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  **********************/
31 static 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 
38 static 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;
59  centeredInfo.icon = content->infoLongPress.icon;
60  centeredInfo.title = content->infoLongPress.text;
61  centeredInfo.smallTitle = NULL;
62  centeredInfo.description = NULL;
63  centeredInfo.iconHug = 0;
64  centeredInfo.subText = NULL;
65  centeredInfo.padding = false;
66  nbgl_layoutAddContentCenter(layout, &centeredInfo);
68  content->infoLongPress.longPressText,
69  content->infoLongPress.longPressToken,
70  content->infoLongPress.tuneId);
71  break;
72  }
73  case INFO_BUTTON: {
74  nbgl_contentCenter_t centeredInfo;
75  nbgl_layoutButton_t buttonInfo;
76 
77  centeredInfo.icon = content->infoButton.icon;
78  centeredInfo.title = content->infoButton.text;
79  centeredInfo.smallTitle = NULL;
80  centeredInfo.description = NULL;
81  centeredInfo.iconHug = 0;
82  centeredInfo.subText = NULL;
83  centeredInfo.padding = false;
84  nbgl_layoutAddContentCenter(layout, &centeredInfo);
85 
86  buttonInfo.fittingContent = false;
87  buttonInfo.icon = NULL;
88  buttonInfo.onBottom = true;
89  buttonInfo.style = BLACK_BACKGROUND;
90  buttonInfo.text = content->infoButton.buttonText;
91  buttonInfo.token = content->infoButton.buttonToken;
92  buttonInfo.tuneId = content->infoButton.tuneId;
93  nbgl_layoutAddButton(layout, &buttonInfo);
94  break;
95  }
96  case CENTERED_INFO:
97  if (!headerAdded) {
98  addEmptyHeader(layout, SMALL_CENTERING_HEADER);
99  }
100  nbgl_layoutAddCenteredInfo(layout, &content->centeredInfo);
101  break;
102 
103  case EXTENDED_CENTER:
104  if ((!headerAdded) && (content->extendedCenter.tipBox.text == NULL)) {
105  addEmptyHeader(layout, SMALL_CENTERING_HEADER);
106  }
107  nbgl_layoutAddContentCenter(layout, &content->extendedCenter.contentCenter);
108  if (content->extendedCenter.tipBox.text != NULL) {
109  nbgl_layoutUpFooter_t upFooterDesc
110  = {.type = UP_FOOTER_TIP_BOX,
111  .tipBox.text = content->extendedCenter.tipBox.text,
112  .tipBox.icon = content->extendedCenter.tipBox.icon,
113  .tipBox.token = content->extendedCenter.tipBox.token,
114  .tipBox.tuneId = content->extendedCenter.tipBox.tuneId};
115  nbgl_layoutAddUpFooter(layout, &upFooterDesc);
116  }
117  break;
118 
119  case TAG_VALUE_LIST:
120  // add a space of 32/40px if no header already added
121  if (!headerAdded) {
122  addEmptyHeader(layout, SMALL_CENTERING_HEADER);
123  }
124  nbgl_layoutAddTagValueList(layout, &content->tagValueList);
125  break;
126  case TAG_VALUE_DETAILS: {
127  // add a space of 32/40px if no header already added
128  if (!headerAdded) {
129  addEmptyHeader(layout, SMALL_CENTERING_HEADER);
130  }
131  // display a button under tag/value
132  nbgl_layoutButton_t buttonInfo;
133  content->tagValueDetails.tagValueList.nbMaxLinesForValue -= 3;
134  nbgl_layoutAddTagValueList(layout, &content->tagValueDetails.tagValueList);
135  buttonInfo.fittingContent = true;
136  buttonInfo.icon = content->tagValueDetails.detailsButtonIcon;
137  buttonInfo.style = WHITE_BACKGROUND;
138  buttonInfo.text = content->tagValueDetails.detailsButtonText;
139  buttonInfo.token = content->tagValueDetails.detailsButtonToken;
140  buttonInfo.tuneId = content->tagValueDetails.tuneId;
141  buttonInfo.onBottom = false;
142  nbgl_layoutAddButton(layout, &buttonInfo);
143  break;
144  }
145  case TAG_VALUE_CONFIRM: {
146  nbgl_layoutButton_t buttonInfo;
147  if (!headerAdded) {
148  addEmptyHeader(layout, SMALL_CENTERING_HEADER);
149  }
150  nbgl_layoutAddTagValueList(layout, &content->tagValueConfirm.tagValueList);
151  // Always display the details button as a normal button (full width),
152  // even if "Confirm" button is on the same page
153  if (content->tagValueConfirm.detailsButtonText != NULL) {
154  buttonInfo.fittingContent = true;
155  buttonInfo.icon = content->tagValueConfirm.detailsButtonIcon;
156  buttonInfo.style = WHITE_BACKGROUND;
157  buttonInfo.text = content->tagValueConfirm.detailsButtonText;
158  buttonInfo.token = content->tagValueConfirm.detailsButtonToken;
159  buttonInfo.tuneId = content->tagValueConfirm.tuneId;
160  buttonInfo.onBottom = false;
161  nbgl_layoutAddButton(layout, &buttonInfo);
162  }
163  else if ((content->tagValueConfirm.detailsButtonIcon != NULL)
164  && (content->tagValueConfirm.confirmationText != NULL)) {
165  // On Flex, a small button with only the icon is displayed on the left
166  // of "Confirm"
168  = {.leftIcon = content->tagValueConfirm.detailsButtonIcon,
169  .rightText = content->tagValueConfirm.confirmationText,
170  .leftToken = content->tagValueConfirm.detailsButtonToken,
171  .rightToken = content->tagValueConfirm.confirmationToken,
172  .tuneId = content->tagValueConfirm.tuneId};
173  nbgl_layoutAddHorizontalButtons(layout, &choice);
174  break;
175  }
176  if (content->tagValueConfirm.confirmationText != NULL) {
177  buttonInfo.fittingContent = false;
178  buttonInfo.icon = NULL;
179  buttonInfo.style = BLACK_BACKGROUND;
180  buttonInfo.text = content->tagValueConfirm.confirmationText;
181  buttonInfo.token = content->tagValueConfirm.confirmationToken;
182  buttonInfo.tuneId = content->tagValueConfirm.tuneId;
183  buttonInfo.onBottom = true;
184  nbgl_layoutAddButton(layout, &buttonInfo);
185  }
186  break;
187  }
188  case SWITCHES_LIST: {
189  uint8_t i;
190  for (i = 0; i < content->switchesList.nbSwitches; i++) {
191  availableHeight -= nbgl_layoutAddSwitch(layout, &content->switchesList.switches[i]);
192  // do not draw a separation line if too low in the container
193  if (availableHeight > 10) {
195  }
196  }
197  break;
198  }
199  case INFOS_LIST: {
200  uint8_t i;
201  for (i = 0; i < content->infosList.nbInfos; i++) {
202  availableHeight -= nbgl_layoutAddText(
203  layout, content->infosList.infoTypes[i], content->infosList.infoContents[i]);
204  // do not draw a separation line if too low in the container
205  if (availableHeight > 10) {
207  }
208  }
209  break;
210  }
211  case CHOICES_LIST:
212  nbgl_layoutAddRadioChoice(layout, &content->choicesList);
213  break;
214  case BARS_LIST: {
215  uint8_t i;
216  for (i = 0; i < content->barsList.nbBars; i++) {
217  nbgl_layoutBar_t bar;
218  bar.text = content->barsList.barTexts[i];
219  bar.subText = NULL;
220  bar.iconRight = &PUSH_ICON;
221  bar.iconLeft = NULL;
222  bar.token = content->barsList.tokens[i];
223  bar.tuneId = content->barsList.tuneId;
224  bar.large = false;
225  bar.inactive = false;
226  availableHeight -= nbgl_layoutAddTouchableBar(layout, &bar);
227  // do not draw a separation line if too low in the container
228  if (availableHeight > 10) {
230  }
231  }
232  break;
233  }
234  }
235 }
236 
237 /**********************
238  * GLOBAL FUNCTIONS
239  **********************/
240 
251  const nbgl_screenTickerConfiguration_t *ticker,
252  const char *text,
253  int tapActionToken)
254 {
255  nbgl_layoutDescription_t layoutDescription;
256  nbgl_layout_t *layout;
257  nbgl_layoutCenteredInfo_t centeredInfo = {.text1 = text,
258  .text2 = NULL,
259  .text3 = NULL,
260  .style = LARGE_CASE_INFO,
261  .icon = &C_Check_Circle_64px,
262  .offsetY = 0};
263 
264  layoutDescription.modal = false;
265  layoutDescription.withLeftBorder = true;
266 
267  layoutDescription.onActionCallback = onActionCallback;
268  layoutDescription.tapActionText = "";
269  layoutDescription.tapActionToken = tapActionToken;
270  layoutDescription.tapTuneId = TUNE_TAP_CASUAL;
271 
272  layoutDescription.ticker.tickerCallback = ticker->tickerCallback;
273  layoutDescription.ticker.tickerIntervale = ticker->tickerIntervale;
274  layoutDescription.ticker.tickerValue = ticker->tickerValue;
275  layout = nbgl_layoutGet(&layoutDescription);
276 
277  addEmptyHeader(layout, SIMPLE_FOOTER_HEIGHT);
278  nbgl_layoutAddCenteredInfo(layout, &centeredInfo);
279 
280  nbgl_layoutDraw(layout);
281 
282  return (nbgl_page_t *) layout;
283 }
284 
293 nbgl_page_t *nbgl_pageDrawSpinner(nbgl_layoutTouchCallback_t onActionCallback, const char *text)
294 {
295  nbgl_layoutDescription_t layoutDescription;
296  nbgl_layout_t *layout;
297 
298  layoutDescription.modal = false;
299  layoutDescription.withLeftBorder = true;
300 
301  layoutDescription.onActionCallback = onActionCallback;
302  layoutDescription.tapActionText = NULL;
303 
304  layoutDescription.ticker.tickerCallback = NULL;
305  layout = nbgl_layoutGet(&layoutDescription);
306 
307  nbgl_layoutAddSpinner(layout, text, false);
308 
309  nbgl_layoutDraw(layout);
310 
311  return (nbgl_page_t *) layout;
312 }
313 
324  const nbgl_screenTickerConfiguration_t *ticker,
325  const nbgl_pageInfoDescription_t *info)
326 {
327  nbgl_layoutDescription_t layoutDescription = {0};
328  nbgl_layout_t *layout;
329 
330  layoutDescription.modal = false;
331  layoutDescription.withLeftBorder = true;
332 
333  layoutDescription.onActionCallback = onActionCallback;
334  if (!info->isSwipeable) {
335  layoutDescription.tapActionText = info->tapActionText;
336  layoutDescription.tapActionToken = info->tapActionToken;
337  layoutDescription.tapTuneId = info->tuneId;
338  }
339 
340  if (ticker != NULL) {
341  layoutDescription.ticker.tickerCallback = ticker->tickerCallback;
342  layoutDescription.ticker.tickerIntervale = ticker->tickerIntervale;
343  layoutDescription.ticker.tickerValue = ticker->tickerValue;
344  }
345  else {
346  layoutDescription.ticker.tickerCallback = NULL;
347  }
348  layout = nbgl_layoutGet(&layoutDescription);
349  if (info->isSwipeable) {
350  nbgl_layoutAddSwipe(layout,
351  ((1 << SWIPED_LEFT) | (1 << SWIPED_RIGHT)),
352  info->tapActionText,
353  info->tapActionToken,
354  info->tuneId);
355  }
356  // add an empty header if a top-right button is used
357  if (info->topRightStyle != NO_BUTTON_STYLE) {
358  addEmptyHeader(layout, SMALL_CENTERING_HEADER);
359  }
361 
362  // if action button but not QUIT_APP_TEXT bottom button, use a small black button
363  if ((info->actionButtonText != NULL) && (info->bottomButtonStyle != QUIT_APP_TEXT)) {
364  nbgl_layoutButton_t buttonInfo = {.fittingContent = true,
365  .icon = info->actionButtonIcon,
366  .onBottom = false,
367  .style = info->actionButtonStyle,
368  .text = info->actionButtonText,
369  .token = info->bottomButtonsToken,
370  .tuneId = info->tuneId};
371  nbgl_layoutAddButton(layout, &buttonInfo);
372  }
373 
374  if (info->footerText != NULL) {
375  nbgl_layoutAddFooter(layout, PIC(info->footerText), info->footerToken, info->tuneId);
376  }
377  if (info->topRightStyle != NO_BUTTON_STYLE) {
378  const nbgl_icon_details_t *icon;
379  if (info->topRightStyle == SETTINGS_ICON) {
380  icon = &WHEEL_ICON;
381  }
382  else if (info->topRightStyle == INFO_ICON) {
383  icon = &INFO_I_ICON;
384  }
385  else if (info->topRightStyle == QUIT_ICON) {
386  icon = &CLOSE_ICON;
387  }
388  else {
389  return NULL;
390  }
391  nbgl_layoutAddTopRightButton(layout, PIC(icon), info->topRightToken, info->tuneId);
392  }
393  if (info->bottomButtonStyle == QUIT_APP_TEXT) {
394  // if action button and QUIT_APP_TEXT bottom button, use a pair of choice buttons
395  if ((info->actionButtonText != NULL)) {
396  nbgl_layoutChoiceButtons_t buttonsInfo = {.topText = info->actionButtonText,
397  .bottomText = "Quit app",
398  .token = info->bottomButtonsToken,
399  .style = BOTH_ROUNDED_STYLE,
400  .tuneId = info->tuneId,
401  .topIcon = info->actionButtonIcon};
402  buttonsInfo.style = (info->actionButtonStyle == BLACK_BACKGROUND)
405  nbgl_layoutAddChoiceButtons(layout, &buttonsInfo);
406  }
407  else {
408  nbgl_layoutAddFooter(layout, "Quit app", info->bottomButtonsToken, info->tuneId);
409  }
410  }
411  else if (info->bottomButtonStyle != NO_BUTTON_STYLE) {
412  const nbgl_icon_details_t *icon;
413  if (info->bottomButtonStyle == SETTINGS_ICON) {
414  icon = &WHEEL_ICON;
415  }
416  else if (info->bottomButtonStyle == INFO_ICON) {
417  icon = &INFO_I_ICON;
418  }
419  else if (info->bottomButtonStyle == QUIT_ICON) {
420  icon = &CLOSE_ICON;
421  }
422  else {
423  return NULL;
424  }
426  layout, PIC(icon), info->bottomButtonsToken, false, info->tuneId);
427  }
428  nbgl_layoutDraw(layout);
429 
430  return (nbgl_page_t *) layout;
431 }
432 
443 {
444  nbgl_layoutDescription_t layoutDescription;
445  nbgl_layout_t *layout;
446  nbgl_layoutChoiceButtons_t buttonsInfo
447  = {.bottomText = (info->cancelText != NULL) ? PIC(info->cancelText) : "Cancel",
448  .token = info->confirmationToken,
449  .topText = PIC(info->confirmationText),
450  .style = ROUNDED_AND_FOOTER_STYLE,
451  .tuneId = info->tuneId};
452 
453  layoutDescription.modal = info->modal;
454  layoutDescription.withLeftBorder = true;
455 
456  layoutDescription.onActionCallback = onActionCallback;
457  layoutDescription.tapActionText = NULL;
458 
459  layoutDescription.ticker.tickerCallback = NULL;
460  layout = nbgl_layoutGet(&layoutDescription);
461 
462  addEmptyHeader(layout, MEDIUM_CENTERING_HEADER);
463  nbgl_layoutAddChoiceButtons(layout, &buttonsInfo);
464 
466 
467  nbgl_layoutDraw(layout);
468 
469  return (nbgl_page_t *) layout;
470 }
471 
483  const nbgl_pageNavigationInfo_t *nav,
484  nbgl_pageContent_t *content,
485  bool modal)
486 {
487  nbgl_layoutDescription_t layoutDescription;
488  nbgl_layout_t *layout;
489  uint16_t availableHeight = SCREEN_HEIGHT;
490  bool headerAdded = false;
491 
492  layoutDescription.modal = modal;
493  layoutDescription.withLeftBorder = true;
494  layoutDescription.onActionCallback = onActionCallback;
495  layoutDescription.ticker.tickerCallback = NULL;
496 
497  if ((nav != NULL) && (nav->navType == NAV_WITH_TAP)) {
498  layoutDescription.tapActionText = nav->navWithTap.nextPageText;
499  layoutDescription.tapActionToken = nav->navWithTap.nextPageToken;
500  layoutDescription.tapTuneId = nav->tuneId;
501  }
502  else {
503  layoutDescription.tapActionText = NULL;
504  }
505 
506  layout = nbgl_layoutGet(&layoutDescription);
507  if (nav != NULL) {
508  if (nav->navType == NAV_WITH_TAP) {
509  if (nav->skipText == NULL) {
510  availableHeight -= nbgl_layoutAddFooter(
511  layout, nav->navWithTap.quitText, nav->quitToken, nav->tuneId);
512  }
513  else {
514  availableHeight -= nbgl_layoutAddSplitFooter(layout,
515  nav->navWithTap.quitText,
516  nav->quitToken,
517  nav->skipText,
518  nav->skipToken,
519  nav->tuneId);
520  }
521  if (nav->progressIndicator) {
522  availableHeight -= nbgl_layoutAddProgressIndicator(layout,
523  nav->activePage,
524  nav->nbPages,
525  nav->navWithTap.backButton,
526  nav->navWithTap.backToken,
527  nav->tuneId);
528  headerAdded = true;
529  }
530  }
531  else if (nav->navType == NAV_WITH_BUTTONS) {
532  nbgl_layoutFooter_t footerDesc;
533  bool drawFooter = true;
534 
535  if (nav->skipText != NULL) {
536  nbgl_layoutHeader_t headerDesc = {.type = HEADER_RIGHT_TEXT,
537  .separationLine = false,
538  .rightText.text = nav->skipText,
539  .rightText.token = nav->skipToken,
540  .rightText.tuneId = nav->tuneId};
541  availableHeight -= nbgl_layoutAddHeader(layout, &headerDesc);
542  headerAdded = true;
543  }
544  footerDesc.separationLine = true;
545  if (nav->nbPages > 1) {
546  if (nav->navWithButtons.quitText == NULL) {
547  footerDesc.type = FOOTER_NAV;
548  footerDesc.navigation.activePage = nav->activePage;
549  footerDesc.navigation.nbPages = nav->nbPages;
552  footerDesc.navigation.withPageIndicator = false;
553  footerDesc.navigation.token = nav->navWithButtons.navToken;
554  footerDesc.navigation.tuneId = nav->tuneId;
555  }
556  else {
557  footerDesc.type = FOOTER_TEXT_AND_NAV;
558  footerDesc.textAndNav.text = nav->navWithButtons.quitText;
559  footerDesc.textAndNav.tuneId = nav->tuneId;
560  footerDesc.textAndNav.token = nav->quitToken;
561  footerDesc.textAndNav.navigation.activePage = nav->activePage;
562  footerDesc.textAndNav.navigation.nbPages = nav->nbPages;
563  footerDesc.textAndNav.navigation.withExitKey = false;
564  footerDesc.textAndNav.navigation.withBackKey = nav->navWithButtons.backButton;
565  footerDesc.textAndNav.navigation.visibleIndicator
567  footerDesc.textAndNav.navigation.withPageIndicator = true;
568  footerDesc.textAndNav.navigation.token = nav->navWithButtons.navToken;
569  footerDesc.textAndNav.navigation.tuneId = nav->tuneId;
570  }
571  }
572  else if (nav->navWithButtons.quitText != NULL) {
573  // simple footer
574  footerDesc.type = FOOTER_SIMPLE_TEXT;
575  footerDesc.simpleText.text = nav->navWithButtons.quitText;
576  footerDesc.simpleText.mutedOut = false;
577  footerDesc.simpleText.token = nav->quitToken;
578  footerDesc.simpleText.tuneId = nav->tuneId;
579  }
580  else {
581  drawFooter = false;
582  }
583  if (drawFooter) {
584  availableHeight -= nbgl_layoutAddExtendedFooter(layout, &footerDesc);
585  }
586 
587 #ifdef TARGET_STAX
588  if (nav->progressIndicator) {
589  availableHeight -= nbgl_layoutAddProgressIndicator(
590  layout, nav->activePage, nav->nbPages, false, 0, nav->tuneId);
591  headerAdded = true;
592  }
593 #endif // TARGET_STAX
594  }
595  }
596  addContent(content, layout, availableHeight, headerAdded);
597  nbgl_layoutDraw(layout);
598 
599  return (nbgl_page_t *) layout;
600 }
601 
612  const nbgl_pageNavigationInfo_t *nav,
613  nbgl_pageContent_t *content)
614 {
615  return nbgl_pageDrawGenericContentExt(onActionCallback, nav, content, false);
616 }
617 
625 {
626  int ret;
627 
628  LOG_DEBUG(PAGE_LOGGER, "nbgl_pageRelease(): \n");
629  ret = nbgl_layoutRelease((nbgl_layout_t *) page);
630 
631  return ret;
632 }
633 #endif // NBGL_PAGE
@ LARGE_CASE_INFO
text in BLACK and large case (INTER 32px), subText in black in Inter24px
Definition: nbgl_content.h:36
@ INFO_LONG_PRESS
a centered info and a long press button
Definition: nbgl_content.h:332
@ EXTENDED_CENTER
a centered content and a possible tip-box
Definition: nbgl_content.h:331
@ CHOICES_LIST
list of choices through radio buttons
Definition: nbgl_content.h:339
@ CENTERED_INFO
a centered info
Definition: nbgl_content.h:330
@ SWITCHES_LIST
list of switches with descriptions
Definition: nbgl_content.h:337
@ TAG_VALUE_DETAILS
a tag/value pair and a small button to get details.
Definition: nbgl_content.h:335
@ INFOS_LIST
list of infos with titles
Definition: nbgl_content.h:338
@ TAG_VALUE_CONFIRM
tag/value pairs and a black button/footer to confirm/cancel.
Definition: nbgl_content.h:336
@ TAG_VALUE_LIST
list of tag/value pairs
Definition: nbgl_content.h:334
@ BARS_LIST
list of touchable bars (with > on the right to go to sub-pages)
Definition: nbgl_content.h:340
@ INFO_BUTTON
a centered info and a simple black button
Definition: nbgl_content.h:333
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
Definition: nbgl_layout.h:104
#define SIMPLE_FOOTER_HEIGHT
Definition: nbgl_layout.h:60
int nbgl_layoutAddTagValueList(nbgl_layout_t *layout, const nbgl_layoutTagValueList_t *list)
Creates a list of [tag,value] pairs.
Definition: nbgl_layout.c:1809
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.
Definition: nbgl_layout.c:1614
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,...
Definition: nbgl_layout.c:2892
#define MEDIUM_CENTERING_HEADER
Definition: nbgl_layout.h:62
int nbgl_layoutAddText(nbgl_layout_t *layout, const char *text, const char *subText)
Creates an area with given text and sub text (in gray)
Definition: nbgl_layout.c:1197
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 ...
Definition: nbgl_layout.c:3192
int nbgl_layoutAddSeparationLine(nbgl_layout_t *layout)
adds a separation line on bottom of the last added item
Definition: nbgl_layout.c:2032
int nbgl_layoutAddRadioChoice(nbgl_layout_t *layout, const nbgl_layoutRadioChoice_t *choices)
Creates a list of radio buttons (on the right)
Definition: nbgl_layout.c:1454
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...
Definition: nbgl_layout.c:1551
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...
Definition: nbgl_layout.c:2209
int nbgl_layoutDraw(nbgl_layout_t *layout)
Applies given layout. The screen will be redrawn.
Definition: nbgl_layout.c:3286
int nbgl_layoutAddTouchableBar(nbgl_layout_t *layout, const nbgl_layoutBar_t *barLayout)
Creates a touchable bar in main panel.
Definition: nbgl_layout.c:1118
@ WHITE_BACKGROUND
rounded bordered button, with text/icon in black, on white background
Definition: nbgl_layout.h:327
@ BLACK_BACKGROUND
rounded bordered button, with text/icon in white, on black background
Definition: nbgl_layout.h:325
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.
Definition: nbgl_layout.c:1021
@ UP_FOOTER_TIP_BOX
Tip-box.
Definition: nbgl_layout.h:519
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.
Definition: nbgl_layout.c:980
void * nbgl_layout_t
type shared externally
Definition: nbgl_layout.h:96
int nbgl_layoutAddSwitch(nbgl_layout_t *layout, const nbgl_layoutSwitch_t *switchLayout)
Creates a switch with the given text and its state.
Definition: nbgl_layout.c:1157
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...
Definition: nbgl_layout.c:1788
@ HEADER_EMPTY
empty space, to have a better vertical centering of centered info
Definition: nbgl_layout.h:406
@ HEADER_BACK_AND_TEXT
back key and optional text
Definition: nbgl_layout.h:407
@ HEADER_RIGHT_TEXT
touchable text on the right, with a vertical separation line
Definition: nbgl_layout.h:411
int nbgl_layoutAddButton(nbgl_layout_t *layout, const nbgl_layoutButton_t *buttonInfo)
Creates a rounded button in the main container.
Definition: nbgl_layout.c:2052
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,...
Definition: nbgl_layout.c:2498
@ SOFT_ACTION_AND_FOOTER_STYLE
A white button on top of a footer, with a separation line.
Definition: nbgl_layout.h:282
@ ROUNDED_AND_FOOTER_STYLE
A black background button on top of a footer.
Definition: nbgl_layout.h:280
@ STRONG_ACTION_AND_FOOTER_STYLE
A black button on top of a footer, with a separation line.
Definition: nbgl_layout.h:281
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,...
Definition: nbgl_layout.c:1765
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.
Definition: nbgl_layout.c:2154
#define BOTH_ROUNDED_STYLE
Definition: nbgl_layout.h:286
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,...
Definition: nbgl_layout.c:2235
#define SMALL_CENTERING_HEADER
Definition: nbgl_layout.h:61
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.
Definition: nbgl_layout.c:1092
@ FOOTER_SIMPLE_TEXT
simple touchable text in bold
Definition: nbgl_layout.h:465
@ FOOTER_NAV
navigation bar
Definition: nbgl_layout.h:469
@ FOOTER_TEXT_AND_NAV
Definition: nbgl_layout.h:467
int nbgl_layoutRelease(nbgl_layout_t *layout)
Release the layout obtained with nbgl_layoutGet()
Definition: nbgl_layout.c:3317
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...
Definition: nbgl_layout.c:2182
int nbgl_layoutAddSpinner(nbgl_layout_t *layout, const char *text, bool fixed)
Creates a centered (vertically & horizontally) spinner with a text under it.
Definition: nbgl_layout.c:3221
nbgl_layout_t * nbgl_layoutGet(const nbgl_layoutDescription_t *description)
returns a layout of the given type. The layout is reset
Definition: nbgl_layout.c:891
#define INFO_I_ICON
Definition: nbgl_obj.h:145
#define PUSH_ICON
Definition: nbgl_obj.h:138
#define WHEEL_ICON
Definition: nbgl_obj.h:144
#define CLOSE_ICON
Definition: nbgl_obj.h:143
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:611
nbgl_page_t * nbgl_pageDrawSpinner(nbgl_layoutTouchCallback_t onActionCallback, const char *text)
draw a spinner page with the given parameters. The spinner will "rotate" automatically every 800 ms
Definition: nbgl_page.c:293
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:250
int nbgl_pageRelease(nbgl_page_t *page)
Release the page obtained with any of the nbgl_pageDrawXXX() functions.
Definition: nbgl_page.c:624
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:482
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:323
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:441
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:236
@ SWIPED_RIGHT
Definition: nbgl_types.h:235
#define SCREEN_HEIGHT
Definition: nbgl_types.h:45
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,...
Definition: nbgl_content.h:81
uint16_t iconHug
vertical margin to apply on top and bottom of the icon
Definition: nbgl_content.h:87
const nbgl_icon_details_t * icon
the icon (can be null)
Definition: nbgl_content.h:82
const char * title
title in black large (can be null)
Definition: nbgl_content.h:83
const char * description
description in black small regular case (can be null)
Definition: nbgl_content.h:85
const char * subText
sub-text in dark gray regular small case
Definition: nbgl_content.h:86
bool padding
if true, apply a padding of 40px at the bottom
Definition: nbgl_content.h:88
const char * smallTitle
sub-title in black small bold case (can be null)
Definition: nbgl_content.h:84
This structure contains info to build a centered (vertically and horizontally) area,...
Definition: nbgl_content.h:57
const char * text1
first text (can be null)
Definition: nbgl_content.h:58
This structure contains info to build a clickable "bar" with a text and an icon.
Definition: nbgl_layout.h:197
bool inactive
if set to true, the bar is grayed-out and cannot be touched
Definition: nbgl_layout.h:206
const char * text
text (can be NULL)
Definition: nbgl_layout.h:200
uint8_t token
the token that will be used as argument of the callback
Definition: nbgl_layout.h:205
bool large
set to true only for the main level of OS settings
Definition: nbgl_layout.h:204
const char * subText
sub text (can be NULL)
Definition: nbgl_layout.h:203
const nbgl_icon_details_t * iconLeft
a buffer containing the 1BPP icon for icon on left (can be NULL)
Definition: nbgl_layout.h:199
const nbgl_icon_details_t * iconRight
Definition: nbgl_layout.h:201
This structure contains info to build a single button.
Definition: nbgl_layout.h:335
const char * text
button text
Definition: nbgl_layout.h:336
uint8_t token
the token that will be used as argument of the callback
Definition: nbgl_layout.h:338
const nbgl_icon_details_t * icon
a buffer containing the 1BPP icon for button
Definition: nbgl_layout.h:337
nbgl_layoutButtonStyle_t style
Definition: nbgl_layout.h:339
bool fittingContent
if set to true, fit the width of button to text, otherwise full width
Definition: nbgl_layout.h:340
This structure contains info to build a pair of buttons, one on top of the other.
Definition: nbgl_layout.h:293
nbgl_layoutChoiceButtonsStyle_t style
the style of the pair
Definition: nbgl_layout.h:298
const char * topText
up-button text (index 0)
Definition: nbgl_layout.h:294
const char * bottomText
bottom-button text (index 1)
Definition: nbgl_layout.h:295
Structure containing all information when creating a layout. This structure must be passed as argumen...
Definition: nbgl_layout.h:171
nbgl_screenTickerConfiguration_t ticker
Definition: nbgl_layout.h:190
const char * tapActionText
Light gray text used when main container is "tapable".
Definition: nbgl_layout.h:177
nbgl_layoutTouchCallback_t onActionCallback
the callback to be called on any action on the layout
Definition: nbgl_layout.h:185
This structure contains info to build an extended footer.
Definition: nbgl_layout.h:479
bool separationLine
if true, a separation line is added at the top of this control
Definition: nbgl_layout.h:481
struct nbgl_layoutFooter_t::@15::@18 simpleText
if type is FOOTER_SIMPLE_TEXT
nbgl_layoutFooterType_t type
type of footer
Definition: nbgl_layout.h:480
nbgl_layoutNavigationBar_t navigation
if type is FOOTER_NAV
Definition: nbgl_layout.h:500
struct nbgl_layoutFooter_t::@15::@20 textAndNav
if type is FOOTER_TEXT_AND_NAV
This structure contains info to build a header.
Definition: nbgl_layout.h:419
nbgl_layoutHeaderType_t type
type of header
Definition: nbgl_layout.h:420
This structure contains info to build a pair of buttons, the small one, with icon,...
Definition: nbgl_layout.h:310
const nbgl_icon_details_t * leftIcon
a buffer containing the 1BPP icon for left button
Definition: nbgl_layout.h:311
uint8_t activePage
index of active page (from 0 to nbPages-1).
Definition: nbgl_layout.h:121
bool withBackKey
if set to true, the "back" key is drawn
Definition: nbgl_layout.h:123
bool withExitKey
if set to true, an exit button is drawn (X on the left)
Definition: nbgl_layout.h:122
uint8_t token
the token that will be used as argument of the callback
Definition: nbgl_layout.h:119
uint8_t nbPages
number of pages. (if 0, no navigation)
Definition: nbgl_layout.h:120
This structure contains info to build an up-footer (area on top of footer).
Definition: nbgl_layout.h:528
nbgl_layoutUpFooterType_t type
type of up-footer
Definition: nbgl_layout.h:529
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
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 * tapActionText
Definition: nbgl_page.h:194
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
Structure containing all specific information when creating a NBGL step.
Definition: nbgl_flow.h:43
const nbgl_icon_details_t * icon
icon to display in step (text must be single-page)
Definition: nbgl_flow.h:48
const char * text
text to display in step (can be multi-pages if icon == NULL)
Definition: nbgl_flow.h:46
unsigned short uint16_t
Definition: usbd_conf.h:54
unsigned char uint8_t
Definition: usbd_conf.h:53