Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve some widgets to add icon #530

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 19 additions & 1 deletion lib_nbgl/include/nbgl_content.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,19 @@ typedef struct {
#endif // HAVE_PIEZO_SOUND
} nbgl_contentBarsList_t;

/**
* @brief This structure contains data to build a @ref BARS_LIST_ICONS content
*/
typedef struct nbgl_contentBarsListIcons_s {
const char *const *barTexts; ///< array of texts for each bar (nbBars items, in black/bold)
const nbgl_icon_details_t *const *barIcons; ///< a buffer containing the 1BPP icons
const uint8_t *tokens; ///< array of tokens, one for each bar (nbBars items)
uint8_t nbBars; ///< number of elements in barTexts and tokens array
#ifdef HAVE_PIEZO_SOUND
tune_index_e tuneId; ///< if not @ref NBGL_NO_TUNE, a tune will be played when a bar is touched
#endif // HAVE_PIEZO_SOUND
} nbgl_contentBarsListIcons_t;

/**
* @brief The different types of predefined contents
*
Expand All @@ -255,11 +268,15 @@ typedef enum {
SWITCHES_LIST, ///< list of switches with descriptions
INFOS_LIST, ///< list of infos with titles
CHOICES_LIST, ///< list of choices through radio buttons
BARS_LIST ///< list of touchable bars (with > on the right to go to sub-pages)
BARS_LIST, ///< list of touchable bars (with > on the right to go to sub-pages)
BARS_LIST_ICONS ///< list of touchable bars (with > on the right and icon on the left)
} nbgl_contentType_t;

/**
* @brief Union of the different type of contents
*
* @note This union is duplicated in nbgl_page.h: @ref nbgl_pageContent_t
*
*/
typedef union {
nbgl_contentCenteredInfo_t centeredInfo; ///< @ref CENTERED_INFO type
Expand All @@ -272,6 +289,7 @@ typedef union {
nbgl_contentInfoList_t infosList; ///< @ref INFOS_LIST type
nbgl_contentRadioChoice_t choicesList; ///< @ref CHOICES_LIST type
nbgl_contentBarsList_t barsList; ///< @ref BARS_LIST type
nbgl_contentBarsListIcons_t barsListIcons; ///< @ref BARS_LIST_ICONS type
} nbgl_content_u;

/**
Expand Down
6 changes: 6 additions & 0 deletions lib_nbgl/include/nbgl_layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,13 @@ int nbgl_layoutAddSwitch(nbgl_layout_t *layout, const nbgl_layoutSwitch_t *switc
int nbgl_layoutAddText(nbgl_layout_t *layout, const char *text, const char *subText);
int nbgl_layoutAddRadioChoice(nbgl_layout_t *layout, const nbgl_layoutRadioChoice_t *choices);
int nbgl_layoutAddQRCode(nbgl_layout_t *layout, const nbgl_layoutQRCode_t *info);
int nbgl_layoutAddQRCodeIcon(nbgl_layout_t *layout,
const nbgl_layoutQRCode_t *info,
const nbgl_icon_details_t *icon);
int nbgl_layoutAddChoiceButtons(nbgl_layout_t *layout, const nbgl_layoutChoiceButtons_t *info);
int nbgl_layoutAddChoiceButtonsIcon(nbgl_layout_t *layout,
const nbgl_layoutChoiceButtons_t *info,
const nbgl_icon_details_t *topIcon);
int nbgl_layoutAddTagValueList(nbgl_layout_t *layout, const nbgl_layoutTagValueList_t *list);
int nbgl_layoutAddLargeCaseText(nbgl_layout_t *layout, const char *text);
int nbgl_layoutAddSeparationLine(nbgl_layout_t *layout);
Expand Down
8 changes: 8 additions & 0 deletions lib_nbgl/include/nbgl_page.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ typedef nbgl_contentInfoLongPress_t nbgl_pageInfoLongPress_t;
/**
* @brief This structure contains data to build a page in multi-pages mode (@ref
* nbgl_pageDrawGenericContent)
*
* @note This union is duplicated in nbgl_content.h: @ref nbgl_content_u
*
*/
typedef struct nbgl_pageContent_s {
const char *title; ///< text for the title of the page (if NULL, no title)
Expand All @@ -67,6 +70,7 @@ typedef struct nbgl_pageContent_s {
nbgl_contentInfoList_t infosList; ///< @ref INFOS_LIST type
nbgl_contentRadioChoice_t choicesList; ///< @ref CHOICES_LIST type
nbgl_contentBarsList_t barsList; ///< @ref BARS_LIST type
nbgl_contentBarsListIcons_t barsListIcons; ///< @ref BARS_LIST_ICONS type
};
} nbgl_pageContent_t;

Expand Down Expand Up @@ -203,6 +207,10 @@ nbgl_page_t *nbgl_pageDrawSpinner(nbgl_layoutTouchCallback_t onActionCallback, c
nbgl_page_t *nbgl_pageDrawInfo(nbgl_layoutTouchCallback_t onActionCallback,
const nbgl_screenTickerConfiguration_t *ticker,
const nbgl_pageInfoDescription_t *info);
nbgl_page_t *nbgl_pageDrawInfoIcon(nbgl_layoutTouchCallback_t onActionCallback,
const nbgl_screenTickerConfiguration_t *ticker,
const nbgl_pageInfoDescription_t *info,
const nbgl_icon_details_t *topIcon);
nbgl_page_t *nbgl_pageDrawConfirmation(nbgl_layoutTouchCallback_t onActionCallback,
const nbgl_pageConfirmationDescription_t *info);
nbgl_page_t *nbgl_pageDrawGenericContentExt(nbgl_layoutTouchCallback_t onActionCallback,
Expand Down
9 changes: 9 additions & 0 deletions lib_nbgl/include/nbgl_use_case.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,15 @@ void nbgl_useCaseHomeExt(const char *appName,
nbgl_callback_t actionCallback,
nbgl_callback_t topRightCallback,
nbgl_callback_t quitCallback);
void nbgl_useCaseHomeExtIcon(const char *appName,
const nbgl_icon_details_t *appIcon,
const char *tagline,
bool withSettings,
const char *actionButtonText,
nbgl_callback_t actionCallback,
nbgl_callback_t topRightCallback,
nbgl_callback_t quitCallback,
const nbgl_icon_details_t *icon);
void nbgl_useCasePlugInHome(const char *plugInName,
const char *appName,
const nbgl_icon_details_t *appIcon,
Expand Down