ConfirmDialog moved to libopenui
This commit is contained in:
@@ -96,7 +96,6 @@ foreach(LIBOPENUI_FILE ${LIBOPENUI_SRC})
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
add_gui_src(fullscreen_dialog.cpp)
|
add_gui_src(fullscreen_dialog.cpp)
|
||||||
add_gui_src(confirm_dialog.cpp)
|
|
||||||
add_gui_src(timeedit.cpp)
|
add_gui_src(timeedit.cpp)
|
||||||
add_gui_src(curve.cpp)
|
add_gui_src(curve.cpp)
|
||||||
add_gui_src(sourcechoice.cpp)
|
add_gui_src(sourcechoice.cpp)
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) OpenTX
|
|
||||||
*
|
|
||||||
* Based on code named
|
|
||||||
* th9x - http://code.google.com/p/th9x
|
|
||||||
* er9x - http://code.google.com/p/er9x
|
|
||||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
|
||||||
*
|
|
||||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program 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 General Public License for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "confirm_dialog.h"
|
|
||||||
#include "static.h"
|
|
||||||
|
|
||||||
ConfirmDialog::ConfirmDialog(const char * title, const char * message, std::function<void(void)> confirmHandler) :
|
|
||||||
Dialog(title, {50, 73, LCD_W - 100, LCD_H - 146}),
|
|
||||||
confirmHandler(std::move(confirmHandler))
|
|
||||||
{
|
|
||||||
new StaticText(this, {0, height() / 2, width(), PAGE_LINE_HEIGHT}, message, CENTERED);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(HARDWARE_KEYS)
|
|
||||||
void ConfirmDialog::onEvent(event_t event)
|
|
||||||
{
|
|
||||||
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
|
|
||||||
|
|
||||||
if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
|
||||||
deleteLater(); // this restore the focus (it can be changed then in confirmHandler)
|
|
||||||
confirmHandler();
|
|
||||||
}
|
|
||||||
else if (event == EVT_KEY_BREAK(KEY_EXIT)) {
|
|
||||||
deleteLater();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) OpenTX
|
|
||||||
*
|
|
||||||
* Based on code named
|
|
||||||
* th9x - http://code.google.com/p/th9x
|
|
||||||
* er9x - http://code.google.com/p/er9x
|
|
||||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
|
||||||
*
|
|
||||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 as
|
|
||||||
* published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program 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 General Public License for more details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _CONFIRM_DIALOG_H_
|
|
||||||
#define _CONFIRM_DIALOG_H_
|
|
||||||
|
|
||||||
#include "dialog.h"
|
|
||||||
|
|
||||||
class ConfirmDialog: public Dialog {
|
|
||||||
public:
|
|
||||||
ConfirmDialog(const char * title, const char * message, std::function<void(void)> confirmHandler);
|
|
||||||
|
|
||||||
#if defined(HARDWARE_KEYS)
|
|
||||||
void onEvent(event_t event) override;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
protected:
|
|
||||||
std::function<void(void)> confirmHandler;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // _CONFIRM_DIALOG_H_
|
|
||||||
Vendored
+1
-1
Submodule radio/src/thirdparty/libopenui updated: c408b0d5da...dbede68f0e
Reference in New Issue
Block a user