7 #include "app_config.h"
24 #include "os_helpers.h"
31 #define INTERNAL_SPACE 16
33 #define INNER_MARGIN 12
35 #define NB_MAX_LAYOUTS 3
38 #define NB_MAX_CONTAINER_CHILDREN 20
40 #define TAG_VALUE_ICON_WIDTH 32
43 #define RADIO_CHOICE_HEIGHT 96
44 #define FOOTER_HEIGHT 80
45 #define BAR_INTERVALE 12
46 #define BACK_KEY_WIDTH 88
47 #define FOOTER_BUTTON_HEIGHT 128
48 #define UP_FOOTER_BUTTON_HEIGHT 120
49 #define ROUNDED_AND_FOOTER_FOOTER_HEIGHT 192
50 #define ACTION_AND_FOOTER_FOOTER_HEIGHT 216
52 #define RADIO_CHOICE_HEIGHT 92
53 #define FOOTER_HEIGHT 80
54 #define BAR_INTERVALE 16
55 #define BACK_KEY_WIDTH 104
56 #define FOOTER_BUTTON_HEIGHT 136
57 #define UP_FOOTER_BUTTON_HEIGHT 136
58 #define ROUNDED_AND_FOOTER_FOOTER_HEIGHT 208
59 #define ACTION_AND_FOOTER_FOOTER_HEIGHT 232
63 #define SPINNER_REFRESH_PERIOD 400
66 #define FIRST_BUTTON_INDEX 0
103 #ifdef HAVE_PIEZO_SOUND
119 static uint8_t nbTouchableControls = 0;
126 #ifdef HAVE_FAST_HOLD_TO_APPROVE
128 #define HOLD_TO_APPROVE_STEP_PERCENT (7)
132 #define HOLD_TO_APPROVE_STEP_DURATION_MS (100)
134 #define HOLD_TO_APPROVE_STEP_PERCENT (25)
135 #define HOLD_TO_APPROVE_STEP_DURATION_MS (400)
138 static inline uint8_t get_hold_to_approve_percent(uint32_t touch_duration)
140 #ifdef HAVE_FAST_HOLD_TO_APPROVE
149 static bool getLayoutAndLayoutObj(
nbgl_obj_t *obj,
159 if (gLayout[i].nbChildren > 0) {
164 if (obj == gLayout[i].callbackObjPool[j].obj) {
166 "getLayoutAndLayoutObj(): obj found in layout[%d], index = %d, "
167 "nbUsedCallbackObjs = %d\n",
170 gLayout[i].nbUsedCallbackObjs);
171 *layout = &gLayout[i];
182 static void radioTouchCallback(
nbgl_obj_t *obj,
185 static void longTouchCallback(
nbgl_obj_t *obj,
195 bool needRefresh =
false;
201 if (getLayoutAndLayoutObj(obj, &layout, &layoutObj) ==
false) {
203 if (getLayoutAndLayoutObj(obj->parent, &layout, &layoutObj) ==
false) {
206 "touchCallback(): eventType = %d, obj = %p, no active layout or obj not found\n",
224 layoutObj->
index = eventType;
273 layoutObj->
index = lSwitch->state;
279 radioTouchCallback(obj, eventType, layout);
286 longTouchCallback(obj, eventType, layout, layoutObj);
291 #ifdef HAVE_PIEZO_SOUND
293 io_seproxyhal_play_tune(layoutObj->
tuneId);
304 static void longTouchCallback(
nbgl_obj_t *obj,
314 "longTouchCallback(): eventType = %d, obj = %p, gLayout[1].nbChildren = %d\n",
317 gLayout[1].nbChildren);
324 uint8_t new_state = get_hold_to_approve_percent(touchDuration);
328 bool trigger_callback = (new_state >= 100) && (progressBar->state < 100);
331 if (new_state >= 100) {
336 if (new_state != progressBar->state) {
337 progressBar->partialRedraw =
true;
338 progressBar->state = new_state;
347 if (trigger_callback) {
358 progressBar->partialRedraw =
true;
359 progressBar->state = 0;
366 static void radioTouchCallback(
nbgl_obj_t *obj,
378 while (i < layout->nbUsedCallbackObjs) {
388 foundRadioIndex = radioIndex;
390 textArea->textColor =
BLACK;
391 textArea->fontId = SMALL_BOLD_FONT;
413 textArea->fontId = SMALL_REGULAR_FONT;
421 if (foundRadio != 0xFF) {
423 #ifdef HAVE_PIEZO_SOUND
435 static void spinnerTickerCallback(
void)
442 if (gLayout[1].nbChildren > 0) {
443 layout = &gLayout[1];
446 layout = &gLayout[0];
450 while (i < layout->container->nbChildren) {
454 spinner->position &= 3;
470 line->obj.area.height = 4;
482 line->obj.area.width = 1;
502 layoutObj->
obj = obj;
503 layoutObj->
token = token;
504 layoutObj->
tuneId = tuneId;
553 layoutInt->
container->obj.touchMask = swipesMask;
580 layoutInt, (
nbgl_obj_t *) container, itemDesc->
token, itemDesc->tuneId);
587 container->nbChildren = 0;
594 container->obj.alignTo = NULL;
599 container->obj.touchMask = (1 <<
TOUCHED);
600 container->obj.touchId =
CONTROLS_ID + nbTouchableControls;
601 nbTouchableControls++;
606 textArea->textColor = color;
607 textArea->text = PIC(itemDesc->
text);
608 textArea->onDrawCallback = NULL;
609 textArea->fontId = SMALL_BOLD_FONT;
610 textArea->wrapping =
true;
611 textArea->obj.area.width = container->obj.area.width;
614 textArea->obj.area.width
619 textArea->obj.area.width
626 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
627 usedHeight =
MAX(usedHeight, textArea->obj.area.height);
631 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
632 container->nbChildren++;
637 imageLeft->foregroundColor = color;
638 imageLeft->buffer = PIC(itemDesc->
iconLeft);
640 imageLeft->obj.alignment =
MID_LEFT;
641 imageLeft->obj.alignTo = (
nbgl_obj_t *) textArea;
643 container->children[container->nbChildren] = (
nbgl_obj_t *) imageLeft;
644 container->nbChildren++;
646 textArea->obj.alignmentMarginX = imageLeft->buffer->width +
BAR_INTERVALE;
648 usedHeight =
MAX(usedHeight, imageLeft->buffer->height);
653 imageRight->foregroundColor = color;
654 imageRight->buffer = PIC(itemDesc->
iconRight);
658 imageRight->obj.alignTo = (
nbgl_obj_t *) textArea;
660 container->children[container->nbChildren] = (
nbgl_obj_t *) imageRight;
661 container->nbChildren++;
663 usedHeight =
MAX(usedHeight, imageRight->buffer->height);
667 switchObj->onColor =
BLACK;
669 switchObj->state = itemDesc->
state;
672 switchObj->obj.alignTo = (
nbgl_obj_t *) textArea;
674 container->children[container->nbChildren] = (
nbgl_obj_t *) switchObj;
675 container->nbChildren++;
678 if (itemDesc->
subText != NULL) {
682 subTextArea->textColor = color;
683 subTextArea->text = PIC(itemDesc->
subText);
684 subTextArea->textAlignment =
MID_LEFT;
685 subTextArea->fontId = SMALL_REGULAR_FONT;
687 subTextArea->wrapping =
true;
688 subTextArea->obj.alignment =
MID_LEFT;
689 subTextArea->obj.area.width = container->obj.area.width;
692 subTextArea->obj.area.width,
693 subTextArea->wrapping);
694 container->children[container->nbChildren] = (
nbgl_obj_t *) subTextArea;
695 container->nbChildren++;
696 container->obj.area.height += subTextArea->obj.area.height + 12;
699 textArea->obj.alignmentMarginY = -(subTextArea->obj.area.height + 12) / 2;
700 subTextArea->obj.alignmentMarginY = (usedHeight + 12) / 2;
728 container->nbChildren = 0;
732 if (info->
icon != NULL) {
734 image->foregroundColor =
BLACK;
735 image->buffer = PIC(info->
icon);
737 image->obj.alignmentMarginY = info->
iconHug;
739 fullHeight += image->buffer->height + info->
iconHug;
740 container->children[container->nbChildren] = (
nbgl_obj_t *) image;
741 container->nbChildren++;
744 if (info->
title != NULL) {
746 textArea->textColor =
BLACK;
747 textArea->text = PIC(info->
title);
748 textArea->textAlignment =
CENTER;
749 textArea->fontId = LARGE_MEDIUM_FONT;
750 textArea->wrapping =
true;
753 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
756 if (container->nbChildren > 0) {
758 textArea->obj.alignTo = (
nbgl_obj_t *) container->children[container->nbChildren - 1];
765 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY;
767 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
768 container->nbChildren++;
773 textArea->textColor =
BLACK;
775 textArea->textAlignment =
CENTER;
776 textArea->fontId = SMALL_BOLD_FONT;
777 textArea->wrapping =
true;
780 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
783 if (container->nbChildren > 0) {
785 textArea->obj.alignTo = (
nbgl_obj_t *) container->children[container->nbChildren - 1];
787 if (container->children[container->nbChildren - 1]->type ==
IMAGE) {
791 textArea->obj.alignmentMarginY = 16;
798 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY;
800 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
801 container->nbChildren++;
806 textArea->textColor =
BLACK;
808 textArea->textAlignment =
CENTER;
809 textArea->fontId = SMALL_REGULAR_FONT;
810 textArea->wrapping =
true;
813 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
816 if (container->nbChildren > 0) {
818 textArea->obj.alignTo = (
nbgl_obj_t *) container->children[container->nbChildren - 1];
819 if (container->children[container->nbChildren - 1]->type ==
TEXT_AREA) {
821 textArea->obj.alignmentMarginY = 16;
831 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY;
833 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
834 container->nbChildren++;
840 textArea->text = PIC(info->
subText);
841 textArea->textAlignment =
CENTER;
842 textArea->fontId = SMALL_REGULAR_FONT;
843 textArea->wrapping =
true;
846 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
848 textArea->obj.area.height += 2 * 8;
850 if (container->nbChildren > 0) {
852 textArea->obj.alignTo = (
nbgl_obj_t *) container->children[container->nbChildren - 1];
853 textArea->obj.alignmentMarginY = 16;
854 if (container->children[container->nbChildren - 1]->type ==
IMAGE) {
855 textArea->obj.alignmentMarginY += info->
iconHug;
862 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY;
864 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
865 container->nbChildren++;
868 container->obj.alignment =
CENTER;
870 container->obj.area.height = fullHeight;
872 container->obj.area.height += 40;
894 if (layout == NULL) {
906 textArea->textColor =
BLACK;
907 textArea->text = PIC(text);
909 textArea->fontId = SMALL_BOLD_FONT;
911 textArea->wrapping =
true;
914 textArea->obj.area.width = container->obj.area.width;
915 if (withAlias ==
true) {
919 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
920 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY;
921 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
922 container->nbChildren++;
923 if (withAlias ==
true) {
929 image->foregroundColor =
BLACK;
932 image->obj.alignmentMarginX = 12;
934 container->obj.touchMask = (1 <<
TOUCHED);
937 container->children[container->nbChildren] = (
nbgl_obj_t *) image;
938 container->nbChildren++;
941 if (subText != NULL) {
943 subTextArea->textColor =
BLACK;
944 subTextArea->text = PIC(subText);
945 subTextArea->fontId = SMALL_REGULAR_FONT;
947 subTextArea->wrapping =
true;
948 subTextArea->obj.area.width = container->obj.area.width;
951 subTextArea->obj.area.width,
952 subTextArea->wrapping);
953 subTextArea->textAlignment =
MID_LEFT;
964 subTextArea->obj.alignmentMarginY = 26;
968 container->children[container->nbChildren] = (
nbgl_obj_t *) subTextArea;
969 container->nbChildren++;
970 fullHeight += subTextArea->obj.area.height + subTextArea->obj.alignmentMarginY;
975 container->obj.area.height = fullHeight;
982 return container->obj.area.height;
1000 if (description->
modal) {
1001 if (gLayout[1].nbChildren == 0) {
1002 layout = &gLayout[1];
1004 else if (gLayout[2].nbChildren == 0) {
1005 layout = &gLayout[2];
1011 layout = &gLayout[0];
1013 if (layout == NULL) {
1021 nbTouchableControls = 0;
1026 if (description->
modal) {
1058 obj->
tuneId = description->tapTuneId;
1066 footerDesc.
text.tuneId = description->tapTuneId;
1088 tune_index_e tuneId)
1093 if (layout == NULL) {
1100 layoutInt->
tapText->text = PIC(text);
1102 layoutInt->
tapText->fontId = SMALL_REGULAR_FONT;
1109 layoutInt->
tapText->obj.alignmentMarginY = 30;
1128 tune_index_e tuneId)
1135 if (layout == NULL) {
1149 button->foregroundColor =
BLACK;
1150 button->innerColor =
WHITE;
1152 button->obj.touchMask = (1 <<
TOUCHED);
1154 button->icon = PIC(icon);
1199 bool separationLine,
1200 tune_index_e tuneId)
1210 footerDesc.
button.tuneId = tuneId;
1229 if (layout == NULL) {
1233 if (barLayout->
text == NULL) {
1242 itemDesc.tuneId = barLayout->tuneId;
1246 container = addListItem(layoutInt, &itemDesc);
1248 if (container == NULL) {
1251 return container->obj.area.height;
1268 if (layout == NULL) {
1272 if (switchLayout->
text == NULL) {
1278 itemDesc.
text = switchLayout->
text;
1281 itemDesc.tuneId = switchLayout->tuneId;
1283 itemDesc.
large =
false;
1285 container = addListItem(layoutInt, &itemDesc);
1287 if (container == NULL) {
1290 return container->obj.area.height;
1304 return addText(layout, text, subText, 0, 0,
false);
1320 const char *subText,
1325 return addText(layout, text, subText, token, index,
true);
1341 if (layout == NULL) {
1346 textArea->textColor =
BLACK;
1347 textArea->text = PIC(text);
1348 textArea->textAlignment =
MID_LEFT;
1349 textArea->fontId = SMALL_REGULAR_FONT;
1351 textArea->wrapping =
true;
1356 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1358 textArea->obj.area.height += 2 * 24;
1360 textArea->obj.area.height += 2 * 28;
1366 return textArea->obj.area.height;
1383 if (layout == NULL) {
1389 textArea->text = PIC(text);
1390 textArea->textAlignment =
MID_LEFT;
1391 textArea->fontId = LARGE_MEDIUM_FONT;
1393 textArea->wrapping =
true;
1395 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1399 if (layoutInt->
container->nbChildren == 0) {
1407 textArea->obj.alignmentMarginY = 40;
1409 textArea->obj.alignmentMarginY = 24;
1433 const char *description,
1440 if (layout == NULL) {
1446 textArea->textColor =
BLACK;
1447 textArea->text = PIC(title);
1448 textArea->textAlignment =
MID_LEFT;
1449 textArea->fontId = LARGE_MEDIUM_FONT;
1451 textArea->wrapping =
true;
1455 textArea->obj.alignmentMarginY = 24;
1457 textArea->obj.alignmentMarginY = 16;
1461 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1467 textArea->textColor =
BLACK;
1468 textArea->text = PIC(description);
1469 textArea->fontId = SMALL_REGULAR_FONT;
1471 textArea->wrapping =
true;
1474 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1475 textArea->textAlignment =
MID_LEFT;
1479 textArea->obj.alignmentMarginY = 16;
1481 textArea->obj.alignmentMarginY = 24;
1489 textArea->text = PIC(info);
1490 textArea->fontId = SMALL_REGULAR_FONT;
1492 textArea->wrapping =
true;
1495 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1496 textArea->textAlignment =
MID_LEFT;
1499 textArea->obj.alignmentMarginY = 40;
1503 return layoutInt->
container->obj.area.height;
1520 if (layout == NULL) {
1523 for (i = 0; i < choices->
nbChoices; i++) {
1534 layoutInt, (
nbgl_obj_t *) container, choices->
token, choices->tuneId);
1540 container->nbChildren = 2;
1546 container->obj.alignTo = (
nbgl_obj_t *) NULL;
1549 button->activeColor =
BLACK;
1551 button->obj.alignTo = (
nbgl_obj_t *) container;
1554 container->children[1] = (
nbgl_obj_t *) button;
1558 #ifdef HAVE_LANGUAGE_PACK
1563 textArea->text = PIC(choices->
names[i]);
1565 textArea->textAlignment =
MID_LEFT;
1566 textArea->obj.area.width = container->obj.area.width -
RADIO_WIDTH;
1568 textArea->obj.alignment =
MID_LEFT;
1569 textArea->obj.alignTo = (
nbgl_obj_t *) container;
1570 container->children[0] = (
nbgl_obj_t *) textArea;
1573 container->obj.touchMask = (1 <<
TOUCHED);
1574 container->obj.touchId =
CONTROLS_ID + nbTouchableControls;
1575 nbTouchableControls++;
1580 textArea->textColor =
BLACK;
1581 textArea->fontId = SMALL_BOLD_FONT;
1586 textArea->fontId = SMALL_REGULAR_FONT;
1590 line = createHorizontalLine(layoutInt->
layer);
1591 line->obj.alignmentMarginY = -4;
1617 .description = NULL,
1623 if (layout == NULL) {
1627 if (info->
text1 != NULL) {
1635 if (info->
text2 != NULL) {
1643 if (info->
text3 != NULL) {
1651 container = addContentCenter(layoutInt, ¢eredInfo);
1659 container->obj.alignmentMarginY = info->
offsetY;
1662 return container->obj.area.height;
1679 if (layout == NULL) {
1683 container = addContentCenter(layoutInt, info);
1685 return container->obj.area.height;
1703 if (layout == NULL) {
1709 container->nbChildren = info->
nbRows + 1;
1717 textArea->textColor =
BLACK;
1718 textArea->text = PIC(info->
title);
1719 textArea->textAlignment =
MID_LEFT;
1720 textArea->fontId = LARGE_MEDIUM_FONT;
1721 textArea->wrapping =
true;
1724 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1726 container->obj.area.height += textArea->obj.area.height;
1728 container->children[0] = (
nbgl_obj_t *) textArea;
1730 for (row = 0; row < info->
nbRows; row++) {
1736 rowContainer->nbChildren = 2;
1741 image->foregroundColor =
BLACK;
1742 image->buffer = info->
rowIcons[row];
1743 rowContainer->children[0] = (
nbgl_obj_t *) image;
1746 textArea->textColor =
BLACK;
1747 textArea->text = info->
rowTexts[row];
1748 textArea->textAlignment =
MID_LEFT;
1749 textArea->fontId = SMALL_REGULAR_FONT;
1750 textArea->wrapping =
true;
1751 textArea->obj.alignmentMarginX = 16;
1752 textArea->obj.area.width
1753 =
AVAILABLE_WIDTH - image->buffer->width - textArea->obj.alignmentMarginX;
1755 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1757 textArea->obj.alignTo = (
nbgl_obj_t *) image;
1758 rowContainer->children[1] = (
nbgl_obj_t *) textArea;
1759 rowContainer->obj.area.height =
MAX(image->buffer->height, textArea->obj.area.height);
1762 rowContainer->obj.alignmentMarginY = 32;
1766 rowContainer->obj.alignmentMarginY = 16;
1768 rowContainer->obj.alignmentMarginY = 26;
1771 container->children[1 + row] = (
nbgl_obj_t *) rowContainer;
1772 container->obj.area.height
1773 += rowContainer->obj.area.height + rowContainer->obj.alignmentMarginY;
1777 return container->obj.area.height;
1798 if (layout == NULL) {
1806 container->nbChildren = 0;
1810 if (strlen(PIC(info->
url)) > 62) {
1826 fullHeight +=
qrcode->obj.area.height;
1828 container->nbChildren++;
1830 if (info->
text1 != NULL) {
1832 textArea->textColor =
BLACK;
1833 textArea->text = PIC(info->
text1);
1834 textArea->textAlignment =
CENTER;
1835 textArea->fontId = (info->
largeText1 ==
true) ? LARGE_MEDIUM_FONT : SMALL_REGULAR_FONT;
1836 textArea->wrapping =
true;
1839 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1841 textArea->obj.alignTo = (
nbgl_obj_t *) container->children[container->nbChildren - 1];
1842 textArea->obj.alignmentMarginY = 24;
1844 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY;
1846 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
1847 container->nbChildren++;
1849 if (info->
text2 != NULL) {
1852 textArea->text = PIC(info->
text2);
1853 textArea->textAlignment =
CENTER;
1854 textArea->fontId = SMALL_REGULAR_FONT;
1855 textArea->wrapping =
true;
1858 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1860 textArea->obj.alignTo = (
nbgl_obj_t *) container->children[container->nbChildren - 1];
1861 if (info->
text1 != NULL) {
1863 textArea->obj.alignmentMarginY = 40;
1865 textArea->obj.alignmentMarginY = 28;
1869 textArea->obj.alignmentMarginY = 32;
1873 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY;
1875 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
1876 container->nbChildren++;
1879 if ((fullHeight >= (layoutInt->
container->obj.area.height - 16))
1887 container->obj.area.height = fullHeight;
1890 container->obj.alignment =
CENTER;
1894 container->obj.alignTo
1897 container->obj.alignmentMarginY = info->
offsetY;
1943 .horizontalButtons.leftIcon = info->
leftIcon,
1944 .horizontalButtons.leftToken = info->
leftToken,
1945 .horizontalButtons.rightText = info->
rightText,
1946 .horizontalButtons.rightToken = info->
rightToken,
1947 .horizontalButtons.tuneId = info->tuneId};
1969 if (layout == NULL) {
1973 for (i = 0; i < list->
nbPairs; i++) {
1978 if (list->
pairs != NULL) {
1979 pair = &list->
pairs[i];
1996 itemTextArea->text = PIC(pair->
item);
1997 itemTextArea->textAlignment =
MID_LEFT;
1998 itemTextArea->fontId = SMALL_REGULAR_FONT;
1999 itemTextArea->wrapping =
true;
2002 itemTextArea->fontId, itemTextArea->text,
AVAILABLE_WIDTH, itemTextArea->wrapping);
2005 itemTextArea->obj.alignmentMarginX = 0;
2006 itemTextArea->obj.alignmentMarginY = 0;
2007 itemTextArea->obj.alignTo = NULL;
2008 container->children[container->nbChildren] = (
nbgl_obj_t *) itemTextArea;
2009 container->nbChildren++;
2011 fullHeight += itemTextArea->obj.area.height;
2014 valueTextArea->textColor =
BLACK;
2015 valueTextArea->text = PIC(pair->
value);
2016 valueTextArea->textAlignment =
MID_LEFT;
2018 valueTextArea->fontId = SMALL_BOLD_FONT;
2021 valueTextArea->fontId = LARGE_MEDIUM_FONT;
2036 valueTextArea->obj.area.width =
AVAILABLE_WIDTH - valueIcon->width - 12;
2042 valueTextArea->text,
2043 valueTextArea->obj.area.width,
2051 valueTextArea->obj.area.height = nbLines * font->
line_height;
2054 valueTextArea->obj.alignmentMarginY = 4;
2055 valueTextArea->obj.alignTo = (
nbgl_obj_t *) itemTextArea;
2056 valueTextArea->wrapping = list->
wrapping;
2057 container->children[container->nbChildren] = (
nbgl_obj_t *) valueTextArea;
2058 container->nbChildren++;
2060 fullHeight += valueTextArea->obj.area.height + valueTextArea->obj.alignmentMarginY;
2061 if (valueIcon != NULL) {
2066 image->foregroundColor =
BLACK;
2067 image->buffer = valueIcon;
2069 image->obj.alignmentMarginX = 12;
2070 image->obj.alignTo = (
nbgl_obj_t *) valueTextArea;
2071 image->obj.touchMask = (1 <<
TOUCHED);
2074 container->children[container->nbChildren] = (
nbgl_obj_t *) image;
2075 container->nbChildren++;
2079 container->obj.area.height = fullHeight;
2085 container->obj.alignmentMarginY = 12;
2088 container->obj.alignmentMarginY = 24;
2093 container->obj.alignmentMarginY = 24;
2118 if (layout == NULL) {
2121 if (barLayout->
text != NULL) {
2126 textArea->textColor =
BLACK;
2127 textArea->text = PIC(barLayout->
text);
2128 textArea->textAlignment =
MID_LEFT;
2129 textArea->fontId = SMALL_REGULAR_FONT;
2130 textArea->wrapping =
true;
2133 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
2142 progress->foregroundColor =
BLACK;
2143 progress->withBorder =
true;
2145 progress->obj.area.width = 120;
2146 progress->obj.area.height = 12;
2148 progress->obj.alignmentMarginX = (
AVAILABLE_WIDTH - progress->obj.area.width) / 2;
2152 if (barLayout->
subText != NULL) {
2158 subTextArea->text = PIC(barLayout->
subText);
2159 subTextArea->textAlignment =
MID_LEFT;
2160 subTextArea->fontId = SMALL_REGULAR_FONT;
2161 subTextArea->wrapping =
true;
2165 subTextArea->obj.area.width,
2166 subTextArea->wrapping);
2189 line = createHorizontalLine(layoutInt->
layer);
2190 line->obj.alignmentMarginY = -4;
2210 if (layout == NULL) {
2222 footerDesc.
button.tuneId = buttonInfo->tuneId;
2232 upFooterDesc.
button.tuneId = buttonInfo->tuneId;
2241 layoutInt, (
nbgl_obj_t *) button, buttonInfo->
token, buttonInfo->tuneId);
2247 button->obj.alignmentMarginY = 12;
2250 button->innerColor =
BLACK;
2251 button->foregroundColor =
WHITE;
2254 button->innerColor =
WHITE;
2255 button->foregroundColor =
BLACK;
2258 button->borderColor =
WHITE;
2262 button->borderColor =
BLACK;
2268 button->text = PIC(buttonInfo->
text);
2269 button->fontId = SMALL_BOLD_FONT;
2270 button->icon = PIC(buttonInfo->
icon);
2274 + ((button->icon) ? (button->icon->width + 12) : 0);
2277 if (buttonInfo->
onBottom !=
true) {
2278 button->obj.alignmentMarginX
2287 button->obj.alignTo = NULL;
2288 button->obj.touchMask = (1 <<
TOUCHED);
2308 tune_index_e tuneId)
2311 .longPress.text = text,
2312 .longPress.token = token,
2313 .longPress.tuneId = tuneId};
2316 if (layout == NULL) {
2336 tune_index_e tuneId)
2361 const char *leftText,
2363 const char *rightText,
2365 tune_index_e tuneId)
2373 footerDesc.
doubleText.rightToken = rightToken;
2396 if (layout == NULL) {
2410 switch (headerDesc->
type) {
2434 button->innerColor =
WHITE;
2435 button->foregroundColor =
BLACK;
2436 button->borderColor =
WHITE;
2439 button->text = NULL;
2441 button->obj.touchMask = (1 <<
TOUCHED);
2459 textArea->obj.touchMask = (1 <<
TOUCHED);
2461 textArea->obj.alignment =
CENTER;
2462 textArea->textColor =
BLACK;
2463 textArea->obj.area.width
2466 textArea->text = text;
2467 textArea->fontId = SMALL_BOLD_FONT;
2468 textArea->textAlignment =
CENTER;
2469 textArea->wrapping =
true;
2473 textArea->obj.area.width,
2477 "nbgl_layoutAddHeader: text [%s] is too long for header\n",
2497 button->obj.touchMask = (1 <<
TOUCHED);
2501 button->innerColor =
WHITE;
2502 button->foregroundColor
2505 button->borderColor =
WHITE;
2508 button->text = NULL;
2509 button->icon = PIC(headerDesc->
extendedBack.actionIcon);
2533 button->innerColor =
WHITE;
2534 button->foregroundColor =
BLACK;
2535 button->borderColor =
WHITE;
2538 button->text = NULL;
2540 button->obj.touchMask = (1 <<
TOUCHED);
2557 progress->obj.area.width = 224;
2558 progress->obj.alignment =
CENTER;
2572 textArea->textColor =
BLACK;
2575 textArea->text = PIC(headerDesc->
title.text);
2576 textArea->fontId = SMALL_BOLD_FONT;
2577 textArea->textAlignment =
CENTER;
2578 textArea->wrapping =
true;
2582 layoutInt->
headerContainer->obj.area.height = textArea->obj.area.height;
2596 textArea->textColor =
BLACK;
2599 textArea->text = PIC(headerDesc->
rightText.text);
2600 textArea->fontId = SMALL_BOLD_FONT;
2602 textArea->obj.touchMask = (1 <<
TOUCHED);
2608 layoutInt->
headerContainer->obj.area.height = textArea->obj.area.height;
2616 line = createHorizontalLine(layoutInt->
layer);
2623 if (separationLine != NULL) {
2658 if (layout == NULL) {
2672 switch (footerDesc->
type) {
2690 textArea->obj.area.height
2692 textArea->text = PIC(footerDesc->
simpleText.text);
2694 = (footerDesc->
simpleText.mutedOut) ? SMALL_REGULAR_FONT : SMALL_BOLD_FONT;
2695 textArea->textAlignment =
CENTER;
2696 textArea->obj.touchMask = (1 <<
TOUCHED);
2701 layoutInt->
footerContainer->obj.area.height = textArea->obj.area.height;
2714 textArea->textColor =
BLACK;
2717 textArea->text = PIC(footerDesc->
doubleText.leftText);
2718 textArea->fontId = SMALL_BOLD_FONT;
2719 textArea->textAlignment =
CENTER;
2720 textArea->obj.touchMask = (1 <<
TOUCHED);
2738 textArea->textColor =
BLACK;
2741 textArea->text = PIC(footerDesc->
doubleText.rightText);
2742 textArea->fontId = SMALL_BOLD_FONT;
2743 textArea->textAlignment =
CENTER;
2744 textArea->obj.touchMask = (1 <<
TOUCHED);
2750 layoutInt->
footerContainer->obj.area.height = textArea->obj.area.height;
2755 separationLine->obj.area.width = 1;
2756 separationLine->obj.area.height = layoutInt->
footerContainer->obj.area.height;
2757 separationLine->direction =
VERTICAL;
2758 separationLine->thickness = 1;
2759 separationLine->obj.alignment =
MID_LEFT;
2760 separationLine->obj.alignTo = (
nbgl_obj_t *) textArea;
2761 separationLine->obj.alignmentMarginX = -1;
2777 textArea->textColor =
BLACK;
2779 textArea->obj.area.width = 160;
2781 textArea->obj.area.width = 192;
2784 textArea->text = PIC(footerDesc->
textAndNav.text);
2785 textArea->fontId = SMALL_BOLD_FONT;
2786 textArea->textAlignment =
CENTER;
2787 textArea->obj.touchMask = (1 <<
TOUCHED);
2799 navContainer->nbChildren = 4;
2800 navContainer->children
2803 navContainer->obj.area.width =
SCREEN_WIDTH - textArea->obj.area.width;
2817 separationLine->obj.area.width = 1;
2818 separationLine->obj.area.height = layoutInt->
footerContainer->obj.area.height;
2819 separationLine->direction =
VERTICAL;
2820 separationLine->thickness = 1;
2821 separationLine->obj.alignment =
MID_LEFT;
2822 separationLine->obj.alignTo = (
nbgl_obj_t *) navContainer;
2823 separationLine->obj.alignmentMarginX = -1;
2856 footerDesc->
button.tuneId);
2861 button->obj.alignment =
CENTER;
2863 button->innerColor =
BLACK;
2864 button->foregroundColor =
WHITE;
2867 button->innerColor =
WHITE;
2868 button->foregroundColor =
BLACK;
2872 button->borderColor =
WHITE;
2876 button->borderColor =
BLACK;
2883 button->fontId = SMALL_BOLD_FONT;
2894 button->obj.touchMask = (1 <<
TOUCHED);
2922 button->obj.alignmentMarginY = 4;
2923 button->borderColor =
WHITE;
2924 button->innerColor =
WHITE;
2925 button->foregroundColor =
BLACK;
2930 button->fontId = SMALL_BOLD_FONT;
2931 button->obj.touchMask = (1 <<
TOUCHED);
2940 line = createHorizontalLine(layoutInt->
layer);
2942 line->obj.alignmentMarginY = 4;
2963 button->innerColor =
WHITE;
2965 button->foregroundColor =
BLACK;
2968 button->innerColor =
BLACK;
2969 button->borderColor =
BLACK;
2970 button->foregroundColor =
WHITE;
2979 button->fontId = SMALL_BOLD_FONT;
2980 button->obj.touchMask = (1 <<
TOUCHED);
3002 addSwipeInternal(layoutInt,
3013 line = createHorizontalLine(layoutInt->
layer);
3019 if (separationLine != NULL) {
3052 if (layout == NULL) {
3069 switch (upFooterDesc->
type) {
3090 button->innerColor =
BLACK;
3091 button->foregroundColor =
WHITE;
3092 button->borderColor =
BLACK;
3100 textArea->textColor =
BLACK;
3101 textArea->text = PIC(upFooterDesc->
longPress.text);
3102 textArea->textAlignment =
MID_LEFT;
3103 textArea->fontId = LARGE_MEDIUM_FONT;
3104 textArea->wrapping =
true;
3107 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
3109 textArea->obj.alignment =
MID_LEFT;
3113 line = createHorizontalLine(layoutInt->
layer);
3119 progressBar->withBorder =
false;
3121 progressBar->obj.area.height = 8;
3123 progressBar->obj.alignmentMarginY = 4;
3124 progressBar->obj.alignTo = NULL;
3133 upFooterDesc->
button.tuneId);
3140 button->obj.alignment =
CENTER;
3143 button->innerColor =
BLACK;
3144 button->foregroundColor =
WHITE;
3147 button->innerColor =
WHITE;
3148 button->foregroundColor =
BLACK;
3151 button->borderColor =
WHITE;
3155 button->borderColor =
BLACK;
3161 button->text = PIC(upFooterDesc->
button.
text);
3162 button->fontId = SMALL_BOLD_FONT;
3163 button->icon = PIC(upFooterDesc->
button.
icon);
3168 button->obj.alignTo = NULL;
3169 button->obj.touchMask = (1 <<
TOUCHED);
3198 button->innerColor =
WHITE;
3199 button->foregroundColor =
BLACK;
3204 button->fontId = SMALL_BOLD_FONT;
3205 button->obj.touchMask = (1 <<
TOUCHED);
3222 button->innerColor =
BLACK;
3223 button->borderColor =
BLACK;
3224 button->foregroundColor =
WHITE;
3229 button->fontId = SMALL_BOLD_FONT;
3230 button->obj.touchMask = (1 <<
TOUCHED);
3243 upFooterDesc->
tipBox.tuneId);
3252 textArea->textColor =
BLACK;
3253 textArea->text = PIC(upFooterDesc->
tipBox.
text);
3254 textArea->textAlignment =
MID_LEFT;
3255 textArea->fontId = SMALL_REGULAR_FONT;
3256 textArea->wrapping =
true;
3259 textArea->obj.area.width
3264 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
3265 textArea->obj.alignment =
MID_LEFT;
3270 line = createHorizontalLine(layoutInt->
layer);
3279 image->foregroundColor =
BLACK;
3280 image->buffer = PIC(upFooterDesc->
tipBox.
icon);
3293 upFooterDesc->
text.token,
3294 upFooterDesc->
text.tuneId);
3305 textArea->text = PIC(upFooterDesc->
text.text);
3306 textArea->textAlignment =
CENTER;
3307 textArea->fontId = SMALL_REGULAR_FONT;
3308 textArea->wrapping =
true;
3311 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
3312 textArea->obj.alignment =
CENTER;
3348 tune_index_e tuneId)
3351 .separationLine =
false,
3352 .progressAndBack.activePage = activePage,
3353 .progressAndBack.nbPages = nbPages,
3354 .progressAndBack.token = backToken,
3355 .progressAndBack.tuneId = tuneId,
3356 .progressAndBack.withBack = withBack,
3357 .progressAndBack.actionIcon = NULL,
3379 if (layout == NULL) {
3385 spinner->position = fixed ? 0xFF : 0;
3386 spinner->obj.alignmentMarginY = -20;
3387 spinner->obj.alignTo = NULL;
3388 spinner->obj.alignment =
CENTER;
3394 textArea->textColor =
BLACK;
3395 textArea->text = PIC(text);
3396 textArea->textAlignment =
CENTER;
3397 textArea->fontId = SMALL_REGULAR_FONT;
3398 textArea->wrapping =
true;
3400 textArea->obj.alignmentMarginY = 20;
3402 textArea->obj.alignmentMarginY = 24;
3404 textArea->obj.alignTo = (
nbgl_obj_t *) spinner;
3408 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
3412 spinner->obj.alignmentMarginY
3413 = -(textArea->obj.alignmentMarginY + textArea->obj.area.height) / 2;
3424 tickerCfg.tickerCallback = &spinnerTickerCallback;
3441 if (layout == NULL) {
3445 "nbgl_layoutDraw(): container.nbChildren =%d, layout->nbChildren = %d\n",
3472 if (layout == NULL) {
3476 if (layout->
modal) {
Random Number Generation.
#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.
#define HOLD_TO_APPROVE_STEP_PERCENT
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.
#define ROUNDED_AND_FOOTER_FOOTER_HEIGHT
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...
#define ACTION_AND_FOOTER_FOOTER_HEIGHT
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_layoutAddProgressBar(nbgl_layout_t *layout, const nbgl_layoutProgressBar_t *barLayout)
Creates an area in main panel to display a progress bar, with a title text and a description under th...
int nbgl_layoutAddSubHeaderText(nbgl_layout_t *layout, const char *text)
Creates an area with given text in small regular font, under the header.
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.
const char * get_ux_loc_string(uint32_t index)
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.
#define RADIO_CHOICE_HEIGHT
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.
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_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
layoutObj_t * layoutAddCallbackObj(nbgl_layoutInternal_t *layout, nbgl_obj_t *obj, uint8_t token, tune_index_e tuneId)
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.
#define HOLD_TO_APPROVE_STEP_DURATION_MS
#define FOOTER_BUTTON_HEIGHT
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)
int nbgl_layoutAddSpinner(nbgl_layout_t *layout, const char *text, bool fixed)
Creates a centered (vertically & horizontally) spinner with a text under it.
#define UP_FOOTER_BUTTON_HEIGHT
nbgl_layout_t * nbgl_layoutGet(const nbgl_layoutDescription_t *description)
returns a layout of the given type. The layout is reset
void(* nbgl_layoutTouchCallback_t)(int token, uint8_t index)
prototype of function to be called when an object is touched
#define SIMPLE_FOOTER_HEIGHT
#define LONG_PRESS_BUTTON_HEIGHT
#define TOUCHABLE_MAIN_BAR_HEIGHT
#define TEXT_SUBTEXT_MARGIN
#define TOUCHABLE_BAR_HEIGHT
@ 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
#define SMALL_FOOTER_HEIGHT
#define NBGL_INVALID_TOKEN
@ SOFT_ACTION_AND_FOOTER_STYLE
A white button on top of a footer, with a separation line.
@ 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.
#define POST_SUBTEXT_MARGIN
@ 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)
#define TOUCHABLE_HEADER_BAR_HEIGHT
Internal functions/constants of NBGL layout layer.
@ SWIPE_USAGE_SUGGESTIONS
bool keyboardSwipeCallback(nbgl_obj_t *obj, nbgl_touchType_t eventType)
#define SMALL_BUTTON_HEIGHT
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)
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.
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)
struct PACKED__ nbgl_button_s nbgl_button_t
struct to represent a button (BUTTON type) that can contain a text and/or an icon
void nbgl_refreshSpecialWithPostRefresh(nbgl_refresh_mode_t mode, nbgl_post_refresh_t post_refresh)
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.
#define BOTTOM_BORDER_MARGIN
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
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_WITH_PIPELINE
Force screen power on and enable pipeline.
@ RADIUS_32_PIXELS
32 pixels
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
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
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
bool padding
if true, apply a padding of 40px at the bottom
const char * smallTitle
sub-title in black small bold case (can be null)
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...
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
nbgl_state_t initState
initial state of the switch
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
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
nbgl_contentTagValueCallback_t callback
function to call to retrieve a given pair
uint8_t nbMaxLinesForValue
This structure contains a [tag,value] pair.
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
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)
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
nbgl_swipe_usage_t swipeUsage
nbgl_layoutTouchCallback_t callback
nbgl_container_t * container
nbgl_container_t * headerContainer
container used to store header (progress, back, empty space...)
nbgl_layoutFooterType_t footerType
type of footer
bool modal
if true, means the screen is a modal
uint8_t nbChildren
number of children in above array
nbgl_layoutHeaderType_t headerType
type of header
nbgl_container_t * upFooterContainer
uint8_t nbPages
number of pages for navigation bar
nbgl_layoutUpFooterType_t upFooterType
type of up-footer
layoutObj_t callbackObjPool[LAYOUT_OBJ_POOL_LEN]
nbgl_text_area_t * tapText
nbgl_obj_t ** children
children for main screen
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).
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 progress bar with info. The progress bar itself is 120px widt...
uint8_t percentage
percentage of completion, from 0 to 100.
const char * text
text in black, on top of progress bar
const char * subText
text in gray, under progress bar
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