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/checkgroupbox.h | 58 +++++++++++++++++++++++++++--------------- 1 file changed, 38 insertions(+), 20 deletions(-) (limited to 'client/widgets/checkgroupbox.h') diff --git a/client/widgets/checkgroupbox.h b/client/widgets/checkgroupbox.h index 9b6dcdc..5dfa7fb 100644 --- a/client/widgets/checkgroupbox.h +++ b/client/widgets/checkgroupbox.h @@ -28,14 +28,32 @@ #ifndef __PRACRO_CHECKGROUPBOX_H__ #define __PRACRO_CHECKGROUPBOX_H__ -#include "widget.h" +#include "checkbox.h" + #include +#include + +#ifdef LUA_CLASS +#undef LUA_CLASS +#endif +#define LUA_CLASS "CheckGroupBox" /*** * Checkable GroupBox Widget * @tag checkgroupbox * @extends checkbox - * @screenshot + * @screenshot Example 1: type="framed" + * + * + * + * + * @screenshot Example 2: type="simple" + * + * + * + * * @container * @att layout The layout used in the groupbox. Can be one of 'vbox' or 'hbox'. * @att type Defines the type of the checkbox. It can be one of 'framed' or @@ -44,39 +62,39 @@ * to the right of it. Default is 'framed'. */ -class QGroupBox; -class QCheckBox; -class CheckGroupBox : public Widget +class CheckGroupBox : public CheckBox { Q_OBJECT public: CheckGroupBox(QDomNode &node, MacroWindow *macrowindow); ~CheckGroupBox(); - QString value(); - void setValue(QString value, QString source = ""); - - void setWdgValid(bool valid); - - bool checked(); - void setChecked(bool checked); + //void setWdgValid(bool valid); bool setKeyboardFocus(); public slots: - void state_change(bool); + void cgb_state_change(); private: - QString truevalue; - QString falsevalue; - QString type; - bool changedByUser; - - QGroupBox *groupbox; + QCheckBox *checkbox; - QWidget *container; }; +const struct luaL_Reg chkgrpbox_meths[] = + { WDG_METHS, CHKBOX_METHS, {NULL, NULL} }; + +inline void register_checkgroupbox(lua_State *L) +{ + register_widget(L); + + luaL_newmetatable(L, LUA_CLASS); + lua_pushliteral(L, "__index"); + lua_pushvalue(L, -2); + lua_rawset(L, -3); + luaL_register(L, NULL, chkgrpbox_meths); +} + #endif/*__PRACRO_CHECKGROUPBOX_H__*/ -- cgit v1.2.3