Revert (MessageDialog and ConfirmDialog)

This commit is contained in:
Bertrand Songis
2019-12-02 11:40:47 +01:00
parent 98d0369c66
commit fcbb01da00
4 changed files with 74 additions and 1 deletions
+1
View File
@@ -96,6 +96,7 @@ foreach(LIBOPENUI_FILE ${LIBOPENUI_SRC})
endforeach()
add_gui_src(fullscreen_dialog.cpp)
add_gui_src(message_dialog.cpp)
add_gui_src(confirm_dialog.cpp)
add_gui_src(timeedit.cpp)
add_gui_src(curve.cpp)
+38
View File
@@ -0,0 +1,38 @@
/*
* 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 "message_dialog.h"
#include "static.h"
MessageDialog::MessageDialog(const char * title, const char * message):
Dialog(title, {50, 73, LCD_W - 100, LCD_H - 146})
{
new StaticText(this, {0, coord_t(height() - PAGE_LINE_HEIGHT) / 2, width(), PAGE_LINE_HEIGHT}, message, 0, CENTERED);
}
#if defined(HARDWARE_KEYS)
void MessageDialog::onEvent(event_t event)
{
TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event);
if (event == EVT_KEY_BREAK(KEY_EXIT) || event == EVT_KEY_BREAK(KEY_ENTER)) {
deleteLater();
}
}
#endif
+34
View File
@@ -0,0 +1,34 @@
/*
* 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.
*/
#ifndef _MESSAGE_DIALOG_H_
#define _MESSAGE_DIALOG_H_
#include "dialog.h"
class MessageDialog: public Dialog {
public:
MessageDialog(const char * title, const char * message);
#if defined(HARDWARE_KEYS)
void onEvent(event_t event) override;
#endif
};
#endif // _MESSAGE_DIALOG_H_