17#include "os_helpers.h"
74 textArea->textColor =
WHITE;
75 textArea->text = PIC(text);
76 textArea->textAlignment =
CENTER;
79 textArea->obj.area.height = 12;
80 textArea->wrapping =
false;
82 textArea->obj.alignmentMarginY = 3;
89 keypad->obj.alignmentMarginY = 6;
90 keypad->obj.alignTo = NULL;
91 keypad->callback = PIC(callback);
92 keypad->enableBackspace =
false;
93 keypad->enableValidate =
false;
94 keypad->selectedKey = 0xFF;
95 keypad->shuffled = shuffled;
115 bool enableBackspace)
121 "nbgl_layoutUpdateKeypad(): enableValidate = %d, enableBackspace = %d\n",
124 if (layout == NULL) {
130 if ((keypad == NULL) || (keypad->obj.type !=
KEYPAD)) {
134 if (enableValidate && !keypad->enableValidate) {
136 keypad->selectedKey = 11;
139 else if ((keypad->selectedKey != 0) || (keypad->enableBackspace && !enableBackspace)) {
140 keypad->selectedKey = 0xFF;
142 keypad->enableValidate = enableValidate;
143 keypad->enableBackspace = enableBackspace;
206 if (layout == NULL) {
213 container->nbChildren = nbDigits;
216 container->obj.area.width = nbDigits * C_pin_bullet_empty.width + (nbDigits - 1);
217 container->obj.area.height = C_pin_bullet_empty.height;
219 container->obj.alignmentMarginY = 24;
220 container->obj.alignTo = NULL;
229 for (
int i = 0; i < nbDigits; i++) {
231 image->buffer = &C_pin_bullet_empty;
232 image->foregroundColor =
WHITE;
235 image->obj.alignTo = (
nbgl_obj_t *) container->children[i - 1];
236 image->obj.alignmentMarginX = 1;
246 textArea->textColor =
WHITE;
247 textArea->text = text;
248 textArea->textAlignment =
CENTER;
252 textArea->autoHideLongLine =
true;
254 textArea->obj.alignmentMarginY = 20;
255 textArea->obj.alignTo = NULL;
287 if (layout == NULL) {
295 if ((container == NULL) || (container->obj.type !=
CONTAINER)) {
298 if (nbActiveDigits > container->nbChildren) {
301 if (nbActiveDigits == 0) {
304 if ((image == NULL) || (image->obj.type !=
IMAGE)) {
307 image->buffer = &C_pin_bullet_empty;
310 image = (
nbgl_image_t *) container->children[nbActiveDigits - 1];
311 if ((image == NULL) || (image->obj.type !=
IMAGE)) {
316 if (image->buffer == &C_pin_bullet_filled) {
318 if (nbActiveDigits == container->nbChildren) {
322 image = (
nbgl_image_t *) container->children[nbActiveDigits];
323 image->buffer = &C_pin_bullet_empty;
326 image->buffer = &C_pin_bullet_filled;
335 if ((textArea == NULL) || (textArea->obj.type !=
TEXT_AREA)) {
338 textArea->text = text;
Random Number Generation.
#define LOG_WARN(__logger,...)
#define LOG_DEBUG(__logger,...)
@ BAGL_FONT_OPEN_SANS_REGULAR_11px_1bpp
@ BAGL_FONT_OPEN_SANS_EXTRABOLD_11px_1bpp
uint8_t nbgl_getFontLineHeight(nbgl_font_id_e fontId)
return the height in pixels of the line of font with the given font ID
void layoutAddObject(nbgl_layoutInternal_t *layout, nbgl_obj_t *obj)
adds the given obj to the main container
int nbgl_layoutUpdateKeypad(nbgl_layout_t *layout, uint8_t index, bool enableValidate, bool enableBackspace, bool enableDigits)
Updates an existing keypad on bottom of the screen, with the given configuration.
DEPRECATED int nbgl_layoutAddHiddenDigits(nbgl_layout_t *layout, uint8_t nbDigits)
Adds a placeholder for hidden digits on top of a keypad, to represent the entered digits,...
void * nbgl_layout_t
type shared externally
DEPRECATED int nbgl_layoutUpdateHiddenDigits(nbgl_layout_t *layout, uint8_t index, uint8_t nbActive)
Updates an existing set of hidden digits, with the given configuration.
int nbgl_layoutAddKeypadContent(nbgl_layout_t *layout, const char *title, bool hidden, uint8_t nbDigits, const char *text)
Adds an area with a title and a placeholder for hidden digits on top of a keypad, to represent the en...
int nbgl_layoutUpdateKeypadContent(nbgl_layout_t *layout, bool hidden, uint8_t nbActiveDigits, const char *text)
Updates an existing set of hidden digits, with the given configuration.
int nbgl_layoutAddKeypad(nbgl_layout_t *layout, keyboardCallback_t callback, bool shuffled)
Adds a keypad on bottom of the screen, with the associated callback.
Internal functions/constants of NBGL layout layer.
struct PACKED__ nbgl_text_area_s nbgl_text_area_t
struct to represent a text area (TEXT_AREA type)
void nbgl_objDraw(nbgl_obj_t *obj)
This function draws or redraws the given object and its children (recursive version)
nbgl_obj_t ** nbgl_containerPoolGet(uint8_t nbObjs, uint8_t layer)
Gets a new container from the pool, with the given number of obj pointers.
struct PACKED__ nbgl_keypad_s nbgl_keypad_t
struct to represent a keypad (KEYPAD 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_image_s nbgl_image_t
struct to represent an image (IMAGE type)
int nbgl_objPoolGetArray(nbgl_obj_type_t type, uint8_t nbObjs, uint8_t layer, nbgl_obj_t **objArray)
Gets nbObjects new graphic object from the pool, with the given type, for the given layer (screen)....
void(* keyboardCallback_t)(char touchedKey)
prototype of function to be called when a valid key is pressed on keyboard Backspace is equal to 0x8 ...
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.
@ NO_ALIGNMENT
used when parent container layout is used
@ IMAGE
Bitmap (y and height must be multiple of 4 on Stax)
@ CONTAINER
Empty container.
@ TEXT_AREA
Area to contain text line(s)
Structure containing all information about the current layout.
uint8_t nbChildren
number of children in above array
nbgl_obj_t ** children
children for main screen