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  // if the extension is valid for this index, use a Text with Alias
203  if ((content->infosList.withExtensions == true)
204  && (content->infosList.infoExtensions != NULL)
205  && (content->infosList.infoExtensions[i].fullValue != NULL)) {
206  availableHeight
207  -= nbgl_layoutAddTextWithAlias(layout,
208  content->infosList.infoTypes[i],
209  content->infosList.infoContents[i],
210  content->infosList.token,
211  i);
212  }
213  else {
214  availableHeight -= nbgl_layoutAddText(layout,
215  content->infosList.infoTypes[i],
216  content->infosList.infoContents[i]);
217  }
218  // do not draw a separation line if too low in the container
219  if (availableHeight > 10) {
221  }
222  }
223  break;
224  }
225  case CHOICES_LIST:
226  nbgl_layoutAddRadioChoice(layout, &content->choicesList);
227  break;
228  case BARS_LIST: {
229  uint8_t i;
230  for (i = 0; i < content->barsList.nbBars; i++) {
231  nbgl_layoutBar_t bar;
232  bar.text = content->barsList.barTexts[i];
233  bar.subText = NULL;
234  bar.iconRight = &PUSH_ICON;
235  bar.iconLeft = NULL;
236  bar.token = content->barsList.tokens[i];
237  bar.tuneId = content->barsList.tuneId;
238  bar.large = false;
239  bar.inactive = false;
240  availableHeight -= nbgl_layoutAddTouchableBar(layout, &bar);
241  // do not draw a separation line if too low in the container
242  if (availableHeight > 10) {
244  }
245  }
246  break;
247  }
248  }
249 }
250 
251 /**********************
252  * GLOBAL FUNCTIONS
253  **********************/
254 
265  const nbgl_screenTickerConfiguration_t *ticker,
266  const char *text,
267  int tapActionToken)
268 {
269  nbgl_layoutDescription_t layoutDescription;
270  nbgl_layout_t *layout;
271  nbgl_layoutCenteredInfo_t centeredInfo = {.text1 = text,
272  .text2 = NULL,
273  .text3 = NULL,
274  .style = LARGE_CASE_INFO,
275  .icon = &C_Check_Circle_64px,
276  .offsetY = 0};
277 
278  layoutDescription.modal = false;
279  layoutDescription.withLeftBorder = true;
280 
281  layoutDescription.onActionCallback = onActionCallback;
282  layoutDescription.tapActionText = "";
283  layoutDescription.tapActionToken = tapActionToken;
284  layoutDescription.tapTuneId = TUNE_TAP_CASUAL;
285 
286  layoutDescription.ticker.tickerCallback = ticker->tickerCallback;
287  layoutDescription.ticker.tickerIntervale = ticker->tickerIntervale;
288  layoutDescription.ticker.tickerValue = ticker->tickerValue;
289  layout = nbgl_layoutGet(&layoutDescription);
290 
291  addEmptyHeader(layout, SIMPLE_FOOTER_HEIGHT);
292  nbgl_layoutAddCenteredInfo(layout, &centeredInfo);
293 
294  nbgl_layoutDraw(layout);
295 
296  return (nbgl_page_t *) layout;
297 }
298 
307 nbgl_page_t *nbgl_pageDrawSpinner(nbgl_layoutTouchCallback_t onActionCallback, const char *text)
308 {
309  nbgl_layoutDescription_t layoutDescription;
310  nbgl_layout_t *layout;
311 
312  layoutDescription.modal = false;
313  layoutDescription.withLeftBorder = true;
314 
315  layoutDescription.onActionCallback = onActionCallback;
316  layoutDescription.tapActionText = NULL;
317 
318  layoutDescription.ticker.tickerCallback = NULL;
319  layout = nbgl_layoutGet(&layoutDescription);
320 
321  nbgl_layoutAddSpinner(layout, text, false);
322 
323  nbgl_layoutDraw(layout);
324 
325  return (nbgl_page_t *) layout;
326 }
327 
338  const nbgl_screenTickerConfiguration_t *ticker,
339  const nbgl_pageInfoDescription_t *info)
340 {
341  nbgl_layoutDescription_t layoutDescription = {0};
342  nbgl_layout_t *layout;
343 
344  layoutDescription.modal = false;
345  layoutDescription.withLeftBorder = true;
346 
347  layoutDescription.onActionCallback = onActionCallback;
348  if (!info->isSwipeable) {
349  layoutDescription.tapActionText = info->tapActionText;
350  layoutDescription.tapActionToken = info->tapActionToken;
351  layoutDescription.tapTuneId = info->tuneId;
352  }
353 
354  if (ticker != NULL) {
355  layoutDescription.ticker.tickerCallback = ticker->tickerCallback;
356  layoutDescription.ticker.tickerIntervale = ticker->tickerIntervale;
357  layoutDescription.ticker.tickerValue = ticker->tickerValue;
358  }
359  else {
360  layoutDescription.ticker.tickerCallback = NULL;
361  }
362  layout = nbgl_layoutGet(&layoutDescription);
363  if (info->isSwipeable) {
364  nbgl_layoutAddSwipe(layout,
365  ((1 << SWIPED_LEFT) | (1 << SWIPED_RIGHT)),
366  info->tapActionText,
367  info->tapActionToken,
368  info->tuneId);
369  }
370  // add an empty header if a top-right button is used
371  if (info->topRightStyle != NO_BUTTON_STYLE) {
372  addEmptyHeader(layout, SMALL_CENTERING_HEADER);
373  }
375 
376  // if action button but not QUIT_APP_TEXT bottom button, use a small black button
377  if ((info->actionButtonText != NULL) && (info->bottomButtonStyle != QUIT_APP_TEXT)) {
378  nbgl_layoutButton_t buttonInfo = {.fittingContent = true,
379  .icon = info->actionButtonIcon,
380  .onBottom = false,
381  .style = info->actionButtonStyle,
382  .text = info->actionButtonText,
383  .token = info->bottomButtonsToken,
384  .tuneId = info->tuneId};
385  nbgl_layoutAddButton(layout, &buttonInfo);
386  }
387 
388  if (info->footerText != NULL) {
389  nbgl_layoutAddFooter(layout, PIC(info->footerText), info->footerToken, info->tuneId);
390  }
391  if (info->topRightStyle != NO_BUTTON_STYLE) {
392  const nbgl_icon_details_t *icon;
393  if (info->topRightStyle == SETTINGS_ICON) {
394  icon = &WHEEL_ICON;
395  }
396  else if (info->topRightStyle == INFO_ICON) {
397  icon = &INFO_I_ICON;
398  }
399  else if (info->topRightStyle == QUIT_ICON) {
400  icon = &CLOSE_ICON;
401  }
402  else {
403  return NULL;
404  }
405  nbgl_layoutAddTopRightButton(layout, PIC(icon), info->topRightToken, info->tuneId);
406  }
407  if (info->bottomButtonStyle == QUIT_APP_TEXT) {
408  // if action button and QUIT_APP_TEXT bottom button, use a pair of choice buttons
409  if ((info->actionButtonText != NULL)) {
410  nbgl_layoutChoiceButtons_t buttonsInfo = {.topText = info->actionButtonText,
411  .bottomText = "Quit app",
412  .token = info->bottomButtonsToken,
413  .style = BOTH_ROUNDED_STYLE,
414  .tuneId = info->tuneId,
415  .topIcon = info->actionButtonIcon};
416  buttonsInfo.style = (info->actionButtonStyle == BLACK_BACKGROUND)
419  nbgl_layoutAddChoiceButtons(layout, &buttonsInfo);
420  }
421  else {
422  nbgl_layoutAddFooter(layout, "Quit app", info->bottomButtonsToken, info->tuneId);
423  }
424  }
425  else if (info->bottomButtonStyle != NO_BUTTON_STYLE) {
426  const nbgl_icon_details_t *icon;
427  if (info->bottomButtonStyle == SETTINGS_ICON) {
428  icon = &WHEEL_ICON;
429  }
430  else if (info->bottomButtonStyle == INFO_ICON) {
431  icon = &INFO_I_ICON;
432  }
433  else if (info->bottomButtonStyle == QUIT_ICON) {
434  icon = &CLOSE_ICON;
435  }
436  else {
437  return NULL;
438  }
440  layout, PIC(icon), info->bottomButtonsToken, false, info->tuneId);
441  }
442  nbgl_layoutDraw(layout);
443 
444  return (nbgl_page_t *) layout;
445 }
446 
457 {
458  nbgl_layoutDescription_t layoutDescription;
459  nbgl_layout_t *layout;
460  nbgl_layoutChoiceButtons_t buttonsInfo
461  = {.bottomText = (info->cancelText != NULL) ? PIC(info->cancelText) : "Cancel",
462  .token = info->confirmationToken,
463  .topText = PIC(info->confirmationText),
464  .style = ROUNDED_AND_FOOTER_STYLE,
465  .tuneId = info->tuneId};
466 
467  layoutDescription.modal = info->modal;
468  layoutDescription.withLeftBorder = true;
469 
470  layoutDescription.onActionCallback = onActionCallback;
471  layoutDescription.tapActionText = NULL;
472 
473  layoutDescription.ticker.tickerCallback = NULL;
474  layout = nbgl_layoutGet(&layoutDescription);
475 
476  addEmptyHeader(layout, MEDIUM_CENTERING_HEADER);
477  nbgl_layoutAddChoiceButtons(layout, &buttonsInfo);
478 
480 
481  nbgl_layoutDraw(layout);
482 
483  return (nbgl_page_t *) layout;
484 }
485 
497  const nbgl_pageNavigationInfo_t *nav,
498  nbgl_pageContent_t *content,
499  bool modal)
500 {
501  nbgl_layoutDescription_t layoutDescription;
502  nbgl_layout_t *layout;
503  uint16_t availableHeight = SCREEN_HEIGHT;
504  bool headerAdded = false;
505 
506  layoutDescription.modal = modal;
507  layoutDescription.withLeftBorder = true;
508  layoutDescription.onActionCallback = onActionCallback;
509  layoutDescription.ticker.tickerCallback = NULL;
510 
511  if ((nav != NULL) && (nav->navType == NAV_WITH_TAP)) {
512  layoutDescription.tapActionText = nav->navWithTap.nextPageText;
513  layoutDescription.tapActionToken = nav->navWithTap.nextPageToken;
514  layoutDescription.tapTuneId = nav->tuneId;
515  }
516  else {
517  layoutDescription.tapActionText = NULL;
518  }
519 
520  layout = nbgl_layoutGet(&layoutDescription);
521  if (nav != NULL) {
522  if (nav->navType == NAV_WITH_TAP) {
523  if (nav->skipText == NULL) {
524  availableHeight -= nbgl_layoutAddFooter(
525  layout, nav->navWithTap.quitText, nav->quitToken, nav->tuneId);
526  }
527  else {
528  availableHeight -= nbgl_layoutAddSplitFooter(layout,
529  nav->navWithTap.quitText,
530  nav->quitToken,
531  nav->skipText,
532  nav->skipToken,
533  nav->tuneId);
534  }
535  if (nav->progressIndicator) {
536  availableHeight -= nbgl_layoutAddProgressIndicator(layout,
537  nav->activePage,
538  nav->nbPages,
539  nav->navWithTap.backButton,
540  nav->navWithTap.backToken,
541  nav->tuneId);
542  headerAdded = true;
543  }
544  }
545  else if (nav->navType == NAV_WITH_BUTTONS) {
546  nbgl_layoutFooter_t footerDesc;
547  bool drawFooter = true;
548 
549  if (nav->skipText != NULL) {
550  nbgl_layoutHeader_t headerDesc = {.type = HEADER_RIGHT_TEXT,
551  .separationLine = false,
552  .rightText.text = nav->skipText,
553  .rightText.token = nav->skipToken,
554  .rightText.tuneId = nav->tuneId};
555  availableHeight -= nbgl_layoutAddHeader(layout, &headerDesc);
556  headerAdded = true;
557  }
558  footerDesc.separationLine = true;
559  if (nav->nbPages > 1) {
560  if (nav->navWithButtons.quitText == NULL) {
561  footerDesc.type = FOOTER_NAV;
562  footerDesc.navigation.activePage = nav->activePage;
563  footerDesc.navigation.nbPages = nav->nbPages;
566  footerDesc.navigation.withPageIndicator = false;
567  footerDesc.navigation.token = nav->navWithButtons.navToken;
568  footerDesc.navigation.tuneId = nav->tuneId;
569  }
570  else {
571  footerDesc.type = FOOTER_TEXT_AND_NAV;
572  footerDesc.textAndNav.text = nav->navWithButtons.quitText;
573  footerDesc.textAndNav.tuneId = nav->tuneId;
574  footerDesc.textAndNav.token = nav->quitToken;
575  footerDesc.textAndNav.navigation.activePage = nav->activePage;
576  footerDesc.textAndNav.navigation.nbPages = nav->nbPages;
577  footerDesc.textAndNav.navigation.withExitKey = false;
578  footerDesc.textAndNav.navigation.withBackKey = nav->navWithButtons.backButton;
579  footerDesc.textAndNav.navigation.visibleIndicator
581  footerDesc.textAndNav.navigation.withPageIndicator = true;
582  footerDesc.textAndNav.navigation.token = nav->navWithButtons.navToken;
583  footerDesc.textAndNav.navigation.tuneId = nav->tuneId;
584  }
585  }
586  else if (nav->navWithButtons.quitText != NULL) {
587  // simple footer
588  footerDesc.type = FOOTER_SIMPLE_TEXT;
589  footerDesc.simpleText.text = nav->navWithButtons.quitText;
590  footerDesc.simpleText.mutedOut = false;
591  footerDesc.simpleText.token = nav->quitToken;
592  footerDesc.simpleText.tuneId = nav->tuneId;
593  }
594  else {
595  drawFooter = false;
596  }
597  if (drawFooter) {
598  availableHeight -= nbgl_layoutAddExtendedFooter(layout, &footerDesc);
599  }
600 
601 #ifdef TARGET_STAX
602  if (nav->progressIndicator) {
603  availableHeight -= nbgl_layoutAddProgressIndicator(
604  layout, nav->activePage, nav->nbPages, false, 0, nav->tuneId);
605  headerAdded = true;
606  }
607 #endif // TARGET_STAX
608  }
609  }
610  addContent(content, layout, availableHeight, headerAdded);
611  nbgl_layoutDraw(layout);
612 
613  return (nbgl_page_t *) layout;
614 }
615 
626  const nbgl_pageNavigationInfo_t *nav,
627  nbgl_pageContent_t *content)
628 {
629  return nbgl_pageDrawGenericContentExt(onActionCallback, nav, content, false);
630 }
631 
639 {
640  int ret;
641 
642  LOG_DEBUG(PAGE_LOGGER, "nbgl_pageRelease(): \n");
643  ret = nbgl_layoutRelease((nbgl_layout_t *) page);
644 
645  return ret;
646 }
647 #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:343
@ EXTENDED_CENTER
a centered content and a possible tip-box
Definition: nbgl_content.h:342
@ CHOICES_LIST
list of choices through radio buttons
Definition: nbgl_content.h:350
@ CENTERED_INFO
a centered info
Definition: nbgl_content.h:341
@ SWITCHES_LIST
list of switches with descriptions
Definition: nbgl_content.h:348
@ TAG_VALUE_DETAILS
a tag/value pair and a small button to get details.
Definition: nbgl_content.h:346
@ INFOS_LIST
list of infos with titles
Definition: nbgl_content.h:349
@ TAG_VALUE_CONFIRM
tag/value pairs and a black button/footer to confirm/cancel.
Definition: nbgl_content.h:347
@ TAG_VALUE_LIST
list of tag/value pairs
Definition: nbgl_content.h:345
@ BARS_LIST
list of touchable bars (with > on the right to go to sub-pages)
Definition: nbgl_content.h:351
@ INFO_BUTTON
a centered info and a simple black button
Definition: nbgl_content.h:344
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:1859
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:1664
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:2942
#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:1300
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:3242
int nbgl_layoutAddSeparationLine(nbgl_layout_t *layout)
adds a separation line on bottom of the last added item
Definition: nbgl_layout.c:2082
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:1504
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:1601
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:2259
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:1317
int nbgl_layoutDraw(nbgl_layout_t *layout)
Applies given layout. The screen will be redrawn.
Definition: nbgl_layout.c:3336
int nbgl_layoutAddTouchableBar(nbgl_layout_t *layout, const nbgl_layoutBar_t *barLayout)
Creates a touchable bar in main panel.
Definition: nbgl_layout.c:1221
@ 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:1124
@ 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:1083
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:1260
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:1838
@ 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:2102
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:2548
@ 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:1815
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:2204
#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:2285
#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:1195
@ 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:3367
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:2232
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:3271
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:994
#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:625
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:307
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:264
int nbgl_pageRelease(nbgl_page_t *page)
Release the page obtained with any of the nbgl_pageDrawXXX() functions.
Definition: nbgl_page.c:638
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:496
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:337
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:455
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