diff options
Diffstat (limited to 'client/widgets/altcombobox.h')
-rw-r--r-- | client/widgets/altcombobox.h | 51 |
1 files changed, 42 insertions, 9 deletions
diff --git a/client/widgets/altcombobox.h b/client/widgets/altcombobox.h index ccc81cd..e6a21d7 100644 --- a/client/widgets/altcombobox.h +++ b/client/widgets/altcombobox.h @@ -30,16 +30,37 @@ #include "widget.h" #include "combobox.h" +#include "frame.h" #include <QDomNode> #include <QMap> +#ifdef LUA_CLASS +#undef LUA_CLASS +#endif +#define LUA_CLASS "AltComboBox" + /*** * ComboBox Widget with Alternate Value * @tag altcombobox * @extends combobox + * @screenshot Example: altitem selected. + * <altcombobox name="ex" layout="vbox" value="altitem" type="select"> + * <item caption="Item" value="item"/> + * <altitem caption="Alt Item" value="altitem" innerwidget="in" layout="hbox"> + * <label caption="Alt label:"/> + * <lineedit name="in" value="Alt value"/> + * </altitem> + * </altcombobox> + * @screenshot Example: altitem not selected. + * <altcombobox name="ex" layout="vbox" value="item" type="select"> + * <item caption="Item" value="item"/> + * <altitem caption="Alt Item" value="altitem" innerwidget="in" layout="hbox"> + * <label caption="Alt label:"/> + * <lineedit name="in" value="Alt value"/> + * </altitem> + * </altcombobox> * @container - * @screenshot * The AltComboBox is used to make a normal selection with a ComboBox but with * a special list item that shows an alternate widget and uses this widget for * input. The AltComboBox contains <code><item></code> tags in the same @@ -56,33 +77,45 @@ */ class QFrame; -class AltComboBox : public Widget +class QComboBox; +class AltComboBox : public ComboBox { Q_OBJECT public: AltComboBox(QDomNode &node, MacroWindow *macrowindow); ~AltComboBox(); + virtual QString luaclass() { return LUA_CLASS; } + QString value(); void setValue(QString value, QString source = ""); bool preValid(); - void setWdgValid(bool valid); - bool setKeyboardFocus(); + QComboBox *qcombobox(); public slots: - void onValueChange(int index); - void onValueChange(const QString &text); + void comboChanged(); void onChildChange(); private: QFrame *frame; - ComboBox *combobox; + QComboBox *combobox; Widget *innerwidget; QString altvalue; - QWidget *altframe; - QWidget *altframerepl; + Frame *altframe; }; +const struct luaL_Reg acmbbox_meths[] = + { WDG_METHS, CMBBOX_METHS, {NULL, NULL} }; + +inline void register_altcombobox(lua_State *L) +{ + luaL_newmetatable(L, LUA_CLASS); + lua_pushliteral(L, "__index"); + lua_pushvalue(L, -2); + lua_rawset(L, -3); + luaL_register(L, NULL, acmbbox_meths); +} + #endif/*__PRACRO_ALTCOMBOBOX_H__*/ |