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 = {0};
59  centeredInfo.icon = content->infoLongPress.icon;
60  centeredInfo.title = content->infoLongPress.text;
61  centeredInfo.illustrType = ICON_ILLUSTRATION;
62  nbgl_layoutAddContentCenter(layout, &centeredInfo);
64  content->infoLongPress.longPressText,
65  content->infoLongPress.longPressToken,
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  }
92  nbgl_layoutAddCenteredInfo(layout, &content->centeredInfo);
93  break;
94 
95  case EXTENDED_CENTER:
96  if ((!headerAdded) && (content->extendedCenter.tipBox.text == NULL)) {
97  addEmptyHeader(layout, SMALL_CENTERING_HEADER);
98  }
99  nbgl_layoutAddContentCenter(layout, &content->extendedCenter.contentCenter);
100  if (content->extendedCenter.tipBox.text != NULL) {
101  nbgl_layoutUpFooter_t upFooterDesc
102  = {.type = UP_FOOTER_TIP_BOX,
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;
125  content->tagValueDetails.tagValueList.nbMaxLinesForValue -= 3;
126  nbgl_layoutAddTagValueList(layout, &content->tagValueDetails.tagValueList);
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  }
142  nbgl_layoutAddTagValueList(layout, &content->tagValueConfirm.tagValueList);
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"
160  = {.leftIcon = content->tagValueConfirm.detailsButtonIcon,
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
199  -= nbgl_layoutAddTextWithAlias(layout,
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++) {
223  nbgl_layoutBar_t bar;
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 
257  const nbgl_screenTickerConfiguration_t *ticker,
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 = &C_Check_Circle_64px,
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 
299 nbgl_page_t *nbgl_pageDrawSpinner(nbgl_layoutTouchCallback_t onActionCallback, const char *text)
300 {
301  nbgl_layoutDescription_t layoutDescription;
302  nbgl_layout_t *layout;
303 
304  layoutDescription.modal = false;
305  layoutDescription.withLeftBorder = true;
306 
307  layoutDescription.onActionCallback = onActionCallback;
308  layoutDescription.tapActionText = NULL;
309 
310  layoutDescription.ticker.tickerCallback = NULL;
311  layout = nbgl_layoutGet(&layoutDescription);
312 
313  nbgl_layoutAddSpinner(layout, text, NULL, false);
314 
315  nbgl_layoutDraw(layout);
316 
317  return (nbgl_page_t *) layout;
318 }
319 
330  const nbgl_screenTickerConfiguration_t *ticker,
331  const nbgl_pageInfoDescription_t *info)
332 {
333  nbgl_layoutDescription_t layoutDescription = {0};
334  nbgl_layout_t *layout;
335 
336  layoutDescription.modal = false;
337  layoutDescription.withLeftBorder = true;
338 
339  layoutDescription.onActionCallback = onActionCallback;
340  if (!info->isSwipeable) {
341  layoutDescription.tapActionText = info->tapActionText;
342  layoutDescription.tapActionToken = info->tapActionToken;
343  layoutDescription.tapTuneId = info->tuneId;
344  }
345 
346  if (ticker != NULL) {
347  layoutDescription.ticker.tickerCallback = ticker->tickerCallback;
348  layoutDescription.ticker.tickerIntervale = ticker->tickerIntervale;
349  layoutDescription.ticker.tickerValue = ticker->tickerValue;
350  }
351  else {
352  layoutDescription.ticker.tickerCallback = NULL;
353  }
354  layout = nbgl_layoutGet(&layoutDescription);
355  if (info->isSwipeable) {
356  nbgl_layoutAddSwipe(layout,
357  ((1 << SWIPED_LEFT) | (1 << SWIPED_RIGHT)),
358  info->tapActionText,
359  info->tapActionToken,
360  info->tuneId);
361  }
362  // add an empty header if a top-right button is used
363  if (info->topRightStyle != NO_BUTTON_STYLE) {
364  addEmptyHeader(layout, SMALL_CENTERING_HEADER);
365  }
367 
368  // if action button but not QUIT_APP_TEXT bottom button, use a small black button
369  if ((info->actionButtonText != NULL) && (info->bottomButtonStyle != QUIT_APP_TEXT)) {
370  nbgl_layoutButton_t buttonInfo = {.fittingContent = true,
371  .icon = info->actionButtonIcon,
372  .onBottom = false,
373  .style = info->actionButtonStyle,
374  .text = info->actionButtonText,
375  .token = info->bottomButtonsToken,
376  .tuneId = info->tuneId};
377  nbgl_layoutAddButton(layout, &buttonInfo);
378  }
379 
380  if (info->footerText != NULL) {
381  nbgl_layoutAddFooter(layout, PIC(info->footerText), info->footerToken, info->tuneId);
382  }
383  if (info->topRightStyle != NO_BUTTON_STYLE) {
384  const nbgl_icon_details_t *icon;
385  if (info->topRightStyle == SETTINGS_ICON) {
386  icon = &WHEEL_ICON;
387  }
388  else if (info->topRightStyle == INFO_ICON) {
389  icon = &INFO_I_ICON;
390  }
391  else if (info->topRightStyle == QUIT_ICON) {
392  icon = &CLOSE_ICON;
393  }
394  else {
395  return NULL;
396  }
397  nbgl_layoutAddTopRightButton(layout, PIC(icon), info->topRightToken, info->tuneId);
398  }
399  if (info->bottomButtonStyle == QUIT_APP_TEXT) {
400  // if action button and QUIT_APP_TEXT bottom button, use a pair of choice buttons
401  if ((info->actionButtonText != NULL)) {
402  nbgl_layoutChoiceButtons_t buttonsInfo = {.topText = info->actionButtonText,
403  .bottomText = "Quit app",
404  .token = info->bottomButtonsToken,
405  .tuneId = info->tuneId,
406  .topIcon = info->actionButtonIcon};
407  buttonsInfo.style = (info->actionButtonStyle == BLACK_BACKGROUND)
410  nbgl_layoutAddChoiceButtons(layout, &buttonsInfo);
411  }
412  else {
413  nbgl_layoutAddFooter(layout, "Quit app", info->bottomButtonsToken, info->tuneId);
414  }
415  }
416  else if (info->bottomButtonStyle != NO_BUTTON_STYLE) {
417  const nbgl_icon_details_t *icon;
418  if (info->bottomButtonStyle == SETTINGS_ICON) {
419  icon = &WHEEL_ICON;
420  }
421  else if (info->bottomButtonStyle == INFO_ICON) {
422  icon = &INFO_I_ICON;
423  }
424  else if (info->bottomButtonStyle == QUIT_ICON) {
425  icon = &CLOSE_ICON;
426  }
427  else {
428  return NULL;
429  }
431  layout, PIC(icon), info->bottomButtonsToken, false, info->tuneId);
432  }
433  nbgl_layoutDraw(layout);
434 
435  return (nbgl_page_t *) layout;
436 }
437 
448 {
449  nbgl_layoutDescription_t layoutDescription;
450  nbgl_layout_t *layout;
451  nbgl_layoutChoiceButtons_t buttonsInfo
452  = {.bottomText = (info->cancelText != NULL) ? PIC(info->cancelText) : "Cancel",
453  .token = info->confirmationToken,
454  .topText = PIC(info->confirmationText),
455  .style = ROUNDED_AND_FOOTER_STYLE,
456  .tuneId = info->tuneId};
457 
458  layoutDescription.modal = info->modal;
459  layoutDescription.withLeftBorder = true;
460 
461  layoutDescription.onActionCallback = onActionCallback;
462  layoutDescription.tapActionText = NULL;
463 
464  layoutDescription.ticker.tickerCallback = NULL;
465  layout = nbgl_layoutGet(&layoutDescription);
466 
467  addEmptyHeader(layout, MEDIUM_CENTERING_HEADER);
468  nbgl_layoutAddChoiceButtons(layout, &buttonsInfo);
469 
471 
472  nbgl_layoutDraw(layout);
473 
474  return (nbgl_page_t *) layout;
475 }
476 
488  const nbgl_pageNavigationInfo_t *nav,
489  nbgl_pageContent_t *content,
490  bool modal)
491 {
492  nbgl_layoutDescription_t layoutDescription;
493  nbgl_layout_t *layout;
494  uint16_t availableHeight = SCREEN_HEIGHT;
495  bool headerAdded = false;
496 
497  layoutDescription.modal = modal;
498  layoutDescription.withLeftBorder = true;
499  layoutDescription.onActionCallback = onActionCallback;
500  layoutDescription.ticker.tickerCallback = NULL;
501 
502  if ((nav != NULL) && (nav->navType == NAV_WITH_TAP)) {
503  layoutDescription.tapActionText = nav->navWithTap.nextPageText;
504  layoutDescription.tapActionToken = nav->navWithTap.nextPageToken;
505  layoutDescription.tapTuneId = nav->tuneId;
506  }
507  else {
508  layoutDescription.tapActionText = NULL;
509  }
510 
511  layout = nbgl_layoutGet(&layoutDescription);
512  if (nav != NULL) {
513  if (nav->navType == NAV_WITH_TAP) {
514  if (nav->skipText == NULL) {
515  availableHeight -= nbgl_layoutAddFooter(
516  layout, nav->navWithTap.quitText, nav->quitToken, nav->tuneId);
517  }
518  else {
519  availableHeight -= nbgl_layoutAddSplitFooter(layout,
520  nav->navWithTap.quitText,
521  nav->quitToken,
522  nav->skipText,
523  nav->skipToken,
524  nav->tuneId);
525  }
526  if (nav->progressIndicator) {
527  availableHeight -= nbgl_layoutAddProgressIndicator(layout,
528  nav->activePage,
529  nav->nbPages,
530  nav->navWithTap.backButton,
531  nav->navWithTap.backToken,
532  nav->tuneId);
533  headerAdded = true;
534  }
535  }
536  else if (nav->navType == NAV_WITH_BUTTONS) {
537  nbgl_layoutFooter_t footerDesc;
538  bool drawFooter = true;
539 
540  if (nav->skipText != NULL) {
541  nbgl_layoutHeader_t headerDesc = {.type = HEADER_RIGHT_TEXT,
542  .separationLine = false,
543  .rightText.text = nav->skipText,
544  .rightText.token = nav->skipToken,
545  .rightText.tuneId = nav->tuneId};
546  availableHeight -= nbgl_layoutAddHeader(layout, &headerDesc);
547  headerAdded = true;
548  }
549  footerDesc.separationLine = true;
550  if (nav->nbPages > 1) {
551  if (nav->navWithButtons.quitText == NULL) {
552  footerDesc.type = FOOTER_NAV;
553  footerDesc.navigation.activePage = nav->activePage;
554  footerDesc.navigation.nbPages = nav->nbPages;
557  footerDesc.navigation.withPageIndicator = false;
558  footerDesc.navigation.token = nav->navWithButtons.navToken;
559  footerDesc.navigation.tuneId = nav->tuneId;
560  }
561  else {
562  footerDesc.type = FOOTER_TEXT_AND_NAV;
563  footerDesc.textAndNav.text = nav->navWithButtons.quitText;
564  footerDesc.textAndNav.tuneId = nav->tuneId;
565  footerDesc.textAndNav.token = nav->quitToken;
566  footerDesc.textAndNav.navigation.activePage = nav->activePage;
567  footerDesc.textAndNav.navigation.nbPages = nav->nbPages;
568  footerDesc.textAndNav.navigation.withExitKey = false;
569  footerDesc.textAndNav.navigation.withBackKey = nav->navWithButtons.backButton;
570  footerDesc.textAndNav.navigation.visibleIndicator
572  footerDesc.textAndNav.navigation.withPageIndicator = true;
573  footerDesc.textAndNav.navigation.token = nav->navWithButtons.navToken;
574  footerDesc.textAndNav.navigation.tuneId = nav->tuneId;
575  }
576  }
577  else if (nav->navWithButtons.quitText != NULL) {
578  // simple footer
579  footerDesc.type = FOOTER_SIMPLE_TEXT;
580  footerDesc.simpleText.text = nav->navWithButtons.quitText;
581  footerDesc.simpleText.mutedOut = false;
582  footerDesc.simpleText.token = nav->quitToken;
583  footerDesc.simpleText.tuneId = nav->tuneId;
584  }
585  else {
586  drawFooter = false;
587  }
588  if (drawFooter) {
589  availableHeight -= nbgl_layoutAddExtendedFooter(layout, &footerDesc);
590  }
591 
592 #ifdef TARGET_STAX
593  if (nav->progressIndicator) {
594  availableHeight -= nbgl_layoutAddProgressIndicator(
595  layout, nav->activePage, nav->nbPages, false, 0, nav->tuneId);
596  headerAdded = true;
597  }
598 #endif // TARGET_STAX
599  }
600  }
601  addContent(content, layout, availableHeight, headerAdded);
602  nbgl_layoutDraw(layout);
603 
604  return (nbgl_page_t *) layout;
605 }
606 
617  const nbgl_pageNavigationInfo_t *nav,
618  nbgl_pageContent_t *content)
619 {
620  return nbgl_pageDrawGenericContentExt(onActionCallback, nav, content, false);
621 }
622 
630 {
631  int ret;
632 
633  LOG_DEBUG(PAGE_LOGGER, "nbgl_pageRelease(): \n");
634  ret = nbgl_layoutRelease((nbgl_layout_t *) page);
635 
636  return ret;
637 }
638 #endif // NBGL_PAGE
@ ICON_ILLUSTRATION
simple icon
Definition: nbgl_content.h:76
@ 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:357
@ EXTENDED_CENTER
a centered content and a possible tip-box
Definition: nbgl_content.h:356
@ CHOICES_LIST
list of choices through radio buttons
Definition: nbgl_content.h:364
@ CENTERED_INFO
a centered info
Definition: nbgl_content.h:355
@ SWITCHES_LIST
list of switches with descriptions
Definition: nbgl_content.h:362
@ TAG_VALUE_DETAILS
a tag/value pair and a small button to get details.
Definition: nbgl_content.h:360
@ INFOS_LIST
list of infos with titles
Definition: nbgl_content.h:363
@ TAG_VALUE_CONFIRM
tag/value pairs and a black button/footer to confirm/cancel.
Definition: nbgl_content.h:361
@ TAG_VALUE_LIST
list of tag/value pairs
Definition: nbgl_content.h:359
@ BARS_LIST
list of touchable bars (with > on the right to go to sub-pages)
Definition: nbgl_content.h:365
@ INFO_BUTTON
a centered info and a simple black button
Definition: nbgl_content.h:358
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:2048
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:1761
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:3163
#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 (in bold) and sub text (in regular)
Definition: nbgl_layout.c:1392
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:3463
int nbgl_layoutAddSeparationLine(nbgl_layout_t *layout)
adds a separation line on bottom of the last added item
Definition: nbgl_layout.c:2271
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:1604
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:1701
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:2448
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 ...
Definition: nbgl_layout.c:1409
int nbgl_layoutDraw(nbgl_layout_t *layout)
Applies given layout. The screen will be redrawn.
Definition: nbgl_layout.c:3600
int nbgl_layoutAddTouchableBar(nbgl_layout_t *layout, const nbgl_layoutBar_t *barLayout)
Creates a touchable bar in main panel.
Definition: nbgl_layout.c:1313
@ WHITE_BACKGROUND
rounded bordered button, with text/icon in black, on white background
Definition: nbgl_layout.h:336
@ BLACK_BACKGROUND
rounded bordered button, with text/icon in white, on black background
Definition: nbgl_layout.h:334
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:1216
@ UP_FOOTER_TIP_BOX
Tip-box.
Definition: nbgl_layout.h:531
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:1175
void * nbgl_layout_t
type shared externally
Definition: nbgl_layout.h:96
int nbgl_layoutAddSpinner(nbgl_layout_t *layout, const char *text, const char *subText, bool fixed)
Creates a centered (vertically & horizontally) spinner with a text under it.
Definition: nbgl_layout.c:3493
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:1352
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:2027
@ HEADER_EMPTY
empty space, to have a better vertical centering of centered info
Definition: nbgl_layout.h:415
@ HEADER_BACK_AND_TEXT
back key and optional text
Definition: nbgl_layout.h:416
@ HEADER_RIGHT_TEXT
touchable text on the right, with a vertical separation line
Definition: nbgl_layout.h:421
int nbgl_layoutAddButton(nbgl_layout_t *layout, const nbgl_layoutButton_t *buttonInfo)
Creates a rounded button in the main container.
Definition: nbgl_layout.c:2291
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:2761
@ SOFT_ACTION_AND_FOOTER_STYLE
A white button on top of a footer, with a separation line.
Definition: nbgl_layout.h:293
@ ROUNDED_AND_FOOTER_STYLE
A black background button on top of a footer.
Definition: nbgl_layout.h:291
@ STRONG_ACTION_AND_FOOTER_STYLE
A black button on top of a footer, with a separation line.
Definition: nbgl_layout.h:292
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:2004
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:2393
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:2474
#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:1287
@ FOOTER_SIMPLE_TEXT
simple touchable text in bold
Definition: nbgl_layout.h:477
@ FOOTER_NAV
navigation bar
Definition: nbgl_layout.h:481
@ FOOTER_TEXT_AND_NAV
Definition: nbgl_layout.h:479
int nbgl_layoutRelease(nbgl_layout_t *layout)
Release the layout obtained with nbgl_layoutGet()
Definition: nbgl_layout.c:3631
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:2421
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:1086
#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:616
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:299
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
int nbgl_pageRelease(nbgl_page_t *page)
Release the page obtained with any of the nbgl_pageDrawXXX() functions.
Definition: nbgl_page.c:629
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:487
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:329
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:446
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:90
const nbgl_icon_details_t * icon
the icon (can be null)
Definition: nbgl_content.h:92
const char * title
title in black large (can be null)
Definition: nbgl_content.h:97
nbgl_contentIllustrationType_t illustrType
Definition: nbgl_content.h:91
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:344
const char * text
button text
Definition: nbgl_layout.h:345
uint8_t token
the token that will be used as argument of the callback
Definition: nbgl_layout.h:347
const nbgl_icon_details_t * icon
a buffer containing the 1BPP icon for button
Definition: nbgl_layout.h:346
nbgl_layoutButtonStyle_t style
Definition: nbgl_layout.h:348
bool fittingContent
if set to true, fit the width of button to text, otherwise full width
Definition: nbgl_layout.h:349
This structure contains info to build a pair of buttons, one on top of the other.
Definition: nbgl_layout.h:302
nbgl_layoutChoiceButtonsStyle_t style
the style of the pair
Definition: nbgl_layout.h:307
const char * topText
up-button text (index 0)
Definition: nbgl_layout.h:303
const char * bottomText
bottom-button text (index 1)
Definition: nbgl_layout.h:304
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:491
bool separationLine
if true, a separation line is added at the top of this control
Definition: nbgl_layout.h:493
struct nbgl_layoutFooter_t::@15::@18 simpleText
if type is FOOTER_SIMPLE_TEXT
nbgl_layoutFooterType_t type
type of footer
Definition: nbgl_layout.h:492
nbgl_layoutNavigationBar_t navigation
if type is FOOTER_NAV
Definition: nbgl_layout.h:512
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:429
nbgl_layoutHeaderType_t type
type of header
Definition: nbgl_layout.h:430
This structure contains info to build a pair of buttons, the small one, with icon,...
Definition: nbgl_layout.h:319
const nbgl_icon_details_t * leftIcon
a buffer containing the 1BPP icon for left button
Definition: nbgl_layout.h:320
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:540
nbgl_layoutUpFooterType_t type
type of up-footer
Definition: nbgl_layout.h:541
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