Cosmetics
This commit is contained in:
+2
-2
@@ -32,7 +32,7 @@ void Button::onPress()
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void Button::onKeyEvent(event_t event)
|
||||
void Button::onEvent(event_t event)
|
||||
{
|
||||
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
|
||||
|
||||
@@ -40,7 +40,7 @@ void Button::onKeyEvent(event_t event)
|
||||
onPress();
|
||||
}
|
||||
else {
|
||||
FormField::onKeyEvent(event);
|
||||
FormField::onEvent(event);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ class Button : public FormField {
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onKeyEvent(event_t event);
|
||||
void onEvent(event_t event);
|
||||
#endif
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ void CheckBox::paint(BitmapBuffer * dc)
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void CheckBox::onKeyEvent(event_t event)
|
||||
void CheckBox::onEvent(event_t event)
|
||||
{
|
||||
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
|
||||
|
||||
@@ -36,7 +36,7 @@ void CheckBox::onKeyEvent(event_t event)
|
||||
invalidate({0, 0, 20, 20});
|
||||
}
|
||||
else {
|
||||
FormField::onKeyEvent(event);
|
||||
FormField::onEvent(event);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ class CheckBox : public FormField {
|
||||
void paint(BitmapBuffer * dc) override;
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onKeyEvent(event_t event) override;
|
||||
void onEvent(event_t event) override;
|
||||
#endif
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
|
||||
+4
-2
@@ -36,11 +36,12 @@ Choice::Choice(Window * parent, const rect_t & rect, const char * values, int16_
|
||||
void Choice::paint(BitmapBuffer * dc)
|
||||
{
|
||||
FormField::paint(dc);
|
||||
|
||||
theme->drawChoice(dc, this, textHandler ? textHandler(getValue()).c_str() : TEXT_AT_INDEX(values, getValue() - vmin).c_str());
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void Choice::onKeyEvent(event_t event)
|
||||
void Choice::onEvent(event_t event)
|
||||
{
|
||||
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
|
||||
|
||||
@@ -50,7 +51,7 @@ void Choice::onKeyEvent(event_t event)
|
||||
openMenu();
|
||||
}
|
||||
else {
|
||||
FormField::onKeyEvent(event);
|
||||
FormField::onEvent(event);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -96,6 +97,7 @@ bool Choice::onTouchEnd(coord_t, coord_t)
|
||||
{
|
||||
onKeyPress();
|
||||
openMenu();
|
||||
setEditMode(true);
|
||||
setFocus();
|
||||
return true;
|
||||
}
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ class Choice : public ChoiceBase {
|
||||
void paint(BitmapBuffer * dc) override;
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onKeyEvent(event_t event) override;
|
||||
void onEvent(event_t event) override;
|
||||
#endif
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
|
||||
+3
-2
@@ -119,7 +119,7 @@ bool FileChoice::openMenu()
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void FileChoice::onKeyEvent(event_t event)
|
||||
void FileChoice::onEvent(event_t event)
|
||||
{
|
||||
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
|
||||
|
||||
@@ -130,7 +130,7 @@ void FileChoice::onKeyEvent(event_t event)
|
||||
}
|
||||
}
|
||||
else {
|
||||
FormField::onKeyEvent(event);
|
||||
FormField::onEvent(event);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -140,6 +140,7 @@ bool FileChoice::onTouchEnd(coord_t, coord_t)
|
||||
{
|
||||
openMenu();
|
||||
setFocus();
|
||||
setEditMode(true);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ class FileChoice: public ChoiceBase {
|
||||
void paint(BitmapBuffer * dc) override;
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onKeyEvent(event_t event) override;
|
||||
void onEvent(event_t event) override;
|
||||
#endif
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
|
||||
+6
-6
@@ -39,7 +39,7 @@ FormField::FormField(Window *parent, const rect_t &rect, uint8_t flags) :
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void FormWindow::onKeyEvent(event_t event)
|
||||
void FormWindow::onEvent(event_t event)
|
||||
{
|
||||
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
|
||||
|
||||
@@ -47,11 +47,11 @@ void FormWindow::onKeyEvent(event_t event)
|
||||
first->setFocus();
|
||||
}
|
||||
else {
|
||||
Window::onKeyEvent(event);
|
||||
Window::onEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void FormField::onKeyEvent(event_t event)
|
||||
void FormField::onEvent(event_t event)
|
||||
{
|
||||
TRACE_WINDOWS("%s received event 0x%X", FormField::getWindowDebugString().c_str(), event);
|
||||
|
||||
@@ -74,11 +74,11 @@ void FormField::onKeyEvent(event_t event)
|
||||
invalidate();
|
||||
}
|
||||
else {
|
||||
Window::onKeyEvent(event);
|
||||
Window::onEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void FormGroup::onKeyEvent(event_t event)
|
||||
void FormGroup::onEvent(event_t event)
|
||||
{
|
||||
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
|
||||
|
||||
@@ -91,7 +91,7 @@ void FormGroup::onKeyEvent(event_t event)
|
||||
setFocus();
|
||||
}
|
||||
else {
|
||||
FormField::onKeyEvent(event);
|
||||
FormField::onEvent(event);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
+8
-3
@@ -68,6 +68,11 @@ class FormField: public Window {
|
||||
return editMode;
|
||||
}
|
||||
|
||||
inline void setEditMode(bool newEditMode)
|
||||
{
|
||||
editMode = newEditMode;
|
||||
}
|
||||
|
||||
inline static void link(FormField * previous, FormField * next)
|
||||
{
|
||||
previous->setNextField(next);
|
||||
@@ -77,7 +82,7 @@ class FormField: public Window {
|
||||
void paint(BitmapBuffer * dc) override;
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onKeyEvent(event_t event) override;
|
||||
void onEvent(event_t event) override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
@@ -140,7 +145,7 @@ class FormGroup: public FormField {
|
||||
FormField * first = nullptr;
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onKeyEvent(event_t event) override;
|
||||
void onEvent(event_t event) override;
|
||||
#endif
|
||||
|
||||
void paint(BitmapBuffer * dc) override;
|
||||
@@ -188,7 +193,7 @@ class FormWindow: public Window {
|
||||
protected:
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onKeyEvent(event_t event) override;
|
||||
void onEvent(event_t event) override;
|
||||
#endif
|
||||
|
||||
void paint(BitmapBuffer * dc) override
|
||||
|
||||
+35
-23
@@ -21,12 +21,8 @@
|
||||
#define _KEYBOARD_BASE_H_
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "libopenui_types.h"
|
||||
#include "form.h"
|
||||
|
||||
class Page;
|
||||
class TabsGroup;
|
||||
|
||||
template <class T>
|
||||
class Keyboard: public Window {
|
||||
public:
|
||||
explicit Keyboard(coord_t height):
|
||||
@@ -34,34 +30,50 @@ class Keyboard: public Window {
|
||||
{
|
||||
}
|
||||
|
||||
void setField(T * newField)
|
||||
static void hide()
|
||||
{
|
||||
field = newField;
|
||||
attach(&mainWindow);
|
||||
Window * w = getPageBody();
|
||||
w->setHeight(LCD_H - height() - w->top());
|
||||
w->scrollTo(newField);
|
||||
invalidate();
|
||||
if (activeKeyboard) {
|
||||
activeKeyboard->clearField();
|
||||
activeKeyboard = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void disable(bool resizePage)
|
||||
protected:
|
||||
static Keyboard * activeKeyboard;
|
||||
FormField * field = nullptr;
|
||||
Window * fieldContainer = nullptr;
|
||||
|
||||
void setField(FormField * newField)
|
||||
{
|
||||
if (activeKeyboard) {
|
||||
if (activeKeyboard == this)
|
||||
return;
|
||||
activeKeyboard->clearField();
|
||||
}
|
||||
activeKeyboard = this;
|
||||
attach(&mainWindow);
|
||||
fieldContainer = getFieldContainer(newField);
|
||||
fieldContainer->setHeight(LCD_H - height() - fieldContainer->top());
|
||||
fieldContainer->scrollTo(newField);
|
||||
invalidate();
|
||||
newField->setEditMode(true);
|
||||
field = newField;
|
||||
}
|
||||
|
||||
void clearField()
|
||||
{
|
||||
detach();
|
||||
if (fieldContainer) {
|
||||
fieldContainer->setHeight(LCD_H - 0 - fieldContainer->top());
|
||||
fieldContainer = nullptr;
|
||||
}
|
||||
if (field) {
|
||||
Window * w = getPageBody();
|
||||
w->setHeight(LCD_H - 0 - w->top());
|
||||
field->setEditMode(false);
|
||||
field = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
T * getField() const
|
||||
{
|
||||
return field;
|
||||
}
|
||||
|
||||
protected:
|
||||
T * field = nullptr;
|
||||
Window * getPageBody()
|
||||
Window * getFieldContainer(FormField * field)
|
||||
{
|
||||
Window * parent = field;
|
||||
while (true) {
|
||||
|
||||
+23
-38
@@ -19,70 +19,55 @@
|
||||
|
||||
#include "keyboard_number.h"
|
||||
#include "button.h"
|
||||
#include "basenumberedit.h"
|
||||
#include "libopenui_globals.h"
|
||||
|
||||
constexpr coord_t KEYBOARD_HEIGHT = 90;
|
||||
|
||||
NumberKeyboard * NumberKeyboard::_instance = nullptr;
|
||||
|
||||
NumberKeyboard::NumberKeyboard():
|
||||
Keyboard<BaseNumberEdit>(KEYBOARD_HEIGHT)
|
||||
NumberKeyboard::NumberKeyboard() :
|
||||
Keyboard(KEYBOARD_HEIGHT)
|
||||
{
|
||||
new TextButton(this, { LCD_W/2 - 115, 10, 50, 30 }, "<<",
|
||||
new TextButton(this, {LCD_W / 2 - 115, 10, 50, 30}, "<<",
|
||||
[=]() -> uint8_t {
|
||||
if (field) {
|
||||
field->setValue(field->getValue() - 10 * field->getStep());
|
||||
}
|
||||
return 0;
|
||||
putEvent(EVT_VIRTUAL_KEY_BACKWARD);
|
||||
return 0;
|
||||
}, BUTTON_BACKGROUND | BUTTON_NOFOCUS);
|
||||
|
||||
new TextButton(this, { LCD_W/2 - 55, 10, 50, 30 }, "-",
|
||||
new TextButton(this, {LCD_W / 2 - 55, 10, 50, 30}, "-",
|
||||
[=]() -> uint8_t {
|
||||
if (field) {
|
||||
field->setValue(field->getValue() - field->getStep());
|
||||
}
|
||||
return 0;
|
||||
putEvent(EVT_VIRTUAL_KEY_MINUS);
|
||||
return 0;
|
||||
}, BUTTON_BACKGROUND | BUTTON_NOFOCUS);
|
||||
|
||||
new TextButton(this, { LCD_W/2 + 5, 10, 50, 30 }, "+",
|
||||
new TextButton(this, {LCD_W / 2 + 5, 10, 50, 30}, "+",
|
||||
[=]() -> uint8_t {
|
||||
if (field) {
|
||||
field->setValue(field->getValue() + field->getStep());
|
||||
}
|
||||
return 0;
|
||||
putEvent(EVT_VIRTUAL_KEY_PLUS);
|
||||
return 0;
|
||||
}, BUTTON_BACKGROUND | BUTTON_NOFOCUS);
|
||||
|
||||
new TextButton(this, { LCD_W/2 + 65, 10, 50, 30 }, ">>",
|
||||
new TextButton(this, {LCD_W / 2 + 65, 10, 50, 30}, ">>",
|
||||
[=]() -> uint8_t {
|
||||
if (field) {
|
||||
field->setValue(field->getValue() + 10 * field->getStep());
|
||||
}
|
||||
return 0;
|
||||
putEvent(EVT_VIRTUAL_KEY_FORWARD);
|
||||
return 0;
|
||||
}, BUTTON_BACKGROUND | BUTTON_NOFOCUS);
|
||||
|
||||
new TextButton(this, { LCD_W/2 - 115, 50, 50, 30 }, "MIN",
|
||||
new TextButton(this, {LCD_W / 2 - 115, 50, 50, 30}, "MIN",
|
||||
[=]() -> uint8_t {
|
||||
if (field) {
|
||||
field->setValue(field->getMin());
|
||||
}
|
||||
return 0;
|
||||
putEvent(EVT_VIRTUAL_KEY_MIN);
|
||||
return 0;
|
||||
}, BUTTON_BACKGROUND | BUTTON_NOFOCUS);
|
||||
|
||||
new TextButton(this, { LCD_W/2 + 65, 50, 50, 30 }, "MAX",
|
||||
new TextButton(this, {LCD_W / 2 + 65, 50, 50, 30}, "MAX",
|
||||
[=]() -> uint8_t {
|
||||
if (field) {
|
||||
field->setValue(field->getMax());
|
||||
}
|
||||
return 0;
|
||||
putEvent(EVT_VIRTUAL_KEY_MAX);
|
||||
return 0;
|
||||
}, BUTTON_BACKGROUND | BUTTON_NOFOCUS);
|
||||
|
||||
new TextButton(this, { LCD_W/2 - 55, 50, 110, 30 }, "DEFAULT",
|
||||
new TextButton(this, {LCD_W / 2 - 55, 50, 110, 30}, "DEFAULT",
|
||||
[=]() -> uint8_t {
|
||||
if (field) {
|
||||
field->setValue(field->getDefault());
|
||||
}
|
||||
return 0;
|
||||
putEvent(EVT_VIRTUAL_KEY_DEFAULT);
|
||||
return 0;
|
||||
}, BUTTON_BACKGROUND | BUTTON_NOFOCUS);
|
||||
}
|
||||
|
||||
|
||||
+3
-6
@@ -21,11 +21,8 @@
|
||||
#define _KEYBOARD_NUMBER_H_
|
||||
|
||||
#include "keyboard_base.h"
|
||||
#include "basenumberedit.h"
|
||||
|
||||
class NumberKeyboard : public Keyboard<BaseNumberEdit> {
|
||||
friend class BaseNumberEdit;
|
||||
|
||||
class NumberKeyboard : public Keyboard {
|
||||
public:
|
||||
NumberKeyboard();
|
||||
|
||||
@@ -38,11 +35,11 @@ class NumberKeyboard : public Keyboard<BaseNumberEdit> {
|
||||
}
|
||||
#endif
|
||||
|
||||
static NumberKeyboard * instance()
|
||||
static void show(FormField * field)
|
||||
{
|
||||
if (!_instance)
|
||||
_instance = new NumberKeyboard();
|
||||
return _instance;
|
||||
_instance->setField(field);
|
||||
}
|
||||
|
||||
void paint(BitmapBuffer * dc) override;
|
||||
|
||||
+7
-57
@@ -58,14 +58,6 @@ const uint8_t * const LBM_SPECIAL_KEYS[] = {
|
||||
LBM_KEY_NUMBERS,
|
||||
};
|
||||
|
||||
#define KEYBOARD_SPACE "\t"
|
||||
#define KEYBOARD_ENTER "\n"
|
||||
#define KEYBOARD_BACKSPACE "\200"
|
||||
#define KEYBOARD_SET_UPPERCASE "\201"
|
||||
#define KEYBOARD_SET_LOWERCASE "\202"
|
||||
#define KEYBOARD_SET_LETTERS "\203"
|
||||
#define KEYBOARD_SET_NUMBERS "\204"
|
||||
|
||||
const char * const KEYBOARD_LOWERCASE[] = {
|
||||
"qwertyuiop",
|
||||
" asdfghjkl",
|
||||
@@ -95,7 +87,7 @@ const char * const * const KEYBOARD_LAYOUTS[] = {
|
||||
};
|
||||
|
||||
TextKeyboard::TextKeyboard():
|
||||
Keyboard<TextEdit>(KEYBOARD_HEIGHT),
|
||||
Keyboard(KEYBOARD_HEIGHT),
|
||||
layout(KEYBOARD_LOWERCASE)
|
||||
{
|
||||
}
|
||||
@@ -105,27 +97,6 @@ TextKeyboard::~TextKeyboard()
|
||||
_instance = nullptr;
|
||||
}
|
||||
|
||||
void TextKeyboard::setCursorPos(coord_t x)
|
||||
{
|
||||
if (!field)
|
||||
return;
|
||||
|
||||
uint8_t size = field->getMaxLength();
|
||||
char * data = field->getData();
|
||||
coord_t rest = x;
|
||||
for (cursorIndex = 0; cursorIndex < size; cursorIndex++) {
|
||||
if (data[cursorIndex] == '\0')
|
||||
break;
|
||||
char c = data[cursorIndex];
|
||||
uint8_t w = getCharWidth(c, fontspecsTable[0]);
|
||||
if (rest < w)
|
||||
break;
|
||||
rest -= w;
|
||||
}
|
||||
cursorPos = x - rest;
|
||||
field->invalidate();
|
||||
}
|
||||
|
||||
void TextKeyboard::paint(BitmapBuffer * dc)
|
||||
{
|
||||
lcdSetColor(RGB(0xE0, 0xE0, 0xE0));
|
||||
@@ -165,16 +136,8 @@ void TextKeyboard::paint(BitmapBuffer * dc)
|
||||
|
||||
bool TextKeyboard::onTouchEnd(coord_t x, coord_t y)
|
||||
{
|
||||
if (!field)
|
||||
return false;
|
||||
|
||||
onKeyPress();
|
||||
|
||||
uint8_t size = field->getMaxLength();
|
||||
char * data = field->getData();
|
||||
|
||||
char c = 0;
|
||||
|
||||
uint8_t row = max<coord_t>(0, y - 5) / 40;
|
||||
const char * key = layout[row];
|
||||
while (*key) {
|
||||
@@ -183,15 +146,15 @@ bool TextKeyboard::onTouchEnd(coord_t x, coord_t y)
|
||||
}
|
||||
else if (*key == KEYBOARD_SPACE[0]) {
|
||||
if (x <= 135) {
|
||||
c = ' ';
|
||||
break;
|
||||
putEvent(EVT_VIRTUAL_KEY(' '));
|
||||
return true;
|
||||
}
|
||||
x -= 135;
|
||||
}
|
||||
else if (*key == KEYBOARD_ENTER[0]) {
|
||||
if (x <= 80) {
|
||||
// enter
|
||||
disable(true);
|
||||
hide();
|
||||
return true;
|
||||
}
|
||||
x -= 80;
|
||||
@@ -201,13 +164,7 @@ bool TextKeyboard::onTouchEnd(coord_t x, coord_t y)
|
||||
uint8_t specialKey = *key;
|
||||
if (specialKey == 128) {
|
||||
// backspace
|
||||
if (cursorIndex > 0) {
|
||||
char c = data[cursorIndex - 1];
|
||||
memmove(data + cursorIndex - 1, data + cursorIndex, size - cursorIndex);
|
||||
data[size - 1] = '\0';
|
||||
cursorPos -= getCharWidth(c, fontspecsTable[0]);
|
||||
--cursorIndex;
|
||||
}
|
||||
putEvent(EVT_VIRTUAL_KEY(KEYBOARD_BACKSPACE[0]));
|
||||
}
|
||||
else {
|
||||
layout = KEYBOARD_LAYOUTS[specialKey - 129];
|
||||
@@ -219,20 +176,13 @@ bool TextKeyboard::onTouchEnd(coord_t x, coord_t y)
|
||||
}
|
||||
else {
|
||||
if (x <= 30) {
|
||||
c = *key;
|
||||
break;
|
||||
putEvent(EVT_VIRTUAL_KEY(*key));
|
||||
return true;
|
||||
}
|
||||
x -= 30;
|
||||
}
|
||||
key++;
|
||||
}
|
||||
|
||||
if (c && size - cursorIndex > 1) {
|
||||
memmove(data + cursorIndex + 1, data + cursorIndex, size - cursorIndex - 1);
|
||||
data[cursorIndex++] = c;
|
||||
cursorPos += getCharWidth(c, fontspecsTable[0]);
|
||||
}
|
||||
|
||||
field->invalidate();
|
||||
return true;
|
||||
}
|
||||
|
||||
+11
-14
@@ -21,11 +21,16 @@
|
||||
#define _KEYBOARD_TEXT_H_
|
||||
|
||||
#include "keyboard_base.h"
|
||||
#include "textedit.h"
|
||||
|
||||
class TextKeyboard : public Keyboard<TextEdit> {
|
||||
friend class TextEdit;
|
||||
#define KEYBOARD_SPACE "\t"
|
||||
#define KEYBOARD_ENTER "\n"
|
||||
#define KEYBOARD_BACKSPACE "\200"
|
||||
#define KEYBOARD_SET_UPPERCASE "\201"
|
||||
#define KEYBOARD_SET_LOWERCASE "\202"
|
||||
#define KEYBOARD_SET_LETTERS "\203"
|
||||
#define KEYBOARD_SET_NUMBERS "\204"
|
||||
|
||||
class TextKeyboard : public Keyboard {
|
||||
public:
|
||||
TextKeyboard();
|
||||
|
||||
@@ -38,19 +43,13 @@ class TextKeyboard : public Keyboard<TextEdit> {
|
||||
}
|
||||
#endif
|
||||
|
||||
static TextKeyboard * instance() {
|
||||
static void show(FormField * field)
|
||||
{
|
||||
if (!_instance)
|
||||
_instance = new TextKeyboard();
|
||||
return _instance;
|
||||
_instance->setField(field);
|
||||
}
|
||||
|
||||
coord_t getCursorPos() const
|
||||
{
|
||||
return cursorPos;
|
||||
}
|
||||
|
||||
void setCursorPos(coord_t x);
|
||||
|
||||
void paint(BitmapBuffer * dc) override;
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
@@ -59,8 +58,6 @@ class TextKeyboard : public Keyboard<TextEdit> {
|
||||
|
||||
protected:
|
||||
static TextKeyboard * _instance;
|
||||
coord_t cursorPos = 0;
|
||||
uint8_t cursorIndex = 0;
|
||||
const char * const * layout;
|
||||
};
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "keyboard_base.h"
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
#include "touch.h"
|
||||
@@ -27,6 +28,7 @@ MainWindow mainWindow;
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
STRUCT_TOUCH touchState;
|
||||
Keyboard * Keyboard::activeKeyboard = nullptr;
|
||||
#endif
|
||||
|
||||
void MainWindow::emptyTrash()
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ class MainWindow: public Window {
|
||||
}
|
||||
#endif
|
||||
|
||||
void checkEvents(bool trash=true);
|
||||
void checkEvents(bool trash = true);
|
||||
|
||||
void invalidate()
|
||||
{
|
||||
|
||||
+6
-6
@@ -35,7 +35,7 @@ void MenuWindow::select(int index)
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void MenuWindow::onKeyEvent(event_t event)
|
||||
void MenuWindow::onEvent(event_t event)
|
||||
{
|
||||
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
|
||||
|
||||
@@ -46,16 +46,16 @@ void MenuWindow::onKeyEvent(event_t event)
|
||||
select(selectedIndex == 0 ? lines.size() - 1 : selectedIndex - 1);
|
||||
}
|
||||
else if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
Window::onKeyEvent(event); // the window above will be closed on event
|
||||
Window::onEvent(event); // the window above will be closed on event
|
||||
lines[selectedIndex].onPress();
|
||||
}
|
||||
else if (event == EVT_KEY_BREAK(KEY_EXIT)) {
|
||||
if (onCancel)
|
||||
onCancel();
|
||||
Window::onKeyEvent(event);
|
||||
Window::onEvent(event);
|
||||
}
|
||||
else {
|
||||
Window::onKeyEvent(event);
|
||||
Window::onEvent(event);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -120,10 +120,10 @@ void Menu::removeLines()
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void Menu::onKeyEvent(event_t event)
|
||||
void Menu::onEvent(event_t event)
|
||||
{
|
||||
if (toolbar && (event == EVT_KEY_BREAK(KEY_PGDN) || event == EVT_KEY_LONG(KEY_PGDN))) {
|
||||
toolbar->onKeyEvent(event);
|
||||
toolbar->onEvent(event);
|
||||
}
|
||||
else if (event == EVT_KEY_BREAK(KEY_EXIT) || event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
deleteLater();
|
||||
|
||||
+2
-2
@@ -94,7 +94,7 @@ class MenuWindow: public Window {
|
||||
void paint(BitmapBuffer * dc) override;
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onKeyEvent(event_t event) override;
|
||||
void onEvent(event_t event) override;
|
||||
#endif
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
@@ -171,7 +171,7 @@ class Menu : public Window {
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onKeyEvent(event_t event) override;
|
||||
void onEvent(event_t event) override;
|
||||
#endif
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ class MenuToolbar: public Window {
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onKeyEvent(event_t event) override
|
||||
void onEvent(event_t event) override
|
||||
{
|
||||
if (event == EVT_KEY_BREAK(KEY_PGDN)) {
|
||||
if (current == children.end()) {
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ MessageDialog::MessageDialog(const char * title, const char * message):
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void MessageDialog::onKeyEvent(event_t event)
|
||||
void MessageDialog::onEvent(event_t event)
|
||||
{
|
||||
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
|
||||
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ class MessageDialog: public Dialog {
|
||||
MessageDialog(const char * title, const char * message);
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onKeyEvent(event_t event) override;
|
||||
void onEvent(event_t event) override;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
+60
-31
@@ -51,39 +51,72 @@ void NumberEdit::paint(BitmapBuffer * dc)
|
||||
dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, textColor | flags, 0, prefix.c_str(), suffix.c_str());
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void NumberEdit::onKeyEvent(event_t event)
|
||||
void NumberEdit::onEvent(event_t event)
|
||||
{
|
||||
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
|
||||
|
||||
if (editMode) {
|
||||
if (event == EVT_ROTARY_RIGHT) {
|
||||
int value = getValue();
|
||||
do {
|
||||
value += rotencSpeed * step;
|
||||
} while (isValueAvailable && !isValueAvailable(value) && value <= vmax);
|
||||
if (value <= vmax)
|
||||
setValue(value);
|
||||
else
|
||||
onKeyError();
|
||||
return;
|
||||
}
|
||||
else if (event == EVT_ROTARY_LEFT) {
|
||||
int value = getValue();
|
||||
do {
|
||||
value -= rotencSpeed * step;
|
||||
} while (isValueAvailable && !isValueAvailable(value) && value >= vmin);
|
||||
if (value >= vmin)
|
||||
setValue(value);
|
||||
else
|
||||
onKeyError();
|
||||
return;
|
||||
switch (event) {
|
||||
#if defined(HARDWARE_KEYS)
|
||||
case EVT_ROTARY_RIGHT: {
|
||||
int value = getValue();
|
||||
do {
|
||||
value += rotencSpeed * step;
|
||||
} while (isValueAvailable && !isValueAvailable(value) && value <= vmax);
|
||||
if (value <= vmax)
|
||||
setValue(value);
|
||||
else
|
||||
onKeyError();
|
||||
return;
|
||||
}
|
||||
|
||||
case EVT_ROTARY_LEFT: {
|
||||
int value = getValue();
|
||||
do {
|
||||
value -= rotencSpeed * step;
|
||||
} while (isValueAvailable && !isValueAvailable(value) && value >= vmin);
|
||||
if (value >= vmin)
|
||||
setValue(value);
|
||||
else
|
||||
onKeyError();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
case EVT_VIRTUAL_KEY_PLUS:
|
||||
setValue(getValue() + getStep());
|
||||
break;
|
||||
|
||||
case EVT_VIRTUAL_KEY_MINUS:
|
||||
setValue(getValue() - getStep());
|
||||
break;
|
||||
|
||||
case EVT_VIRTUAL_KEY_FORWARD:
|
||||
setValue(getValue() + 10 * getStep());
|
||||
break;
|
||||
|
||||
case EVT_VIRTUAL_KEY_BACKWARD:
|
||||
setValue(getValue() - 10 * getStep());
|
||||
break;
|
||||
|
||||
case EVT_VIRTUAL_KEY_DEFAULT:
|
||||
setValue(getDefault());
|
||||
break;
|
||||
|
||||
case EVT_VIRTUAL_KEY_MAX:
|
||||
setValue(getMax());
|
||||
break;
|
||||
|
||||
case EVT_VIRTUAL_KEY_MIN:
|
||||
setValue(getMin());
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
FormField::onKeyEvent(event);
|
||||
FormField::onEvent(event);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
bool NumberEdit::onTouchEnd(coord_t, coord_t)
|
||||
@@ -96,10 +129,7 @@ bool NumberEdit::onTouchEnd(coord_t, coord_t)
|
||||
setFocus();
|
||||
}
|
||||
|
||||
NumberKeyboard * keyboard = NumberKeyboard::instance();
|
||||
if (keyboard->getField() != this) {
|
||||
keyboard->setField(this);
|
||||
}
|
||||
NumberKeyboard::show(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -108,8 +138,7 @@ bool NumberEdit::onTouchEnd(coord_t, coord_t)
|
||||
void NumberEdit::onFocusLost()
|
||||
{
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
NumberKeyboard::instance()->disable(true);
|
||||
Keyboard::hide();
|
||||
#endif
|
||||
|
||||
FormField::onFocusLost();
|
||||
}
|
||||
|
||||
+1
-3
@@ -67,9 +67,7 @@ class NumberEdit : public BaseNumberEdit {
|
||||
displayFunction = std::move(function);
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onKeyEvent(event_t event) override;
|
||||
#endif
|
||||
void onEvent(event_t event) override;
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
bool onTouchEnd(coord_t x, coord_t y) override;
|
||||
|
||||
+4
-10
@@ -19,9 +19,7 @@
|
||||
|
||||
#include "page.h"
|
||||
#include "mainwindow.h"
|
||||
#include "keyboard_number.h"
|
||||
#include "keyboard_text.h"
|
||||
#include "keyboard_curve.h"
|
||||
#include "keyboard_base.h"
|
||||
#include "theme.h"
|
||||
#include "opentx.h"
|
||||
|
||||
@@ -55,9 +53,7 @@ Page::Page(unsigned icon):
|
||||
Page::~Page()
|
||||
{
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
TextKeyboard::instance()->disable(false);
|
||||
NumberKeyboard::instance()->disable(false);
|
||||
CurveKeyboard::instance()->disable(false);
|
||||
Keyboard::hide();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -76,7 +72,7 @@ void Page::paint(BitmapBuffer * dc)
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void Page::onKeyEvent(event_t event)
|
||||
void Page::onEvent(event_t event)
|
||||
{
|
||||
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
|
||||
|
||||
@@ -93,9 +89,7 @@ bool Page::onTouchEnd(coord_t x, coord_t y)
|
||||
if (Window::onTouchEnd(x, y))
|
||||
return true;
|
||||
|
||||
TextKeyboard::instance()->disable(true);
|
||||
NumberKeyboard::instance()->disable(true);
|
||||
CurveKeyboard::instance()->disable(true);
|
||||
Keyboard::hide();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ class Page: public Window {
|
||||
#endif
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onKeyEvent(event_t event) override;
|
||||
void onEvent(event_t event) override;
|
||||
#endif
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
|
||||
+2
-2
@@ -31,7 +31,7 @@ int Slider::value(coord_t x) const
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void Slider::onKeyEvent(event_t event)
|
||||
void Slider::onEvent(event_t event)
|
||||
{
|
||||
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
|
||||
|
||||
@@ -48,7 +48,7 @@ void Slider::onKeyEvent(event_t event)
|
||||
}
|
||||
}
|
||||
|
||||
FormField::onKeyEvent(event);
|
||||
FormField::onEvent(event);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ class Slider : public FormField {
|
||||
void paint(BitmapBuffer * dc) override;
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onKeyEvent(event_t event) override;
|
||||
void onEvent(event_t event) override;
|
||||
#endif
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
|
||||
+7
-15
@@ -19,15 +19,13 @@
|
||||
|
||||
#include "tabsgroup.h"
|
||||
#include "mainwindow.h"
|
||||
#include "view_main.h"
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
#include "keyboard_number.h"
|
||||
#include "keyboard_text.h"
|
||||
#include "keyboard_curve.h"
|
||||
#include "keyboard_base.h"
|
||||
#endif
|
||||
|
||||
#include "opentx.h" // TODO for constants...
|
||||
#include "view_main.h"
|
||||
|
||||
TabsGroupHeader::TabsGroupHeader(TabsGroup * parent, uint8_t icon):
|
||||
Window(parent, { 0, 0, LCD_W, MENU_BODY_TOP }, OPAQUE),
|
||||
@@ -84,9 +82,7 @@ TabsGroup::TabsGroup(uint8_t icon):
|
||||
TabsGroup::~TabsGroup()
|
||||
{
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
TextKeyboard::instance()->disable(false);
|
||||
NumberKeyboard::instance()->disable(false);
|
||||
CurveKeyboard::instance()->disable(false);
|
||||
Keyboard::hide();
|
||||
#endif
|
||||
|
||||
for (auto tab: tabs) {
|
||||
@@ -131,9 +127,7 @@ void TabsGroup::setVisibleTab(PageTab * tab)
|
||||
FormField::clearCurrentField();
|
||||
body.clear();
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
TextKeyboard::instance()->disable(false);
|
||||
NumberKeyboard::instance()->disable(false);
|
||||
CurveKeyboard::instance()->disable(false);
|
||||
Keyboard::hide();
|
||||
#endif
|
||||
currentTab = tab;
|
||||
tab->build(&body);
|
||||
@@ -151,7 +145,7 @@ void TabsGroup::checkEvents()
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void TabsGroup::onKeyEvent(event_t event)
|
||||
void TabsGroup::onEvent(event_t event)
|
||||
{
|
||||
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
|
||||
|
||||
@@ -170,7 +164,7 @@ void TabsGroup::onKeyEvent(event_t event)
|
||||
deleteLater();
|
||||
}
|
||||
else if (parent) {
|
||||
parent->onKeyEvent(event);
|
||||
parent->onEvent(event);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -186,9 +180,7 @@ bool TabsGroup::onTouchEnd(coord_t x, coord_t y)
|
||||
if (Window::onTouchEnd(x, y))
|
||||
return true;
|
||||
|
||||
TextKeyboard::instance()->disable(true);
|
||||
NumberKeyboard::instance()->disable(true);
|
||||
CurveKeyboard::instance()->disable(true);
|
||||
Keyboard::hide();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -170,7 +170,7 @@ class TabsGroup: public Window {
|
||||
void checkEvents() override;
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onKeyEvent(event_t event) override;
|
||||
void onEvent(event_t event) override;
|
||||
#endif
|
||||
|
||||
void paint(BitmapBuffer * dc) override;
|
||||
|
||||
+55
-27
@@ -19,6 +19,7 @@
|
||||
|
||||
#include "textedit.h"
|
||||
#include "font.h"
|
||||
#include "libopenui_globals.h"
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
#include "keyboard_text.h"
|
||||
@@ -31,40 +32,57 @@ void TextEdit::paint(BitmapBuffer * dc)
|
||||
if (editMode) {
|
||||
dc->drawSizedText(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, length, FOCUS_COLOR);
|
||||
coord_t left = (cursorPos == 0 ? 0 : getTextWidth(value, cursorPos));
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
dc->drawSolidFilledRect(left + 2, FIELD_PADDING_TOP + 1, 2, 20, FOCUS_COLOR);
|
||||
#else
|
||||
char s[] = { value[cursorPos], '\0' };
|
||||
dc->drawSolidFilledRect(FIELD_PADDING_LEFT + left - 1, FIELD_PADDING_TOP + 1, getTextWidth(s, 1) + 1, height() - 2, FOCUS_COLOR);
|
||||
dc->drawText(FIELD_PADDING_LEFT + left, FIELD_PADDING_TOP, s, DEFAULT_COLOR);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
const char * displayedValue = value;
|
||||
LcdFlags textColor;
|
||||
if (strlen(value) == 0) {
|
||||
displayedValue = "---";
|
||||
textColor = hasFocus() ? FOCUS_BGCOLOR : DISABLE_COLOR;
|
||||
}
|
||||
else if (hasFocus()) {
|
||||
if (hasFocus()) {
|
||||
textColor = FOCUS_BGCOLOR;
|
||||
}
|
||||
else {
|
||||
textColor = DEFAULT_COLOR;
|
||||
if (strlen(value) == 0) {
|
||||
displayedValue = "---";
|
||||
textColor = DISABLE_COLOR;
|
||||
}
|
||||
else {
|
||||
textColor = DEFAULT_COLOR;
|
||||
}
|
||||
}
|
||||
dc->drawSizedText(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, displayedValue, length, textColor);
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
auto keyboard = TextKeyboard::instance();
|
||||
if (hasFocus() && keyboard->getField() == this) {
|
||||
coord_t cursorPos = keyboard->getCursorPos();
|
||||
dc->drawSolidFilledRect(cursorPos + 2, FIELD_PADDING_TOP, 2, 21, 0); // FOCUS_BGCOLOR);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void TextEdit::onKeyEvent(event_t event)
|
||||
void TextEdit::onEvent(event_t event)
|
||||
{
|
||||
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
if (IS_VIRTUAL_KEY_EVENT(event)) {
|
||||
uint8_t c = event & 0xFF;
|
||||
if (c == (uint8_t)KEYBOARD_BACKSPACE[0]) {
|
||||
if (cursorPos > 0) {
|
||||
memmove(value + cursorPos - 1, value + cursorPos, length - cursorPos);
|
||||
value[length - 1] = '\0';
|
||||
--cursorPos;
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
else {
|
||||
memmove(value + cursorPos + 1, value + cursorPos, length - cursorPos - 1);
|
||||
value[cursorPos++] = c;
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
if (editMode) {
|
||||
int c = value[cursorPos];
|
||||
int v = c;
|
||||
@@ -102,19 +120,19 @@ void TextEdit::onKeyEvent(event_t event)
|
||||
invalidate();
|
||||
}
|
||||
else {
|
||||
FormField::onKeyEvent(event);
|
||||
FormField::onEvent(event);
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
cursorPos = 0;
|
||||
FormField::onKeyEvent(event);
|
||||
FormField::onEvent(event);
|
||||
break;
|
||||
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
if (v == 0) {
|
||||
killEvents(event);
|
||||
FormField::onKeyEvent(EVT_KEY_BREAK(KEY_ENTER));
|
||||
FormField::onEvent(EVT_KEY_BREAK(KEY_ENTER));
|
||||
break;
|
||||
}
|
||||
// no break
|
||||
@@ -138,10 +156,10 @@ void TextEdit::onKeyEvent(event_t event)
|
||||
}
|
||||
}
|
||||
else {
|
||||
FormField::onKeyEvent(event);
|
||||
FormField::onEvent(event);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
bool TextEdit::onTouchEnd(coord_t x, coord_t y)
|
||||
@@ -150,19 +168,29 @@ bool TextEdit::onTouchEnd(coord_t x, coord_t y)
|
||||
setFocus();
|
||||
}
|
||||
|
||||
auto keyboard = TextKeyboard::instance();
|
||||
if (keyboard->getField() != this) {
|
||||
keyboard->setField(this);
|
||||
TextKeyboard::show(this);
|
||||
|
||||
coord_t rest = x;
|
||||
for (cursorPos = 0; cursorPos < length; cursorPos++) {
|
||||
char c = value[cursorPos];
|
||||
if (c == '\0')
|
||||
break;
|
||||
uint8_t w = getCharWidth(c, fontspecsTable[0]);
|
||||
if (rest < w)
|
||||
break;
|
||||
rest -= w;
|
||||
}
|
||||
|
||||
keyboard->setCursorPos(x);
|
||||
|
||||
invalidate();
|
||||
return true;
|
||||
}
|
||||
|
||||
void TextEdit::onFocusLost()
|
||||
{
|
||||
TextKeyboard::instance()->disable(true);
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
TextKeyboard::hide();
|
||||
#endif
|
||||
// TODO storageDirty(...);
|
||||
FormField::onFocusLost();
|
||||
}
|
||||
#endif
|
||||
|
||||
+1
-3
@@ -52,9 +52,7 @@ class TextEdit : public FormField {
|
||||
|
||||
void paint(BitmapBuffer * dc) override;
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void onKeyEvent(event_t event) override;
|
||||
#endif
|
||||
void onEvent(event_t event) override;
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
bool onTouchEnd(coord_t x, coord_t y) override;
|
||||
|
||||
+3
-7
@@ -261,30 +261,26 @@ void Window::checkEvents()
|
||||
child->checkEvents();
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
if (this == focusWindow) {
|
||||
event_t event = getEvent(false);
|
||||
if (event) {
|
||||
TRACE_WINDOWS("Event 0x%x received ...", event);
|
||||
this->onKeyEvent(event);
|
||||
this->onEvent(event);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (windowFlags & REFRESH_ALWAYS) {
|
||||
invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
void Window::onKeyEvent(event_t event)
|
||||
void Window::onEvent(event_t event)
|
||||
{
|
||||
TRACE_WINDOWS("%s received event 0x%X", Window::getWindowDebugString().c_str(), event);
|
||||
if (parent) {
|
||||
parent->onKeyEvent(event);
|
||||
parent->onEvent(event);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
bool Window::onTouchStart(coord_t x, coord_t y)
|
||||
|
||||
+1
-3
@@ -256,9 +256,7 @@ class Window {
|
||||
invalidate();
|
||||
};
|
||||
|
||||
#if defined(HARDWARE_KEYS)
|
||||
virtual void onKeyEvent(event_t event);
|
||||
#endif
|
||||
virtual void onEvent(event_t event);
|
||||
|
||||
#if defined(HARDWARE_TOUCH)
|
||||
virtual bool onTouchStart(coord_t x, coord_t y);
|
||||
|
||||
Reference in New Issue
Block a user