Cosmetics

This commit is contained in:
Bertrand Songis
2020-12-09 17:18:03 +01:00
parent 4a828eae07
commit 8fb4236936
2 changed files with 13 additions and 9 deletions
+12 -2
View File
@@ -26,6 +26,14 @@ void ExpansionPanel::updateHeight()
setHeight(newHeight);
}
void ExpansionPanel::setFocus(uint8_t flag)
{
if (!enabled || isOpen)
FormGroup::setFocus(flag);
else
header->setFocus(flag);
}
ExpansionPanelHeader::ExpansionPanelHeader(ExpansionPanel * parent):
FormGroup(parent, {0, 0, parent->width(), parent->height()}, FORWARD_SCROLL)
{
@@ -57,8 +65,10 @@ void ExpansionPanelHeader::onEvent(event_t event)
#if defined(HARDWARE_TOUCH)
bool ExpansionPanelHeader::onTouchEnd(coord_t, coord_t)
{
static_cast<ExpansionPanel *>(parent)->toggle();
setFocus(SET_FOCUS_DEFAULT);
if (enabled) {
static_cast<ExpansionPanel *>(parent)->toggle();
setFocus(SET_FOCUS_DEFAULT);
}
return true;
}
#endif
+1 -7
View File
@@ -73,13 +73,7 @@ class ExpansionPanel: public FormGroup
void updateHeight();
void setFocus(uint8_t flag) override
{
if (isOpen)
FormGroup::setFocus(flag);
else
header->setFocus(flag);
}
void setFocus(uint8_t flag) override;
FormGroup * body = nullptr;