[Horus] UI continued

This commit is contained in:
Bertrand Songis
2016-02-08 20:56:02 +01:00
parent afddad9396
commit 366c286e73
61 changed files with 1575 additions and 562 deletions
+57
View File
@@ -0,0 +1,57 @@
/*
* 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 "opentx.h"
class TextWidget: public Widget
{
public:
TextWidget(const WidgetFactory * factory, const Zone & zone, Widget::PersistentData * persistentData):
Widget(factory, zone, persistentData)
{
}
void create()
{
str2zchar(persistentData->options[0].stringValue, "Label", sizeof(persistentData->options[0].stringValue));
persistentData->options[1].unsignedValue = RED;
persistentData->options[2].unsignedValue = 0;
}
void refresh();
static const ZoneOption options[];
};
const ZoneOption TextWidget::options[] = {
{ "Text", ZoneOption::String },
{ "Color", ZoneOption::Color },
{ "Size", ZoneOption::TextSize },
{ NULL, ZoneOption::Bool }
};
void TextWidget::refresh()
{
lcdSetColor(persistentData->options[1].unsignedValue);
LcdFlags fontsize = FONTSIZE(persistentData->options[2].unsignedValue << 8);
lcdDrawSizedText(zone.x, zone.y, persistentData->options[0].stringValue, sizeof(persistentData->options[0].stringValue), ZCHAR|fontsize|CUSTOM_COLOR);
}
BaseWidgetFactory<TextWidget> textWidget("Text", "", TextWidget::options);