From 6389aabffe198ece92b58ae34a905902c7eefe7c Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 28 Jun 2011 06:38:10 +0000 Subject: Complete rewrite of the way lua widget methods, 'inheritance' in particular, are handled. --- client/widgets/checkbox.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'client/widgets/checkbox.h') diff --git a/client/widgets/checkbox.h b/client/widgets/checkbox.h index 92cc4b3..ce31a62 100644 --- a/client/widgets/checkbox.h +++ b/client/widgets/checkbox.h @@ -30,11 +30,18 @@ #include "widget.h" #include +#ifdef LUA_CLASS +#undef LUA_CLASS +#endif +#define LUA_CLASS "CheckBox" + /*** * CheckBox Widget * @tag checkbox + * @screenshot An example checkbox + * * @extends widget - * @screenshot * This widget is used to retrieve boolean values from the user. The widget can * either be in checked state or unschecked state. The value of the widget * depends on its state and the values of the falseval and trueval attributes. @@ -51,6 +58,8 @@ public: CheckBox(QDomNode &node, MacroWindow *macrowindow); ~CheckBox(); + virtual QString luaclass() { return LUA_CLASS; } + QString value(); void setValue(QString value, QString source = ""); @@ -98,7 +107,7 @@ inline void register_checkbox(lua_State *L) { register_widget(L); - luaL_newmetatable(L, "CheckBox"); + luaL_newmetatable(L, LUA_CLASS); lua_pushliteral(L, "__index"); lua_pushvalue(L, -2); lua_rawset(L, -3); -- cgit v1.2.3