18#include "os_helpers.h"
24#define INTERNAL_SMALL_MARGIN 8
26#define BORDER_COLOR WHITE
27#if defined(TARGET_STAX)
28#define NAVIGATION_HEIGHT 92
29#define NAV_BUTTON_HEIGHT 80
30#define NAV_BUTTON_WIDTH 80
31#define PAGE_NUMBER_WIDTH 79
32#elif defined(TARGET_FLEX)
33#define NAVIGATION_HEIGHT 96
34#define NAV_BUTTON_HEIGHT NAVIGATION_HEIGHT
35#define NAV_BUTTON_WIDTH 104
36#define PAGE_NUMBER_WIDTH 79
53static char navText[11];
69 buttonPrevious->foregroundColor = (navActivePage == 0) ?
LIGHT_GRAY :
BLACK;
72 buttonNext->foregroundColor = (navActivePage == (navNbPages - 1)) ?
LIGHT_GRAY :
BLACK;
105 if (*activePage > 0) {
106 *activePage = *activePage - 1;
107 configButtons(navContainer, nbPages, *activePage);
112 if ((nbPages < 2) || (*activePage < (nbPages - 1))) {
113 *activePage = *activePage + 1;
114 configButtons(navContainer, nbPages, *activePage);
121 if (*activePage > 0) {
122 *activePage = *activePage - 1;
128 if ((nbPages < 2) || (*activePage < (nbPages - 1))) {
129 *activePage = *activePage + 1;
154 button->innerColor =
WHITE;
156 button->obj.area.width = BUTTON_DIAMETER;
157 button->obj.area.height = BUTTON_DIAMETER;
158 button->radius = BUTTON_RADIUS;
159 button->icon = &CLOSE_ICON;
161 button->obj.alignmentMarginX = (navConfig->
nbPages > 1) ? 8 : 0;
165 button->obj.touchMask = (1 <<
TOUCHED);
172 button->innerColor =
WHITE;
174 button->obj.area.width = NAV_BUTTON_WIDTH;
175 button->obj.area.height = NAV_BUTTON_HEIGHT;
176 button->radius = BUTTON_RADIUS;
177 button->icon = &CHEVRON_BACK_ICON;
180 button->obj.alignmentMarginX = NAV_BUTTON_WIDTH;
181 button->obj.touchMask = (1 <<
TOUCHED);
188 button->innerColor =
WHITE;
190 button->foregroundColor =
BLACK;
191 button->obj.area.width = NAV_BUTTON_WIDTH;
192 button->obj.area.height = NAV_BUTTON_HEIGHT;
193 button->radius = BUTTON_RADIUS;
194 button->icon = &CHEVRON_NEXT_ICON;
196 button->obj.touchMask = (1 <<
TOUCHED);
204 uint16_t marginX = (NAV_BUTTON_WIDTH - CHEVRON_NEXT_ICON.width) / 2;
211 textArea->obj.area.width
212 = navContainer->obj.area.width - (2 * (marginX + CHEVRON_NEXT_ICON.width));
213 textArea->text = navText;
214 textArea->fontId = SMALL_REGULAR_FONT;
215 textArea->obj.area.height = NAV_BUTTON_HEIGHT;
216 textArea->textAlignment =
CENTER;
217 textArea->obj.alignment =
CENTER;
Middle Level API of the new BOLOS Graphical Library.
Internal functions/constants of NBGL layout layer.
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.
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_text_area_s nbgl_text_area_t
struct to represent a text area (TEXT_AREA type)
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.
struct PACKED__ nbgl_button_s nbgl_button_t
struct to represent a button (BUTTON type) that can contain a text and/or an icon
struct PACKED__ nbgl_container_s nbgl_container_t
struct to represent a container (CONTAINER type)
struct PACKED__ nbgl_obj_s nbgl_obj_t
Common structure for all graphical objects.
nbgl_touchType_t
The different types of Touchscreen events.
@ BUTTON
Rounded rectangle button with icon and/or text.
@ TEXT_AREA
Area to contain text line(s)
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 nbPages
number of pages. (if 0, no navigation)