Implement the "coloralpha" automation control type

This commit is contained in:
Thomas Goyne 2013-01-13 11:20:44 -08:00
parent 0b5674e6aa
commit 9e37e0897f
1 changed files with 6 additions and 5 deletions

View File

@ -210,6 +210,7 @@ namespace Automation4 {
/// A color-picker button /// A color-picker button
class Color : public LuaDialogControl { class Color : public LuaDialogControl {
wxString text; wxString text;
bool alpha;
struct ColorValidator : public wxValidator { struct ColorValidator : public wxValidator {
wxString *text; wxString *text;
@ -225,9 +226,10 @@ namespace Automation4 {
} }
}; };
public: public:
Color(lua_State *L) Color(lua_State *L, bool alpha)
: LuaDialogControl(L) : LuaDialogControl(L)
, text(get_field(L, "value")) , text(get_field(L, "value"))
, alpha(alpha)
{ {
} }
@ -246,7 +248,7 @@ namespace Automation4 {
wxControl *Create(wxWindow *parent) wxControl *Create(wxWindow *parent)
{ {
agi::Color colour(from_wx(text)); agi::Color colour(from_wx(text));
wxControl *cw = new ColourButton(parent, wxSize(50*width,10*height), false, colour, ColorValidator(&text)); wxControl *cw = new ColourButton(parent, wxSize(50*width,10*height), alpha, colour, ColorValidator(&text));
cw->SetToolTip(hint); cw->SetToolTip(hint);
return cw; return cw;
} }
@ -526,10 +528,9 @@ namespace Automation4 {
} else if (controlclass == "checkbox") { } else if (controlclass == "checkbox") {
ctl = new LuaControl::Checkbox(L); ctl = new LuaControl::Checkbox(L);
} else if (controlclass == "color") { } else if (controlclass == "color") {
ctl = new LuaControl::Color(L); ctl = new LuaControl::Color(L, false);
} else if (controlclass == "coloralpha") { } else if (controlclass == "coloralpha") {
// FIXME ctl = new LuaControl::Color(L, true);
ctl = new LuaControl::Edit(L);
} else if (controlclass == "alpha") { } else if (controlclass == "alpha") {
// FIXME // FIXME
ctl = new LuaControl::Edit(L); ctl = new LuaControl::Edit(L);