23#include "os_io_seph_ux.h"
25#include "os_helpers.h"
32#define INTERNAL_SPACE 16
34#define INNER_MARGIN 12
36#define NB_MAX_LAYOUTS 3
39#define NB_MAX_CONTAINER_CHILDREN 20
41#define TAG_VALUE_ICON_WIDTH 32
43#if defined(TARGET_STAX)
44#define RADIO_CHOICE_HEIGHT 96
45#define BAR_INTERVALE 12
46#define FOOTER_BUTTON_HEIGHT 128
47#define FOOTER_IN_PAIR_HEIGHT 80
48#define ROUNDED_AND_FOOTER_FOOTER_HEIGHT 192
49#define FOOTER_TEXT_AND_NAV_WIDTH 160
50#define TAP_TO_CONTINUE_MARGIN 24
51#define SUB_HEADER_MARGIN 24
52#define PRE_FIRST_TEXT_MARGIN 24
53#define INTER_PARAGRAPHS_MARGIN 40
54#define PRE_TITLE_MARGIN 24
55#define PRE_DESCRIPTION_MARGIN 16
56#define PRE_FIRST_ROW_MARGIN 32
57#define INTER_ROWS_MARGIN 16
58#define QR_PRE_TEXT_MARGIN 24
59#define QR_INTER_TEXTS_MARGIN 40
60#define SPINNER_TEXT_MARGIN 20
61#define SPINNER_INTER_TEXTS_MARGIN 20
62#define BAR_TEXT_MARGIN 24
63#define BAR_INTER_TEXTS_MARGIN 16
64#define LEFT_CONTENT_TEXT_PADDING 0
65#define BUTTON_FROM_BOTTOM_MARGIN 4
66#define TOP_BUTTON_MARGIN VERTICAL_BORDER_MARGIN
67#define TOP_BUTTON_MARGIN_WITH_ACTION VERTICAL_BORDER_MARGIN
68#define SINGLE_BUTTON_MARGIN 24
69#define LONG_PRESS_PROGRESS_HEIGHT 8
70#define LONG_PRESS_PROGRESS_ALIGN 1
71#define LEFT_CONTENT_ICON_TEXT_X 16
72#define TIP_BOX_MARGIN_Y 24
73#define TIP_BOX_TEXT_ICON_MARGIN 24
74#elif defined(TARGET_FLEX)
75#define RADIO_CHOICE_HEIGHT 92
76#define BAR_INTERVALE 16
77#define FOOTER_BUTTON_HEIGHT 136
78#define FOOTER_IN_PAIR_HEIGHT 88
79#define ROUNDED_AND_FOOTER_FOOTER_HEIGHT 208
80#define FOOTER_TEXT_AND_NAV_WIDTH 192
81#define TAP_TO_CONTINUE_MARGIN 30
82#define SUB_HEADER_MARGIN 28
83#define PRE_FIRST_TEXT_MARGIN 0
84#define INTER_PARAGRAPHS_MARGIN 24
85#define PRE_TITLE_MARGIN 16
86#define PRE_DESCRIPTION_MARGIN 24
87#define PRE_FIRST_ROW_MARGIN 32
88#define INTER_ROWS_MARGIN 24
89#define QR_PRE_TEXT_MARGIN 24
90#define QR_INTER_TEXTS_MARGIN 28
91#define SPINNER_TEXT_MARGIN 24
92#define SPINNER_INTER_TEXTS_MARGIN 16
93#define BAR_TEXT_MARGIN 24
94#define BAR_INTER_TEXTS_MARGIN 16
95#define LEFT_CONTENT_TEXT_PADDING 4
96#define BUTTON_FROM_BOTTOM_MARGIN 4
97#define TOP_BUTTON_MARGIN VERTICAL_BORDER_MARGIN
98#define TOP_BUTTON_MARGIN_WITH_ACTION VERTICAL_BORDER_MARGIN
99#define SINGLE_BUTTON_MARGIN 24
100#define LONG_PRESS_PROGRESS_HEIGHT 8
101#define LONG_PRESS_PROGRESS_ALIGN 1
102#define LEFT_CONTENT_ICON_TEXT_X 16
103#define TIP_BOX_MARGIN_Y 24
104#define TIP_BOX_TEXT_ICON_MARGIN 32
105#elif defined(TARGET_APEX)
106#define RADIO_CHOICE_HEIGHT 68
107#define BAR_INTERVALE 8
108#define FOOTER_BUTTON_HEIGHT 88
109#define FOOTER_IN_PAIR_HEIGHT 60
110#define ROUNDED_AND_FOOTER_FOOTER_HEIGHT 128
111#define FOOTER_TEXT_AND_NAV_WIDTH 120
112#define TAP_TO_CONTINUE_MARGIN 30
113#define SUB_HEADER_MARGIN 16
114#define PRE_FIRST_TEXT_MARGIN 0
115#define INTER_PARAGRAPHS_MARGIN 16
116#define PRE_TITLE_MARGIN 16
117#define PRE_DESCRIPTION_MARGIN 12
118#define PRE_FIRST_ROW_MARGIN 24
119#define INTER_ROWS_MARGIN 12
120#define QR_PRE_TEXT_MARGIN 16
121#define QR_INTER_TEXTS_MARGIN 20
122#define SPINNER_TEXT_MARGIN 16
123#define SPINNER_INTER_TEXTS_MARGIN 16
124#define BAR_TEXT_MARGIN 16
125#define BAR_INTER_TEXTS_MARGIN 12
126#define LEFT_CONTENT_TEXT_PADDING 4
127#define BUTTON_FROM_BOTTOM_MARGIN 0
128#define TOP_BUTTON_MARGIN 12
129#define TOP_BUTTON_MARGIN_WITH_ACTION 0
130#define SINGLE_BUTTON_MARGIN 16
131#define LONG_PRESS_PROGRESS_HEIGHT 4
132#define LONG_PRESS_PROGRESS_ALIGN 0
133#define LEFT_CONTENT_ICON_TEXT_X 8
134#define TIP_BOX_MARGIN_Y 12
135#define TIP_BOX_TEXT_ICON_MARGIN 20
137#error Undefined target
141#define SPINNER_REFRESH_PERIOD 400
188static uint8_t nbTouchableControls = 0;
196#if defined(TARGET_FLEX)
198#define HOLD_TO_APPROVE_STEP_PERCENT (7)
200#define HOLD_TO_APPROVE_STEP_DURATION_MS (100)
202#define HOLD_TO_APPROVE_FIRST_STEP (0)
203#elif defined(TARGET_STAX)
204#define HOLD_TO_APPROVE_STEP_PERCENT (25)
205#define HOLD_TO_APPROVE_STEP_DURATION_MS (400)
206#define HOLD_TO_APPROVE_FIRST_STEP (1)
207#elif defined(TARGET_APEX)
208#define HOLD_TO_APPROVE_STEP_PERCENT (20)
209#define HOLD_TO_APPROVE_STEP_DURATION_MS (300)
210#define HOLD_TO_APPROVE_FIRST_STEP (1)
213static inline uint8_t get_hold_to_approve_percent(uint32_t touch_duration)
215 uint8_t current_step_nb
216 = (touch_duration / HOLD_TO_APPROVE_STEP_DURATION_MS) + HOLD_TO_APPROVE_FIRST_STEP;
217 return (current_step_nb * HOLD_TO_APPROVE_STEP_PERCENT);
221static bool getLayoutAndLayoutObj(
nbgl_obj_t *obj,
228 if ((topLayout) && (topLayout->
isUsed)) {
235 "getLayoutAndLayoutObj(): obj found in layout %p "
236 "nbUsedCallbackObjs = %d\n",
249static void radioTouchCallback(
nbgl_obj_t *obj,
262 bool needRefresh =
false;
268 if (getLayoutAndLayoutObj(obj, &layout, &layoutObj) ==
false) {
270 if (getLayoutAndLayoutObj(obj->parent, &layout, &layoutObj) ==
false) {
273 "touchCallback(): eventType = %d, obj = %p, no active layout or obj not found\n",
291 layoutObj->
index = eventType;
340 layoutObj->
index = lSwitch->state;
346 radioTouchCallback(obj, eventType, layout);
353 longTouchCallback(obj, eventType, layout, layoutObj);
358#ifdef HAVE_PIEZO_SOUND
360 os_io_seph_cmd_piezo_play_tune(layoutObj->
tuneId);
387 uint8_t new_state = get_hold_to_approve_percent(touchDuration);
391 bool trigger_callback = (new_state >= 100) && (progressBar->state < 100);
394 if (new_state >= 100) {
399 if (new_state != progressBar->state) {
400 progressBar->partialRedraw =
true;
401 progressBar->state = new_state;
410 if (trigger_callback) {
421 progressBar->partialRedraw =
true;
422 progressBar->state = 0;
432static void radioTouchCallback(
nbgl_obj_t *obj,
436 uint8_t i =
NB_MAX_LAYOUTS, radioIndex = 0, foundRadio = 0xFF, foundRadioIndex;
444 while (i < layout->nbUsedCallbackObjs) {
454 foundRadioIndex = radioIndex;
456 textArea->textColor =
BLACK;
457 textArea->fontId = SMALL_BOLD_FONT;
479 textArea->fontId = SMALL_REGULAR_FONT;
487 if (foundRadio != 0xFF) {
489#ifdef HAVE_PIEZO_SOUND
501static void spinnerTickerCallback(
void)
506 if (!topLayout || !topLayout->
isUsed) {
511 while (i < topLayout->container->nbChildren) {
514 if (container->nbChildren && (container->children[0]->type ==
SPINNER)) {
519 spinner->position = 0;
531static void animTickerCallback(
void)
542 while (i < layout->container->nbChildren) {
545 if (container->children[1]->type ==
IMAGE) {
584static nbgl_line_t *createHorizontalLine(uint8_t layer)
590 line->obj.area.width = SCREEN_WIDTH;
591 line->obj.area.height = 1;
598static nbgl_line_t *createLeftVerticalLine(uint8_t layer)
604 line->obj.area.width = 1;
605 line->obj.area.height = SCREEN_HEIGHT;
625 layoutObj->
obj = obj;
626 layoutObj->
token = token;
627 layoutObj->
tuneId = tuneId;
676 layoutInt->
container->obj.touchMask = swipesMask;
714 container->nbChildren = 0;
717 container->obj.area.height
718 = LIST_ITEM_MIN_TEXT_HEIGHT
719 + 2 * (itemDesc->
large ? LIST_ITEM_PRE_HEADING_LARGE : LIST_ITEM_PRE_HEADING);
721 container->obj.alignmentMarginX = BORDER_MARGIN;
723 container->obj.alignTo = NULL;
728 container->obj.touchMask = (1 <<
TOUCHED);
729 container->obj.touchId =
CONTROLS_ID + nbTouchableControls;
730 nbTouchableControls++;
734 if (itemDesc->
text != NULL) {
736 textArea->textColor = color;
737 textArea->text = PIC(itemDesc->
text);
738 textArea->onDrawCallback = NULL;
739 textArea->fontId = fontId;
740 textArea->wrapping =
true;
741 textArea->obj.area.width = container->obj.area.width;
744 textArea->obj.area.width
749 textArea->obj.area.width
753 textArea->obj.area.width -= SWITCH_ICON.width + BAR_INTERVALE;
755 textArea->obj.area.height =
MAX(
756 LIST_ITEM_MIN_TEXT_HEIGHT,
758 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping));
761 textArea->obj.alignmentMarginY
762 = itemDesc->
large ? LIST_ITEM_PRE_HEADING_LARGE : LIST_ITEM_PRE_HEADING;
763 if (textArea->obj.area.height > LIST_ITEM_MIN_TEXT_HEIGHT) {
764 textArea->obj.alignmentMarginY
765 -= (textArea->obj.area.height - LIST_ITEM_MIN_TEXT_HEIGHT) / 2;
768 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
769 container->nbChildren++;
775 imageLeft->foregroundColor = color;
776 imageLeft->buffer = PIC(itemDesc->
iconLeft);
778 imageLeft->obj.alignment =
MID_LEFT;
779 imageLeft->obj.alignTo = (
nbgl_obj_t *) textArea;
780 imageLeft->obj.alignmentMarginX = BAR_INTERVALE;
781 container->children[container->nbChildren] = (
nbgl_obj_t *) imageLeft;
782 container->nbChildren++;
784 if (textArea != NULL) {
785 textArea->obj.alignmentMarginX = imageLeft->buffer->width + BAR_INTERVALE;
791 imageRight->foregroundColor = color;
792 imageRight->buffer = PIC(itemDesc->
iconRight);
795 imageRight->obj.alignmentMarginX = BAR_INTERVALE;
796 imageRight->obj.alignTo = (
nbgl_obj_t *) textArea;
798 container->children[container->nbChildren] = (
nbgl_obj_t *) imageRight;
799 container->nbChildren++;
803 switchObj->onColor =
BLACK;
805 switchObj->state = itemDesc->
state;
807 switchObj->obj.alignmentMarginX = BAR_INTERVALE;
808 switchObj->obj.alignTo = (
nbgl_obj_t *) textArea;
810 container->children[container->nbChildren] = (
nbgl_obj_t *) switchObj;
811 container->nbChildren++;
814 if (itemDesc->
subText != NULL) {
818 subTextArea->textColor = color;
819 subTextArea->text = PIC(itemDesc->
subText);
820 subTextArea->textAlignment =
MID_LEFT;
821 subTextArea->fontId = SMALL_REGULAR_FONT;
823 subTextArea->wrapping =
true;
824 if (itemDesc->
text != NULL) {
826 subTextArea->obj.alignTo = (
nbgl_obj_t *) textArea;
827 subTextArea->obj.alignmentMarginY = LIST_ITEM_HEADING_SUB_TEXT;
830 subTextArea->obj.alignment =
TOP_LEFT;
831 subTextArea->obj.alignmentMarginY = SUB_HEADER_MARGIN;
832 container->obj.area.height = SUB_HEADER_MARGIN;
835 subTextArea->obj.alignmentMarginX
838 subTextArea->obj.area.width = container->obj.area.width;
841 subTextArea->obj.area.width,
842 subTextArea->wrapping);
843 container->children[container->nbChildren] = (
nbgl_obj_t *) subTextArea;
844 container->nbChildren++;
845 container->obj.area.height
846 += subTextArea->obj.area.height + subTextArea->obj.alignmentMarginY;
868 uint16_t fullHeight = 0;
873 container->nbChildren = 0;
878 if (info->
icon != NULL) {
881 image->buffer = PIC(info->
icon);
883 image->obj.alignmentMarginY = info->
iconHug;
885 fullHeight += image->buffer->height + info->
iconHug;
886 container->children[container->nbChildren] = (
nbgl_obj_t *) image;
887 container->nbChildren++;
898 container->children[container->nbChildren] = (
nbgl_obj_t *) anim;
899 container->nbChildren++;
910 tickerCfg.tickerCallback = &animTickerCallback;
915 if (info->
title != NULL) {
918 textArea->text = PIC(info->
title);
919 textArea->textAlignment =
CENTER;
920 textArea->fontId = LARGE_MEDIUM_FONT;
921 textArea->wrapping =
true;
924 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
927 if (container->nbChildren > 0) {
930 textArea->obj.alignmentMarginY = ICON_TITLE_MARGIN + info->
iconHug;
936 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY;
938 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
939 container->nbChildren++;
946 textArea->textAlignment =
CENTER;
947 textArea->fontId = SMALL_BOLD_FONT;
948 textArea->wrapping =
true;
951 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
954 if (container->nbChildren > 0) {
956 textArea->obj.alignTo = (
nbgl_obj_t *) container->children[container->nbChildren - 1];
957 textArea->obj.alignmentMarginY = VERTICAL_BORDER_MARGIN;
958 if (container->children[container->nbChildren - 1]->type ==
IMAGE) {
959 textArea->obj.alignmentMarginY = VERTICAL_BORDER_MARGIN + info->
iconHug;
962 textArea->obj.alignmentMarginY = TITLE_DESC_MARGIN;
969 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY;
971 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
972 container->nbChildren++;
979 textArea->textAlignment =
CENTER;
980 textArea->fontId = SMALL_REGULAR_FONT;
981 textArea->wrapping =
true;
984 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
987 if (container->nbChildren > 0) {
989 textArea->obj.alignTo = (
nbgl_obj_t *) container->children[container->nbChildren - 1];
990 if (container->children[container->nbChildren - 1]->type ==
TEXT_AREA) {
992 textArea->obj.alignmentMarginY = TITLE_DESC_MARGIN;
995 textArea->obj.alignmentMarginY = ICON_TITLE_MARGIN + info->
iconHug;
1002 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY;
1004 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
1005 container->nbChildren++;
1011 textArea->text = PIC(info->
subText);
1012 textArea->textAlignment =
CENTER;
1013 textArea->fontId = SMALL_REGULAR_FONT;
1014 textArea->wrapping =
true;
1017 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1019 textArea->obj.area.height += 2 * 8;
1021 if (container->nbChildren > 0) {
1023 textArea->obj.alignTo = (
nbgl_obj_t *) container->children[container->nbChildren - 1];
1024 textArea->obj.alignmentMarginY = 16;
1025 if (container->children[container->nbChildren - 1]->type ==
IMAGE) {
1026 textArea->obj.alignmentMarginY += info->
iconHug;
1033 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY;
1035 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
1036 container->nbChildren++;
1039 container->obj.alignment =
CENTER;
1041 container->obj.area.height = fullHeight;
1043 container->obj.area.height += 40;
1066 if (description->
modal) {
1070 if (!gLayout[i].isUsed) {
1071 layout = &gLayout[i];
1077 layout = &gLayout[0];
1078 if (topLayout == NULL) {
1082 if (layout == NULL) {
1091 if (description->
modal) {
1092 if (topLayout != NULL) {
1094 topLayout->
top = layout;
1095 layout->
bottom = topLayout;
1099 layout->
bottom = &gLayout[0];
1100 gLayout[0].
top = layout;
1106 gLayout[0].
top = backgroundTop;
1109 nbTouchableControls = 0;
1114 if (description->
modal) {
1128 layout->
container->obj.area.width = SCREEN_WIDTH;
1129 layout->
container->obj.area.height = SCREEN_HEIGHT;
1141 const char *tapActionText = PIC(description->
tapActionText);
1151 if (strlen(tapActionText) > 0) {
1154 footerDesc.
text.text = tapActionText;
1175 uint16_t swipesMask,
1178 tune_index_e tuneId)
1183 if (layout == NULL) {
1190 layoutInt->
tapText->text = PIC(text);
1192 layoutInt->
tapText->fontId = SMALL_REGULAR_FONT;
1196 layoutInt->
tapText->obj.alignmentMarginY = TAP_TO_CONTINUE_MARGIN;
1214 if (layout == NULL) {
1244 tune_index_e tuneId)
1251 if (layout == NULL) {
1262 button->radius = BUTTON_RADIUS;
1263 button->obj.alignmentMarginX = BORDER_MARGIN;
1264 button->obj.alignmentMarginY = BORDER_MARGIN;
1265 button->foregroundColor =
BLACK;
1266 button->innerColor =
WHITE;
1268 button->obj.touchMask = (1 <<
TOUCHED);
1270 button->icon = PIC(icon);
1315 bool separationLine,
1316 tune_index_e tuneId)
1345 if (layout == NULL) {
1349 if (barLayout->
text == NULL) {
1362 container = addListItem(layoutInt, &itemDesc);
1364 if (container == NULL) {
1367 return container->obj.area.height;
1384 if (layout == NULL) {
1388 if (switchLayout->
text == NULL) {
1392 itemDesc.
text = switchLayout->
text;
1397 itemDesc.
large =
false;
1399 container = addListItem(layoutInt, &itemDesc);
1401 if (container == NULL) {
1404 return container->obj.area.height;
1422 if (layout == NULL) {
1426 itemDesc.
text = text;
1431 container = addListItem(layoutInt, &itemDesc);
1433 if (container == NULL) {
1436 return container->obj.area.height;
1452 const char *subText,
1460 if (layout == NULL) {
1464 itemDesc.
text = text;
1467 itemDesc.
token = token;
1470 itemDesc.
index = index;
1472 container = addListItem(layoutInt, &itemDesc);
1474 if (container == NULL) {
1477 return container->obj.area.height;
1494 if (layout == NULL) {
1500 textArea->text = PIC(text);
1501 textArea->textAlignment =
MID_LEFT;
1502 textArea->fontId = LARGE_MEDIUM_FONT;
1504 textArea->wrapping =
true;
1506 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1509 textArea->obj.alignmentMarginX = BORDER_MARGIN;
1510 if (layoutInt->
container->nbChildren == 0) {
1512 textArea->obj.alignmentMarginY += PRE_FIRST_TEXT_MARGIN;
1515 textArea->obj.alignmentMarginY = INTER_PARAGRAPHS_MARGIN;
1538 const char *description,
1545 if (layout == NULL) {
1551 textArea->textColor =
BLACK;
1552 textArea->text = PIC(title);
1553 textArea->textAlignment =
MID_LEFT;
1554 textArea->fontId = LARGE_MEDIUM_FONT;
1556 textArea->wrapping =
true;
1558 textArea->obj.alignmentMarginX = BORDER_MARGIN;
1559 textArea->obj.alignmentMarginY = PRE_TITLE_MARGIN;
1562 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1568 textArea->textColor =
BLACK;
1569 textArea->text = PIC(description);
1570 textArea->fontId = SMALL_REGULAR_FONT;
1572 textArea->wrapping =
true;
1575 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1576 textArea->textAlignment =
MID_LEFT;
1578 textArea->obj.alignmentMarginX = BORDER_MARGIN;
1579 textArea->obj.alignmentMarginY = PRE_DESCRIPTION_MARGIN;
1586 textArea->text = PIC(info);
1587 textArea->fontId = SMALL_REGULAR_FONT;
1589 textArea->wrapping =
true;
1592 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1593 textArea->textAlignment =
MID_LEFT;
1595 textArea->obj.alignmentMarginX = BORDER_MARGIN;
1596 textArea->obj.alignmentMarginY = 40;
1600 return layoutInt->
container->obj.area.height;
1617 if (layout == NULL) {
1620 for (i = 0; i < choices->
nbChoices; i++) {
1637 container->nbChildren = 2;
1640 container->obj.area.height = RADIO_CHOICE_HEIGHT;
1642 container->obj.alignmentMarginX = BORDER_MARGIN;
1643 container->obj.alignTo = (
nbgl_obj_t *) NULL;
1646 button->activeColor =
BLACK;
1648 button->obj.alignTo = (
nbgl_obj_t *) container;
1651 container->children[1] = (
nbgl_obj_t *) button;
1655#ifdef HAVE_LANGUAGE_PACK
1656 textArea->text = get_ux_loc_string(choices->nameIds[i]);
1660 textArea->text = PIC(choices->
names[i]);
1662 textArea->textAlignment =
MID_LEFT;
1663 textArea->obj.area.width = container->obj.area.width - RADIO_WIDTH;
1665 textArea->obj.alignment =
MID_LEFT;
1666 textArea->obj.alignTo = (
nbgl_obj_t *) container;
1667 container->children[0] = (
nbgl_obj_t *) textArea;
1670 container->obj.touchMask = (1 <<
TOUCHED);
1671 container->obj.touchId =
CONTROLS_ID + nbTouchableControls;
1672 nbTouchableControls++;
1677 textArea->textColor =
BLACK;
1678 textArea->fontId = SMALL_BOLD_FONT;
1683 textArea->fontId = SMALL_REGULAR_FONT;
1687 line = createHorizontalLine(layoutInt->
layer);
1688 line->obj.alignmentMarginY = -1;
1713 if (layout == NULL) {
1720 if (info->
text1 != NULL) {
1728 if (info->
text2 != NULL) {
1736 if (info->
text3 != NULL) {
1744 container = addContentCenter(layoutInt, ¢eredInfo);
1747 container->obj.alignmentMarginX = BORDER_MARGIN;
1748 container->obj.alignmentMarginY = BORDER_MARGIN + info->
offsetY;
1752 container->obj.alignmentMarginY = info->
offsetY;
1755 return container->obj.area.height;
1772 if (layout == NULL) {
1776 container = addContentCenter(layoutInt, info);
1778 return container->obj.area.height;
1796 if (layout == NULL) {
1802 container->nbChildren = info->
nbRows + 1;
1806 container->obj.alignmentMarginX = BORDER_MARGIN;
1810 textArea->textColor =
BLACK;
1811 textArea->text = PIC(info->
title);
1812 textArea->textAlignment =
MID_LEFT;
1813 textArea->fontId = LARGE_MEDIUM_FONT;
1814 textArea->wrapping =
true;
1816 textArea->obj.alignmentMarginY = 24;
1820 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1822 container->obj.area.height += textArea->obj.area.height + textArea->obj.alignmentMarginY;
1824 container->children[0] = (
nbgl_obj_t *) textArea;
1826 for (row = 0; row < info->
nbRows; row++) {
1832 rowContainer->nbChildren = 2;
1837 image->foregroundColor =
BLACK;
1838 image->buffer = PIC(info->
rowIcons[row]);
1839 rowContainer->children[0] = (
nbgl_obj_t *) image;
1842 textArea->textColor =
BLACK;
1843 textArea->text = PIC(info->
rowTexts[row]);
1844 textArea->textAlignment =
MID_LEFT;
1845 textArea->fontId = SMALL_REGULAR_FONT;
1846 textArea->wrapping =
true;
1847 textArea->obj.area.width
1850 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1852 rowContainer->children[1] = (
nbgl_obj_t *) textArea;
1853 rowContainer->obj.area.height
1854 =
MAX(image->buffer->height, textArea->obj.area.height + LEFT_CONTENT_TEXT_PADDING);
1857 rowContainer->obj.alignmentMarginY = PRE_FIRST_ROW_MARGIN;
1860 rowContainer->obj.alignmentMarginY = INTER_ROWS_MARGIN;
1862 container->children[1 + row] = (
nbgl_obj_t *) rowContainer;
1863 container->obj.area.height
1864 += rowContainer->obj.area.height + rowContainer->obj.alignmentMarginY;
1868 return container->obj.area.height;
1886 uint16_t fullHeight = 0;
1889 if (layout == NULL) {
1897 container->nbChildren = 0;
1901 if (strlen(PIC(info->
url)) > 62) {
1924 fullHeight +=
qrcode->obj.area.height;
1926 container->nbChildren++;
1928 if (info->
text1 != NULL) {
1930 textArea->textColor =
BLACK;
1931 textArea->text = PIC(info->
text1);
1932 textArea->textAlignment =
CENTER;
1933 textArea->fontId = (info->
largeText1 ==
true) ? LARGE_MEDIUM_FONT : SMALL_REGULAR_FONT;
1934 textArea->wrapping =
true;
1937 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1939 textArea->obj.alignTo = (
nbgl_obj_t *) container->children[container->nbChildren - 1];
1940 textArea->obj.alignmentMarginY = QR_PRE_TEXT_MARGIN;
1942 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY;
1944 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
1945 container->nbChildren++;
1947 if (info->
text2 != NULL) {
1950 textArea->text = PIC(info->
text2);
1951 textArea->textAlignment =
CENTER;
1952 textArea->fontId = SMALL_REGULAR_FONT;
1953 textArea->wrapping =
true;
1956 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1958 textArea->obj.alignTo = (
nbgl_obj_t *) container->children[container->nbChildren - 1];
1959 if (info->
text1 != NULL) {
1960 textArea->obj.alignmentMarginY = QR_INTER_TEXTS_MARGIN;
1963 textArea->obj.alignmentMarginY = QR_PRE_TEXT_MARGIN + 8;
1966 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY + 8;
1968 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
1969 container->nbChildren++;
1972 if ((fullHeight >= (layoutInt->
container->obj.area.height - 16))
1980 container->obj.area.height = fullHeight;
1983 container->obj.alignment =
CENTER;
1987 container->obj.alignTo
1990 container->obj.alignmentMarginY = info->
offsetY;
2036 .horizontalButtons.leftIcon = info->
leftIcon,
2037 .horizontalButtons.leftToken = info->
leftToken,
2038 .horizontalButtons.rightText = info->
rightText,
2039 .horizontalButtons.rightToken = info->
rightToken,
2040 .horizontalButtons.tuneId = info->
tuneId};
2062 if (layout == NULL) {
2066 for (i = 0; i < list->
nbPairs; i++) {
2068 uint16_t fullHeight = 0;
2071 if (list->
pairs != NULL) {
2072 pair = &list->
pairs[i];
2089 itemTextArea->text = PIC(pair->
item);
2090 itemTextArea->textAlignment =
MID_LEFT;
2091 itemTextArea->fontId = SMALL_REGULAR_FONT;
2092 itemTextArea->wrapping =
true;
2095 itemTextArea->fontId, itemTextArea->text,
AVAILABLE_WIDTH, itemTextArea->wrapping);
2098 itemTextArea->obj.alignmentMarginX = 0;
2099 itemTextArea->obj.alignmentMarginY = 0;
2100 itemTextArea->obj.alignTo = NULL;
2101 container->children[container->nbChildren] = (
nbgl_obj_t *) itemTextArea;
2102 container->nbChildren++;
2104 fullHeight += itemTextArea->obj.area.height;
2107 valueTextArea->textColor =
BLACK;
2108 valueTextArea->text = PIC(pair->
value);
2109 valueTextArea->textAlignment =
MID_LEFT;
2111 valueTextArea->fontId = SMALL_BOLD_FONT;
2114 valueTextArea->fontId = LARGE_MEDIUM_FONT;
2122 valueIcon = &MINI_PUSH_ICON;
2129 valueTextArea->obj.area.width =
AVAILABLE_WIDTH - valueIcon->width - 12;
2135 valueTextArea->text,
2136 valueTextArea->obj.area.width,
2144 valueTextArea->obj.area.height = nbLines * font->
line_height;
2147 valueTextArea->obj.alignmentMarginY = 4;
2148 valueTextArea->obj.alignTo = (
nbgl_obj_t *) itemTextArea;
2149 valueTextArea->wrapping = list->
wrapping;
2150 container->children[container->nbChildren] = (
nbgl_obj_t *) valueTextArea;
2151 container->nbChildren++;
2153 fullHeight += valueTextArea->obj.area.height + valueTextArea->obj.alignmentMarginY;
2154 if (valueIcon != NULL) {
2160 image->foregroundColor =
BLACK;
2161 image->buffer = valueIcon;
2163 image->obj.alignmentMarginX = 12;
2164 image->obj.alignTo = (
nbgl_obj_t *) valueTextArea;
2166 container->obj.touchMask = (1 <<
TOUCHED);
2169 container->children[container->nbChildren] = (
nbgl_obj_t *) image;
2170 container->nbChildren++;
2174 container->obj.area.height = fullHeight;
2176 container->obj.alignmentMarginX = BORDER_MARGIN;
2178 container->obj.alignmentMarginY = INTER_TAG_VALUE_MARGIN;
2186 container->obj.alignmentMarginY = INTER_TAG_VALUE_MARGIN;
2189 container->obj.alignmentMarginY = PRE_TAG_VALUE_MARGIN;
2214 const char *subText,
2223 if (layout == NULL) {
2230 container->nbChildren = (subText != NULL) ? 3 : 2;
2235 container->obj.alignment =
CENTER;
2239 progress->foregroundColor =
BLACK;
2240 progress->withBorder =
true;
2241 progress->state = percentage;
2242 progress->obj.area.width = PROGRESSBAR_WIDTH;
2243 progress->obj.area.height = PROGRESSBAR_HEIGHT;
2247 container->children[0] = (
nbgl_obj_t *) progress;
2250 container->obj.area.height = progress->obj.alignmentMarginY + progress->obj.area.height;
2254 textArea->textColor =
BLACK;
2255 textArea->text = PIC(text);
2256 textArea->textAlignment =
CENTER;
2257 textArea->fontId = LARGE_MEDIUM_FONT;
2258 textArea->wrapping =
true;
2259 textArea->obj.alignmentMarginY = BAR_TEXT_MARGIN;
2260 textArea->obj.alignTo = (
nbgl_obj_t *) progress;
2264 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
2268 container->obj.area.height += textArea->obj.alignmentMarginY + textArea->obj.area.height;
2271 container->children[1] = (
nbgl_obj_t *) textArea;
2273 if (subText != NULL) {
2277 subTextArea->textColor =
BLACK;
2278 subTextArea->text = PIC(subText);
2279 subTextArea->textAlignment =
CENTER;
2280 subTextArea->fontId = SMALL_REGULAR_FONT;
2281 subTextArea->wrapping =
true;
2282 subTextArea->obj.alignmentMarginY = BAR_INTER_TEXTS_MARGIN;
2283 subTextArea->obj.alignTo = (
nbgl_obj_t *) textArea;
2288 subTextArea->obj.area.width,
2289 subTextArea->wrapping);
2293 container->obj.area.height
2294 += subTextArea->obj.alignmentMarginY + subTextArea->obj.area.height;
2297 container->children[2] = (
nbgl_obj_t *) subTextArea;
2300 container->obj.area.height = (container->obj.area.height + 7) & 0xFFF8;
2319 line = createHorizontalLine(layoutInt->
layer);
2320 line->obj.alignmentMarginY = -1;
2339 if (layout == NULL) {
2375 button->obj.alignmentMarginX = BORDER_MARGIN;
2376 button->obj.alignmentMarginY = 12;
2379 button->innerColor =
BLACK;
2380 button->foregroundColor =
WHITE;
2383 button->innerColor =
WHITE;
2384 button->foregroundColor =
BLACK;
2387 button->borderColor =
WHITE;
2391 button->borderColor =
BLACK;
2397 button->text = PIC(buttonInfo->
text);
2398 button->fontId = SMALL_BOLD_FONT;
2399 button->icon = PIC(buttonInfo->
icon);
2402 + SMALL_BUTTON_HEIGHT
2403 + ((button->icon) ? (button->icon->width + 12) : 0);
2404 button->obj.area.height = SMALL_BUTTON_HEIGHT;
2405 button->radius = SMALL_BUTTON_RADIUS_INDEX;
2406 if (buttonInfo->
onBottom !=
true) {
2407 button->obj.alignmentMarginX += (
AVAILABLE_WIDTH - button->obj.area.width) / 2;
2413 button->radius = BUTTON_RADIUS;
2415 button->obj.alignTo = NULL;
2416 button->obj.touchMask = (1 <<
TOUCHED);
2436 tune_index_e tuneId)
2439 .longPress.text = text,
2440 .longPress.token = token,
2441 .longPress.tuneId = tuneId};
2444 if (layout == NULL) {
2464 tune_index_e tuneId)
2489 const char *leftText,
2491 const char *rightText,
2493 tune_index_e tuneId)
2524 if (layout == NULL) {
2538 switch (headerDesc->
type) {
2569 button->innerColor =
WHITE;
2571 button->borderColor =
WHITE;
2572 button->obj.area.width = BACK_KEY_WIDTH;
2573 button->obj.area.height = TOUCHABLE_HEADER_BAR_HEIGHT;
2574 button->text = NULL;
2575 button->icon = PIC(&LEFT_ARROW_ICON);
2588 image->foregroundColor =
BLACK;
2589 image->obj.alignment =
CENTER;
2604 textArea->obj.touchMask = (1 <<
TOUCHED);
2606 textArea->obj.alignment =
CENTER;
2607 textArea->textColor =
BLACK;
2608 textArea->obj.area.width
2612 textArea->obj.area.width -= 16 + image->buffer->width;
2614 textArea->obj.area.height = TOUCHABLE_HEADER_BAR_HEIGHT;
2615 textArea->text = text;
2616 textArea->fontId = SMALL_BOLD_FONT;
2617 textArea->textAlignment =
CENTER;
2618 textArea->wrapping =
true;
2623 textArea->obj.area.width,
2626 textArea->obj.area.height
2628#ifndef BUILD_SCREENSHOTS
2630 "nbgl_layoutAddHeader: text [%s] is too long for header\n",
2642 textArea->obj.alignmentMarginX = 8 + image->buffer->width / 2;
2643 image->obj.alignmentMarginX = -8 - textArea->obj.area.width / 2;
2659 actionButton->obj.touchMask = (1 <<
TOUCHED);
2662 actionButton->obj.alignment =
MID_RIGHT;
2663 actionButton->innerColor =
WHITE;
2664 button->foregroundColor
2667 actionButton->borderColor =
WHITE;
2668 actionButton->obj.area.width = BACK_KEY_WIDTH;
2669 actionButton->obj.area.height = TOUCHABLE_HEADER_BAR_HEIGHT;
2670 actionButton->text = NULL;
2678 layoutInt->
headerContainer->obj.area.height = TOUCHABLE_HEADER_BAR_HEIGHT;
2684 line = createHorizontalLine(layoutInt->
layer);
2686 line->obj.alignmentMarginY = TOUCHABLE_HEADER_BAR_HEIGHT;
2692 subTextArea->textColor =
BLACK;
2694 subTextArea->textAlignment =
MID_LEFT;
2695 subTextArea->fontId = SMALL_REGULAR_FONT;
2696 subTextArea->wrapping =
true;
2698 subTextArea->obj.alignmentMarginY = SUB_HEADER_MARGIN;
2700 subTextArea->obj.area.height
2703 subTextArea->obj.area.width,
2704 subTextArea->wrapping);
2709 += subTextArea->obj.area.height + 2 * SUB_HEADER_MARGIN;
2711 if (button != NULL) {
2712 button->obj.alignmentMarginY
2713 -= (subTextArea->obj.area.height + 2 * SUB_HEADER_MARGIN) / 2;
2715 if (textArea != NULL) {
2716 textArea->obj.alignmentMarginY
2717 -= (subTextArea->obj.area.height + 2 * SUB_HEADER_MARGIN) / 2;
2719 if (actionButton != NULL) {
2720 actionButton->obj.alignmentMarginY
2721 -= (subTextArea->obj.area.height + 2 * SUB_HEADER_MARGIN) / 2;
2740 button->innerColor =
WHITE;
2741 button->foregroundColor =
BLACK;
2742 button->borderColor =
WHITE;
2743 button->obj.area.width = BACK_KEY_WIDTH;
2744 button->obj.area.height = TOUCHABLE_HEADER_BAR_HEIGHT;
2745 button->text = NULL;
2746 button->icon = PIC(&LEFT_ARROW_ICON);
2747 button->obj.touchMask = (1 <<
TOUCHED);
2764 progress->obj.area.width = 224;
2765 progress->obj.alignment =
CENTER;
2773 layoutInt->
headerContainer->obj.area.height = TOUCHABLE_HEADER_BAR_HEIGHT;
2779 textArea->textColor =
BLACK;
2781 textArea->obj.area.height = TOUCHABLE_HEADER_BAR_HEIGHT;
2782 textArea->text = PIC(headerDesc->
title.
text);
2783 textArea->fontId = SMALL_BOLD_FONT;
2784 textArea->textAlignment =
CENTER;
2785 textArea->wrapping =
true;
2789 layoutInt->
headerContainer->obj.area.height = textArea->obj.area.height;
2802 textArea->obj.alignmentMarginX = BORDER_MARGIN;
2803 textArea->textColor =
BLACK;
2805 textArea->obj.area.height = TOUCHABLE_HEADER_BAR_HEIGHT;
2807 textArea->fontId = SMALL_BOLD_FONT;
2809 textArea->obj.touchMask = (1 <<
TOUCHED);
2815 layoutInt->
headerContainer->obj.area.height = textArea->obj.area.height;
2823 line = createHorizontalLine(layoutInt->
layer);
2859 if (layout == NULL) {
2873 switch (footerDesc->
type) {
2891 textArea->obj.area.height
2896 textArea->textAlignment =
CENTER;
2897 textArea->obj.touchMask = (1 <<
TOUCHED);
2902 layoutInt->
footerContainer->obj.area.height = textArea->obj.area.height;
2915 textArea->textColor =
BLACK;
2917 textArea->obj.area.height = SIMPLE_FOOTER_HEIGHT;
2919 textArea->fontId = SMALL_BOLD_FONT;
2920 textArea->textAlignment =
CENTER;
2921 textArea->obj.touchMask = (1 <<
TOUCHED);
2939 textArea->textColor =
BLACK;
2941 textArea->obj.area.height = SIMPLE_FOOTER_HEIGHT;
2943 textArea->fontId = SMALL_BOLD_FONT;
2944 textArea->textAlignment =
CENTER;
2945 textArea->obj.touchMask = (1 <<
TOUCHED);
2951 layoutInt->
footerContainer->obj.area.height = textArea->obj.area.height;
2956 separationLine->obj.area.width = 1;
2957 separationLine->obj.area.height = layoutInt->
footerContainer->obj.area.height;
2958 separationLine->direction =
VERTICAL;
2959 separationLine->thickness = 1;
2960 separationLine->obj.alignment =
MID_LEFT;
2961 separationLine->obj.alignTo = (
nbgl_obj_t *) textArea;
2962 separationLine->obj.alignmentMarginX = -1;
2977 textArea->textColor =
BLACK;
2978 textArea->obj.area.width = FOOTER_TEXT_AND_NAV_WIDTH;
2979 textArea->obj.area.height = SIMPLE_FOOTER_HEIGHT;
2981 textArea->fontId = SMALL_BOLD_FONT;
2982 textArea->textAlignment =
CENTER;
2983 textArea->obj.touchMask = (1 <<
TOUCHED);
2995 navContainer->nbChildren = 4;
2996 navContainer->children
2999 navContainer->obj.area.width = SCREEN_WIDTH - textArea->obj.area.width;
3000 navContainer->obj.area.height = SIMPLE_FOOTER_HEIGHT;
3013 separationLine->obj.area.width = 1;
3014 separationLine->obj.area.height = layoutInt->
footerContainer->obj.area.height;
3015 separationLine->direction =
VERTICAL;
3016 separationLine->thickness = 1;
3017 separationLine->obj.alignment =
MID_LEFT;
3018 separationLine->obj.alignTo = (
nbgl_obj_t *) navContainer;
3019 separationLine->obj.alignmentMarginX = -1;
3057 button->obj.alignmentMarginY = SINGLE_BUTTON_MARGIN;
3059 button->innerColor =
BLACK;
3060 button->foregroundColor =
WHITE;
3063 button->innerColor =
WHITE;
3064 button->foregroundColor =
BLACK;
3068 button->borderColor =
WHITE;
3072 button->borderColor =
BLACK;
3079 button->fontId = SMALL_BOLD_FONT;
3081 button->radius = BUTTON_RADIUS;
3090 button->obj.touchMask = (1 <<
TOUCHED);
3118 button->innerColor =
WHITE;
3120 button->obj.alignmentMarginY
3121 = SINGLE_BUTTON_MARGIN;
3126 button->obj.alignmentMarginY
3127 = BUTTON_FROM_BOTTOM_MARGIN;
3128 button->borderColor =
WHITE;
3129 button->obj.area.height = FOOTER_IN_PAIR_HEIGHT;
3131 button->foregroundColor =
BLACK;
3133 button->radius = BUTTON_RADIUS;
3135 button->fontId = SMALL_BOLD_FONT;
3136 button->obj.touchMask = (1 <<
TOUCHED);
3146 line = createHorizontalLine(layoutInt->
layer);
3167 button->obj.alignmentMarginY = TOP_BUTTON_MARGIN;
3170 button->obj.alignmentMarginY
3171 = SINGLE_BUTTON_MARGIN;
3174 button->obj.alignmentMarginY
3175 = TOP_BUTTON_MARGIN_WITH_ACTION;
3178 button->innerColor =
WHITE;
3180 button->foregroundColor =
BLACK;
3183 button->innerColor =
BLACK;
3184 button->borderColor =
BLACK;
3185 button->foregroundColor =
WHITE;
3189 button->radius = BUTTON_RADIUS;
3194 button->fontId = SMALL_BOLD_FONT;
3195 button->obj.touchMask = (1 <<
TOUCHED);
3203 layoutInt->
footerContainer->obj.area.height = ROUNDED_AND_FOOTER_FOOTER_HEIGHT;
3206 layoutInt->
footerContainer->obj.area.height = BOTH_ROUNDED_FOOTER_HEIGHT;
3209 layoutInt->
footerContainer->obj.area.height = ACTION_AND_FOOTER_FOOTER_HEIGHT;
3220 addSwipeInternal(layoutInt,
3231 line = createHorizontalLine(layoutInt->
layer);
3237 if (separationLine != NULL) {
3270 if (layout == NULL) {
3287 switch (upFooterDesc->
type) {
3306 button->obj.alignmentMarginX = BORDER_MARGIN;
3308 button->innerColor =
BLACK;
3309 button->foregroundColor =
WHITE;
3310 button->borderColor =
BLACK;
3313 button->radius = BUTTON_RADIUS;
3314 button->icon = PIC(&VALIDATE_ICON);
3318 textArea->textColor =
BLACK;
3320 textArea->textAlignment =
MID_LEFT;
3321 textArea->fontId = LARGE_MEDIUM_FONT;
3322 textArea->wrapping =
true;
3323 textArea->obj.area.width = SCREEN_WIDTH - 3 * BORDER_MARGIN - button->obj.area.width;
3325 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
3327 textArea->obj.alignment =
MID_LEFT;
3328 textArea->obj.alignmentMarginX = BORDER_MARGIN;
3331 line = createHorizontalLine(layoutInt->
layer);
3336 progressBar->obj.area.width = SCREEN_WIDTH;
3337 progressBar->obj.area.height = LONG_PRESS_PROGRESS_HEIGHT;
3339 progressBar->obj.alignmentMarginY = LONG_PRESS_PROGRESS_ALIGN;
3340 progressBar->resetIfOverriden =
true;
3341 progressBar->partialRedraw =
true;
3357 button->obj.alignment =
CENTER;
3360 button->innerColor =
BLACK;
3361 button->foregroundColor =
WHITE;
3364 button->innerColor =
WHITE;
3365 button->foregroundColor =
BLACK;
3368 button->borderColor =
WHITE;
3372 button->borderColor =
BLACK;
3378 button->text = PIC(upFooterDesc->
button.
text);
3379 button->fontId = SMALL_BOLD_FONT;
3380 button->icon = PIC(upFooterDesc->
button.
icon);
3383 button->radius = BUTTON_RADIUS;
3385 button->obj.alignTo = NULL;
3386 button->obj.touchMask = (1 <<
TOUCHED);
3413 button->obj.alignmentMarginX = BORDER_MARGIN;
3415 button->innerColor =
WHITE;
3416 button->foregroundColor =
BLACK;
3419 button->radius = BUTTON_RADIUS;
3421 button->fontId = SMALL_BOLD_FONT;
3422 button->obj.touchMask = (1 <<
TOUCHED);
3438 button->obj.alignmentMarginX = BORDER_MARGIN;
3439 button->innerColor =
BLACK;
3440 button->borderColor =
BLACK;
3441 button->foregroundColor =
WHITE;
3444 button->radius = BUTTON_RADIUS;
3446 button->fontId = SMALL_BOLD_FONT;
3447 button->obj.touchMask = (1 <<
TOUCHED);
3469 textArea->textColor =
BLACK;
3470 textArea->text = PIC(upFooterDesc->
tipBox.
text);
3471 textArea->textAlignment =
MID_LEFT;
3472 textArea->fontId = SMALL_REGULAR_FONT;
3473 textArea->wrapping =
true;
3476 textArea->obj.area.width
3478 + TIP_BOX_TEXT_ICON_MARGIN;
3481 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
3482 textArea->obj.alignment =
MID_LEFT;
3483 textArea->obj.alignmentMarginX = BORDER_MARGIN;
3487 line = createHorizontalLine(layoutInt->
layer);
3493 image->obj.alignmentMarginX = BORDER_MARGIN;
3495 image->foregroundColor =
BLACK;
3496 image->buffer = PIC(upFooterDesc->
tipBox.
icon);
3509 upFooterDesc->
text.token,
3510 upFooterDesc->
text.tuneId);
3520 if (strlen(PIC(upFooterDesc->
text.text))) {
3523 textArea->text = PIC(upFooterDesc->
text.text);
3524 textArea->textAlignment =
CENTER;
3525 textArea->fontId = SMALL_REGULAR_FONT;
3526 textArea->wrapping =
true;
3529 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
3530 textArea->obj.alignment =
CENTER;
3567 tune_index_e tuneId)
3570 .separationLine =
false,
3571 .progressAndBack.activePage = activePage,
3572 .progressAndBack.nbPages = nbPages,
3573 .progressAndBack.token = backToken,
3574 .progressAndBack.tuneId = tuneId,
3575 .progressAndBack.withBack = withBack,
3576 .progressAndBack.actionIcon = NULL,
3595 const char *subText,
3596 uint8_t initPosition)
3604 if (layout == NULL) {
3610 container->nbChildren = 3;
3615 container->obj.alignment =
CENTER;
3619 spinner->position = initPosition;
3622 container->children[0] = (
nbgl_obj_t *) spinner;
3625 container->obj.area.height += SPINNER_HEIGHT;
3629 textArea->textColor =
BLACK;
3630 textArea->text = PIC(text);
3631 textArea->textAlignment =
CENTER;
3632 textArea->fontId = (subText != NULL) ? LARGE_MEDIUM_FONT : SMALL_REGULAR_FONT;
3633 textArea->wrapping =
true;
3634 textArea->obj.alignmentMarginY = SPINNER_TEXT_MARGIN;
3635 textArea->obj.alignTo = (
nbgl_obj_t *) spinner;
3639 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
3643 container->obj.area.height += textArea->obj.alignmentMarginY + textArea->obj.area.height;
3646 container->children[1] = (
nbgl_obj_t *) textArea;
3648 if (subText != NULL) {
3652 subTextArea->textColor =
BLACK;
3653 subTextArea->text = PIC(subText);
3654 subTextArea->textAlignment =
CENTER;
3655 subTextArea->fontId = SMALL_REGULAR_FONT;
3656 subTextArea->wrapping =
true;
3657 subTextArea->obj.alignmentMarginY = SPINNER_INTER_TEXTS_MARGIN;
3658 subTextArea->obj.alignTo = (
nbgl_obj_t *) textArea;
3663 subTextArea->obj.area.width,
3664 subTextArea->wrapping);
3668 container->obj.area.height
3669 += subTextArea->obj.alignmentMarginY + subTextArea->obj.area.height;
3672 container->children[2] = (
nbgl_obj_t *) subTextArea;
3682 tickerCfg.tickerCallback = &spinnerTickerCallback;
3702 const char *subText,
3712 if ((layout == NULL) || (layoutInt->
container->nbChildren == 0)) {
3717 if ((container->obj.type !=
CONTAINER) || (container->nbChildren < 2)) {
3722 if (spinner->obj.type !=
SPINNER) {
3726 if (spinner->position != position) {
3727 spinner->position = position;
3737 const char *newText = PIC(text);
3738 size_t newTextLen = strlen(newText);
3740 if ((newTextLen != strlen(textArea->text)) || memcmp(textArea->text, newText, newTextLen)) {
3741 textArea->text = newText;
3746 if (subText != NULL) {
3749 if (container->nbChildren != 3) {
3753 if (subTextArea->obj.type !=
TEXT_AREA) {
3756 const char *newSubText = PIC(subText);
3757 size_t newSubTextLen = strlen(newSubText);
3759 if ((newSubTextLen != strlen(subTextArea->text))
3760 || memcmp(subTextArea->text, newSubText, newSubTextLen)) {
3761 subTextArea->text = newSubText;
3780 if (layout == NULL) {
3810 if ((layout == NULL) || (!layout->
isUsed)) {
3814 if (layout->
modal) {
3817 if (layout == topLayout) {
3818 topLayout = layout->
bottom;
3819 topLayout->
top = NULL;
Random Number Generation.
@ ANIM_ILLUSTRATION
animation
@ ICON_ILLUSTRATION
simple icon
#define LOG_WARN(__logger,...)
#define LOG_DEBUG(__logger,...)
#define LOG_FATAL(__logger,...)
Middle Level API of the new BOLOS Graphical Library.
#define QR_V10_NB_PIX_SIZE
#define QR_V4_NB_PIX_SIZE
uint8_t nbgl_getFontHeight(nbgl_font_id_e fontId)
return the height in pixels of the font with the given font ID
uint16_t nbgl_getTextWidth(nbgl_font_id_e fontId, const char *text)
return the max width in pixels of the given text (can be multiline)
uint16_t nbgl_getTextHeightInWidth(nbgl_font_id_e fontId, const char *text, uint16_t maxWidth, bool wrapping)
return the height of the given multiline text, with the given font.
uint16_t nbgl_getTextNbLinesInWidth(nbgl_font_id_e fontId, const char *text, uint16_t maxWidth, bool wrapping)
compute the number of lines of the given text fitting in the given maxWidth
const nbgl_font_t * nbgl_getFont(nbgl_font_id_e fontId)
uint8_t nbgl_getFontLineHeight(nbgl_font_id_e fontId)
return the height in pixels of the line of font with the given font ID
Font screen low-Level driver API, to draw elementary forms.
int nbgl_layoutAddTagValueList(nbgl_layout_t *layout, const nbgl_layoutTagValueList_t *list)
Creates a list of [tag,value] pairs.
int nbgl_layoutAddContentCenter(nbgl_layout_t *layout, const nbgl_contentCenter_t *info)
Creates an area on the center of the main panel, with a possible icon, and possible texts under it.
int nbgl_layoutAddUpFooter(nbgl_layout_t *layout, const nbgl_layoutUpFooter_t *upFooterDesc)
Creates a touchable area on top of the footer of the screen, containing various controls,...
int nbgl_layoutDraw(nbgl_layout_t *layoutParam)
Applies given layout. The screen will be redrawn.
#define NB_MAX_CONTAINER_CHILDREN
int nbgl_layoutAddTextContent(nbgl_layout_t *layout, const char *title, const char *description, const char *info)
Creates in the main container three text areas:
int nbgl_layoutAddText(nbgl_layout_t *layout, const char *text, const char *subText)
Creates an area with given text (in bold) and sub text (in regular)
int nbgl_layoutAddProgressIndicator(nbgl_layout_t *layout, uint8_t activePage, uint8_t nbPages, bool withBack, uint8_t backToken, tune_index_e tuneId)
Creates a kind of navigation bar with an optional <- arrow on the left. This widget is placed on top ...
int nbgl_layoutAddNavigationBar(nbgl_layout_t *layout, const nbgl_layoutNavigationBar_t *info)
Creates a navigation bar on bottom of main container.
int nbgl_layoutAddSeparationLine(nbgl_layout_t *layout)
adds a separation line on bottom of the last added item
int nbgl_layoutAddQRCode(nbgl_layout_t *layout, const nbgl_layoutQRCode_t *info)
Creates an area on the center of the main panel, with a QRCode, a possible text in black (bold) under...
int nbgl_layoutAddRadioChoice(nbgl_layout_t *layout, const nbgl_layoutRadioChoice_t *choices)
Creates a list of radio buttons (on the right)
int nbgl_layoutAddCenteredInfo(nbgl_layout_t *layout, const nbgl_layoutCenteredInfo_t *info)
Creates an area on the center of the main panel, with a possible icon/image, a possible text in black...
int nbgl_layoutAddSplitFooter(nbgl_layout_t *layout, const char *leftText, uint8_t leftToken, const char *rightText, uint8_t rightToken, tune_index_e tuneId)
Creates 2 touchable texts at the footer of the screen, separated with a thin line from the rest of th...
int nbgl_layoutAddTextWithAlias(nbgl_layout_t *layout, const char *text, const char *subText, uint8_t token, uint8_t index)
Creates an area with given text (in bold) and sub text (in regular), with a icon on right of text to...
int nbgl_layoutAddTouchableBar(nbgl_layout_t *layout, const nbgl_layoutBar_t *barLayout)
Creates a touchable bar in main panel.
#define SPINNER_REFRESH_PERIOD
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.
int nbgl_layoutInvertBackground(nbgl_layout_t *layout)
Inverts the background color (black instead of white)
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.
int nbgl_layoutAddSwitch(nbgl_layout_t *layout, const nbgl_layoutSwitch_t *switchLayout)
Creates a switch with the given text and its state.
int nbgl_layoutAddHorizontalButtons(nbgl_layout_t *layout, const nbgl_layoutHorizontalButtons_t *info)
Creates two buttons to make a choice. Both buttons are mandatory The left one contains only an icon a...
int nbgl_layoutAddButton(nbgl_layout_t *layout, const nbgl_layoutButton_t *buttonInfo)
Creates a rounded button in the main container.
nbgl_layout_t * nbgl_layoutGet(const nbgl_layoutDescription_t *description)
returns a layout of the given type. The layout is reset
int nbgl_layoutAddExtendedFooter(nbgl_layout_t *layout, const nbgl_layoutFooter_t *footerDesc)
Creates a touchable area at the footer of the screen, containing various controls,...
int nbgl_layoutAddLeftContent(nbgl_layout_t *layout, const nbgl_layoutLeftContent_t *info)
Creates an area with a title, and rows of icon + text, left aligned.
int nbgl_layoutAddChoiceButtons(nbgl_layout_t *layout, const nbgl_layoutChoiceButtons_t *info)
Creates two buttons to make a choice. Both buttons are mandatory. Both buttons are full width,...
int nbgl_layoutRelease(nbgl_layout_t *layoutParam)
Release the layout obtained with nbgl_layoutGet()
int nbgl_layoutAddSpinner(nbgl_layout_t *layout, const char *text, const char *subText, uint8_t initPosition)
Creates a centered (vertically & horizontally) spinner with a text under it.
int nbgl_layoutUpdateSpinner(nbgl_layout_t *layout, const char *text, const char *subText, uint8_t position)
Update an existing spinner (must be the only object of the layout)
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.
void layoutAddObject(nbgl_layoutInternal_t *layout, nbgl_obj_t *obj)
adds the given obj to the main container
int nbgl_layoutAddProgressBar(nbgl_layout_t *layout, const char *text, const char *subText, uint8_t percentage)
Creates an area in main panel to display a progress bar, with a title text and a subtext if needed.
int nbgl_layoutAddHeader(nbgl_layout_t *layout, const nbgl_layoutHeader_t *headerDesc)
Creates a touchable (or not) area at the header of the screen, containing various controls,...
int nbgl_layoutAddBottomButton(nbgl_layout_t *layout, const nbgl_icon_details_t *icon, uint8_t token, bool separationLine, tune_index_e tuneId)
Creates a centered button at bottom of main container.
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...
int nbgl_layoutAddLargeCaseText(nbgl_layout_t *layout, const char *text, bool grayedOut)
Creates an area with given text in 32px font (in Black or Light Gray)
layoutObj_t * layoutAddCallbackObj(nbgl_layoutInternal_t *layout, nbgl_obj_t *obj, uint8_t token, tune_index_e tuneId)
void(* nbgl_layoutTouchCallback_t)(int token, uint8_t index)
prototype of function to be called when an object is touched
@ WHITE_BACKGROUND
rounded bordered button, with text/icon in black, on white background
@ NO_BORDER
simple clickable text, in black
@ BLACK_BACKGROUND
rounded bordered button, with text/icon in white, on black background
@ UP_FOOTER_TEXT
grayed-out text, for example "Tap to continue"
@ UP_FOOTER_BUTTON
simple button
@ UP_FOOTER_LONG_PRESS
long-press button
@ UP_FOOTER_TIP_BOX
Tip-box.
@ UP_FOOTER_HORIZONTAL_BUTTONS
2 buttons, on the same line
void * nbgl_layout_t
type shared externally
@ HEADER_TITLE
simple centered text
@ HEADER_BACK_AND_PROGRESS
optional back key and progress indicator (only on Stax)
@ HEADER_EMPTY
empty space, to have a better vertical centering of centered info
@ HEADER_EXTENDED_BACK
back key, centered text and touchable key on the right
@ HEADER_BACK_AND_TEXT
back key and optional text
@ HEADER_RIGHT_TEXT
touchable text on the right, with a vertical separation line
@ HEADER_BACK_ICON_AND_TEXT
back key and optional icon and text
#define NBGL_INVALID_TOKEN
#define SPINNER_FIXED
position to use for a "fixed" spinner
@ SOFT_ACTION_AND_FOOTER_STYLE
A white button on top of a footer, with a separation line.
@ BOTH_ROUNDED_STYLE
A black button on top of a white button.
@ ROUNDED_AND_FOOTER_STYLE
A black background button on top of a footer.
#define NBGL_NO_PROGRESS_INDICATOR
To be used when a control token shall not be used.
@ FOOTER_SIMPLE_TEXT
simple touchable text in bold
@ FOOTER_NAV
navigation bar
@ FOOTER_SIMPLE_BUTTON
simple black or white button (see nbgl_layoutButtonStyle_t)
@ FOOTER_DOUBLE_TEXT
2 touchable texts in bold, separated by a vertical line (only on Stax)
@ FOOTER_EMPTY
empty space, to have a better vertical centering of centered info
@ FOOTER_CHOICE_BUTTONS
double buttons (see nbgl_layoutChoiceButtonsStyle_t)
Internal functions/constants of NBGL layout layer.
@ SWIPE_USAGE_SUGGESTIONS
bool keyboardSwipeCallback(nbgl_obj_t *obj, nbgl_touchType_t eventType)
void layoutNavigationPopulate(nbgl_container_t *navContainer, const nbgl_layoutNavigationBar_t *navConfig, uint8_t layer)
This function creates a full navigation bar "object", with buttons and returns it as a container.
#define LAYOUT_OBJ_POOL_LEN
Max number of complex objects with callback retrievable from pool.
bool layoutNavigationCallback(nbgl_obj_t *obj, nbgl_touchType_t eventType, uint8_t nbPages, uint8_t *activePage)
function to be called when any of the controls in navigation bar is touched
API to draw all basic graphic objects.
struct PACKED__ nbgl_line_s nbgl_line_t
struct to represent a vertical or horizontal line
struct PACKED__ nbgl_navigation_bar_s nbgl_page_indicator_t
struct to represent a navigation bar (PAGE_INDICATOR type) There can be up to 5 page indicators,...
struct PACKED__ nbgl_radio_s nbgl_radio_t
struct to represent a radio button (RADIO_BUTTON type)
#define NB_SPINNER_POSITIONS
void(* nbgl_touchCallback_t)(void *obj, nbgl_touchType_t eventType)
prototype of function to be called when a touch event is received by an object
struct PACKED__ nbgl_text_area_s nbgl_text_area_t
struct to represent a text area (TEXT_AREA type)
void nbgl_objDraw(nbgl_obj_t *obj)
This function draws or redraws the given object and its children (recursive version)
struct PACKED__ nbgl_progress_bar_s nbgl_progress_bar_t
struct to represent a progress bar (PROGRESS_BAR type)
nbgl_obj_t ** nbgl_containerPoolGet(uint8_t nbObjs, uint8_t layer)
Gets a new container from the pool, with the given number of obj pointers.
nbgl_obj_t * nbgl_objPoolGet(nbgl_obj_type_t type, uint8_t layer)
Gets a new graphic object from the pool, with the given type. The type field of the object is set.
void nbgl_refreshSpecial(nbgl_refresh_mode_t mode)
This functions refreshes the actual screen on display with what has changed since the last refresh,...
struct PACKED__ nbgl_image_s nbgl_image_t
struct to represent an image (IMAGE type)
#define INACTIVE_SMALL_FONT
struct PACKED__ nbgl_button_s nbgl_button_t
struct to represent a button (BUTTON type) that can contain a text and/or an icon
#define INACTIVE_TEXT_COLOR
void nbgl_refreshSpecialWithPostRefresh(nbgl_refresh_mode_t mode, nbgl_post_refresh_t post_refresh)
struct PACKED__ nbgl_container_s nbgl_container_t
struct to represent a container (CONTAINER type)
struct PACKED__ nbgl_switch_s nbgl_switch_t
struct to represent a switch (size is fixed) (SWITCH type)
struct PACKED__ nbgl_obj_s nbgl_obj_t
Common structure for all graphical objects.
struct PACKED__ nbgl_spinner_s nbgl_spinner_t
struct to represent a "spinner", represented by the Ledger corners, in gray, with one of the corners ...
struct PACKED__ nbgl_qrcode_s nbgl_qrcode_t
struct to represent a QR code (QR_CODE type), whose size is fixed
int nbgl_screenSet(nbgl_obj_t ***elements, uint8_t nbElements, const nbgl_screenTickerConfiguration_t *ticker, nbgl_touchCallback_t touchCallback)
Configures the lowest layer screen. To be used by applications A nbgl_screenRedraw() can be called af...
int nbgl_screenPush(nbgl_obj_t ***elements, uint8_t nbElements, const nbgl_screenTickerConfiguration_t *ticker, nbgl_touchCallback_t touchCallback)
Pushes a screen on top of the stack, with the given number of elements, if possible....
void nbgl_wait_pipeline(void)
int nbgl_screenUpdateTicker(uint8_t screenIndex, const nbgl_screenTickerConfiguration_t *ticker)
Updates the ticker configuration of the screen at the given screenIndex, always set at WHITE in.
int nbgl_screenPop(uint8_t screenIndex)
Release the screen at the given index in screen array (index returned by nbgl_screenPush())....
struct PACKED__ nbgl_screenTickerConfiguration_s nbgl_screenTickerConfiguration_t
struct to configure a screen layer
int nbgl_screenUpdateBackgroundColor(uint8_t screenIndex, color_t color)
Updates the background color of the screen at the given screenIndex, always set at WHITE in.
void nbgl_screenRedraw(void)
This function redraws the whole screen on top of stack and its children.
uint32_t nbgl_touchGetTouchDuration(nbgl_obj_t *obj)
nbgl_state_t
to represent a boolean state.
@ POST_REFRESH_FORCE_POWER_OFF
Force screen power off after refresh.
@ POST_REFRESH_FORCE_POWER_ON
Force screen power on after refresh.
@ POST_REFRESH_FORCE_POWER_ON_WITH_PIPELINE
Force screen power on and enable pipeline.
nbgl_touchType_t
The different types of Touchscreen events.
@ TOUCHING
corresponding to an object that is currently touched
@ QRCODE_V10
QRCode V10, can encode text len up to 1500 chars, display size = 228*228.
@ QRCODE_V4_SMALL
QRCode V4, can encode text len up to 1500 chars, display size = 132*132.
@ QRCODE_V4
QRCode V4, can encode text len up to 62 chars, display size = 264*264.
@ VERTICAL
from top to bottom
@ HORIZONTAL
from left to right
@ LOOP_PARSING
0, 1, 2, 0, 1, 2, ...
struct PACKED__ nbgl_icon_details_s nbgl_icon_details_t
Represents all information about an icon.
@ NO_ALIGNMENT
used when parent container layout is used
@ RIGHT_TOP
on outside right
@ IMAGE
Bitmap (y and height must be multiple of 4 on Stax)
@ SWITCH
Switch to turn on/off something.
@ RADIO_BUTTON
Indicator to inform whether something is on or off.
@ BUTTON
Rounded rectangle button with icon and/or text.
@ PROGRESS_BAR
horizontal bar to indicate progression of something (between 0% and 100%)
@ PAGE_INDICATOR
horizontal bar to indicate position within pages
@ LINE
Vertical or Horizontal line.
@ CONTAINER
Empty container.
@ TEXT_AREA
Area to contain text line(s)
@ NBGL_BPP_1
1 bit per pixel
@ BLACK_AND_WHITE_REFRESH
to be used for pure B&W area, when contrast is important
@ BLACK_AND_WHITE_FAST_REFRESH
to be used for pure B&W area, when contrast is not priority
@ FULL_COLOR_PARTIAL_REFRESH
to be used for small partial refresh (radio buttons, switches)
const nbgl_icon_details_t * iconRight
const nbgl_icon_details_t * iconLeft
uint16_t delayMs
delay between 2 drawings
uint8_t nbIcons
number of icons in icons array
const nbgl_icon_details_t ** icons
array of nbIcons pointers on icons
nbgl_parsingType_t parsing
This structure contains info to build a centered (vertically and horizontally) area,...
uint16_t iconHug
vertical margin to apply on top and bottom of the icon
const nbgl_icon_details_t * icon
the icon (can be null)
const char * title
title in black large (can be null)
const char * description
description in black small regular case (can be null)
const char * subText
sub-text in dark gray regular small case
uint16_t animOffsetY
vertical offset of animation in icon if integrated (but usually 0)
bool padding
if true, apply a padding of 40px at the bottom
const nbgl_animation_t * animation
the animation (can be null), used if illustrType is ANIM_ILLUSTRATION
const char * smallTitle
sub-title in black small bold case (can be null)
uint16_t animOffsetX
horizontal offset of animation in icon if integrated (but usually 0)
nbgl_contentIllustrationType_t illustrType
This structure contains info to build a centered (vertically and horizontally) area,...
const char * text2
second text (can be null)
const char * text1
first text (can be null)
bool onTop
if set to true, align only horizontally
nbgl_contentCenteredInfoStyle_t style
style to apply to this info
int16_t offsetY
vertical shift to apply to this info (if >0, shift to bottom)
const char * text3
third text (can be null)
const nbgl_icon_details_t * icon
a buffer containing the 1BPP icon
This structure contains a list of names to build a list of radio buttons (on the right part of screen...
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when selecting a radio button)
uint8_t token
the token that will be used as argument of the callback
bool localized
if set to true, use nameIds and not names
uint8_t initChoice
index of the current choice
const char *const * names
array of strings giving the choices (nbChoices)
uint8_t nbChoices
number of choices
This structure contains info to build a switch (on the right) with a description (on the left),...
const char * text
main text for the switch
uint8_t token
the token that will be used as argument of the callback (unused on Nano)
nbgl_state_t initState
initial state of the switch
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played
const char * subText
description under main text (NULL terminated, single line, may be null)
This structure contains a list of [tag,value] pairs.
const nbgl_contentTagValue_t * pairs
array of [tag,value] pairs (nbPairs items). If NULL, callback is used instead
nbgl_contentTagValueCallback_t callback
function to call to retrieve a given pair
uint8_t nbMaxLinesForValue
bool wrapping
if set to true, value text will be wrapped on ' ' to avoid cutting words
uint8_t startIndex
index of the first pair to get with callback
This structure contains a [tag,value] pair and possible extensions.
const nbgl_icon_details_t * valueIcon
const char * value
string giving the value name
const char * item
string giving the tag name
const char * text
text of the tip-box
const nbgl_icon_details_t * icon
icon of the tip-box
uint8_t token
token used when tip-box is tapped
tune_index_e tuneId
tune played when tip-box is tapped
structure defining an ASCII font
uint8_t line_height
height of a line for all characters in pixels
This structure contains info to build a clickable "bar" with a text and an icon.
bool inactive
if set to true, the bar is grayed-out and cannot be touched
const char * text
text (can be NULL)
uint8_t token
the token that will be used as argument of the callback
bool large
set to true only for the main level of OS settings
const char * subText
sub text (can be NULL)
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played
const nbgl_icon_details_t * iconLeft
a buffer containing the 1BPP icon for icon on left (can be NULL)
const nbgl_icon_details_t * iconRight
Structure containing all information when creating a layout. This structure must be passed as argumen...
nbgl_screenTickerConfiguration_t ticker
const char * tapActionText
Light gray text used when main container is "tapable".
nbgl_layoutTouchCallback_t onActionCallback
the callback to be called on any action on the layout
Structure containing all information about the current layout.
uint8_t nbUsedCallbackObjs
nbgl_container_t * footerContainer
container used to store footer (buttons, nav....)
uint8_t activePage
index of active page for navigation bar
uint8_t layer
layer in screen stack
struct nbgl_layoutInternal_s * top
layout above this one, in stack
nbgl_swipe_usage_t swipeUsage
nbgl_layoutTouchCallback_t callback
user callback for all controls
struct nbgl_layoutInternal_s * bottom
layout under this one, in stack
uint8_t invertedColors
if true, means that background is black
nbgl_container_t * container
uint8_t iconIdxInAnim
current icon index in animation
nbgl_container_t * headerContainer
container used to store header (progress, back, empty space...)
uint8_t isUsed
if true, means this layout is in use
nbgl_layoutFooterType_t footerType
type of footer
nbgl_layoutHeaderType_t headerType
type of header
nbgl_container_t * upFooterContainer
uint8_t incrementAnim
if true, means that animation index is currently incrementing
uint8_t nbPages
number of pages for navigation bar
nbgl_layoutUpFooterType_t upFooterType
type of up-footer
uint8_t modal
if true, means the screen is a modal
layoutObj_t callbackObjPool[LAYOUT_OBJ_POOL_LEN]
nbgl_text_area_t * tapText
nbgl_obj_t ** children
children for main screen
const nbgl_animation_t * animation
current animation (if not NULL)
This structure contains info to build a left content area.
uint8_t nbRows
number of rows in the area
const char * title
title of area in bold
const nbgl_icon_details_t ** rowIcons
array of nbRows icon
const char ** rowTexts
array of nbRows texts (displayed in regular)
This structure contains info to build a navigation bar at the bottom of the screen.
uint8_t activePage
index of active page (from 0 to nbPages-1).
tune_index_e tuneId
if not NBGL_NO_TUNE, a tune will be played when pressing keys)
bool withBackKey
if set to true, the "back" key is drawn
bool withExitKey
if set to true, an exit button is drawn (X on the left)
uint8_t token
the token that will be used as argument of the callback
uint8_t nbPages
number of pages. (if 0, no navigation)
This structure contains info to build a centered (vertically and horizontally) area,...
const char * text2
second text (can be null)
const char * text1
first text (can be null)
const char * url
URL for QR code.
bool largeText1
if set to true, use 32px font for text1
int16_t offsetY
vertical shift to apply to this info (if > 0, shift to bottom)
bool centered
if set to true, center vertically