More code moved to the theme
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 2.8 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 297 B After Width: | Height: | Size: 3.5 KiB |
@@ -93,7 +93,6 @@ endforeach()
|
|||||||
|
|
||||||
add_gui_src(fullscreen_dialog.cpp)
|
add_gui_src(fullscreen_dialog.cpp)
|
||||||
add_gui_src(confirm_dialog.cpp)
|
add_gui_src(confirm_dialog.cpp)
|
||||||
add_gui_src(message_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)
|
||||||
|
|||||||
@@ -56,4 +56,9 @@
|
|||||||
#include "coloredit.h"
|
#include "coloredit.h"
|
||||||
#include "draw_functions.h"
|
#include "draw_functions.h"
|
||||||
|
|
||||||
|
inline void POPUP_INFORMATION(const char * str)
|
||||||
|
{
|
||||||
|
new MessageDialog("Message", str);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // _LIBOPENUI_H_
|
#endif // _LIBOPENUI_H_
|
||||||
|
|||||||
@@ -1,39 +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 "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, height() / 2, width(), PAGE_LINE_HEIGHT}, message, CENTERED);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(HARDWARE_KEYS)
|
|
||||||
void MessageDialog::onKeyEvent(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
|
|
||||||
@@ -1,40 +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 _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 onKeyEvent(event_t event) override;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
inline void POPUP_INFORMATION(const char * str)
|
|
||||||
{
|
|
||||||
new MessageDialog("Message", str);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // _MESSAGE_DIALOG_H_
|
|
||||||
@@ -25,6 +25,14 @@ const BitmapBuffer * ThemeBase::asterisk = NULL;
|
|||||||
const BitmapBuffer * ThemeBase::question = NULL;
|
const BitmapBuffer * ThemeBase::question = NULL;
|
||||||
const BitmapBuffer * ThemeBase::busy = NULL;
|
const BitmapBuffer * ThemeBase::busy = NULL;
|
||||||
|
|
||||||
|
const uint8_t LBM_FOLDER[] = {
|
||||||
|
#include "mask_folder.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t LBM_DROPDOWN[] = {
|
||||||
|
#include "mask_dropdown.lbm"
|
||||||
|
};
|
||||||
|
|
||||||
std::list<ThemeBase *> & getRegisteredThemes()
|
std::list<ThemeBase *> & getRegisteredThemes()
|
||||||
{
|
{
|
||||||
static std::list<ThemeBase *> themes;
|
static std::list<ThemeBase *> themes;
|
||||||
@@ -154,6 +162,22 @@ void ThemeBase::drawCheckBox(BitmapBuffer * dc, bool value, bool focus) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ThemeBase::drawChoice(BitmapBuffer * dc, ChoiceBase * choice, const char * str) const
|
||||||
|
{
|
||||||
|
LcdFlags textColor;
|
||||||
|
if (choice->isEditMode())
|
||||||
|
textColor = TEXT_INVERTED_COLOR;
|
||||||
|
else if (choice->hasFocus())
|
||||||
|
textColor = TEXT_INVERTED_BGCOLOR;
|
||||||
|
else if (!str || str[0] == '\0')
|
||||||
|
textColor = CURVE_AXIS_COLOR;
|
||||||
|
else
|
||||||
|
textColor = TEXT_COLOR;
|
||||||
|
|
||||||
|
dc->drawText(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, str[0] == '\0' ? "---" : str, textColor);
|
||||||
|
dc->drawBitmapPattern(choice->getRect().w - 20, (choice->getRect().h - 11) / 2, choice->getType() == CHOICE_TYPE_FOLDER ? LBM_FOLDER : LBM_DROPDOWN, textColor);
|
||||||
|
}
|
||||||
|
|
||||||
void ThemeBase::drawSlider(BitmapBuffer * dc, int vmin, int vmax, int value, const rect_t & rect, bool edit, bool focus) const
|
void ThemeBase::drawSlider(BitmapBuffer * dc, int vmin, int vmax, int value, const rect_t & rect, bool edit, bool focus) const
|
||||||
{
|
{
|
||||||
int val = limit(vmin, value, vmax);
|
int val = limit(vmin, value, vmax);
|
||||||
|
|||||||
@@ -84,6 +84,8 @@ class ThemeBase: public Theme
|
|||||||
|
|
||||||
void drawCheckBox(BitmapBuffer * dc, bool value, bool focus) const override;
|
void drawCheckBox(BitmapBuffer * dc, bool value, bool focus) const override;
|
||||||
|
|
||||||
|
void drawChoice(BitmapBuffer * dc, ChoiceBase * choice, const char * str) const override;
|
||||||
|
|
||||||
void drawSlider(BitmapBuffer * dc, int vmin, int vmax, int value, const rect_t & rect, bool edit, bool focus) const override;
|
void drawSlider(BitmapBuffer * dc, int vmin, int vmax, int value, const rect_t & rect, bool edit, bool focus) const override;
|
||||||
|
|
||||||
void drawPageHeader(BitmapBuffer * dc, const PageHeader * page) const override;
|
void drawPageHeader(BitmapBuffer * dc, const PageHeader * page) const override;
|
||||||
|
|||||||
Vendored
+1
-1
Submodule radio/src/thirdparty/libopenui updated: aacc3e382e...67cf7faeaf
Reference in New Issue
Block a user