Embedded SDK
Embedded SDK
|
Implementation of predefined keyboard related layouts management. More...
#include <string.h>
#include <stdlib.h>
#include "nbgl_debug.h"
#include "nbgl_front.h"
#include "nbgl_layout_internal.h"
#include "nbgl_obj.h"
#include "nbgl_draw.h"
#include "nbgl_screen.h"
#include "nbgl_touch.h"
#include "glyphs.h"
#include "os_pic.h"
#include "os_helpers.h"
Go to the source code of this file.
Macros | |
#define | TEXT_ENTRY_NORMAL_HEIGHT 72 |
#define | TEXT_ENTRY_COMPACT_HEIGHT 56 |
#define | BOTTOM_NORMAL_MARGIN 24 |
#define | BOTTOM_COMPACT_MARGIN 12 |
#define | TOP_NORMAL_MARGIN 20 |
#define | TOP_COMPACT_MARGIN 12 |
#define | LINE_REAL_HEIGHT 4 |
#define | NUMBER_WIDTH 56 |
#define | NUMBER_TEXT_SPACE 8 |
Enumerations | |
enum | { PAGE_INDICATOR_INDEX = 0 , LEFT_HALF_INDEX , RIGHT_HALF_INDEX , FIRST_BUTTON_INDEX , SECOND_BUTTON_INDEX , NB_SUGGESTION_CHILDREN } |
Functions | |
bool | keyboardSwipeCallback (nbgl_obj_t *obj, nbgl_touchType_t eventType) |
int | nbgl_layoutAddKeyboard (nbgl_layout_t *layout, const nbgl_layoutKbd_t *kbdInfo) |
Creates a keyboard on bottom of the screen, with the given configuration. More... | |
int | nbgl_layoutUpdateKeyboard (nbgl_layout_t *layout, uint8_t index, uint32_t keyMask, bool updateCasing, keyboardCase_t casing) |
Updates an existing keyboard on bottom of the screen, with the given configuration. More... | |
bool | nbgl_layoutKeyboardNeedsRefresh (nbgl_layout_t *layout, uint8_t index) |
function called to know whether the keyboard has been redrawn and needs a refresh More... | |
int | nbgl_layoutAddSuggestionButtons (nbgl_layout_t *layout, uint8_t nbUsedButtons, const char *buttonTexts[NB_MAX_SUGGESTION_BUTTONS], int firstButtonToken, tune_index_e tuneId) |
Adds up to 4 black suggestion buttons under the previously added object. More... | |
int | nbgl_layoutUpdateSuggestionButtons (nbgl_layout_t *layout, uint8_t index, uint8_t nbUsedButtons, const char *buttonTexts[NB_MAX_SUGGESTION_BUTTONS]) |
Updates the number and/or the text suggestion buttons created with nbgl_layoutAddSuggestionButtons() More... | |
int | nbgl_layoutAddEnteredText (nbgl_layout_t *layout, bool numbered, uint8_t number, const char *text, bool grayedOut, int offsetY, int token) |
Adds a "text entry" area under the previously entered object. This area can be preceded (beginning of line) by an index, indicating for example the entered world. A vertical gray line is placed under the text. This text must be vertical placed in the screen with offsetY. More... | |
int | nbgl_layoutUpdateEnteredText (nbgl_layout_t *layout, uint8_t index, bool numbered, uint8_t number, const char *text, bool grayedOut) |
Updates an existing "text entry" area, created with nbgl_layoutAddEnteredText() More... | |
int | nbgl_layoutAddConfirmationButton (nbgl_layout_t *layout, bool active, const char *text, int token, tune_index_e tuneId) |
Adds a black full width confirmation button on top of the previously added keyboard. More... | |
int | nbgl_layoutUpdateConfirmationButton (nbgl_layout_t *layout, uint8_t index, bool active, const char *text) |
Updates an existing black full width confirmation button on top of the previously added keyboard. More... | |
int | nbgl_layoutAddKeyboardContent (nbgl_layout_t *layout, nbgl_layoutKeyboardContent_t *content) |
Adds an area containing a potential title, a text entry and either confirmation or suggestion buttons, on top of the keyboard. More... | |
int | nbgl_layoutUpdateKeyboardContent (nbgl_layout_t *layout, nbgl_layoutKeyboardContent_t *content) |
Updates an area containing a potential title, a text entry and either confirmation or suggestion buttons, on top of the keyboard This area must have been built with nbgl_layoutAddKeyboardContent, and the type must not change. More... | |
Implementation of predefined keyboard related layouts management.
Definition in file nbgl_layout_keyboard.c.
#define BOTTOM_COMPACT_MARGIN 12 |
Definition at line 55 of file nbgl_layout_keyboard.c.
#define BOTTOM_NORMAL_MARGIN 24 |
Definition at line 54 of file nbgl_layout_keyboard.c.
#define LINE_REAL_HEIGHT 4 |
Definition at line 61 of file nbgl_layout_keyboard.c.
#define NUMBER_TEXT_SPACE 8 |
Definition at line 66 of file nbgl_layout_keyboard.c.
#define NUMBER_WIDTH 56 |
Definition at line 63 of file nbgl_layout_keyboard.c.
#define TEXT_ENTRY_COMPACT_HEIGHT 56 |
Definition at line 53 of file nbgl_layout_keyboard.c.
#define TEXT_ENTRY_NORMAL_HEIGHT 72 |
Definition at line 52 of file nbgl_layout_keyboard.c.
#define TOP_COMPACT_MARGIN 12 |
Definition at line 57 of file nbgl_layout_keyboard.c.
#define TOP_NORMAL_MARGIN 20 |
Definition at line 56 of file nbgl_layout_keyboard.c.
anonymous enum |
Enumerator | |
---|---|
PAGE_INDICATOR_INDEX | |
LEFT_HALF_INDEX | |
RIGHT_HALF_INDEX | |
FIRST_BUTTON_INDEX | |
SECOND_BUTTON_INDEX | |
NB_SUGGESTION_CHILDREN |
Definition at line 29 of file nbgl_layout_keyboard.c.
bool keyboardSwipeCallback | ( | nbgl_obj_t * | obj, |
nbgl_touchType_t | eventType | ||
) |
Definition at line 196 of file nbgl_layout_keyboard.c.
int nbgl_layoutAddConfirmationButton | ( | nbgl_layout_t * | layout, |
bool | active, | ||
const char * | text, | ||
int | token, | ||
tune_index_e | tuneId | ||
) |
Adds a black full width confirmation button on top of the previously added keyboard.
layout | the current layout |
active | if true, button is active, otherwise inactive (grayed-out) |
text | text of the button |
token | token of the button, used in onActionCallback |
tuneId | tune to play when button is pressed |
Definition at line 879 of file nbgl_layout_keyboard.c.
int nbgl_layoutAddEnteredText | ( | nbgl_layout_t * | layout, |
bool | numbered, | ||
uint8_t | number, | ||
const char * | text, | ||
bool | grayedOut, | ||
int | offsetY, | ||
int | token | ||
) |
Adds a "text entry" area under the previously entered object. This area can be preceded (beginning of line) by an index, indicating for example the entered world. A vertical gray line is placed under the text. This text must be vertical placed in the screen with offsetY.
layout | the current layout |
numbered | if true, the "number" param is used as index |
number | index of the text |
text | string to display in the area |
grayedOut | if true, the text is grayed out (but not the potential number) |
offsetY | vertical offset from the top of the page |
token | token provided in onActionCallback when this area is touched |
Definition at line 753 of file nbgl_layout_keyboard.c.
int nbgl_layoutAddKeyboard | ( | nbgl_layout_t * | layout, |
const nbgl_layoutKbd_t * | kbdInfo | ||
) |
Creates a keyboard on bottom of the screen, with the given configuration.
layout | the current layout |
kbdInfo | configuration of the keyboard to draw (including the callback when touched) |
Definition at line 474 of file nbgl_layout_keyboard.c.
int nbgl_layoutAddKeyboardContent | ( | nbgl_layout_t * | layout, |
nbgl_layoutKeyboardContent_t * | content | ||
) |
Adds an area containing a potential title, a text entry and either confirmation or suggestion buttons, on top of the keyboard.
layout | the current layout |
content | structure containing the info |
Definition at line 965 of file nbgl_layout_keyboard.c.
int nbgl_layoutAddSuggestionButtons | ( | nbgl_layout_t * | layout, |
uint8_t | nbUsedButtons, | ||
const char * | buttonTexts[NB_MAX_SUGGESTION_BUTTONS], | ||
int | firstButtonToken, | ||
tune_index_e | tuneId | ||
) |
Adds up to 4 black suggestion buttons under the previously added object.
layout | the current layout |
nbUsedButtons | the number of actually used buttons |
buttonTexts | array of 4 strings for buttons (last ones can be NULL) |
firstButtonToken | first token used for buttons, provided in onActionCallback (the next 3 values will be used for other buttons) |
tuneId | tune to play when any button is pressed |
Definition at line 616 of file nbgl_layout_keyboard.c.
bool nbgl_layoutKeyboardNeedsRefresh | ( | nbgl_layout_t * | layout, |
uint8_t | index | ||
) |
function called to know whether the keyboard has been redrawn and needs a refresh
layout | the current layout |
index | index returned by nbgl_layoutAddKeyboard() (unused) |
Definition at line 580 of file nbgl_layout_keyboard.c.
int nbgl_layoutUpdateConfirmationButton | ( | nbgl_layout_t * | layout, |
uint8_t | index, | ||
bool | active, | ||
const char * | text | ||
) |
Updates an existing black full width confirmation button on top of the previously added keyboard.
layout | the current layout |
index | returned value of nbgl_layoutAddConfirmationButton() |
active | if true, button is active |
text | text of the button = * |
Definition at line 920 of file nbgl_layout_keyboard.c.
int nbgl_layoutUpdateEnteredText | ( | nbgl_layout_t * | layout, |
uint8_t | index, | ||
bool | numbered, | ||
uint8_t | number, | ||
const char * | text, | ||
bool | grayedOut | ||
) |
Updates an existing "text entry" area, created with nbgl_layoutAddEnteredText()
layout | the current layout |
index | index of the text (return value of nbgl_layoutAddEnteredText()) |
numbered | if set to true, the text is preceded on the left by 'number.' |
number | if numbered is true, number used to build 'number.' text |
text | string to display in the area |
grayedOut | if true, the text is grayed out (but not the potential number) |
Definition at line 821 of file nbgl_layout_keyboard.c.
int nbgl_layoutUpdateKeyboard | ( | nbgl_layout_t * | layout, |
uint8_t | index, | ||
uint32_t | keyMask, | ||
bool | updateCasing, | ||
keyboardCase_t | casing | ||
) |
Updates an existing keyboard on bottom of the screen, with the given configuration.
layout | the current layout |
index | index returned by nbgl_layoutAddKeyboard() (unused) |
keyMask | mask of keys to activate/deactivate on keyboard |
updateCasing | if true, update keyboard casing with given value |
casing | casing to use |
Definition at line 543 of file nbgl_layout_keyboard.c.
int nbgl_layoutUpdateKeyboardContent | ( | nbgl_layout_t * | layout, |
nbgl_layoutKeyboardContent_t * | content | ||
) |
Updates an area containing a potential title, a text entry and either confirmation or suggestion buttons, on top of the keyboard This area must have been built with nbgl_layoutAddKeyboardContent, and the type must not change.
layout | the current layout |
content | structure containing the updated info |
Definition at line 1039 of file nbgl_layout_keyboard.c.
int nbgl_layoutUpdateSuggestionButtons | ( | nbgl_layout_t * | layout, |
uint8_t | index, | ||
uint8_t | nbUsedButtons, | ||
const char * | buttonTexts[NB_MAX_SUGGESTION_BUTTONS] | ||
) |
Updates the number and/or the text suggestion buttons created with nbgl_layoutAddSuggestionButtons()
layout | the current layout |
index | index returned by nbgl_layoutAddSuggestionButtons() (unused) |
nbUsedButtons | the number of actually used buttons |
buttonTexts | array of 4 strings for buttons (last ones can be NULL) |
Definition at line 669 of file nbgl_layout_keyboard.c.