TODO implemented

This commit is contained in:
Bertrand Songis
2020-04-16 16:12:16 +02:00
parent 98cf1f6c92
commit fe9f5d9a3a
3 changed files with 16 additions and 6 deletions
+2 -4
View File
@@ -117,8 +117,7 @@ void FormGroup::setFocus(uint8_t flag)
break; break;
case SET_FOCUS_BACKWARD: case SET_FOCUS_BACKWARD:
// TODO this test should be recursive if (focusWindow->isChild(first)) {
if (focusWindow == first || focusWindow->getParent() == first) {
if (previous == this) if (previous == this)
last->setFocus(SET_FOCUS_BACKWARD); last->setFocus(SET_FOCUS_BACKWARD);
else if (previous) else if (previous)
@@ -131,8 +130,7 @@ void FormGroup::setFocus(uint8_t flag)
break; break;
case SET_FOCUS_FORWARD: case SET_FOCUS_FORWARD:
// TODO this test should be recursive if (focusWindow->isChild(last)) {
if (focusWindow == last || focusWindow->getParent() == last || focusWindow->getParent()->getParent() == last) {
if (next == this) if (next == this)
first->setFocus(SET_FOCUS_FORWARD); first->setFocus(SET_FOCUS_FORWARD);
else if (next) else if (next)
+1
View File
@@ -422,6 +422,7 @@ void Window::adjustInnerHeight()
for (auto child: children) { for (auto child: children) {
innerHeight = max(innerHeight, child->rect.y + child->rect.h); innerHeight = max(innerHeight, child->rect.y + child->rect.h);
} }
invalidate();
} }
coord_t Window::adjustHeight() coord_t Window::adjustHeight()
+13 -2
View File
@@ -99,6 +99,11 @@ class Window {
return parent; return parent;
} }
bool isChild(Window * window) const
{
return window == this || (getParent() && getParent()->isChild(window));
}
Window * getFullScreenWindow() Window * getFullScreenWindow()
{ {
return (width() == LCD_W && height() == LCD_H) ? this : parent->getFullScreenWindow(); return (width() == LCD_W && height() == LCD_H) ? this : parent->getFullScreenWindow();
@@ -174,7 +179,9 @@ class Window {
void setHeight(coord_t value) void setHeight(coord_t value)
{ {
rect.h = value; rect.h = value;
if (innerHeight <= value) { if (windowFlags & FORWARD_SCROLL)
innerHeight = value;
else if (innerHeight <= value) {
setScrollPositionY(0); setScrollPositionY(0);
} }
invalidate(); invalidate();
@@ -268,7 +275,11 @@ class Window {
void setInnerHeight(coord_t h) void setInnerHeight(coord_t h)
{ {
innerHeight = h; innerHeight = h;
if (height() >= h) { if (windowFlags & FORWARD_SCROLL) {
rect.h = innerHeight;
parent->adjustInnerHeight();
}
else if (height() >= h) {
setScrollPositionY(0); setScrollPositionY(0);
} }
else { else {