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

Add up footer layout object and tip-box object #727

Merged
merged 2 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions lib_nbgl/include/nbgl_content.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,12 +301,34 @@ typedef struct {
#endif // HAVE_PIEZO_SOUND
} nbgl_contentBarsList_t;

/**
* @brief This structure contains data to build a tip-box, on top of a footer,
* on bottom of a content center
*/
typedef struct {
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
#ifdef HAVE_PIEZO_SOUND
tune_index_e tuneId; ///< tune played when tip-box is tapped
#endif // HAVE_PIEZO_SOUND
} nbgl_contentTipBox_t;

/**
* @brief This structure contains data to build a @ref EXTENDED_CENTER content
*/
typedef struct {
nbgl_contentCenter_t contentCenter; ///< centered content (icon + text(s))
nbgl_contentTipBox_t tipBox; ///< if text field is NULL, no tip-box
} nbgl_contentExtendedCenter_t;

/**
* @brief The different types of predefined contents
*
*/
typedef enum {
CENTERED_INFO = 0, ///< a centered info
EXTENDED_CENTER, ///< a centered content and a possible tip-box
INFO_LONG_PRESS, ///< a centered info and a long press button
INFO_BUTTON, ///< a centered info and a simple black button
TAG_VALUE_LIST, ///< list of tag/value pairs
Expand All @@ -323,6 +345,7 @@ typedef enum {
*/
typedef union {
nbgl_contentCenteredInfo_t centeredInfo; ///< @ref CENTERED_INFO type
nbgl_contentExtendedCenter_t extendedCenter; ///< @ref EXTENDED_CENTER type
nbgl_contentInfoLongPress_t infoLongPress; ///< @ref INFO_LONG_PRESS type
nbgl_contentInfoButton_t infoButton; ///< @ref INFO_BUTTON type
nbgl_contentTagValueList_t tagValueList; ///< @ref TAG_VALUE_LIST type
Expand Down
32 changes: 32 additions & 0 deletions lib_nbgl/include/nbgl_layout.h
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,37 @@ typedef struct {
nbgl_layoutChoiceButtons_t choiceButtons; ///< if type is @ref FOOTER_SIMPLE_BUTTON
};
} nbgl_layoutFooter_t;

/**
* @brief The different types of area on top of footer
*
*/
typedef enum {
UP_FOOTER_LONG_PRESS = 0, ///< long-press button
UP_FOOTER_BUTTON, ///< simple button
UP_FOOTER_HORIZONTAL_BUTTONS, ///< 2 buttons, on the same line
UP_FOOTER_TIP_BOX, ///< Tip-box
NB_UP_FOOTER_TYPES
} nbgl_layoutUpFooterType_t;

/**
* @brief This structure contains info to build an up-footer (area on top of footer).
*
*/
typedef struct {
nbgl_layoutUpFooterType_t type; ///< type of up-footer
union {
struct {
const char *text; ///< text in the long-press button
uint8_t token; ///< token used when button is long-pressed
tune_index_e tuneId; ///< tune played when button is long-pressed
} longPress; ///< if type is @ref UP_FOOTER_LONG_PRESS
nbgl_layoutButton_t button; ///< if type is @ref UP_FOOTER_BUTTON
nbgl_layoutHorizontalButtons_t
horizontalButtons; ///< if type is @ref UP_FOOTER_HORIZONTAL_BUTTONS
nbgl_contentTipBox_t tipBox; ///< if type is @ref UP_FOOTER_TIP_BOX
};
} nbgl_layoutUpFooter_t;
#endif // HAVE_SE_TOUCH

/**
Expand Down Expand Up @@ -574,6 +605,7 @@ int nbgl_layoutAddSplitFooter(nbgl_layout_t *layout,
tune_index_e tuneId);
int nbgl_layoutAddHeader(nbgl_layout_t *layout, const nbgl_layoutHeader_t *headerDesc);
int nbgl_layoutAddExtendedFooter(nbgl_layout_t *layout, const nbgl_layoutFooter_t *footerDesc);
int nbgl_layoutAddUpFooter(nbgl_layout_t *layout, const nbgl_layoutUpFooter_t *upFooterDesc);
int nbgl_layoutAddNavigationBar(nbgl_layout_t *layout, const nbgl_layoutNavigationBar_t *info);
int nbgl_layoutAddBottomButton(nbgl_layout_t *layout,
const nbgl_icon_details_t *icon,
Expand Down
1 change: 1 addition & 0 deletions lib_nbgl/include/nbgl_obj.h
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ enum {
VALUE_BUTTON_2_ID,
VALUE_BUTTON_3_ID,
LONG_PRESS_BUTTON_ID,
TIP_BOX_ID,
CONTROLS_ID, // when multiple controls in the same pages (buttons, switches, radios)
NB_CONTROL_IDS
};
Expand Down
1 change: 1 addition & 0 deletions lib_nbgl/include/nbgl_page.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ typedef struct nbgl_pageContent_s {
nbgl_contentType_t type; ///< type of page content in the following union
union {
nbgl_contentCenteredInfo_t centeredInfo; ///< @ref CENTERED_INFO type
nbgl_contentExtendedCenter_t extendedCenter; ///< @ref EXTENDED_CENTER type
nbgl_contentInfoLongPress_t infoLongPress; ///< @ref INFO_LONG_PRESS type
nbgl_contentInfoButton_t infoButton; ///< @ref INFO_BUTTON type
nbgl_contentTagValueList_t tagValueList; ///< @ref TAG_VALUE_LIST type
Expand Down
24 changes: 24 additions & 0 deletions lib_nbgl/include/nbgl_use_case.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,21 @@ typedef struct {
nbgl_callback_t callback; ///< function to call when action button is touched in Home page
} nbgl_homeAction_t;

/**
* @brief The necessary parameters to build a tip-box in first review page and
* the modal if this tip box is touched
*
*/
typedef struct {
const char *text; ///< text of the tip-box
const nbgl_icon_details_t *icon; ///< icon of the tip-box
const char *modalTitle; ///< title given to modal window displayed when tip-box is touched
nbgl_contentType_t type; ///< type of page content in the following union
union {
const nbgl_contentInfoList_t infos; ///< infos pairs displayed in modal.
};
} nbgl_tipBox_t;

/**
* @brief The different types of operation to review
*
Expand Down Expand Up @@ -219,6 +234,15 @@ void nbgl_useCaseReview(nbgl_operationType_t operationType,
const char *finishTitle,
nbgl_choiceCallback_t choiceCallback);

void nbgl_useCaseAdvancedReview(nbgl_operationType_t operationType,
const nbgl_contentTagValueList_t *tagValueList,
const nbgl_icon_details_t *icon,
const char *reviewTitle,
const char *reviewSubTitle,
const char *finishTitle,
const nbgl_tipBox_t *tipBox,
nbgl_choiceCallback_t choiceCallback);

void nbgl_useCaseReviewLight(nbgl_operationType_t operationType,
const nbgl_contentTagValueList_t *tagValueList,
const nbgl_icon_details_t *icon,
Expand Down
Loading
Loading