18 #include "os_helpers.h"
24 #define INTERNAL_SMALL_MARGIN 8
26 #define BORDER_COLOR WHITE
28 #define NAVIGATION_HEIGHT 92
29 #define NAV_BUTTON_HEIGHT 80
30 #define NAV_BUTTON_WIDTH 80
32 #define NAVIGATION_HEIGHT 96
33 #define NAV_BUTTON_HEIGHT NAVIGATION_HEIGHT
34 #define NAV_BUTTON_WIDTH 104
51 static char navText[11];
67 buttonPrevious->foregroundColor = (navActivePage == 0) ?
LIGHT_GRAY :
BLACK;
70 buttonNext->foregroundColor = (navActivePage == (navNbPages - 1)) ?
LIGHT_GRAY :
BLACK;
103 if (*activePage > 0) {
104 *activePage = *activePage - 1;
105 configButtons(navContainer, nbPages, *activePage);
110 if ((nbPages < 2) || (*activePage < (nbPages - 1))) {
111 *activePage = *activePage + 1;
112 configButtons(navContainer, nbPages, *activePage);
119 if (*activePage > 0) {
120 *activePage = *activePage - 1;
126 if ((nbPages < 2) || (*activePage < (nbPages - 1))) {
127 *activePage = *activePage + 1;
152 button->innerColor =
WHITE;
159 button->obj.alignmentMarginX = (navConfig->
nbPages > 1) ? 8 : 0;
163 button->obj.touchMask = (1 <<
TOUCHED);
170 button->innerColor =
WHITE;
179 button->obj.touchMask = (1 <<
TOUCHED);
186 button->innerColor =
WHITE;
188 button->foregroundColor =
BLACK;
194 button->obj.touchMask = (1 <<
TOUCHED);
209 textArea->obj.area.width
211 textArea->text = navText;
212 textArea->fontId = SMALL_REGULAR_FONT;
214 textArea->textAlignment =
CENTER;
215 textArea->obj.alignment =
CENTER;
Middle Level API of the new BOLOS Graphical Library.
Internal functions/constants of NBGL layout layer.
#define NAV_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.
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)
#define CHEVRON_BACK_ICON
#define CHEVRON_NEXT_ICON
struct PACKED__ nbgl_button_s nbgl_button_t
struct to represent a button (BUTTON type) that can contain a text and/or an icon
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_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)