ItemInputCharset

Defines

ITEM_INPUT_CHARSET(...)
class ItemInputCharset : public ItemInput

Public Functions

inline ItemInputCharset(const char *text, char *value, const char *charset, fptrStr callback)

Construct a new ItemInputCharset object with an initial value.

Parameters:
  • text – The text to renderer for the item.

  • value – The initial value for the input.

  • charset – The charset to use for input.

  • callback – A reference to the callback function to be invoked when the input is submitted.

inline ItemInputCharset(const char *text, const char *charset, fptrStr callback)

Construct a new ItemInputCharset object with no initial value.

Parameters:
  • text – The text to renderer for the item.

  • charset – The charset to use for input.

  • callback – A reference to the callback function to be invoked when the input is submitted.

Protected Functions

inline virtual bool process(LcdMenu *menu, const unsigned char command) override

Process a command decoded in 1 byte. It can be a printable character or a control command like ENTER or LEFT. Return value is used to determine operation was successful or ignored. If the parent of item received that handle was ignored it can execute it’s own action on this command. Thus, the item always has priority in processing; if it is ignored, it is delegated to the parent element. Behaviour is very similar to Even Bubbling in JavaScript.

Parameters:
  • menu – the owner menu of the item, can be used to retrieve required object, such as DisplayInterface or MenuScreen

  • command – the character command, can be a printable character or a control command

Returns:

true if command was successfully handled by item.

inline void initCharEdit()

Initialize char edit mode. Set charEdit flag and search for currently selected char in charset.

inline void abortCharEdit(MenuRenderer *renderer)

Stop char edit mode and abort all mde changes. Unset charEdit flag and draw actual char from value.

inline void commitCharEdit(MenuRenderer *renderer)

Commit char edit mode. Replace char at cursor position with selected char from charset.

inline void showNextChar(MenuRenderer *renderer)

Show next char from charset.

inline void showPreviousChar(MenuRenderer *renderer)

Show previous char from charset.

inline void drawChar(MenuRenderer *renderer)

Private Members

const char *charset
int8_t charsetPosition = -1
bool charEdit = false