From 165afd0d36abc8729b28e303077ed285b577caea Mon Sep 17 00:00:00 2001 From: deva Date: Fri, 18 Mar 2011 07:18:56 +0000 Subject: Moved lua methods into their respective Qt widget implementation files. --- client/widgets/checkbox.cc | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'client/widgets/checkbox.cc') 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 #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; +} -- cgit v1.2.3