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;
896 if (description->
modal) {
897 if (gLayout[1].nbChildren == 0) {
898 layout = &gLayout[1];
900 else if (gLayout[2].nbChildren == 0) {
901 layout = &gLayout[2];
907 layout = &gLayout[0];
909 if (layout == NULL) {
917 nbTouchableControls = 0;
922 if (description->
modal) {
954 obj->
tuneId = description->tapTuneId;
962 footerDesc.
text.tuneId = description->tapTuneId;
989 if (layout == NULL) {
996 layoutInt->
tapText->text = PIC(text);
998 layoutInt->
tapText->fontId = SMALL_REGULAR_FONT;
1005 layoutInt->
tapText->obj.alignmentMarginY = 30;
1024 tune_index_e tuneId)
1031 if (layout == NULL) {
1045 button->foregroundColor =
BLACK;
1046 button->innerColor =
WHITE;
1048 button->obj.touchMask = (1 <<
TOUCHED);
1050 button->icon = PIC(icon);
1095 bool separationLine,
1096 tune_index_e tuneId)
1106 footerDesc.
button.tuneId = tuneId;
1125 if (layout == NULL) {
1129 if (barLayout->
text == NULL) {
1138 itemDesc.tuneId = barLayout->tuneId;
1142 container = addListItem(layoutInt, &itemDesc);
1144 if (container == NULL) {
1147 return container->obj.area.height;
1164 if (layout == NULL) {
1168 if (switchLayout->
text == NULL) {
1174 itemDesc.
text = switchLayout->
text;
1177 itemDesc.tuneId = switchLayout->tuneId;
1179 itemDesc.
large =
false;
1181 container = addListItem(layoutInt, &itemDesc);
1183 if (container == NULL) {
1186 return container->obj.area.height;
1206 if (layout == NULL) {
1218 textArea->textColor =
BLACK;
1219 textArea->text = PIC(text);
1220 textArea->textAlignment =
MID_LEFT;
1221 textArea->fontId = SMALL_BOLD_FONT;
1223 textArea->wrapping =
true;
1226 textArea->obj.area.width = container->obj.area.width;
1228 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1229 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY;
1230 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
1231 container->nbChildren++;
1233 if (subText != NULL) {
1235 subTextArea->textColor =
BLACK;
1236 subTextArea->text = PIC(subText);
1237 subTextArea->fontId = SMALL_REGULAR_FONT;
1239 subTextArea->wrapping =
true;
1240 subTextArea->obj.area.width = container->obj.area.width;
1243 subTextArea->obj.area.width,
1244 subTextArea->wrapping);
1245 subTextArea->textAlignment =
MID_LEFT;
1256 subTextArea->obj.alignmentMarginY = 26;
1260 container->children[container->nbChildren] = (
nbgl_obj_t *) subTextArea;
1261 container->nbChildren++;
1262 fullHeight += subTextArea->obj.area.height + subTextArea->obj.alignmentMarginY;
1267 container->obj.area.height = fullHeight;
1274 return container->obj.area.height;
1290 if (layout == NULL) {
1295 textArea->textColor =
BLACK;
1296 textArea->text = PIC(text);
1297 textArea->textAlignment =
MID_LEFT;
1298 textArea->fontId = SMALL_REGULAR_FONT;
1300 textArea->wrapping =
true;
1305 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1307 textArea->obj.area.height += 2 * 24;
1309 textArea->obj.area.height += 2 * 28;
1315 return textArea->obj.area.height;
1331 if (layout == NULL) {
1336 textArea->textColor =
BLACK;
1337 textArea->text = PIC(text);
1338 textArea->textAlignment =
MID_LEFT;
1339 textArea->fontId = LARGE_MEDIUM_FONT;
1341 textArea->wrapping =
true;
1343 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1349 if (layoutInt->
container->nbChildren == 0) {
1374 const char *description,
1381 if (layout == NULL) {
1387 textArea->textColor =
BLACK;
1388 textArea->text = PIC(title);
1389 textArea->textAlignment =
MID_LEFT;
1390 textArea->fontId = LARGE_MEDIUM_FONT;
1392 textArea->wrapping =
true;
1396 textArea->obj.alignmentMarginY = 24;
1398 textArea->obj.alignmentMarginY = 16;
1402 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1408 textArea->textColor =
BLACK;
1409 textArea->text = PIC(description);
1410 textArea->fontId = SMALL_REGULAR_FONT;
1412 textArea->wrapping =
true;
1415 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1416 textArea->textAlignment =
MID_LEFT;
1420 textArea->obj.alignmentMarginY = 16;
1422 textArea->obj.alignmentMarginY = 24;
1430 textArea->text = PIC(info);
1431 textArea->fontId = SMALL_REGULAR_FONT;
1433 textArea->wrapping =
true;
1436 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1437 textArea->textAlignment =
MID_LEFT;
1440 textArea->obj.alignmentMarginY = 40;
1444 return layoutInt->
container->obj.area.height;
1461 if (layout == NULL) {
1464 for (i = 0; i < choices->
nbChoices; i++) {
1475 layoutInt, (
nbgl_obj_t *) container, choices->
token, choices->tuneId);
1481 container->nbChildren = 2;
1487 container->obj.alignTo = (
nbgl_obj_t *) NULL;
1490 button->activeColor =
BLACK;
1492 button->obj.alignTo = (
nbgl_obj_t *) container;
1495 container->children[1] = (
nbgl_obj_t *) button;
1499 #ifdef HAVE_LANGUAGE_PACK
1504 textArea->text = PIC(choices->
names[i]);
1506 textArea->textAlignment =
MID_LEFT;
1507 textArea->obj.area.width = container->obj.area.width -
RADIO_WIDTH;
1509 textArea->obj.alignment =
MID_LEFT;
1510 textArea->obj.alignTo = (
nbgl_obj_t *) container;
1511 container->children[0] = (
nbgl_obj_t *) textArea;
1514 container->obj.touchMask = (1 <<
TOUCHED);
1515 container->obj.touchId =
CONTROLS_ID + nbTouchableControls;
1516 nbTouchableControls++;
1521 textArea->textColor =
BLACK;
1522 textArea->fontId = SMALL_BOLD_FONT;
1527 textArea->fontId = SMALL_REGULAR_FONT;
1531 line = createHorizontalLine(layoutInt->
layer);
1532 line->obj.alignmentMarginY = -4;
1558 .description = NULL,
1564 if (layout == NULL) {
1568 if (info->
text1 != NULL) {
1576 if (info->
text2 != NULL) {
1584 if (info->
text3 != NULL) {
1592 container = addContentCenter(layoutInt, ¢eredInfo);
1600 container->obj.alignmentMarginY = info->
offsetY;
1603 return container->obj.area.height;
1620 if (layout == NULL) {
1624 container = addContentCenter(layoutInt, info);
1626 return container->obj.area.height;
1647 if (layout == NULL) {
1655 container->nbChildren = 0;
1659 if (strlen(PIC(info->
url)) > 62) {
1675 fullHeight +=
qrcode->obj.area.height;
1677 container->nbChildren++;
1679 if (info->
text1 != NULL) {
1681 textArea->textColor =
BLACK;
1682 textArea->text = PIC(info->
text1);
1683 textArea->textAlignment =
CENTER;
1684 textArea->fontId = (info->
largeText1 ==
true) ? LARGE_MEDIUM_FONT : SMALL_REGULAR_FONT;
1685 textArea->wrapping =
true;
1688 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1690 textArea->obj.alignTo = (
nbgl_obj_t *) container->children[container->nbChildren - 1];
1691 textArea->obj.alignmentMarginY = 24;
1693 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY;
1695 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
1696 container->nbChildren++;
1698 if (info->
text2 != NULL) {
1701 textArea->text = PIC(info->
text2);
1702 textArea->textAlignment =
CENTER;
1703 textArea->fontId = SMALL_REGULAR_FONT;
1704 textArea->wrapping =
true;
1707 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1709 textArea->obj.alignTo = (
nbgl_obj_t *) container->children[container->nbChildren - 1];
1710 if (info->
text1 != NULL) {
1712 textArea->obj.alignmentMarginY = 40;
1714 textArea->obj.alignmentMarginY = 28;
1718 textArea->obj.alignmentMarginY = 32;
1722 fullHeight += textArea->obj.area.height + textArea->obj.alignmentMarginY;
1724 container->children[container->nbChildren] = (
nbgl_obj_t *) textArea;
1725 container->nbChildren++;
1728 if ((fullHeight >= (layoutInt->
container->obj.area.height - 16))
1736 container->obj.area.height = fullHeight;
1739 container->obj.alignment =
CENTER;
1743 container->obj.alignTo
1746 container->obj.alignmentMarginY = info->
offsetY;
1792 .horizontalButtons.leftIcon = info->
leftIcon,
1793 .horizontalButtons.leftToken = info->
leftToken,
1794 .horizontalButtons.rightText = info->
rightText,
1795 .horizontalButtons.rightToken = info->
rightToken,
1796 .horizontalButtons.tuneId = info->tuneId};
1818 if (layout == NULL) {
1822 for (i = 0; i < list->
nbPairs; i++) {
1827 if (list->
pairs != NULL) {
1828 pair = &list->
pairs[i];
1845 itemTextArea->text = PIC(pair->
item);
1846 itemTextArea->textAlignment =
MID_LEFT;
1847 itemTextArea->fontId = SMALL_REGULAR_FONT;
1848 itemTextArea->wrapping =
true;
1851 itemTextArea->fontId, itemTextArea->text,
AVAILABLE_WIDTH, itemTextArea->wrapping);
1854 itemTextArea->obj.alignmentMarginX = 0;
1855 itemTextArea->obj.alignmentMarginY = 0;
1856 itemTextArea->obj.alignTo = NULL;
1857 container->children[container->nbChildren] = (
nbgl_obj_t *) itemTextArea;
1858 container->nbChildren++;
1860 fullHeight += itemTextArea->obj.area.height;
1863 valueTextArea->textColor =
BLACK;
1864 valueTextArea->text = PIC(pair->
value);
1865 valueTextArea->textAlignment =
MID_LEFT;
1867 valueTextArea->fontId = SMALL_BOLD_FONT;
1870 valueTextArea->fontId = LARGE_MEDIUM_FONT;
1885 valueTextArea->obj.area.width =
AVAILABLE_WIDTH - valueIcon->width - 12;
1891 valueTextArea->text,
1892 valueTextArea->obj.area.width,
1900 valueTextArea->obj.area.height = nbLines * font->
line_height;
1903 valueTextArea->obj.alignmentMarginY = 4;
1904 valueTextArea->obj.alignTo = (
nbgl_obj_t *) itemTextArea;
1905 valueTextArea->wrapping = list->
wrapping;
1906 container->children[container->nbChildren] = (
nbgl_obj_t *) valueTextArea;
1907 container->nbChildren++;
1909 fullHeight += valueTextArea->obj.area.height + valueTextArea->obj.alignmentMarginY;
1910 if (valueIcon != NULL) {
1915 image->foregroundColor =
BLACK;
1916 image->buffer = valueIcon;
1918 image->obj.alignmentMarginX = 12;
1919 image->obj.alignTo = (
nbgl_obj_t *) valueTextArea;
1920 image->obj.touchMask = (1 <<
TOUCHED);
1923 container->children[container->nbChildren] = (
nbgl_obj_t *) image;
1924 container->nbChildren++;
1928 container->obj.area.height = fullHeight;
1934 container->obj.alignmentMarginY = 12;
1937 container->obj.alignmentMarginY = 24;
1942 container->obj.alignmentMarginY = 24;
1967 if (layout == NULL) {
1970 if (barLayout->
text != NULL) {
1975 textArea->textColor =
BLACK;
1976 textArea->text = PIC(barLayout->
text);
1977 textArea->textAlignment =
MID_LEFT;
1978 textArea->fontId = SMALL_REGULAR_FONT;
1979 textArea->wrapping =
true;
1982 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
1991 progress->foregroundColor =
BLACK;
1992 progress->withBorder =
true;
1994 progress->obj.area.width = 120;
1995 progress->obj.area.height = 12;
1997 progress->obj.alignmentMarginX = (
AVAILABLE_WIDTH - progress->obj.area.width) / 2;
2001 if (barLayout->
subText != NULL) {
2007 subTextArea->text = PIC(barLayout->
subText);
2008 subTextArea->textAlignment =
MID_LEFT;
2009 subTextArea->fontId = SMALL_REGULAR_FONT;
2010 subTextArea->wrapping =
true;
2014 subTextArea->obj.area.width,
2015 subTextArea->wrapping);
2038 line = createHorizontalLine(layoutInt->
layer);
2039 line->obj.alignmentMarginY = -4;
2059 if (layout == NULL) {
2071 footerDesc.
button.tuneId = buttonInfo->tuneId;
2081 upFooterDesc.
button.tuneId = buttonInfo->tuneId;
2090 layoutInt, (
nbgl_obj_t *) button, buttonInfo->
token, buttonInfo->tuneId);
2096 button->obj.alignmentMarginY = 12;
2099 button->innerColor =
BLACK;
2100 button->foregroundColor =
WHITE;
2103 button->innerColor =
WHITE;
2104 button->foregroundColor =
BLACK;
2107 button->borderColor =
WHITE;
2111 button->borderColor =
BLACK;
2117 button->text = PIC(buttonInfo->
text);
2118 button->fontId = SMALL_BOLD_FONT;
2119 button->icon = PIC(buttonInfo->
icon);
2123 + ((button->icon) ? (button->icon->width + 12) : 0);
2126 if (buttonInfo->
onBottom !=
true) {
2127 button->obj.alignmentMarginX
2136 button->obj.alignTo = NULL;
2137 button->obj.touchMask = (1 <<
TOUCHED);
2157 tune_index_e tuneId)
2160 .longPress.text = text,
2161 .longPress.token = token,
2162 .longPress.tuneId = tuneId};
2165 if (layout == NULL) {
2185 tune_index_e tuneId)
2210 const char *leftText,
2212 const char *rightText,
2214 tune_index_e tuneId)
2222 footerDesc.
doubleText.rightToken = rightToken;
2245 if (layout == NULL) {
2259 switch (headerDesc->
type) {
2283 button->innerColor =
WHITE;
2284 button->foregroundColor =
BLACK;
2285 button->borderColor =
WHITE;
2288 button->text = NULL;
2290 button->obj.touchMask = (1 <<
TOUCHED);
2308 textArea->obj.touchMask = (1 <<
TOUCHED);
2310 textArea->obj.alignment =
CENTER;
2311 textArea->textColor =
BLACK;
2312 textArea->obj.area.width
2315 textArea->text = text;
2316 textArea->fontId = SMALL_BOLD_FONT;
2317 textArea->textAlignment =
CENTER;
2318 textArea->wrapping =
true;
2322 textArea->obj.area.width,
2326 "nbgl_layoutAddHeader: text [%s] is too long for header\n",
2346 button->obj.touchMask = (1 <<
TOUCHED);
2350 button->innerColor =
WHITE;
2351 button->foregroundColor
2354 button->borderColor =
WHITE;
2357 button->text = NULL;
2358 button->icon = PIC(headerDesc->
extendedBack.actionIcon);
2382 button->innerColor =
WHITE;
2383 button->foregroundColor =
BLACK;
2384 button->borderColor =
WHITE;
2387 button->text = NULL;
2389 button->obj.touchMask = (1 <<
TOUCHED);
2406 progress->obj.area.width = 224;
2407 progress->obj.alignment =
CENTER;
2421 textArea->textColor =
BLACK;
2424 textArea->text = PIC(headerDesc->
title.text);
2425 textArea->fontId = SMALL_BOLD_FONT;
2426 textArea->textAlignment =
CENTER;
2427 textArea->wrapping =
true;
2431 layoutInt->
headerContainer->obj.area.height = textArea->obj.area.height;
2445 textArea->textColor =
BLACK;
2448 textArea->text = PIC(headerDesc->
rightText.text);
2449 textArea->fontId = SMALL_BOLD_FONT;
2451 textArea->obj.touchMask = (1 <<
TOUCHED);
2457 layoutInt->
headerContainer->obj.area.height = textArea->obj.area.height;
2465 line = createHorizontalLine(layoutInt->
layer);
2472 if (separationLine != NULL) {
2507 if (layout == NULL) {
2521 switch (footerDesc->
type) {
2539 textArea->obj.area.height
2541 textArea->text = PIC(footerDesc->
simpleText.text);
2543 = (footerDesc->
simpleText.mutedOut) ? SMALL_REGULAR_FONT : SMALL_BOLD_FONT;
2544 textArea->textAlignment =
CENTER;
2545 textArea->obj.touchMask = (1 <<
TOUCHED);
2550 layoutInt->
footerContainer->obj.area.height = textArea->obj.area.height;
2563 textArea->textColor =
BLACK;
2566 textArea->text = PIC(footerDesc->
doubleText.leftText);
2567 textArea->fontId = SMALL_BOLD_FONT;
2568 textArea->textAlignment =
CENTER;
2569 textArea->obj.touchMask = (1 <<
TOUCHED);
2587 textArea->textColor =
BLACK;
2590 textArea->text = PIC(footerDesc->
doubleText.rightText);
2591 textArea->fontId = SMALL_BOLD_FONT;
2592 textArea->textAlignment =
CENTER;
2593 textArea->obj.touchMask = (1 <<
TOUCHED);
2599 layoutInt->
footerContainer->obj.area.height = textArea->obj.area.height;
2604 separationLine->obj.area.width = 1;
2605 separationLine->obj.area.height = layoutInt->
footerContainer->obj.area.height;
2606 separationLine->direction =
VERTICAL;
2607 separationLine->thickness = 1;
2608 separationLine->obj.alignment =
MID_LEFT;
2609 separationLine->obj.alignTo = (
nbgl_obj_t *) textArea;
2610 separationLine->obj.alignmentMarginX = -1;
2626 textArea->textColor =
BLACK;
2628 textArea->obj.area.width = 160;
2630 textArea->obj.area.width = 192;
2633 textArea->text = PIC(footerDesc->
textAndNav.text);
2634 textArea->fontId = SMALL_BOLD_FONT;
2635 textArea->textAlignment =
CENTER;
2636 textArea->obj.touchMask = (1 <<
TOUCHED);
2648 navContainer->nbChildren = 4;
2649 navContainer->children
2652 navContainer->obj.area.width =
SCREEN_WIDTH - textArea->obj.area.width;
2666 separationLine->obj.area.width = 1;
2667 separationLine->obj.area.height = layoutInt->
footerContainer->obj.area.height;
2668 separationLine->direction =
VERTICAL;
2669 separationLine->thickness = 1;
2670 separationLine->obj.alignment =
MID_LEFT;
2671 separationLine->obj.alignTo = (
nbgl_obj_t *) navContainer;
2672 separationLine->obj.alignmentMarginX = -1;
2705 footerDesc->
button.tuneId);
2710 button->obj.alignment =
CENTER;
2712 button->innerColor =
BLACK;
2713 button->foregroundColor =
WHITE;
2716 button->innerColor =
WHITE;
2717 button->foregroundColor =
BLACK;
2721 button->borderColor =
WHITE;
2725 button->borderColor =
BLACK;
2732 button->fontId = SMALL_BOLD_FONT;
2743 button->obj.touchMask = (1 <<
TOUCHED);
2771 button->obj.alignmentMarginY = 4;
2772 button->borderColor =
WHITE;
2773 button->innerColor =
WHITE;
2774 button->foregroundColor =
BLACK;
2779 button->fontId = SMALL_BOLD_FONT;
2780 button->obj.touchMask = (1 <<
TOUCHED);
2789 line = createHorizontalLine(layoutInt->
layer);
2791 line->obj.alignmentMarginY = 4;
2812 button->innerColor =
WHITE;
2814 button->foregroundColor =
BLACK;
2817 button->innerColor =
BLACK;
2818 button->borderColor =
BLACK;
2819 button->foregroundColor =
WHITE;
2828 button->fontId = SMALL_BOLD_FONT;
2829 button->obj.touchMask = (1 <<
TOUCHED);
2851 addSwipeInternal(layoutInt,
2862 line = createHorizontalLine(layoutInt->
layer);
2868 if (separationLine != NULL) {
2901 if (layout == NULL) {
2918 switch (upFooterDesc->
type) {
2939 button->innerColor =
BLACK;
2940 button->foregroundColor =
WHITE;
2941 button->borderColor =
BLACK;
2949 textArea->textColor =
BLACK;
2950 textArea->text = PIC(upFooterDesc->
longPress.text);
2951 textArea->textAlignment =
MID_LEFT;
2952 textArea->fontId = LARGE_MEDIUM_FONT;
2953 textArea->wrapping =
true;
2956 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
2958 textArea->obj.alignment =
MID_LEFT;
2962 line = createHorizontalLine(layoutInt->
layer);
2968 progressBar->withBorder =
false;
2970 progressBar->obj.area.height = 8;
2972 progressBar->obj.alignmentMarginY = 4;
2973 progressBar->obj.alignTo = NULL;
2982 upFooterDesc->
button.tuneId);
2989 button->obj.alignment =
CENTER;
2992 button->innerColor =
BLACK;
2993 button->foregroundColor =
WHITE;
2996 button->innerColor =
WHITE;
2997 button->foregroundColor =
BLACK;
3000 button->borderColor =
WHITE;
3004 button->borderColor =
BLACK;
3010 button->text = PIC(upFooterDesc->
button.
text);
3011 button->fontId = SMALL_BOLD_FONT;
3012 button->icon = PIC(upFooterDesc->
button.
icon);
3017 button->obj.alignTo = NULL;
3018 button->obj.touchMask = (1 <<
TOUCHED);
3047 button->innerColor =
WHITE;
3048 button->foregroundColor =
BLACK;
3053 button->fontId = SMALL_BOLD_FONT;
3054 button->obj.touchMask = (1 <<
TOUCHED);
3071 button->innerColor =
BLACK;
3072 button->borderColor =
BLACK;
3073 button->foregroundColor =
WHITE;
3078 button->fontId = SMALL_BOLD_FONT;
3079 button->obj.touchMask = (1 <<
TOUCHED);
3092 upFooterDesc->
tipBox.tuneId);
3101 textArea->textColor =
BLACK;
3102 textArea->text = PIC(upFooterDesc->
tipBox.
text);
3103 textArea->textAlignment =
MID_LEFT;
3104 textArea->fontId = SMALL_REGULAR_FONT;
3105 textArea->wrapping =
true;
3108 textArea->obj.area.width
3113 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
3114 textArea->obj.alignment =
MID_LEFT;
3119 line = createHorizontalLine(layoutInt->
layer);
3128 image->foregroundColor =
BLACK;
3129 image->buffer = PIC(upFooterDesc->
tipBox.
icon);
3142 upFooterDesc->
text.token,
3143 upFooterDesc->
text.tuneId);
3154 textArea->text = PIC(upFooterDesc->
text.text);
3155 textArea->textAlignment =
CENTER;
3156 textArea->fontId = SMALL_REGULAR_FONT;
3157 textArea->wrapping =
true;
3160 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
3161 textArea->obj.alignment =
CENTER;
3197 tune_index_e tuneId)
3200 .separationLine =
false,
3201 .progressAndBack.activePage = activePage,
3202 .progressAndBack.nbPages = nbPages,
3203 .progressAndBack.token = backToken,
3204 .progressAndBack.tuneId = tuneId,
3205 .progressAndBack.withBack = withBack,
3206 .progressAndBack.actionIcon = NULL,
3228 if (layout == NULL) {
3234 spinner->position = fixed ? 0xFF : 0;
3235 spinner->obj.alignmentMarginY = -20;
3236 spinner->obj.alignTo = NULL;
3237 spinner->obj.alignment =
CENTER;
3243 textArea->textColor =
BLACK;
3244 textArea->text = PIC(text);
3245 textArea->textAlignment =
CENTER;
3246 textArea->fontId = SMALL_REGULAR_FONT;
3247 textArea->wrapping =
true;
3249 textArea->obj.alignmentMarginY = 20;
3251 textArea->obj.alignmentMarginY = 24;
3253 textArea->obj.alignTo = (
nbgl_obj_t *) spinner;
3257 textArea->fontId, textArea->text, textArea->obj.area.width, textArea->wrapping);
3261 spinner->obj.alignmentMarginY
3262 = -(textArea->obj.alignmentMarginY + textArea->obj.area.height) / 2;
3273 tickerCfg.tickerCallback = &spinnerTickerCallback;
3290 if (layout == NULL) {
3294 "nbgl_layoutDraw(): container.nbChildren =%d, layout->nbChildren = %d\n",
3321 if (layout == NULL) {
3325 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 and sub text (in gray)
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_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