@@ -1367,13 +1367,14 @@ int nbgl_layoutAddSubHeaderText(nbgl_layout_t *layout, const char *text)
1367
1367
}
1368
1368
1369
1369
/**
1370
- * @brief Creates an area with given text in 32px font (in Black)
1370
+ * @brief Creates an area with given text in 32px font (in Black or Light Gray )
1371
1371
*
1372
1372
* @param layout the current layout
1373
1373
* @param text text to be displayed (auto-wrap)
1374
+ * @param grayedOut if true, use light-gray instead of black
1374
1375
* @return >= 0 if OK
1375
1376
*/
1376
- int nbgl_layoutAddLargeCaseText (nbgl_layout_t * layout , const char * text )
1377
+ int nbgl_layoutAddLargeCaseText (nbgl_layout_t * layout , const char * text , bool grayedOut )
1377
1378
{
1378
1379
nbgl_layoutInternal_t * layoutInt = (nbgl_layoutInternal_t * ) layout ;
1379
1380
nbgl_text_area_t * textArea ;
@@ -1384,7 +1385,7 @@ int nbgl_layoutAddLargeCaseText(nbgl_layout_t *layout, const char *text)
1384
1385
}
1385
1386
textArea = (nbgl_text_area_t * ) nbgl_objPoolGet (TEXT_AREA , layoutInt -> layer );
1386
1387
1387
- textArea -> textColor = BLACK ;
1388
+ textArea -> textColor = grayedOut ? LIGHT_GRAY : BLACK ;
1388
1389
textArea -> text = PIC (text );
1389
1390
textArea -> textAlignment = MID_LEFT ;
1390
1391
textArea -> fontId = LARGE_MEDIUM_FONT ;
@@ -1395,12 +1396,19 @@ int nbgl_layoutAddLargeCaseText(nbgl_layout_t *layout, const char *text)
1395
1396
textArea -> style = NO_STYLE ;
1396
1397
textArea -> obj .alignment = NO_ALIGNMENT ;
1397
1398
textArea -> obj .alignmentMarginX = BORDER_MARGIN ;
1398
- #ifdef TARGET_STAX
1399
- // if first object of container, increase the margin from top
1400
1399
if (layoutInt -> container -> nbChildren == 0 ) {
1400
+ #ifdef TARGET_STAX
1401
+ // if first object of container, increase the margin from top
1401
1402
textArea -> obj .alignmentMarginY += BORDER_MARGIN ;
1402
- }
1403
1403
#endif // TARGET_STAX
1404
+ }
1405
+ else {
1406
+ #ifdef TARGET_STAX
1407
+ textArea -> obj .alignmentMarginY = 40 ; // 40px between paragraphs
1408
+ #else // TARGET_STAX
1409
+ textArea -> obj .alignmentMarginY = 24 ; // 24px between paragraphs
1410
+ #endif // TARGET_STAX
1411
+ }
1404
1412
1405
1413
// set this new obj as child of main container
1406
1414
layoutAddObject (layoutInt , (nbgl_obj_t * ) textArea );
@@ -1677,6 +1685,98 @@ int nbgl_layoutAddContentCenter(nbgl_layout_t *layout, const nbgl_contentCenter_
1677
1685
return container -> obj .area .height ;
1678
1686
}
1679
1687
1688
+ /**
1689
+ * @brief Creates an area with a title, and rows of icon + text, left aligned
1690
+ *
1691
+ * @param layout the current layout
1692
+ * @param info structure giving the description of rows (number of rows, title, icons, texts)
1693
+ * @return >= 0 if OK
1694
+ */
1695
+ int nbgl_layoutAddLeftContent (nbgl_layout_t * layout , const nbgl_layoutLeftContent_t * info )
1696
+ {
1697
+ nbgl_layoutInternal_t * layoutInt = (nbgl_layoutInternal_t * ) layout ;
1698
+ nbgl_container_t * container ;
1699
+ nbgl_text_area_t * textArea ;
1700
+ uint8_t row ;
1701
+
1702
+ LOG_DEBUG (LAYOUT_LOGGER , "nbgl_layoutAddLeftContent():\n" );
1703
+ if (layout == NULL ) {
1704
+ return -1 ;
1705
+ }
1706
+ container = (nbgl_container_t * ) nbgl_objPoolGet (CONTAINER , layoutInt -> layer );
1707
+
1708
+ // get container children
1709
+ container -> nbChildren = info -> nbRows + 1 ;
1710
+ container -> children = nbgl_containerPoolGet (container -> nbChildren , layoutInt -> layer );
1711
+ container -> layout = VERTICAL ;
1712
+ container -> obj .area .width = AVAILABLE_WIDTH ;
1713
+ container -> obj .alignmentMarginX = BORDER_MARGIN ;
1714
+
1715
+ // create title
1716
+ textArea = (nbgl_text_area_t * ) nbgl_objPoolGet (TEXT_AREA , layoutInt -> layer );
1717
+ textArea -> textColor = BLACK ;
1718
+ textArea -> text = PIC (info -> title );
1719
+ textArea -> textAlignment = MID_LEFT ;
1720
+ textArea -> fontId = LARGE_MEDIUM_FONT ;
1721
+ textArea -> wrapping = true;
1722
+ textArea -> obj .area .width = AVAILABLE_WIDTH ;
1723
+ textArea -> obj .area .height = nbgl_getTextHeightInWidth (
1724
+ textArea -> fontId , textArea -> text , textArea -> obj .area .width , textArea -> wrapping );
1725
+
1726
+ container -> obj .area .height += textArea -> obj .area .height ;
1727
+
1728
+ container -> children [0 ] = (nbgl_obj_t * ) textArea ;
1729
+
1730
+ for (row = 0 ; row < info -> nbRows ; row ++ ) {
1731
+ nbgl_container_t * rowContainer ;
1732
+ nbgl_image_t * image ;
1733
+
1734
+ // create a grid with 1 icon on the left column and 1 text on the right one
1735
+ rowContainer = (nbgl_container_t * ) nbgl_objPoolGet (CONTAINER , 0 );
1736
+ rowContainer -> nbChildren = 2 ; // 1 icon + 1 text
1737
+ rowContainer -> children = nbgl_containerPoolGet (rowContainer -> nbChildren , 0 );
1738
+ rowContainer -> obj .area .width = AVAILABLE_WIDTH ;
1739
+
1740
+ image = (nbgl_image_t * ) nbgl_objPoolGet (IMAGE , 0 );
1741
+ image -> foregroundColor = BLACK ;
1742
+ image -> buffer = info -> rowIcons [row ];
1743
+ rowContainer -> children [0 ] = (nbgl_obj_t * ) image ;
1744
+
1745
+ textArea = (nbgl_text_area_t * ) nbgl_objPoolGet (TEXT_AREA , 0 );
1746
+ textArea -> textColor = BLACK ;
1747
+ textArea -> text = info -> rowTexts [row ];
1748
+ textArea -> textAlignment = MID_LEFT ;
1749
+ textArea -> fontId = SMALL_REGULAR_FONT ;
1750
+ textArea -> wrapping = true;
1751
+ textArea -> obj .alignmentMarginX = 16 ;
1752
+ textArea -> obj .area .width
1753
+ = AVAILABLE_WIDTH - image -> buffer -> width - textArea -> obj .alignmentMarginX ;
1754
+ textArea -> obj .area .height = nbgl_getTextHeightInWidth (
1755
+ textArea -> fontId , textArea -> text , textArea -> obj .area .width , textArea -> wrapping );
1756
+ textArea -> obj .alignment = RIGHT_TOP ;
1757
+ textArea -> obj .alignTo = (nbgl_obj_t * ) image ;
1758
+ rowContainer -> children [1 ] = (nbgl_obj_t * ) textArea ;
1759
+ rowContainer -> obj .area .height = MAX (image -> buffer -> height , textArea -> obj .area .height );
1760
+
1761
+ if (row == 0 ) {
1762
+ rowContainer -> obj .alignmentMarginY = 32 ;
1763
+ }
1764
+ else {
1765
+ #ifdef TARGET_STAX
1766
+ rowContainer -> obj .alignmentMarginY = 16 ;
1767
+ #else // TARGET_STAX
1768
+ rowContainer -> obj .alignmentMarginY = 26 ;
1769
+ #endif // TARGET_STAX
1770
+ }
1771
+ container -> children [1 + row ] = (nbgl_obj_t * ) rowContainer ;
1772
+ container -> obj .area .height
1773
+ += rowContainer -> obj .area .height + rowContainer -> obj .alignmentMarginY ;
1774
+ }
1775
+ layoutAddObject (layoutInt , (nbgl_obj_t * ) container );
1776
+
1777
+ return container -> obj .area .height ;
1778
+ }
1779
+
1680
1780
#ifdef NBGL_QRCODE
1681
1781
/**
1682
1782
* @brief Creates an area on the center of the main panel, with a QRCode,
0 commit comments