diff options
Diffstat (limited to 'client/widgets/checkbox.cc')
-rw-r--r-- | client/widgets/checkbox.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/client/widgets/checkbox.cc b/client/widgets/checkbox.cc index 5acf694..9083990 100644 --- a/client/widgets/checkbox.cc +++ b/client/widgets/checkbox.cc @@ -29,6 +29,7 @@ #include <QCheckBox> #include "common.h" +#include "luawidget.h" CheckBox::CheckBox(QDomNode &node, MacroWindow *macrowindow) : Widget(node, macrowindow) @@ -126,3 +127,31 @@ void CheckBox::setWdgValid(bool valid) checkbox->setPalette(palette); } + +int chk_checked(lua_State *L) +{ + wdg_userdata *wdgu; + + wdgu = (wdg_userdata *)luaL_isudata(L, 1, "CheckBox"); + luaL_argcheck(L, wdgu, 1, "checkbox expected"); + + CheckBox *chk = (CheckBox*)wdgu->widget; + lua_pushboolean(L, chk->checked()); + + return 1; +} + +int chk_set_checked(lua_State *L) +{ + wdg_userdata *wdgu; + + wdgu = (wdg_userdata *)luaL_isudata(L, 1, "CheckBox"); + luaL_argcheck(L, wdgu, 1, "checkbox expected"); + + bool val = luaL_checkbool(L, 2); + + CheckBox *chk = (CheckBox*)wdgu->widget; + chk->setChecked(val); + + return 0; +} |