tcMenu
Loading...
Searching...
No Matches
tcMenuKeyboard.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 https://www.thecoderscorner.com (Dave Cherry).
3 * This product is licensed under an Apache license, see the LICENSE file in the top-level directory.
4 */
5
6#ifndef _TCMENU_KEYBOARD_H_
7#define _TCMENU_KEYBOARD_H_
8
9#include <KeyboardManager.h>
10
18enum MenuEditingKeyMode: uint8_t {
19 KEYEDIT_NONE,
20 KEYEDIT_ANALOG_EDIT_WHOLE,
21 KEYEDIT_ANALOG_EDIT_FRACT,
22 KEYEDIT_MULTIEDIT_INT_START = 100,
23};
24
25typedef void (*DirectionalItemCallback)(MenuItem* item, uint16_t currentValue);
26
29
30#define KEY_NOT_CONFIGURED 0xff
31
44class MenuEditingKeyListener : public KeyboardListener {
45private:
46 BaseMenuRenderer* baseRenderer;
47 WholeAndFraction currentValue;
48 MenuItem* currentEditor;
50 uint8_t deleteKey;
51 uint8_t enterKey;
52 uint8_t backKey;
53 uint8_t nextKey;
54public:
63 explicit MenuEditingKeyListener(uint8_t enterKey = '*', uint8_t deleteKey = '#', uint8_t backKey = 'A', uint8_t nextKey = 'B');
64
70 void keyPressed(char key, bool held) override;
71
76 void keyReleased(char key) override;
77
84
85private:
86 void processDirectionalIndexItem(MenuItem *item, uint16_t currVal, char key, DirectionalItemCallback callback);
87 void processSimpleValueKeyPress(ValueMenuItem* item, char key);
88 void processScrollValueKeyPress(ScrollChoiceMenuItem* item, char key);
89 void processAnalogKeyPress(AnalogMenuItem* item, char key);
90 void processMultiEditKeyPress(TextMenuItem* item, char key);
91 void processIntegerMultiEdit(EditableMultiPartMenuItem* item, char key);
92 void processLargeNumberPress(EditableLargeNumberMenuItem*, char key);
93 void processListMenuSelection(ListRuntimeMenuItem *item, char key);
94 void clearState();
95
96 void workOutEditorPosition();
97};
98
99#endif // _TCMENU_KEYBOARD_H_
Definition MenuItems.h:476
Definition BaseRenderers.h:282
Definition EditableLargeNumberMenuItem.h:182
Definition RuntimeMenuItem.h:230
Definition RuntimeMenuItem.h:198
Definition tcMenuKeyboard.h:44
void createInternalEncoder()
Definition tcMenuKeyboard.cpp:268
void keyReleased(char key) override
Definition tcMenuKeyboard.cpp:86
void keyPressed(char key, bool held) override
Definition tcMenuKeyboard.cpp:20
Definition MenuItems.h:329
Definition ScrollChoiceMenuItem.h:34
Definition RuntimeMenuItem.h:268
Definition MenuItems.h:424
Definition MenuItems.h:445
MenuEditingKeyMode
Definition tcMenuKeyboard.h:18