Expansion panel link issue
This commit is contained in:
@@ -32,6 +32,7 @@ set(LIBOPENUI_SRC
|
||||
table.cpp
|
||||
modal_window.cpp
|
||||
dialog.cpp
|
||||
expansion_panel.cpp
|
||||
)
|
||||
|
||||
if(SOFTWARE_KEYBOARD)
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Source:
|
||||
* https://github.com/opentx/libopenui
|
||||
*
|
||||
* This file is a part of libopenui library.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "expansion_panel.h"
|
||||
|
||||
ExpansionPanelHeader::ExpansionPanelHeader(ExpansionPanel * parent):
|
||||
FormGroup(parent, {0, 0, parent->width(), parent->height()}, FORWARD_SCROLL)
|
||||
{
|
||||
}
|
||||
|
||||
bool ExpansionPanelHeader::onTouchEnd(coord_t, coord_t)
|
||||
{
|
||||
static_cast<ExpansionPanel *>(parent)->toggle();
|
||||
setFocus();
|
||||
return true;
|
||||
}
|
||||
|
||||
void ExpansionPanelHeader::onEvent(event_t event)
|
||||
{
|
||||
auto panel = static_cast<ExpansionPanel *>(parent);
|
||||
|
||||
if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
panel->toggle();
|
||||
}
|
||||
else if (event == EVT_ROTARY_RIGHT && !panel->isOpen) {
|
||||
panel->getNextField()->setFocus(SET_FOCUS_FORWARD);
|
||||
}
|
||||
else {
|
||||
FormGroup::onEvent(event);
|
||||
}
|
||||
}
|
||||
@@ -78,31 +78,4 @@ class ExpansionPanel: public FormGroup {
|
||||
bool isOpen = false;
|
||||
};
|
||||
|
||||
ExpansionPanelHeader::ExpansionPanelHeader(ExpansionPanel * parent):
|
||||
FormGroup(parent, {0, 0, parent->width(), parent->height()}, FORWARD_SCROLL)
|
||||
{
|
||||
}
|
||||
|
||||
bool ExpansionPanelHeader::onTouchEnd(coord_t, coord_t)
|
||||
{
|
||||
static_cast<ExpansionPanel *>(parent)->toggle();
|
||||
setFocus();
|
||||
return true;
|
||||
}
|
||||
|
||||
void ExpansionPanelHeader::onEvent(event_t event)
|
||||
{
|
||||
auto panel = static_cast<ExpansionPanel *>(parent);
|
||||
|
||||
if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
panel->toggle();
|
||||
}
|
||||
else if (event == EVT_ROTARY_RIGHT && !panel->isOpen) {
|
||||
panel->getNextField()->setFocus(SET_FOCUS_FORWARD);
|
||||
}
|
||||
else {
|
||||
FormGroup::onEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _EXPANSION_PANEL_H_
|
||||
|
||||
Reference in New Issue
Block a user