[Horus] Widgets can be written in Lua

This commit is contained in:
Bertrand Songis
2016-02-18 22:10:27 +01:00
parent 01ef176173
commit d1be1b4ea0
12 changed files with 354 additions and 186 deletions
+4 -12
View File
@@ -28,24 +28,16 @@ class GaugeWidget: public Widget
{
}
virtual void init()
{
persistentData->options[0].unsignedValue = 1;
persistentData->options[1].signedValue = -RESX;
persistentData->options[2].signedValue = RESX;
persistentData->options[3].unsignedValue = RED;
}
virtual void refresh();
static const ZoneOption options[];
};
const ZoneOption GaugeWidget::options[] = {
{ "Source", ZoneOption::Source },
{ "Min", ZoneOption::Integer },
{ "Max", ZoneOption::Integer },
{ "Color", ZoneOption::Color },
{ "Source", ZoneOption::Source, { .unsignedValue = 1 } },
{ "Min", ZoneOption::Integer, { .signedValue = -RESX } },
{ "Max", ZoneOption::Integer, { .signedValue = RESX } },
{ "Color", ZoneOption::Color, { .unsignedValue = RED } },
{ NULL, ZoneOption::Bool }
};
+3 -10
View File
@@ -28,22 +28,15 @@ class TextWidget: public Widget
{
}
virtual void init()
{
str2zchar(persistentData->options[0].stringValue, "Label", sizeof(persistentData->options[0].stringValue));
persistentData->options[1].unsignedValue = RED;
persistentData->options[2].unsignedValue = 0;
}
virtual void refresh();
static const ZoneOption options[];
};
const ZoneOption TextWidget::options[] = {
{ "Text", ZoneOption::String },
{ "Color", ZoneOption::Color },
{ "Size", ZoneOption::TextSize },
{ "Text", ZoneOption::String, { .stringValue = { '\015', '\347', '\0', '\14', '\377', '\376', '\373', '\364' } } },
{ "Color", ZoneOption::Color, { .unsignedValue = RED } },
{ "Size", ZoneOption::TextSize, { .unsignedValue = 0 } },
{ NULL, ZoneOption::Bool }
};
+1 -1
View File
@@ -34,7 +34,7 @@ class TimerWidget: public Widget
};
const ZoneOption TimerWidget::options[] = {
{ "Timer source", ZoneOption::Timer },
{ "Timer source", ZoneOption::Timer, { .unsignedValue = 0 } },
{ NULL, ZoneOption::Bool }
};
+1 -7
View File
@@ -28,19 +28,13 @@ class ValueWidget: public Widget
{
}
virtual void init()
{
persistentData->options[0].unsignedValue = 1;
persistentData->options[3].unsignedValue = RED;
}
virtual void refresh();
static const ZoneOption options[];
};
const ZoneOption ValueWidget::options[] = {
{ "Source", ZoneOption::Source },
{ "Source", ZoneOption::Source, { .unsignedValue = MIXSRC_Rud } },
{ NULL, ZoneOption::Bool }
};