Cosmetics
This commit is contained in:
+9
-3
@@ -35,7 +35,7 @@ FormField::FormField(Window *parent, const rect_t & rect, WindowFlags windowFlag
|
|||||||
#if defined(HARDWARE_KEYS)
|
#if defined(HARDWARE_KEYS)
|
||||||
void FormField::onEvent(event_t event)
|
void FormField::onEvent(event_t event)
|
||||||
{
|
{
|
||||||
TRACE_WINDOWS("%s received event 0x%X", FormField::getWindowDebugString().c_str(), event);
|
TRACE_WINDOWS("%s received event 0x%X", FormField::getWindowDebugString("FormField").c_str(), event);
|
||||||
|
|
||||||
if (event == EVT_ROTARY_RIGHT/*EVT_KEY_BREAK(KEY_DOWN)*/) {
|
if (event == EVT_ROTARY_RIGHT/*EVT_KEY_BREAK(KEY_DOWN)*/) {
|
||||||
if (next) {
|
if (next) {
|
||||||
@@ -151,7 +151,7 @@ void FormGroup::setFocus(uint8_t flag)
|
|||||||
#if defined(HARDWARE_KEYS)
|
#if defined(HARDWARE_KEYS)
|
||||||
void FormGroup::onEvent(event_t event)
|
void FormGroup::onEvent(event_t event)
|
||||||
{
|
{
|
||||||
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
|
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString("FormGroup").c_str(), event);
|
||||||
|
|
||||||
if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||||
first->setFocus();
|
first->setFocus();
|
||||||
@@ -159,6 +159,12 @@ void FormGroup::onEvent(event_t event)
|
|||||||
else if (event == EVT_KEY_BREAK(KEY_EXIT) && !hasFocus()) {
|
else if (event == EVT_KEY_BREAK(KEY_EXIT) && !hasFocus()) {
|
||||||
setFocus(SET_FOCUS_DEFAULT);
|
setFocus(SET_FOCUS_DEFAULT);
|
||||||
}
|
}
|
||||||
|
else if (event == EVT_ROTARY_RIGHT && !next) {
|
||||||
|
first->setFocus();
|
||||||
|
}
|
||||||
|
else if (event == EVT_ROTARY_LEFT && !previous) {
|
||||||
|
last->setFocus();
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
FormField::onEvent(event);
|
FormField::onEvent(event);
|
||||||
}
|
}
|
||||||
@@ -180,7 +186,7 @@ void FormGroup::paint(BitmapBuffer * dc)
|
|||||||
#if defined(HARDWARE_KEYS)
|
#if defined(HARDWARE_KEYS)
|
||||||
void FormWindow::onEvent(event_t event)
|
void FormWindow::onEvent(event_t event)
|
||||||
{
|
{
|
||||||
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
|
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString("FormWindow").c_str(), event);
|
||||||
|
|
||||||
if (event == EVT_KEY_BREAK(KEY_EXIT) && first) {
|
if (event == EVT_KEY_BREAK(KEY_EXIT) && first) {
|
||||||
Window * currentFocus = getFocus();
|
Window * currentFocus = getFocus();
|
||||||
|
|||||||
+2
-4
@@ -22,10 +22,8 @@
|
|||||||
#include "font.h"
|
#include "font.h"
|
||||||
|
|
||||||
ModalWindow::ModalWindow(Window * parent):
|
ModalWindow::ModalWindow(Window * parent):
|
||||||
Window(parent->getFullScreenWindow(), {0, 0, LCD_W, LCD_H})
|
Window(parent->getFullScreenWindow(), {0, 0, LCD_W, LCD_H}),
|
||||||
#if !defined(HARDWARE_TOUCH)
|
previousFocus(focusWindow)
|
||||||
, previousFocus(focusWindow)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,11 +36,9 @@ class ModalWindow: public Window
|
|||||||
|
|
||||||
void deleteLater()
|
void deleteLater()
|
||||||
{
|
{
|
||||||
#if !defined(HARDWARE_TOUCH)
|
|
||||||
if (previousFocus) {
|
if (previousFocus) {
|
||||||
previousFocus->setFocus();
|
previousFocus->setFocus();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
Window::deleteLater();
|
Window::deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,9 +66,7 @@ class ModalWindow: public Window
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
#if !defined(HARDWARE_TOUCH)
|
|
||||||
Window * previousFocus = nullptr;
|
Window * previousFocus = nullptr;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ModalWindowContent: public Window {
|
class ModalWindowContent: public Window {
|
||||||
|
|||||||
+1
-2
@@ -286,7 +286,6 @@ void Window::checkEvents()
|
|||||||
if (this == focusWindow) {
|
if (this == focusWindow) {
|
||||||
event_t event = getWindowEvent();
|
event_t event = getWindowEvent();
|
||||||
if (event) {
|
if (event) {
|
||||||
TRACE_WINDOWS("Event 0x%x received ...", event);
|
|
||||||
this->onEvent(event);
|
this->onEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -315,7 +314,7 @@ void Window::checkEvents()
|
|||||||
|
|
||||||
void Window::onEvent(event_t event)
|
void Window::onEvent(event_t event)
|
||||||
{
|
{
|
||||||
TRACE_WINDOWS("%s received event 0x%X", Window::getWindowDebugString().c_str(), event);
|
TRACE_WINDOWS("%s received event 0x%X", Window::getWindowDebugString("Window").c_str(), event);
|
||||||
if (parent) {
|
if (parent) {
|
||||||
parent->onEvent(event);
|
parent->onEvent(event);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -87,9 +87,9 @@ class Window {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getWindowDebugString()
|
std::string getWindowDebugString(const char * name = nullptr)
|
||||||
{
|
{
|
||||||
return getIndentString() + getName() + " " + getRectString();
|
return getIndentString() + getName() + (name ? std::string("/") + name : "") + " " + getRectString();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user