18#include "localization.h"
28#include "os_io_seph_ux.h"
30#include "os_helpers.h"
37#define INTERNAL_SPACE 16
39#define INNER_MARGIN 12
41#define NB_MAX_LAYOUTS 3
44#define NB_MAX_CONTAINER_CHILDREN 20
46#define TAG_VALUE_ICON_WIDTH 32
48#if defined(TARGET_STAX)
49#define RADIO_CHOICE_HEIGHT 96
50#define BAR_INTERVALE 12
51#define FOOTER_BUTTON_HEIGHT 128
52#define FOOTER_IN_PAIR_HEIGHT 80
53#define ROUNDED_AND_FOOTER_FOOTER_HEIGHT 192
54#define FOOTER_TEXT_AND_NAV_WIDTH 160
55#define TAP_TO_CONTINUE_MARGIN 24
56#define SUB_HEADER_MARGIN 24
57#define PRE_FIRST_TEXT_MARGIN 24
58#define INTER_PARAGRAPHS_MARGIN 40
59#define PRE_TITLE_MARGIN 24
60#define PRE_DESCRIPTION_MARGIN 16
61#define INTER_DESCRIPTIONS_MARGIN 16
62#define PRE_FIRST_ROW_MARGIN 32
63#define INTER_ROWS_MARGIN 16
64#define QR_PRE_TEXT_MARGIN 24
65#define QR_INTER_TEXTS_MARGIN 40
66#define SPINNER_TEXT_MARGIN 20
67#define SPINNER_INTER_TEXTS_MARGIN 20
68#define BAR_TEXT_MARGIN 24
69#define BAR_INTER_TEXTS_MARGIN 16
70#define LEFT_CONTENT_TEXT_PADDING 0
71#define BUTTON_FROM_BOTTOM_MARGIN 4
72#define TOP_BUTTON_MARGIN VERTICAL_BORDER_MARGIN
73#define TOP_BUTTON_MARGIN_WITH_ACTION VERTICAL_BORDER_MARGIN
74#define SINGLE_BUTTON_MARGIN 24
75#define LONG_PRESS_PROGRESS_HEIGHT 8
76#define LONG_PRESS_PROGRESS_ALIGN 1
77#define LEFT_CONTENT_ICON_TEXT_X 16
78#define TIP_BOX_MARGIN_Y 24
79#define TIP_BOX_TEXT_ICON_MARGIN 24
80#elif defined(TARGET_FLEX) || defined(TARGET_APOLLO)
81#define RADIO_CHOICE_HEIGHT 92
82#define BAR_INTERVALE 16
83#define FOOTER_BUTTON_HEIGHT 136
84#define FOOTER_IN_PAIR_HEIGHT 88
85#define ROUNDED_AND_FOOTER_FOOTER_HEIGHT 208
86#define FOOTER_TEXT_AND_NAV_WIDTH 192
87#define TAP_TO_CONTINUE_MARGIN 30
88#define SUB_HEADER_MARGIN 28
89#define PRE_FIRST_TEXT_MARGIN 0
90#define INTER_PARAGRAPHS_MARGIN 24
91#define PRE_TITLE_MARGIN 16
92#define PRE_DESCRIPTION_MARGIN 24
93#define INTER_DESCRIPTIONS_MARGIN 24
94#define PRE_FIRST_ROW_MARGIN 32
95#define INTER_ROWS_MARGIN 24
96#define QR_PRE_TEXT_MARGIN 24
97#define QR_INTER_TEXTS_MARGIN 28
98#define SPINNER_TEXT_MARGIN 24
99#define SPINNER_INTER_TEXTS_MARGIN 16
100#define BAR_TEXT_MARGIN 24
101#define BAR_INTER_TEXTS_MARGIN 16
102#define LEFT_CONTENT_TEXT_PADDING 4
103#define BUTTON_FROM_BOTTOM_MARGIN 4
104#define TOP_BUTTON_MARGIN VERTICAL_BORDER_MARGIN
105#define TOP_BUTTON_MARGIN_WITH_ACTION VERTICAL_BORDER_MARGIN
106#define SINGLE_BUTTON_MARGIN 24
107#define LONG_PRESS_PROGRESS_HEIGHT 8
108#define LONG_PRESS_PROGRESS_ALIGN 1
109#define LEFT_CONTENT_ICON_TEXT_X 16
110#define TIP_BOX_MARGIN_Y 24
111#define TIP_BOX_TEXT_ICON_MARGIN 32
112#elif defined(TARGET_APEX)
113#define RADIO_CHOICE_HEIGHT 68
114#define BAR_INTERVALE 8
115#define FOOTER_BUTTON_HEIGHT 88
116#define FOOTER_IN_PAIR_HEIGHT 60
117#define ROUNDED_AND_FOOTER_FOOTER_HEIGHT 128
118#define FOOTER_TEXT_AND_NAV_WIDTH 120
119#define TAP_TO_CONTINUE_MARGIN 30
120#define SUB_HEADER_MARGIN 16
121#define PRE_FIRST_TEXT_MARGIN 0
122#define INTER_PARAGRAPHS_MARGIN 16
123#define PRE_TITLE_MARGIN 16
124#define PRE_DESCRIPTION_MARGIN 12
125#define INTER_DESCRIPTIONS_MARGIN 12
126#define PRE_FIRST_ROW_MARGIN 24
127#define INTER_ROWS_MARGIN 12
128#define QR_PRE_TEXT_MARGIN 16
129#define QR_INTER_TEXTS_MARGIN 20
130#define SPINNER_TEXT_MARGIN 16
131#define SPINNER_INTER_TEXTS_MARGIN 16
132#define BAR_TEXT_MARGIN 16
133#define BAR_INTER_TEXTS_MARGIN 12
134#define LEFT_CONTENT_TEXT_PADDING 4
135#define BUTTON_FROM_BOTTOM_MARGIN 0
136#define TOP_BUTTON_MARGIN 12
137#define TOP_BUTTON_MARGIN_WITH_ACTION 0
138#define SINGLE_BUTTON_MARGIN 16
139#define LONG_PRESS_PROGRESS_HEIGHT 4
140#define LONG_PRESS_PROGRESS_ALIGN 0
141#define LEFT_CONTENT_ICON_TEXT_X 8
142#define TIP_BOX_MARGIN_Y 12
143#define TIP_BOX_TEXT_ICON_MARGIN 20
145#error Undefined target
149#define SPINNER_REFRESH_PERIOD 400
204#if defined(TARGET_FLEX) || defined(TARGET_APOLLO)
206#define HOLD_TO_APPROVE_STEP_PERCENT (7)
208#define HOLD_TO_APPROVE_STEP_DURATION_MS (100)
210#define HOLD_TO_APPROVE_FIRST_STEP (0)
211#elif defined(TARGET_STAX)
212#define HOLD_TO_APPROVE_STEP_PERCENT (25)
213#define HOLD_TO_APPROVE_STEP_DURATION_MS (400)
214#define HOLD_TO_APPROVE_FIRST_STEP (1)
215#elif defined(TARGET_APEX)
216#define HOLD_TO_APPROVE_STEP_PERCENT (20)
217#define HOLD_TO_APPROVE_STEP_DURATION_MS (300)
218#define HOLD_TO_APPROVE_FIRST_STEP (1)
223 uint8_t current_step_nb
224 = (touch_duration / HOLD_TO_APPROVE_STEP_DURATION_MS) + HOLD_TO_APPROVE_FIRST_STEP;
225 return (current_step_nb * HOLD_TO_APPROVE_STEP_PERCENT);
240 for (j = 0; j <
topLayout->nbUsedCallbackObjs; j++) {
241 if (obj ==
topLayout->callbackObjPool[j].obj) {
243 "getLayoutAndLayoutObj(): obj found in layout %p "
244 "nbUsedCallbackObjs = %d\n",
248 *layoutObj = &(
topLayout->callbackObjPool[j]);
270 bool needRefresh =
false;
282 "touchCallback(): eventType = %d, obj = %p, no active layout or obj not found\n",
300 layoutObj->
index = eventType;
349 layoutObj->
index = lSwitch->state;
367#ifdef HAVE_PIEZO_SOUND
369 os_io_seph_cmd_piezo_play_tune(layoutObj->
tuneId);
400 bool trigger_callback = (new_state >= 100) && (progressBar->state < 100);
403 if (new_state >= 100) {
408 if (new_state != progressBar->state) {
409 progressBar->partialRedraw =
true;
410 progressBar->state = new_state;
419 if (trigger_callback) {
429#ifdef HAVE_SE_EINK_DISPLAY
432 progressBar->partialRedraw =
true;
433 progressBar->state = 0;
447 uint8_t i =
NB_MAX_LAYOUTS, radioIndex = 0, foundRadio = 0xFF, foundRadioIndex;
455 while (i < layout->nbUsedCallbackObjs) {
465 foundRadioIndex = radioIndex;
467 textArea->textColor =
BLACK;
468 textArea->fontId = SMALL_BOLD_FONT;
490 textArea->fontId = SMALL_REGULAR_FONT;
498 if (foundRadio != 0xFF) {
500#ifdef HAVE_PIEZO_SOUND
522 while (i < topLayout->container->nbChildren) {
525 if (container->nbChildren && (container->children[0]->type ==
SPINNER)) {
530 spinner->position = 0;
553 while (i < layout->container->nbChildren) {
556 if (container->children[1]->type ==
IMAGE) {
601 line->obj.area.width = SCREEN_WIDTH;
602 line->obj.area.height = 1;
609static nbgl_line_t *createLeftVerticalLine(uint8_t layer)
615 line->obj.area.width = 1;
616 line->obj.area.height = SCREEN_HEIGHT;
636 layoutObj->
obj = obj;
637 layoutObj->
token = token;
638 layoutObj->
tuneId = tuneId;
657 if (layout == NULL) {
670 if (layoutObj->
obj == obj) {
671 layoutObj->
token = token;
722 layoutInt->
container->obj.touchMask = swipesMask;
748 common_color =
BLACK;
749 right_icon_color =
BLACK;
770 container->nbChildren = 0;
773 container->obj.area.height
774 = LIST_ITEM_MIN_TEXT_HEIGHT
775 + 2 * (itemDesc->
large ? LIST_ITEM_PRE_HEADING_LARGE : LIST_ITEM_PRE_HEADING);
777 container->obj.alignmentMarginX = BORDER_MARGIN;
779 container->obj.alignTo = NULL;
784 container->obj.touchMask = (1 <<
TOUCHED);
790 if (itemDesc->
text != NULL) {
792 textArea->textColor = common_color;
793 textArea->text = PIC(itemDesc->
text);
794 textArea->onDrawCallback = NULL;
795 textArea->fontId = fontId;
796 textArea->wrapping =
true;
797 textArea->obj.area.width = container->obj.area.width;
800 textArea->obj.area.width
805 textArea->obj.area.width
809 textArea->obj.area.width -= SWITCH_ICON.width + BAR_INTERVALE;
811 textArea->obj.area.height =
MAX(
812 LIST_ITEM_MIN_TEXT_HEIGHT,
814 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping));
817 textArea->obj.alignmentMarginY
818 = itemDesc->
large ? LIST_ITEM_PRE_HEADING_LARGE : LIST_ITEM_PRE_HEADING;
819 if (textArea->obj.area.height > LIST_ITEM_MIN_TEXT_HEIGHT) {
820 textArea->obj.alignmentMarginY
821 -= (textArea->obj.area.height - LIST_ITEM_MIN_TEXT_HEIGHT) / 2;
824 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
825 container->nbChildren++;
831 imageLeft->foregroundColor = common_color;
832 imageLeft->buffer = PIC(itemDesc->
iconLeft);
834 imageLeft->obj.alignment =
MID_LEFT;
835 imageLeft->obj.alignTo = (
nbgl_obj_t *) textArea;
836 imageLeft->obj.alignmentMarginX = BAR_INTERVALE;
837 container->children[container->nbChildren] = (
nbgl_obj_t *) imageLeft;
838 container->nbChildren++;
840 if (textArea != NULL) {
841 textArea->obj.alignmentMarginX = imageLeft->buffer->width + BAR_INTERVALE;
847 imageRight->foregroundColor = right_icon_color;
848 imageRight->buffer = PIC(itemDesc->
iconRight);
851 imageRight->obj.alignmentMarginX = BAR_INTERVALE;
852 imageRight->obj.alignTo = (
nbgl_obj_t *) textArea;
854 container->children[container->nbChildren] = (
nbgl_obj_t *) imageRight;
855 container->nbChildren++;
859 switchObj->onColor =
BLACK;
861 switchObj->state = itemDesc->
state;
863 switchObj->obj.alignmentMarginX = BAR_INTERVALE;
864 switchObj->obj.alignTo = (
nbgl_obj_t *) textArea;
866 container->children[container->nbChildren] = (
nbgl_obj_t *) switchObj;
867 container->nbChildren++;
870 if (itemDesc->
subText != NULL) {
874 subTextArea->textColor = common_color;
875 subTextArea->text = PIC(itemDesc->
subText);
876 subTextArea->textAlignment =
MID_LEFT;
877 subTextArea->fontId = SMALL_REGULAR_FONT;
879 subTextArea->wrapping =
true;
880 if (itemDesc->
text != NULL) {
882 subTextArea->obj.alignTo = (
nbgl_obj_t *) textArea;
883 subTextArea->obj.alignmentMarginY = LIST_ITEM_HEADING_SUB_TEXT;
886 subTextArea->obj.alignment =
TOP_LEFT;
887 subTextArea->obj.alignmentMarginY = SUB_HEADER_MARGIN;
888 container->obj.area.height = SUB_HEADER_MARGIN;
891 subTextArea->obj.alignmentMarginX
894 subTextArea->obj.area.width = container->obj.area.width;
897 subTextArea->obj.area.width,
898 subTextArea->wrapping);
899 container->children[container->nbChildren] = (
nbgl_obj_t *) subTextArea;
900 container->nbChildren++;
901 container->obj.area.height
902 += subTextArea->obj.area.height + subTextArea->obj.alignmentMarginY;
924 uint16_t fullHeight = 0;
929 container->nbChildren = 0;
934 if (info->
icon != NULL) {
937 image->buffer = PIC(info->
icon);
939 image->obj.alignmentMarginY = info->
iconHug;
941 fullHeight += image->buffer->height + info->
iconHug;
942 container->children[container->nbChildren] = (
nbgl_obj_t *) image;
943 container->nbChildren++;
954 container->children[container->nbChildren] = (
nbgl_obj_t *) anim;
955 container->nbChildren++;
971 if (info->
title != NULL) {
974 textArea->text = PIC(info->
title);
975 textArea->textAlignment =
CENTER;
976 textArea->fontId = LARGE_MEDIUM_FONT;
977 textArea->wrapping =
true;
980 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
983 if (container->nbChildren > 0) {
986 textArea->obj.alignmentMarginY = ICON_TITLE_MARGIN + info->
iconHug;
992 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY;
994 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
995 container->nbChildren++;
1002 textArea->textAlignment =
CENTER;
1003 textArea->fontId = SMALL_BOLD_FONT;
1004 textArea->wrapping =
true;
1007 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1010 if (container->nbChildren > 0) {
1012 textArea->obj.alignTo = (
nbgl_obj_t *) container->children[container->nbChildren - 1];
1013 textArea->obj.alignmentMarginY = VERTICAL_BORDER_MARGIN;
1014 if (container->children[container->nbChildren - 1]->type ==
IMAGE) {
1015 textArea->obj.alignmentMarginY = VERTICAL_BORDER_MARGIN + info->
iconHug;
1018 textArea->obj.alignmentMarginY = TITLE_DESC_MARGIN;
1025 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY;
1027 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
1028 container->nbChildren++;
1035 textArea->textAlignment =
CENTER;
1036 textArea->fontId = SMALL_REGULAR_FONT;
1037 textArea->wrapping =
true;
1040 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1043 if (container->nbChildren > 0) {
1045 textArea->obj.alignTo = (
nbgl_obj_t *) container->children[container->nbChildren - 1];
1046 if (container->children[container->nbChildren - 1]->type ==
TEXT_AREA) {
1048 textArea->obj.alignmentMarginY = TITLE_DESC_MARGIN;
1051 textArea->obj.alignmentMarginY = ICON_TITLE_MARGIN + info->
iconHug;
1058 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY;
1060 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
1061 container->nbChildren++;
1067 textArea->text = PIC(info->
subText);
1068 textArea->textAlignment =
CENTER;
1069 textArea->fontId = SMALL_REGULAR_FONT;
1070 textArea->wrapping =
true;
1073 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1075 textArea->obj.area.height += 2 * 8;
1077 if (container->nbChildren > 0) {
1079 textArea->obj.alignTo = (
nbgl_obj_t *) container->children[container->nbChildren - 1];
1080 textArea->obj.alignmentMarginY = 16;
1081 if (container->children[container->nbChildren - 1]->type ==
IMAGE) {
1082 textArea->obj.alignmentMarginY += info->
iconHug;
1089 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY;
1091 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
1092 container->nbChildren++;
1095 container->obj.alignment =
CENTER;
1097 container->obj.area.height = fullHeight;
1099 container->obj.area.height += 40;
1122 if (description->
modal) {
1138 if (layout == NULL) {
1147 if (description->
modal) {
1162 gLayout[0].top = backgroundTop;
1170 if (description->
modal) {
1184 layout->
container->obj.area.width = SCREEN_WIDTH;
1185 layout->
container->obj.area.height = SCREEN_HEIGHT;
1197 const char *tapActionText = PIC(description->
tapActionText);
1207 if (strlen(tapActionText) > 0) {
1210 footerDesc.
text.text = tapActionText;
1231 uint16_t swipesMask,
1234 tune_index_e tuneId)
1239 if (layout == NULL) {
1246 layoutInt->
tapText->text = PIC(text);
1248 layoutInt->
tapText->fontId = SMALL_REGULAR_FONT;
1252 layoutInt->
tapText->obj.alignmentMarginY = TAP_TO_CONTINUE_MARGIN;
1270 if (layout == NULL) {
1300 tune_index_e tuneId)
1307 if (layout == NULL) {
1319 button->radius = BUTTON_RADIUS;
1320 button->obj.alignmentMarginX = BORDER_MARGIN;
1321 button->obj.alignmentMarginY = BORDER_MARGIN;
1322 button->foregroundColor =
BLACK;
1323 button->innerColor =
WHITE;
1325 button->obj.touchMask = (1 <<
TOUCHED);
1327 button->icon = PIC(icon);
1371 bool separationLine,
1372 tune_index_e tuneId)
1399 if (layout == NULL) {
1403 if (barLayout->
text == NULL) {
1418 if (container == NULL) {
1422 return container->obj.area.height;
1439 if (layout == NULL) {
1443 if (switchLayout->
text == NULL) {
1447 itemDesc.
text = switchLayout->
text;
1455 if (container == NULL) {
1459 return container->obj.area.height;
1477 if (layout == NULL) {
1481 itemDesc.
text = text;
1488 if (container == NULL) {
1492 return container->obj.area.height;
1508 const char *subText,
1516 if (layout == NULL) {
1520 itemDesc.
text = text;
1523 itemDesc.
token = token;
1526 itemDesc.
index = index;
1530 if (container == NULL) {
1534 return container->obj.area.height;
1551 if (layout == NULL) {
1557 textArea->text = PIC(text);
1558 textArea->textAlignment =
MID_LEFT;
1559 textArea->fontId = LARGE_MEDIUM_FONT;
1561 textArea->wrapping =
true;
1563 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1566 textArea->obj.alignmentMarginX = BORDER_MARGIN;
1567 if (layoutInt->
container->nbChildren == 0) {
1569 textArea->obj.alignmentMarginY += PRE_FIRST_TEXT_MARGIN;
1572 textArea->obj.alignmentMarginY = INTER_PARAGRAPHS_MARGIN;
1598 if (layout == NULL) {
1603 if (content->
title != NULL) {
1605 textArea->textColor =
BLACK;
1606 textArea->text = PIC(content->
title);
1607 textArea->textAlignment =
MID_LEFT;
1608 textArea->fontId = LARGE_MEDIUM_FONT;
1610 textArea->wrapping =
true;
1612 textArea->obj.alignmentMarginX = BORDER_MARGIN;
1613 textArea->obj.alignmentMarginY = PRE_TITLE_MARGIN;
1616 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1624 textArea->textColor =
BLACK;
1626 textArea->fontId = SMALL_REGULAR_FONT;
1628 textArea->wrapping =
true;
1631 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1632 textArea->textAlignment =
MID_LEFT;
1634 textArea->obj.alignmentMarginX = BORDER_MARGIN;
1635 textArea->obj.alignmentMarginY
1636 = (i == 0) ? PRE_DESCRIPTION_MARGIN : INTER_DESCRIPTIONS_MARGIN;
1642 if (content->
info != NULL) {
1645 textArea->text = PIC(content->
info);
1646 textArea->fontId = SMALL_REGULAR_FONT;
1648 textArea->wrapping =
true;
1651 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1652 textArea->textAlignment =
MID_LEFT;
1654 textArea->obj.alignmentMarginX = BORDER_MARGIN;
1655 textArea->obj.alignmentMarginY = 40;
1660 return layoutInt->
container->obj.area.height;
1677 if (layout == NULL) {
1680 for (i = 0; i < choices->
nbChoices; i++) {
1698 container->nbChildren = 2;
1701 container->obj.area.height = RADIO_CHOICE_HEIGHT;
1703 container->obj.alignmentMarginX = BORDER_MARGIN;
1704 container->obj.alignTo = (
nbgl_obj_t *) NULL;
1707 button->activeColor =
BLACK;
1709 button->obj.alignTo = (
nbgl_obj_t *) container;
1712 container->children[1] = (
nbgl_obj_t *) button;
1716#ifdef HAVE_LANGUAGE_PACK
1717 textArea->text = get_ux_loc_string(choices->nameIds[i]);
1721 textArea->text = PIC(choices->
names[i]);
1723 textArea->textAlignment =
MID_LEFT;
1724 textArea->obj.area.width = container->obj.area.width - RADIO_WIDTH;
1726 textArea->obj.alignment =
MID_LEFT;
1727 textArea->obj.alignTo = (
nbgl_obj_t *) container;
1728 container->children[0] = (
nbgl_obj_t *) textArea;
1731 container->obj.touchMask = (1 <<
TOUCHED);
1738 textArea->textColor =
BLACK;
1739 textArea->fontId = SMALL_BOLD_FONT;
1744 textArea->fontId = SMALL_REGULAR_FONT;
1749 line->obj.alignmentMarginY = -1;
1774 if (layout == NULL) {
1781 if (info->
text1 != NULL) {
1789 if (info->
text2 != NULL) {
1797 if (info->
text3 != NULL) {
1808 container->obj.alignmentMarginX = BORDER_MARGIN;
1809 container->obj.alignmentMarginY = BORDER_MARGIN + info->
offsetY;
1813 container->obj.alignmentMarginY = info->
offsetY;
1816 return container->obj.area.height;
1833 if (layout == NULL) {
1839 return container->obj.area.height;
1857 if (layout == NULL) {
1863 container->nbChildren = info->
nbRows + 1;
1867 container->obj.alignmentMarginX = BORDER_MARGIN;
1871 textArea->textColor =
BLACK;
1872 textArea->text = PIC(info->
title);
1873 textArea->textAlignment =
MID_LEFT;
1874 textArea->fontId = LARGE_MEDIUM_FONT;
1875 textArea->wrapping =
true;
1877 textArea->obj.alignmentMarginY = 24;
1881 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1883 container->obj.area.height += textArea->obj.area.height + textArea->obj.alignmentMarginY;
1885 container->children[0] = (
nbgl_obj_t *) textArea;
1887 for (row = 0; row < info->
nbRows; row++) {
1893 rowContainer->nbChildren = 2;
1898 image->foregroundColor =
BLACK;
1899 image->buffer = PIC(info->
rowIcons[row]);
1900 rowContainer->children[0] = (
nbgl_obj_t *) image;
1903 textArea->textColor =
BLACK;
1904 textArea->text = PIC(info->
rowTexts[row]);
1905 textArea->textAlignment =
MID_LEFT;
1906 textArea->fontId = SMALL_REGULAR_FONT;
1907 textArea->wrapping =
true;
1908 textArea->obj.area.width
1911 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1913 rowContainer->children[1] = (
nbgl_obj_t *) textArea;
1914 rowContainer->obj.area.height
1915 =
MAX(image->buffer->height, textArea->obj.area.height + LEFT_CONTENT_TEXT_PADDING);
1918 rowContainer->obj.alignmentMarginY = PRE_FIRST_ROW_MARGIN;
1921 rowContainer->obj.alignmentMarginY = INTER_ROWS_MARGIN;
1923 container->children[1 + row] = (
nbgl_obj_t *) rowContainer;
1924 container->obj.area.height
1925 += rowContainer->obj.area.height + rowContainer->obj.alignmentMarginY;
1929 return container->obj.area.height;
1947 uint16_t fullHeight = 0;
1950 if (layout == NULL) {
1958 container->nbChildren = 0;
1962 if (strlen(PIC(info->
url)) > 62) {
1968 qrcode->foregroundColor =
BLACK;
1974 qrcode->obj.area.width
1977 qrcode->obj.area.width
1980 qrcode->obj.area.height = qrcode->obj.area.width;
1981 qrcode->text = PIC(info->
url);
1985 fullHeight += qrcode->obj.area.height;
1986 container->children[container->nbChildren] = (
nbgl_obj_t *) qrcode;
1987 container->nbChildren++;
1989 if (info->
text1 != NULL) {
1991 textArea->textColor =
BLACK;
1992 textArea->text = PIC(info->
text1);
1993 textArea->textAlignment =
CENTER;
1994 textArea->fontId = (info->
largeText1 ==
true) ? LARGE_MEDIUM_FONT : SMALL_REGULAR_FONT;
1995 textArea->wrapping =
true;
1998 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
2000 textArea->obj.alignTo = (
nbgl_obj_t *) container->children[container->nbChildren - 1];
2001 textArea->obj.alignmentMarginY = QR_PRE_TEXT_MARGIN;
2003 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY;
2005 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
2006 container->nbChildren++;
2008 if (info->
text2 != NULL) {
2011 textArea->text = PIC(info->
text2);
2012 textArea->textAlignment =
CENTER;
2013 textArea->fontId = SMALL_REGULAR_FONT;
2014 textArea->wrapping =
true;
2017 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
2019 textArea->obj.alignTo = (
nbgl_obj_t *) container->children[container->nbChildren - 1];
2020 if (info->
text1 != NULL) {
2021 textArea->obj.alignmentMarginY = QR_INTER_TEXTS_MARGIN;
2024 textArea->obj.alignmentMarginY = QR_PRE_TEXT_MARGIN + 8;
2027 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY + 8;
2029 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
2030 container->nbChildren++;
2033 if ((fullHeight >= (layoutInt->
container->obj.area.height - 16))
2038 qrcode->obj.area.height = qrcode->obj.area.width;
2041 container->obj.area.height = fullHeight;
2044 container->obj.alignment =
CENTER;
2048 container->obj.alignTo
2051 container->obj.alignmentMarginY = info->
offsetY;
2096 .horizontalButtons.leftIcon = info->
leftIcon,
2097 .horizontalButtons.leftToken = info->
leftToken,
2098 .horizontalButtons.rightText = info->
rightText,
2099 .horizontalButtons.rightToken = info->
rightToken,
2100 .horizontalButtons.tuneId = info->
tuneId};
2120 if (layout == NULL) {
2128 if ((list->
pairs == NULL)
2134 for (i = 0; i < list->
nbPairs; i++) {
2136 uint16_t fullHeight = 0;
2140 uint8_t nbChildren = 2;
2143 if (list->
pairs != NULL) {
2144 pair = &list->
pairs[i];
2150 "nbgl_layoutAddTagValueList(): callback returned NULL for index %d\n",
2162 if (valueIcon != NULL) {
2178 itemTextArea->text = PIC(pair->
item);
2179 itemTextArea->textAlignment =
MID_LEFT;
2180 itemTextArea->fontId = SMALL_REGULAR_FONT;
2181 itemTextArea->wrapping =
true;
2184 itemTextArea->fontId, itemTextArea->text,
AVAILABLE_WIDTH, itemTextArea->wrapping);
2185 container->children[container->nbChildren] = (
nbgl_obj_t *) itemTextArea;
2186 container->nbChildren++;
2188 fullHeight += itemTextArea->obj.area.height;
2191 valueTextArea->textColor =
BLACK;
2192 valueTextArea->text = PIC(pair->
value);
2193 valueTextArea->textAlignment =
MID_LEFT;
2206 valueTextArea->text,
2207 valueTextArea->obj.area.width,
2210 if ((nbMaxLines > 0) && (nbLines > nbMaxLines)) {
2211 nbLines = nbMaxLines;
2212 valueTextArea->nbMaxLines = nbMaxLines;
2216 valueTextArea->obj.area.height = nbLines * font->
line_height;
2219 valueTextArea->obj.alignTo = (
nbgl_obj_t *) itemTextArea;
2220 valueTextArea->wrapping = list->
wrapping;
2221 container->children[container->nbChildren] = (
nbgl_obj_t *) valueTextArea;
2222 container->nbChildren++;
2224 fullHeight += valueTextArea->obj.area.height + valueTextArea->obj.alignmentMarginY;
2225 if (valueIcon != NULL) {
2231 image->foregroundColor =
BLACK;
2232 image->buffer = valueIcon;
2235 image->obj.alignTo = (
nbgl_obj_t *) valueTextArea;
2237 container->obj.touchMask = (1 <<
TOUCHED);
2240 container->children[container->nbChildren] = (
nbgl_obj_t *) image;
2241 container->nbChildren++;
2248 textArea->textColor =
BLACK;
2250 textArea->textAlignment =
MID_LEFT;
2251 textArea->nbMaxLines = 1;
2252 textArea->fontId = SMALL_REGULAR_FONT;
2254 textArea->obj.area.width = valueTextArea->obj.area.width;
2257 textArea->obj.alignTo = (
nbgl_obj_t *) valueTextArea;
2258 textArea->wrapping = list->
wrapping;
2259 textArea->hideEndOfLastLine
2261 > textArea->obj.area.width);
2262 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
2263 container->nbChildren++;
2264 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY;
2269 container->obj.area.height = fullHeight;
2271 container->obj.alignmentMarginX = BORDER_MARGIN;
2273 container->obj.alignmentMarginY = INTER_TAG_VALUE_MARGIN;
2281 container->obj.alignmentMarginY = INTER_TAG_VALUE_MARGIN;
2284 container->obj.alignmentMarginY = PRE_TAG_VALUE_MARGIN;
2309 const char *subText,
2318 if (layout == NULL) {
2325 container->nbChildren = (subText != NULL) ? 3 : 2;
2330 container->obj.alignment =
CENTER;
2334 progress->foregroundColor =
BLACK;
2335 progress->withBorder =
true;
2336 progress->state = percentage;
2337 progress->obj.area.width = PROGRESSBAR_WIDTH;
2338 progress->obj.area.height = PROGRESSBAR_HEIGHT;
2342 container->children[0] = (
nbgl_obj_t *) progress;
2345 container->obj.area.height = progress->obj.alignmentMarginY + progress->obj.area.height;
2349 textArea->textColor =
BLACK;
2350 textArea->text = PIC(text);
2351 textArea->textAlignment =
CENTER;
2352 textArea->fontId = LARGE_MEDIUM_FONT;
2353 textArea->wrapping =
true;
2354 textArea->obj.alignmentMarginY = BAR_TEXT_MARGIN;
2355 textArea->obj.alignTo = (
nbgl_obj_t *) progress;
2359 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
2363 container->obj.area.height += textArea->obj.alignmentMarginY + textArea->obj.area.height;
2366 container->children[1] = (
nbgl_obj_t *) textArea;
2368 if (subText != NULL) {
2372 subTextArea->textColor =
BLACK;
2373 subTextArea->text = PIC(subText);
2374 subTextArea->textAlignment =
CENTER;
2375 subTextArea->fontId = SMALL_REGULAR_FONT;
2376 subTextArea->wrapping =
true;
2377 subTextArea->obj.alignmentMarginY = BAR_INTER_TEXTS_MARGIN;
2378 subTextArea->obj.alignTo = (
nbgl_obj_t *) textArea;
2383 subTextArea->obj.area.width,
2384 subTextArea->wrapping);
2388 container->obj.area.height
2389 += subTextArea->obj.alignmentMarginY + subTextArea->obj.area.height;
2392 container->children[2] = (
nbgl_obj_t *) subTextArea;
2395 container->obj.area.height = (container->obj.area.height + 7) & 0xFFF8;
2415 line->obj.alignmentMarginY = -1;
2434 if (layout == NULL) {
2470 button->obj.alignmentMarginX = BORDER_MARGIN;
2471 button->obj.alignmentMarginY = 12;
2474 button->innerColor =
BLACK;
2475 button->foregroundColor =
WHITE;
2478 button->innerColor =
WHITE;
2479 button->foregroundColor =
BLACK;
2482 button->borderColor =
WHITE;
2486 button->borderColor =
BLACK;
2492 button->text = PIC(buttonInfo->
text);
2493 button->fontId = SMALL_BOLD_FONT;
2494 button->icon = PIC(buttonInfo->
icon);
2497 + SMALL_BUTTON_HEIGHT
2498 + ((button->icon) ? (button->icon->width + 12) : 0);
2499 button->obj.area.height = SMALL_BUTTON_HEIGHT;
2500 button->radius = SMALL_BUTTON_RADIUS_INDEX;
2501 if (buttonInfo->
onBottom !=
true) {
2502 button->obj.alignmentMarginX += (
AVAILABLE_WIDTH - button->obj.area.width) / 2;
2508 button->radius = BUTTON_RADIUS;
2510 button->obj.alignTo = NULL;
2511 button->obj.touchMask = (1 <<
TOUCHED);
2531 tune_index_e tuneId)
2534 .longPress.text = text,
2535 .longPress.token = token,
2536 .longPress.tuneId = tuneId};
2539 if (layout == NULL) {
2559 tune_index_e tuneId)
2583 const char *leftText,
2585 const char *rightText,
2587 tune_index_e tuneId)
2618 if (layout == NULL) {
2632 switch (headerDesc->
type) {
2658 "nbgl_layoutAddHeader(): no more callback obj for type %d\n",
2663 button->innerColor =
WHITE;
2664 button->foregroundColor =
BLACK;
2665 button->borderColor =
WHITE;
2666 button->obj.area.width = BACK_KEY_WIDTH;
2667 button->obj.area.height = TOUCHABLE_HEADER_BAR_HEIGHT;
2668 button->text = NULL;
2669 button->icon = PIC(&LEFT_ARROW_ICON);
2670 button->obj.touchMask = (1 <<
TOUCHED);
2683 image->foregroundColor =
BLACK;
2684 image->obj.alignment =
CENTER;
2698 "nbgl_layoutAddHeader(): no more callback obj for type %d\n",
2702 textArea->obj.touchMask = (1 <<
TOUCHED);
2704 textArea->obj.alignment =
CENTER;
2705 textArea->textColor =
BLACK;
2706 textArea->obj.area.width
2710 textArea->obj.area.width -= 16 + image->buffer->width;
2712 textArea->obj.area.height = TOUCHABLE_HEADER_BAR_HEIGHT;
2713 textArea->text = text;
2714 textArea->fontId = SMALL_BOLD_FONT;
2715 textArea->textAlignment =
CENTER;
2716 textArea->wrapping =
true;
2721 textArea->obj.area.width,
2724 textArea->obj.area.height
2726#ifndef BUILD_SCREENSHOTS
2728 "nbgl_layoutAddHeader: text [%s] is too long for header\n",
2740 textArea->obj.alignmentMarginX = 8 + image->buffer->width / 2;
2741 image->obj.alignmentMarginX = -8 - textArea->obj.area.width / 2;
2756 "nbgl_layoutAddHeader(): no more callback obj for type %d\n",
2760 actionButton->obj.touchMask = (1 <<
TOUCHED);
2763 actionButton->obj.alignment =
MID_RIGHT;
2764 actionButton->innerColor =
WHITE;
2765 actionButton->foregroundColor
2768 actionButton->borderColor =
WHITE;
2769 actionButton->obj.area.width = BACK_KEY_WIDTH;
2770 actionButton->obj.area.height = TOUCHABLE_HEADER_BAR_HEIGHT;
2771 actionButton->text = NULL;
2779 layoutInt->
headerContainer->obj.area.height = TOUCHABLE_HEADER_BAR_HEIGHT;
2787 line->obj.alignmentMarginY = TOUCHABLE_HEADER_BAR_HEIGHT;
2793 subTextArea->textColor =
BLACK;
2795 subTextArea->textAlignment =
MID_LEFT;
2796 subTextArea->fontId = SMALL_REGULAR_FONT;
2797 subTextArea->wrapping =
true;
2799 subTextArea->obj.alignmentMarginY = SUB_HEADER_MARGIN;
2801 subTextArea->obj.area.height
2804 subTextArea->obj.area.width,
2805 subTextArea->wrapping);
2810 += subTextArea->obj.area.height + 2 * SUB_HEADER_MARGIN;
2812 if (button != NULL) {
2813 button->obj.alignmentMarginY
2814 -= (subTextArea->obj.area.height + 2 * SUB_HEADER_MARGIN) / 2;
2816 if (textArea != NULL) {
2817 textArea->obj.alignmentMarginY
2818 -= (subTextArea->obj.area.height + 2 * SUB_HEADER_MARGIN) / 2;
2820 if (actionButton != NULL) {
2821 actionButton->obj.alignmentMarginY
2822 -= (subTextArea->obj.area.height + 2 * SUB_HEADER_MARGIN) / 2;
2838 "nbgl_layoutAddHeader(): no more callback obj for type %d\n",
2844 button->innerColor =
WHITE;
2845 button->foregroundColor =
BLACK;
2846 button->borderColor =
WHITE;
2847 button->obj.area.width = BACK_KEY_WIDTH;
2848 button->obj.area.height = TOUCHABLE_HEADER_BAR_HEIGHT;
2849 button->text = NULL;
2850 button->icon = PIC(&LEFT_ARROW_ICON);
2851 button->obj.touchMask = (1 <<
TOUCHED);
2868 progress->obj.area.width = 224;
2869 progress->obj.alignment =
CENTER;
2877 layoutInt->
headerContainer->obj.area.height = TOUCHABLE_HEADER_BAR_HEIGHT;
2883 textArea->textColor =
BLACK;
2885 textArea->obj.area.height = TOUCHABLE_HEADER_BAR_HEIGHT;
2886 textArea->text = PIC(headerDesc->
title.
text);
2887 textArea->fontId = SMALL_BOLD_FONT;
2888 textArea->textAlignment =
CENTER;
2889 textArea->wrapping =
true;
2893 layoutInt->
headerContainer->obj.area.height = textArea->obj.area.height;
2904 "nbgl_layoutAddHeader(): no more callback obj for type %d\n",
2909 textArea->obj.alignmentMarginX = BORDER_MARGIN;
2910 textArea->textColor =
BLACK;
2912 textArea->obj.area.height = TOUCHABLE_HEADER_BAR_HEIGHT;
2914 textArea->fontId = SMALL_BOLD_FONT;
2916 textArea->obj.touchMask = (1 <<
TOUCHED);
2922 layoutInt->
headerContainer->obj.area.height = textArea->obj.area.height;
2966 if (layout == NULL) {
2980 switch (footerDesc->
type) {
2999 textArea->obj.area.height
3004 textArea->textAlignment =
CENTER;
3005 textArea->obj.touchMask = (1 <<
TOUCHED);
3010 layoutInt->
footerContainer->obj.area.height = textArea->obj.area.height;
3024 textArea->textColor =
BLACK;
3026 textArea->obj.area.height = SIMPLE_FOOTER_HEIGHT;
3028 textArea->fontId = SMALL_BOLD_FONT;
3029 textArea->textAlignment =
CENTER;
3030 textArea->obj.touchMask = (1 <<
TOUCHED);
3049 textArea->textColor =
BLACK;
3051 textArea->obj.area.height = SIMPLE_FOOTER_HEIGHT;
3053 textArea->fontId = SMALL_BOLD_FONT;
3054 textArea->textAlignment =
CENTER;
3055 textArea->obj.touchMask = (1 <<
TOUCHED);
3061 layoutInt->
footerContainer->obj.area.height = textArea->obj.area.height;
3066 separationLine->obj.area.width = 1;
3067 separationLine->obj.area.height = layoutInt->
footerContainer->obj.area.height;
3068 separationLine->direction =
VERTICAL;
3069 separationLine->thickness = 1;
3070 separationLine->obj.alignment =
MID_LEFT;
3071 separationLine->obj.alignTo = (
nbgl_obj_t *) textArea;
3072 separationLine->obj.alignmentMarginX = -1;
3088 textArea->textColor =
BLACK;
3089 textArea->obj.area.width = FOOTER_TEXT_AND_NAV_WIDTH;
3090 textArea->obj.area.height = SIMPLE_FOOTER_HEIGHT;
3092 textArea->fontId = SMALL_BOLD_FONT;
3093 textArea->textAlignment =
CENTER;
3094 textArea->obj.touchMask = (1 <<
TOUCHED);
3106 navContainer->nbChildren = 4;
3107 navContainer->children
3110 navContainer->obj.area.width = SCREEN_WIDTH - textArea->obj.area.width;
3111 navContainer->obj.area.height = SIMPLE_FOOTER_HEIGHT;
3125 separationLine->obj.area.width = 1;
3126 separationLine->obj.area.height = layoutInt->
footerContainer->obj.area.height;
3127 separationLine->direction =
VERTICAL;
3128 separationLine->thickness = 1;
3129 separationLine->obj.alignment =
MID_LEFT;
3130 separationLine->obj.alignTo = (
nbgl_obj_t *) navContainer;
3131 separationLine->obj.alignmentMarginX = -1;
3171 button->obj.alignmentMarginY = SINGLE_BUTTON_MARGIN;
3173 button->innerColor =
BLACK;
3174 button->foregroundColor =
WHITE;
3177 button->innerColor =
WHITE;
3178 button->foregroundColor =
BLACK;
3182 button->borderColor =
WHITE;
3186 button->borderColor =
BLACK;
3193 button->fontId = SMALL_BOLD_FONT;
3195 button->radius = BUTTON_RADIUS;
3204 button->obj.touchMask = (1 <<
TOUCHED);
3217 "nbgl_layoutAddFooter(): FOOTER_CHOICE_BUTTONS texts cannot be NULL\n");
3235 button->innerColor =
WHITE;
3237 button->obj.alignmentMarginY
3238 = SINGLE_BUTTON_MARGIN;
3243 button->obj.alignmentMarginY
3244 = BUTTON_FROM_BOTTOM_MARGIN;
3245 button->borderColor =
WHITE;
3246 button->obj.area.height = FOOTER_IN_PAIR_HEIGHT;
3248 button->foregroundColor =
BLACK;
3250 button->radius = BUTTON_RADIUS;
3252 button->fontId = SMALL_BOLD_FONT;
3253 button->obj.touchMask = (1 <<
TOUCHED);
3285 button->obj.alignmentMarginY = TOP_BUTTON_MARGIN;
3288 button->obj.alignmentMarginY
3289 = SINGLE_BUTTON_MARGIN;
3292 button->obj.alignmentMarginY
3293 = TOP_BUTTON_MARGIN_WITH_ACTION;
3296 button->innerColor =
WHITE;
3298 button->foregroundColor =
BLACK;
3301 button->innerColor =
BLACK;
3302 button->borderColor =
BLACK;
3303 button->foregroundColor =
WHITE;
3307 button->radius = BUTTON_RADIUS;
3312 button->fontId = SMALL_BOLD_FONT;
3313 button->obj.touchMask = (1 <<
TOUCHED);
3321 layoutInt->
footerContainer->obj.area.height = ROUNDED_AND_FOOTER_FOOTER_HEIGHT;
3324 layoutInt->
footerContainer->obj.area.height = BOTH_ROUNDED_FOOTER_HEIGHT;
3327 layoutInt->
footerContainer->obj.area.height = ACTION_AND_FOOTER_FOOTER_HEIGHT;
3355 if (separationLine != NULL) {
3388 if (layout == NULL) {
3405 switch (upFooterDesc->
type) {
3425 button->obj.alignmentMarginX = BORDER_MARGIN;
3427 button->innerColor =
BLACK;
3428 button->foregroundColor =
WHITE;
3429 button->borderColor =
BLACK;
3432 button->radius = BUTTON_RADIUS;
3433 button->icon = PIC(&VALIDATE_ICON);
3437 textArea->textColor =
BLACK;
3439 textArea->textAlignment =
MID_LEFT;
3440 textArea->fontId = LARGE_MEDIUM_FONT;
3441 textArea->wrapping =
true;
3442 textArea->obj.area.width = SCREEN_WIDTH - 3 * BORDER_MARGIN - button->obj.area.width;
3444 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
3446 textArea->obj.alignment =
MID_LEFT;
3447 textArea->obj.alignmentMarginX = BORDER_MARGIN;
3455 progressBar->obj.area.width = SCREEN_WIDTH;
3456 progressBar->obj.area.height = LONG_PRESS_PROGRESS_HEIGHT;
3458 progressBar->obj.alignmentMarginY = LONG_PRESS_PROGRESS_ALIGN;
3459 progressBar->resetIfOverriden =
true;
3460 progressBar->partialRedraw =
true;
3477 button->obj.alignment =
CENTER;
3480 button->innerColor =
BLACK;
3481 button->foregroundColor =
WHITE;
3484 button->innerColor =
WHITE;
3485 button->foregroundColor =
BLACK;
3488 button->borderColor =
WHITE;
3492 button->borderColor =
BLACK;
3498 button->text = PIC(upFooterDesc->
button.
text);
3499 button->fontId = SMALL_BOLD_FONT;
3500 button->icon = PIC(upFooterDesc->
button.
icon);
3503 button->radius = BUTTON_RADIUS;
3505 button->obj.alignTo = NULL;
3506 button->obj.touchMask = (1 <<
TOUCHED);
3516 "nbgl_layoutAddUpFooter(): UP_FOOTER_HORIZONTAL_BUTTONS fields cannot be "
3537 button->obj.alignmentMarginX = BORDER_MARGIN;
3539 button->innerColor =
WHITE;
3540 button->foregroundColor =
BLACK;
3543 button->radius = BUTTON_RADIUS;
3545 button->fontId = SMALL_BOLD_FONT;
3546 button->obj.touchMask = (1 <<
TOUCHED);
3563 button->obj.alignmentMarginX = BORDER_MARGIN;
3564 button->innerColor =
BLACK;
3565 button->borderColor =
BLACK;
3566 button->foregroundColor =
WHITE;
3569 button->radius = BUTTON_RADIUS;
3571 button->fontId = SMALL_BOLD_FONT;
3572 button->obj.touchMask = (1 <<
TOUCHED);
3581 "nbgl_layoutAddUpFooter(): UP_FOOTER_TIP_BOX text cannot be NULL\n");
3597 textArea->textColor =
BLACK;
3598 textArea->text = PIC(upFooterDesc->
tipBox.
text);
3599 textArea->textAlignment =
MID_LEFT;
3600 textArea->fontId = SMALL_REGULAR_FONT;
3601 textArea->wrapping =
true;
3604 textArea->obj.area.width
3606 + TIP_BOX_TEXT_ICON_MARGIN;
3609 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
3610 textArea->obj.alignment =
MID_LEFT;
3611 textArea->obj.alignmentMarginX = BORDER_MARGIN;
3621 image->obj.alignmentMarginX = BORDER_MARGIN;
3623 image->foregroundColor =
BLACK;
3624 image->buffer = PIC(upFooterDesc->
tipBox.
icon);
3637 upFooterDesc->
text.token,
3638 upFooterDesc->
text.tuneId);
3649 if (strlen(PIC(upFooterDesc->
text.text))) {
3652 textArea->text = PIC(upFooterDesc->
text.text);
3653 textArea->textAlignment =
CENTER;
3654 textArea->fontId = SMALL_REGULAR_FONT;
3655 textArea->wrapping =
true;
3658 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
3659 textArea->obj.alignment =
CENTER;
3696 tune_index_e tuneId)
3699 .separationLine =
false,
3700 .progressAndBack.activePage = activePage,
3701 .progressAndBack.nbPages = nbPages,
3702 .progressAndBack.token = backToken,
3703 .progressAndBack.tuneId = tuneId,
3704 .progressAndBack.withBack = withBack,
3705 .progressAndBack.actionIcon = NULL,
3724 const char *subText,
3725 uint8_t initPosition)
3733 if (layout == NULL) {
3739 container->nbChildren = 3;
3744 container->obj.alignment =
CENTER;
3748 spinner->position = initPosition;
3751 container->children[0] = (
nbgl_obj_t *) spinner;
3754 container->obj.area.height += SPINNER_HEIGHT;
3758 textArea->textColor =
BLACK;
3759 textArea->text = PIC(text);
3760 textArea->textAlignment =
CENTER;
3761 textArea->fontId = (subText != NULL) ? LARGE_MEDIUM_FONT : SMALL_REGULAR_FONT;
3762 textArea->wrapping =
true;
3763 textArea->obj.alignmentMarginY = SPINNER_TEXT_MARGIN;
3764 textArea->obj.alignTo = (
nbgl_obj_t *) spinner;
3768 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
3772 container->obj.area.height += textArea->obj.alignmentMarginY + textArea->obj.area.height;
3775 container->children[1] = (
nbgl_obj_t *) textArea;
3777 if (subText != NULL) {
3781 subTextArea->textColor =
BLACK;
3782 subTextArea->text = PIC(subText);
3783 subTextArea->textAlignment =
CENTER;
3784 subTextArea->fontId = SMALL_REGULAR_FONT;
3785 subTextArea->wrapping =
true;
3786 subTextArea->obj.alignmentMarginY = SPINNER_INTER_TEXTS_MARGIN;
3787 subTextArea->obj.alignTo = (
nbgl_obj_t *) textArea;
3792 subTextArea->obj.area.width,
3793 subTextArea->wrapping);
3797 container->obj.area.height
3798 += subTextArea->obj.alignmentMarginY + subTextArea->obj.area.height;
3801 container->children[2] = (
nbgl_obj_t *) subTextArea;
3831 const char *subText,
3841 if ((layout == NULL) || (layoutInt->
container->nbChildren == 0)) {
3846 if ((container->obj.type !=
CONTAINER) || (container->nbChildren < 2)) {
3852 if (spinner->obj.type !=
SPINNER) {
3854 "nbgl_layoutUpdateSpinner(): expected SPINNER, got type %d\n",
3859 if (spinner->position != position) {
3860 spinner->position = position;
3869 "nbgl_layoutUpdateSpinner(): expected TEXT_AREA, got type %d\n",
3870 textArea->obj.type);
3873 const char *newText = PIC(text);
3874 size_t newTextLen = strlen(newText);
3876 if ((newTextLen != strlen(textArea->text)) || memcmp(textArea->text, newText, newTextLen)) {
3877 textArea->text = newText;
3882 if (subText != NULL) {
3885 if (container->nbChildren != 3) {
3887 "nbgl_layoutUpdateSpinner(): expected 3 children for subText, got %d\n",
3888 container->nbChildren);
3892 if (subTextArea->obj.type !=
TEXT_AREA) {
3894 "nbgl_layoutUpdateSpinner(): expected TEXT_AREA for subText, got type %d\n",
3895 subTextArea->obj.type);
3898 const char *newSubText = PIC(subText);
3899 size_t newSubTextLen = strlen(newSubText);
3901 if ((newSubTextLen != strlen(subTextArea->text))
3902 || memcmp(subTextArea->text, newSubText, newSubTextLen)) {
3903 subTextArea->text = newSubText;
3922 if (layout == NULL) {
3953 if ((layout == NULL) || (!layout->
isUsed)) {
3957 if (layout->
modal) {
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
uint16_t nbgl_getSingleLineTextWidth(nbgl_font_id_e fontId, const char *text)
uint8_t nbgl_getFontHeight(nbgl_font_id_e fontId)
uint16_t nbgl_getTextWidth(nbgl_font_id_e fontId, const char *text)
uint16_t nbgl_getTextHeightInWidth(nbgl_font_id_e fontId, const char *text, uint16_t maxWidth, bool wrapping)
uint16_t nbgl_getTextNbLinesInWidth(nbgl_font_id_e fontId, const char *text, uint16_t maxWidth, bool wrapping)
const nbgl_font_t * nbgl_getFont(nbgl_font_id_e fontId)
uint8_t nbgl_getFontLineHeight(nbgl_font_id_e fontId)
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,...
static nbgl_line_t * createHorizontalLine(uint8_t layer)
static bool getLayoutAndLayoutObj(nbgl_obj_t *obj, nbgl_layoutInternal_t **layout, layoutObj_t **layoutObj)
int nbgl_layoutDraw(nbgl_layout_t *layoutParam)
Applies given layout. The screen will be redrawn.
#define NB_MAX_CONTAINER_CHILDREN
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.
static uint8_t nbTouchableControls
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.
int nbgl_layoutAddTouchableBar(nbgl_layout_t *layout, const nbgl_layoutBar_t *barLayout)
Creates a touchable bar in main panel.
static void longTouchCallback(nbgl_obj_t *obj, nbgl_touchType_t eventType, nbgl_layoutInternal_t *layout, layoutObj_t *layoutObj)
#define SPINNER_REFRESH_PERIOD
static uint8_t get_hold_to_approve_percent(uint32_t touch_duration)
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).
static void animTickerCallback(void)
int nbgl_layoutAddTextContent(nbgl_layout_t *layout, nbgl_layoutTextContent_t *content)
Creates in the main container three text areas:
static void radioTouchCallback(nbgl_obj_t *obj, nbgl_touchType_t eventType, nbgl_layoutInternal_t *layout)
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.
static nbgl_layoutInternal_t * topLayout
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
static int addSwipeInternal(nbgl_layoutInternal_t *layoutInt, uint16_t swipesMask, nbgl_swipe_usage_t usage, uint8_t token, tune_index_e tuneId)
add the swipe feature to the main container
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.
static void touchCallback(nbgl_obj_t *obj, nbgl_touchType_t eventType)
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).
static nbgl_container_t * addListItem(nbgl_layoutInternal_t *layoutInt, const listItem_t *itemDesc)
Adds a item of a list. An item can be a touchable bar or a switch.
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
void layoutUpdateCallbackObjToken(nbgl_layoutInternal_t *layout, nbgl_obj_t *obj, uint8_t token)
Update the token associated with a specific object in a layout.
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.
static nbgl_layoutInternal_t gLayout[NB_MAX_LAYOUTS]
array of layouts, if used by modal
static nbgl_container_t * addContentCenter(nbgl_layoutInternal_t *layoutInt, const nbgl_contentCenter_t *info)
Creates a container on the center of the main panel, with a possible icon, and possible texts under i...
static void spinnerTickerCallback(void)
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)
nbgl_contentRadioChoice_t nbgl_layoutRadioChoice_t
Deprecated, kept for retro compatibility.
#define VALUE_ICON_INTERVALE
nbgl_contentSwitch_t nbgl_layoutSwitch_t
Deprecated, kept for retro compatibility.
@ 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.
struct nbgl_layoutDescription_s nbgl_layoutDescription_t
Structure containing all information when creating a layout. This structure must be passed as argumen...
#define TAG_VALUE_INTERVALE
@ 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)
nbgl_contentTagValueList_t nbgl_layoutTagValueList_t
Deprecated, kept for retro compatibility.
nbgl_contentTagValue_t nbgl_layoutTagValue_t
Deprecated, kept for retro compatibility.
nbgl_contentCenteredInfo_t nbgl_layoutCenteredInfo_t
Deprecated, kept for retro compatibility.
Internal functions/constants of NBGL layout layer.
@ SWIPE_USAGE_SUGGESTIONS
static nbgl_font_id_e layoutGetTagValueFont(bool smallCaseForValue)
returns the font used to display the values of a list of tag/value pairs
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.
static uint8_t layoutGetTagValueMaxLines(uint8_t listMaxLines, const nbgl_contentTagValue_t *pair, bool *forceEllipsis)
returns the max number of lines of the value of the given tag/value pair, which is the smallest non-z...
static uint16_t layoutGetTagValueWidth(const nbgl_icon_details_t *icon)
returns the width of the value of a tag/value pair. Shared by the layout and the use cases,...
bool keyboardSwipeCallback(nbgl_layoutInternal_t *layoutInt, nbgl_obj_t *obj, nbgl_touchType_t eventType)
static const nbgl_icon_details_t * layoutGetTagValueIcon(const nbgl_contentTagValue_t *pair)
returns the icon displayed on the right of the value of the given tag/value pair
#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
struct nbgl_layoutInternal_s nbgl_layoutInternal_t
Structure containing all information about the current layout.
void(* nbgl_layoutTouchCallback_t)(int token, uint8_t index)
prototype of function to be called when an object 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)
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)
nbgl_obj_t * nbgl_objPoolGet(nbgl_obj_type_t type, uint8_t layer)
#define INACTIVE_ARROW_COLOR
void nbgl_refreshSpecial(nbgl_refresh_mode_t mode)
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)
int nbgl_screenPush(nbgl_obj_t ***elements, uint8_t nbElements, const nbgl_screenTickerConfiguration_t *ticker, nbgl_touchCallback_t touchCallback)
void nbgl_wait_pipeline(void)
int nbgl_screenUpdateTicker(uint8_t screenIndex, const nbgl_screenTickerConfiguration_t *ticker)
int nbgl_screenPop(uint8_t screenIndex)
struct PACKED__ nbgl_screenTickerConfiguration_s nbgl_screenTickerConfiguration_t
struct to configure a screen layer
int nbgl_screenUpdateBackgroundColor(uint8_t screenIndex, color_t color)
void nbgl_screenRedraw(void)
uint32_t nbgl_touchGetTouchDuration(nbgl_obj_t *obj)
common types for Graphical Library
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
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
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
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)
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 hideEndOfLastLine
if set to true, replace 3 last chars of last line by "..."
bool wrapping
if set to true, value text will be wrapped on ' ' to avoid cutting words
const nbgl_contentValueExt_t * extension
if not NULL, gives additional info on value field
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
const char * aliasSubName
string displayed under alias and in details view
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
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
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
nbgl_obj_t ** children
children for main screen
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
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
This structure contains info for Text content, to be set with nbgl_layoutAddTextContent().
const char * descriptions[NB_MAX_DESCRIPTIONS]
uint8_t nbDescriptions
number of used descriptions in above array
const char * info
description at bottom (in small gray)
const char * title
main text (in large bold font)