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) {
928 image->foregroundColor =
BLACK;
931 image->obj.alignmentMarginX = 12;
933 image->obj.touchMask = (1 <<
TOUCHED);
936 container->children[container->nbChildren] = (
nbgl_obj_t *) image;
937 container->nbChildren++;
940 if (subText != NULL) {
942 subTextArea->textColor =
BLACK;
943 subTextArea->text = PIC(subText);
944 subTextArea->fontId = SMALL_REGULAR_FONT;
946 subTextArea->wrapping =
true;
947 subTextArea->obj.area.width = container->obj.area.width;
950 subTextArea->obj.area.width,
951 subTextArea->wrapping);
952 subTextArea->textAlignment =
MID_LEFT;
963 subTextArea->obj.alignmentMarginY = 26;
967 container->children[container->nbChildren] = (
nbgl_obj_t *) subTextArea;
968 container->nbChildren++;
969 fullHeight += subTextArea->obj.area.height + subTextArea->obj.alignmentMarginY;
974 container->obj.area.height = fullHeight;
981 return container->obj.area.height;
999 if (description->
modal) {
1000 if (gLayout[1].nbChildren == 0) {
1001 layout = &gLayout[1];
1003 else if (gLayout[2].nbChildren == 0) {
1004 layout = &gLayout[2];
1010 layout = &gLayout[0];
1012 if (layout == NULL) {
1020 nbTouchableControls = 0;
1025 if (description->
modal) {
1057 obj->
tuneId = description->tapTuneId;
1065 footerDesc.
text.tuneId = description->tapTuneId;
1087 tune_index_e tuneId)
1092 if (layout == NULL) {
1099 layoutInt->
tapText->text = PIC(text);
1101 layoutInt->
tapText->fontId = SMALL_REGULAR_FONT;
1108 layoutInt->
tapText->obj.alignmentMarginY = 30;
1127 tune_index_e tuneId)
1134 if (layout == NULL) {
1148 button->foregroundColor =
BLACK;
1149 button->innerColor =
WHITE;
1151 button->obj.touchMask = (1 <<
TOUCHED);
1153 button->icon = PIC(icon);
1198 bool separationLine,
1199 tune_index_e tuneId)
1209 footerDesc.
button.tuneId = tuneId;
1228 if (layout == NULL) {
1232 if (barLayout->
text == NULL) {
1241 itemDesc.tuneId = barLayout->tuneId;
1245 container = addListItem(layoutInt, &itemDesc);
1247 if (container == NULL) {
1250 return container->obj.area.height;
1267 if (layout == NULL) {
1271 if (switchLayout->
text == NULL) {
1277 itemDesc.
text = switchLayout->
text;
1280 itemDesc.tuneId = switchLayout->tuneId;
1282 itemDesc.
large =
false;
1284 container = addListItem(layoutInt, &itemDesc);
1286 if (container == NULL) {
1289 return container->obj.area.height;
1303 return addText(layout, text, subText, 0, 0,
false);
1319 const char *subText,
1324 return addText(layout, text, subText, token, index,
true);
1340 if (layout == NULL) {
1345 textArea->textColor =
BLACK;
1346 textArea->text = PIC(text);
1347 textArea->textAlignment =
MID_LEFT;
1348 textArea->fontId = SMALL_REGULAR_FONT;
1350 textArea->wrapping =
true;
1355 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1357 textArea->obj.area.height += 2 * 24;
1359 textArea->obj.area.height += 2 * 28;
1365 return textArea->obj.area.height;
1381 if (layout == NULL) {
1386 textArea->textColor =
BLACK;
1387 textArea->text = PIC(text);
1388 textArea->textAlignment =
MID_LEFT;
1389 textArea->fontId = LARGE_MEDIUM_FONT;
1391 textArea->wrapping =
true;
1393 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1399 if (layoutInt->
container->nbChildren == 0) {
1424 const char *description,
1431 if (layout == NULL) {
1437 textArea->textColor =
BLACK;
1438 textArea->text = PIC(title);
1439 textArea->textAlignment =
MID_LEFT;
1440 textArea->fontId = LARGE_MEDIUM_FONT;
1442 textArea->wrapping =
true;
1446 textArea->obj.alignmentMarginY = 24;
1448 textArea->obj.alignmentMarginY = 16;
1452 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1458 textArea->textColor =
BLACK;
1459 textArea->text = PIC(description);
1460 textArea->fontId = SMALL_REGULAR_FONT;
1462 textArea->wrapping =
true;
1465 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1466 textArea->textAlignment =
MID_LEFT;
1470 textArea->obj.alignmentMarginY = 16;
1472 textArea->obj.alignmentMarginY = 24;
1480 textArea->text = PIC(info);
1481 textArea->fontId = SMALL_REGULAR_FONT;
1483 textArea->wrapping =
true;
1486 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1487 textArea->textAlignment =
MID_LEFT;
1490 textArea->obj.alignmentMarginY = 40;
1494 return layoutInt->
container->obj.area.height;
1511 if (layout == NULL) {
1514 for (i = 0; i < choices->
nbChoices; i++) {
1525 layoutInt, (
nbgl_obj_t *) container, choices->
token, choices->tuneId);
1531 container->nbChildren = 2;
1537 container->obj.alignTo = (
nbgl_obj_t *) NULL;
1540 button->activeColor =
BLACK;
1542 button->obj.alignTo = (
nbgl_obj_t *) container;
1545 container->children[1] = (
nbgl_obj_t *) button;
1549 #ifdef HAVE_LANGUAGE_PACK
1554 textArea->text = PIC(choices->
names[i]);
1556 textArea->textAlignment =
MID_LEFT;
1557 textArea->obj.area.width = container->obj.area.width -
RADIO_WIDTH;
1559 textArea->obj.alignment =
MID_LEFT;
1560 textArea->obj.alignTo = (
nbgl_obj_t *) container;
1561 container->children[0] = (
nbgl_obj_t *) textArea;
1564 container->obj.touchMask = (1 <<
TOUCHED);
1565 container->obj.touchId =
CONTROLS_ID + nbTouchableControls;
1566 nbTouchableControls++;
1571 textArea->textColor =
BLACK;
1572 textArea->fontId = SMALL_BOLD_FONT;
1577 textArea->fontId = SMALL_REGULAR_FONT;
1581 line = createHorizontalLine(layoutInt->
layer);
1582 line->obj.alignmentMarginY = -4;
1608 .description = NULL,
1614 if (layout == NULL) {
1618 if (info->
text1 != NULL) {
1626 if (info->
text2 != NULL) {
1634 if (info->
text3 != NULL) {
1642 container = addContentCenter(layoutInt, ¢eredInfo);
1650 container->obj.alignmentMarginY = info->
offsetY;
1653 return container->obj.area.height;
1670 if (layout == NULL) {
1674 container = addContentCenter(layoutInt, info);
1676 return container->obj.area.height;
1697 if (layout == NULL) {
1705 container->nbChildren = 0;
1709 if (strlen(PIC(info->
url)) > 62) {
1725 fullHeight +=
qrcode->obj.area.height;
1727 container->nbChildren++;
1729 if (info->
text1 != NULL) {
1731 textArea->textColor =
BLACK;
1732 textArea->text = PIC(info->
text1);
1733 textArea->textAlignment =
CENTER;
1734 textArea->fontId = (info->
largeText1 ==
true) ? LARGE_MEDIUM_FONT : SMALL_REGULAR_FONT;
1735 textArea->wrapping =
true;
1738 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1740 textArea->obj.alignTo = (
nbgl_obj_t *) container->children[container->nbChildren - 1];
1741 textArea->obj.alignmentMarginY = 24;
1743 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY;
1745 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
1746 container->nbChildren++;
1748 if (info->
text2 != NULL) {
1751 textArea->text = PIC(info->
text2);
1752 textArea->textAlignment =
CENTER;
1753 textArea->fontId = SMALL_REGULAR_FONT;
1754 textArea->wrapping =
true;
1757 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1759 textArea->obj.alignTo = (
nbgl_obj_t *) container->children[container->nbChildren - 1];
1760 if (info->
text1 != NULL) {
1762 textArea->obj.alignmentMarginY = 40;
1764 textArea->obj.alignmentMarginY = 28;
1768 textArea->obj.alignmentMarginY = 32;
1772 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY;
1774 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
1775 container->nbChildren++;
1778 if ((fullHeight >= (layoutInt->
container->obj.area.height - 16))
1786 container->obj.area.height = fullHeight;
1789 container->obj.alignment =
CENTER;
1793 container->obj.alignTo
1796 container->obj.alignmentMarginY = info->
offsetY;
1842 .horizontalButtons.leftIcon = info->
leftIcon,
1843 .horizontalButtons.leftToken = info->
leftToken,
1844 .horizontalButtons.rightText = info->
rightText,
1845 .horizontalButtons.rightToken = info->
rightToken,
1846 .horizontalButtons.tuneId = info->tuneId};
1868 if (layout == NULL) {
1872 for (i = 0; i < list->
nbPairs; i++) {
1877 if (list->
pairs != NULL) {
1878 pair = &list->
pairs[i];
1895 itemTextArea->text = PIC(pair->
item);
1896 itemTextArea->textAlignment =
MID_LEFT;
1897 itemTextArea->fontId = SMALL_REGULAR_FONT;
1898 itemTextArea->wrapping =
true;
1901 itemTextArea->fontId, itemTextArea->text,
AVAILABLE_WIDTH, itemTextArea->wrapping);
1904 itemTextArea->obj.alignmentMarginX = 0;
1905 itemTextArea->obj.alignmentMarginY = 0;
1906 itemTextArea->obj.alignTo = NULL;
1907 container->children[container->nbChildren] = (
nbgl_obj_t *) itemTextArea;
1908 container->nbChildren++;
1910 fullHeight += itemTextArea->obj.area.height;
1913 valueTextArea->textColor =
BLACK;
1914 valueTextArea->text = PIC(pair->
value);
1915 valueTextArea->textAlignment =
MID_LEFT;
1917 valueTextArea->fontId = SMALL_BOLD_FONT;
1920 valueTextArea->fontId = LARGE_MEDIUM_FONT;
1935 valueTextArea->obj.area.width =
AVAILABLE_WIDTH - valueIcon->width - 12;
1941 valueTextArea->text,
1942 valueTextArea->obj.area.width,
1950 valueTextArea->obj.area.height = nbLines * font->
line_height;
1953 valueTextArea->obj.alignmentMarginY = 4;
1954 valueTextArea->obj.alignTo = (
nbgl_obj_t *) itemTextArea;
1955 valueTextArea->wrapping = list->
wrapping;
1956 container->children[container->nbChildren] = (
nbgl_obj_t *) valueTextArea;
1957 container->nbChildren++;
1959 fullHeight += valueTextArea->obj.area.height + valueTextArea->obj.alignmentMarginY;
1960 if (valueIcon != NULL) {
1965 image->foregroundColor =
BLACK;
1966 image->buffer = valueIcon;
1968 image->obj.alignmentMarginX = 12;
1969 image->obj.alignTo = (
nbgl_obj_t *) valueTextArea;
1970 image->obj.touchMask = (1 <<
TOUCHED);
1973 container->children[container->nbChildren] = (
nbgl_obj_t *) image;
1974 container->nbChildren++;
1978 container->obj.area.height = fullHeight;
1984 container->obj.alignmentMarginY = 12;
1987 container->obj.alignmentMarginY = 24;
1992 container->obj.alignmentMarginY = 24;
2017 if (layout == NULL) {
2020 if (barLayout->
text != NULL) {
2025 textArea->textColor =
BLACK;
2026 textArea->text = PIC(barLayout->
text);
2027 textArea->textAlignment =
MID_LEFT;
2028 textArea->fontId = SMALL_REGULAR_FONT;
2029 textArea->wrapping =
true;
2032 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
2041 progress->foregroundColor =
BLACK;
2042 progress->withBorder =
true;
2044 progress->obj.area.width = 120;
2045 progress->obj.area.height = 12;
2047 progress->obj.alignmentMarginX = (
AVAILABLE_WIDTH - progress->obj.area.width) / 2;
2051 if (barLayout->
subText != NULL) {
2057 subTextArea->text = PIC(barLayout->
subText);
2058 subTextArea->textAlignment =
MID_LEFT;
2059 subTextArea->fontId = SMALL_REGULAR_FONT;
2060 subTextArea->wrapping =
true;
2064 subTextArea->obj.area.width,
2065 subTextArea->wrapping);
2088 line = createHorizontalLine(layoutInt->
layer);
2089 line->obj.alignmentMarginY = -4;
2109 if (layout == NULL) {
2121 footerDesc.
button.tuneId = buttonInfo->tuneId;
2131 upFooterDesc.
button.tuneId = buttonInfo->tuneId;
2140 layoutInt, (
nbgl_obj_t *) button, buttonInfo->
token, buttonInfo->tuneId);
2146 button->obj.alignmentMarginY = 12;
2149 button->innerColor =
BLACK;
2150 button->foregroundColor =
WHITE;
2153 button->innerColor =
WHITE;
2154 button->foregroundColor =
BLACK;
2157 button->borderColor =
WHITE;
2161 button->borderColor =
BLACK;
2167 button->text = PIC(buttonInfo->
text);
2168 button->fontId = SMALL_BOLD_FONT;
2169 button->icon = PIC(buttonInfo->
icon);
2173 + ((button->icon) ? (button->icon->width + 12) : 0);
2176 if (buttonInfo->
onBottom !=
true) {
2177 button->obj.alignmentMarginX
2186 button->obj.alignTo = NULL;
2187 button->obj.touchMask = (1 <<
TOUCHED);
2207 tune_index_e tuneId)
2210 .longPress.text = text,
2211 .longPress.token = token,
2212 .longPress.tuneId = tuneId};
2215 if (layout == NULL) {
2235 tune_index_e tuneId)
2260 const char *leftText,
2262 const char *rightText,
2264 tune_index_e tuneId)
2272 footerDesc.
doubleText.rightToken = rightToken;
2295 if (layout == NULL) {
2309 switch (headerDesc->
type) {
2333 button->innerColor =
WHITE;
2334 button->foregroundColor =
BLACK;
2335 button->borderColor =
WHITE;
2338 button->text = NULL;
2340 button->obj.touchMask = (1 <<
TOUCHED);
2358 textArea->obj.touchMask = (1 <<
TOUCHED);
2360 textArea->obj.alignment =
CENTER;
2361 textArea->textColor =
BLACK;
2362 textArea->obj.area.width
2365 textArea->text = text;
2366 textArea->fontId = SMALL_BOLD_FONT;
2367 textArea->textAlignment =
CENTER;
2368 textArea->wrapping =
true;
2372 textArea->obj.area.width,
2376 "nbgl_layoutAddHeader: text [%s] is too long for header\n",
2396 button->obj.touchMask = (1 <<
TOUCHED);
2400 button->innerColor =
WHITE;
2401 button->foregroundColor
2404 button->borderColor =
WHITE;
2407 button->text = NULL;
2408 button->icon = PIC(headerDesc->
extendedBack.actionIcon);
2432 button->innerColor =
WHITE;
2433 button->foregroundColor =
BLACK;
2434 button->borderColor =
WHITE;
2437 button->text = NULL;
2439 button->obj.touchMask = (1 <<
TOUCHED);
2456 progress->obj.area.width = 224;
2457 progress->obj.alignment =
CENTER;
2471 textArea->textColor =
BLACK;
2474 textArea->text = PIC(headerDesc->
title.text);
2475 textArea->fontId = SMALL_BOLD_FONT;
2476 textArea->textAlignment =
CENTER;
2477 textArea->wrapping =
true;
2481 layoutInt->
headerContainer->obj.area.height = textArea->obj.area.height;
2495 textArea->textColor =
BLACK;
2498 textArea->text = PIC(headerDesc->
rightText.text);
2499 textArea->fontId = SMALL_BOLD_FONT;
2501 textArea->obj.touchMask = (1 <<
TOUCHED);
2507 layoutInt->
headerContainer->obj.area.height = textArea->obj.area.height;
2515 line = createHorizontalLine(layoutInt->
layer);
2522 if (separationLine != NULL) {
2557 if (layout == NULL) {
2571 switch (footerDesc->
type) {
2589 textArea->obj.area.height
2591 textArea->text = PIC(footerDesc->
simpleText.text);
2593 = (footerDesc->
simpleText.mutedOut) ? SMALL_REGULAR_FONT : SMALL_BOLD_FONT;
2594 textArea->textAlignment =
CENTER;
2595 textArea->obj.touchMask = (1 <<
TOUCHED);
2600 layoutInt->
footerContainer->obj.area.height = textArea->obj.area.height;
2613 textArea->textColor =
BLACK;
2616 textArea->text = PIC(footerDesc->
doubleText.leftText);
2617 textArea->fontId = SMALL_BOLD_FONT;
2618 textArea->textAlignment =
CENTER;
2619 textArea->obj.touchMask = (1 <<
TOUCHED);
2637 textArea->textColor =
BLACK;
2640 textArea->text = PIC(footerDesc->
doubleText.rightText);
2641 textArea->fontId = SMALL_BOLD_FONT;
2642 textArea->textAlignment =
CENTER;
2643 textArea->obj.touchMask = (1 <<
TOUCHED);
2649 layoutInt->
footerContainer->obj.area.height = textArea->obj.area.height;
2654 separationLine->obj.area.width = 1;
2655 separationLine->obj.area.height = layoutInt->
footerContainer->obj.area.height;
2656 separationLine->direction =
VERTICAL;
2657 separationLine->thickness = 1;
2658 separationLine->obj.alignment =
MID_LEFT;
2659 separationLine->obj.alignTo = (
nbgl_obj_t *) textArea;
2660 separationLine->obj.alignmentMarginX = -1;
2676 textArea->textColor =
BLACK;
2678 textArea->obj.area.width = 160;
2680 textArea->obj.area.width = 192;
2683 textArea->text = PIC(footerDesc->
textAndNav.text);
2684 textArea->fontId = SMALL_BOLD_FONT;
2685 textArea->textAlignment =
CENTER;
2686 textArea->obj.touchMask = (1 <<
TOUCHED);
2698 navContainer->nbChildren = 4;
2699 navContainer->children
2702 navContainer->obj.area.width =
SCREEN_WIDTH - textArea->obj.area.width;
2716 separationLine->obj.area.width = 1;
2717 separationLine->obj.area.height = layoutInt->
footerContainer->obj.area.height;
2718 separationLine->direction =
VERTICAL;
2719 separationLine->thickness = 1;
2720 separationLine->obj.alignment =
MID_LEFT;
2721 separationLine->obj.alignTo = (
nbgl_obj_t *) navContainer;
2722 separationLine->obj.alignmentMarginX = -1;
2755 footerDesc->
button.tuneId);
2760 button->obj.alignment =
CENTER;
2762 button->innerColor =
BLACK;
2763 button->foregroundColor =
WHITE;
2766 button->innerColor =
WHITE;
2767 button->foregroundColor =
BLACK;
2771 button->borderColor =
WHITE;
2775 button->borderColor =
BLACK;
2782 button->fontId = SMALL_BOLD_FONT;
2793 button->obj.touchMask = (1 <<
TOUCHED);
2821 button->obj.alignmentMarginY = 4;
2822 button->borderColor =
WHITE;
2823 button->innerColor =
WHITE;
2824 button->foregroundColor =
BLACK;
2829 button->fontId = SMALL_BOLD_FONT;
2830 button->obj.touchMask = (1 <<
TOUCHED);
2839 line = createHorizontalLine(layoutInt->
layer);
2841 line->obj.alignmentMarginY = 4;
2862 button->innerColor =
WHITE;
2864 button->foregroundColor =
BLACK;
2867 button->innerColor =
BLACK;
2868 button->borderColor =
BLACK;
2869 button->foregroundColor =
WHITE;
2878 button->fontId = SMALL_BOLD_FONT;
2879 button->obj.touchMask = (1 <<
TOUCHED);
2901 addSwipeInternal(layoutInt,
2912 line = createHorizontalLine(layoutInt->
layer);
2918 if (separationLine != NULL) {
2951 if (layout == NULL) {
2968 switch (upFooterDesc->
type) {
2989 button->innerColor =
BLACK;
2990 button->foregroundColor =
WHITE;
2991 button->borderColor =
BLACK;
2999 textArea->textColor =
BLACK;
3000 textArea->text = PIC(upFooterDesc->
longPress.text);
3001 textArea->textAlignment =
MID_LEFT;
3002 textArea->fontId = LARGE_MEDIUM_FONT;
3003 textArea->wrapping =
true;
3006 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
3008 textArea->obj.alignment =
MID_LEFT;
3012 line = createHorizontalLine(layoutInt->
layer);
3018 progressBar->withBorder =
false;
3020 progressBar->obj.area.height = 8;
3022 progressBar->obj.alignmentMarginY = 4;
3023 progressBar->obj.alignTo = NULL;
3032 upFooterDesc->
button.tuneId);
3039 button->obj.alignment =
CENTER;
3042 button->innerColor =
BLACK;
3043 button->foregroundColor =
WHITE;
3046 button->innerColor =
WHITE;
3047 button->foregroundColor =
BLACK;
3050 button->borderColor =
WHITE;
3054 button->borderColor =
BLACK;
3060 button->text = PIC(upFooterDesc->
button.
text);
3061 button->fontId = SMALL_BOLD_FONT;
3062 button->icon = PIC(upFooterDesc->
button.
icon);
3067 button->obj.alignTo = NULL;
3068 button->obj.touchMask = (1 <<
TOUCHED);
3097 button->innerColor =
WHITE;
3098 button->foregroundColor =
BLACK;
3103 button->fontId = SMALL_BOLD_FONT;
3104 button->obj.touchMask = (1 <<
TOUCHED);
3121 button->innerColor =
BLACK;
3122 button->borderColor =
BLACK;
3123 button->foregroundColor =
WHITE;
3128 button->fontId = SMALL_BOLD_FONT;
3129 button->obj.touchMask = (1 <<
TOUCHED);
3142 upFooterDesc->
tipBox.tuneId);
3151 textArea->textColor =
BLACK;
3152 textArea->text = PIC(upFooterDesc->
tipBox.
text);
3153 textArea->textAlignment =
MID_LEFT;
3154 textArea->fontId = SMALL_REGULAR_FONT;
3155 textArea->wrapping =
true;
3158 textArea->obj.area.width
3163 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
3164 textArea->obj.alignment =
MID_LEFT;
3169 line = createHorizontalLine(layoutInt->
layer);
3178 image->foregroundColor =
BLACK;
3179 image->buffer = PIC(upFooterDesc->
tipBox.
icon);
3192 upFooterDesc->
text.token,
3193 upFooterDesc->
text.tuneId);
3204 textArea->text = PIC(upFooterDesc->
text.text);
3205 textArea->textAlignment =
CENTER;
3206 textArea->fontId = SMALL_REGULAR_FONT;
3207 textArea->wrapping =
true;
3210 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
3211 textArea->obj.alignment =
CENTER;
3247 tune_index_e tuneId)
3250 .separationLine =
false,
3251 .progressAndBack.activePage = activePage,
3252 .progressAndBack.nbPages = nbPages,
3253 .progressAndBack.token = backToken,
3254 .progressAndBack.tuneId = tuneId,
3255 .progressAndBack.withBack = withBack,
3256 .progressAndBack.actionIcon = NULL,
3278 if (layout == NULL) {
3284 spinner->position = fixed ? 0xFF : 0;
3285 spinner->obj.alignmentMarginY = -20;
3286 spinner->obj.alignTo = NULL;
3287 spinner->obj.alignment =
CENTER;
3293 textArea->textColor =
BLACK;
3294 textArea->text = PIC(text);
3295 textArea->textAlignment =
CENTER;
3296 textArea->fontId = SMALL_REGULAR_FONT;
3297 textArea->wrapping =
true;
3299 textArea->obj.alignmentMarginY = 20;
3301 textArea->obj.alignmentMarginY = 24;
3303 textArea->obj.alignTo = (
nbgl_obj_t *) spinner;
3307 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
3311 spinner->obj.alignmentMarginY
3312 = -(textArea->obj.alignmentMarginY + textArea->obj.area.height) / 2;
3323 tickerCfg.tickerCallback = &spinnerTickerCallback;
3340 if (layout == NULL) {
3344 "nbgl_layoutDraw(): container.nbChildren =%d, layout->nbChildren = %d\n",
3371 if (layout == NULL) {
3375 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)
return the non-unicode font corresponding to the given font ID
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_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.
int nbgl_layoutAddLargeCaseText(nbgl_layout_t *layout, const char *text)
Creates an area with given text in 32px font (in Black)
#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_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 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