summaryrefslogtreecommitdiff
path: root/client/luawidget.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/luawidget.cc')
-rw-r--r--client/luawidget.cc32
1 files changed, 31 insertions, 1 deletions
diff --git a/client/luawidget.cc b/client/luawidget.cc
index 5abc236..86dc2bb 100644
--- a/client/luawidget.cc
+++ b/client/luawidget.cc
@@ -280,9 +280,39 @@ static int cmb_add_item(lua_State *L)
return 0;
}
+static int cmb_le_value(lua_State *L)
+{
+ wdg_userdata *wdgu;
+
+ wdgu = (wdg_userdata *)luaL_isudata(L, 1, "ComboBox");
+ luaL_argcheck(L, wdgu, 1, "combobox expected");
+
+ ComboBox *cmb = (ComboBox*)wdgu->widget;
+ lua_pushstring(L, cmb->lineEditValue().toStdString().c_str());
+
+ return 1;
+}
+
+static int cmb_le_set_value(lua_State *L)
+{
+ wdg_userdata *wdgu;
+
+ wdgu = (wdg_userdata *)luaL_isudata(L, 1, "ComboBox");
+ luaL_argcheck(L, wdgu, 1, "combobox expected");
+
+ const char *val = luaL_checkstring(L, 2);
+
+ ComboBox *cmb = (ComboBox*)wdgu->widget;
+ cmb->setLineEditValue(val);
+
+ return 0;
+}
+
#define CMBBOX_METHS \
{"clear", cmb_clear},\
- {"addItem", cmb_add_item}
+ {"addItem", cmb_add_item},\
+ {"lineEditValue", cmb_le_value},\
+ {"setLineEditValue", cmb_le_set_value}
static const struct luaL_Reg wdg_meths[] =
{ WDG_METHS, {NULL, NULL} };