summaryrefslogtreecommitdiff
path: root/client/luawidget.cc
diff options
context:
space:
mode:
authordeva <deva>2010-08-31 09:34:19 +0000
committerdeva <deva>2010-08-31 09:34:19 +0000
commit43e82b32f2d812225e6d7ef76efdbf4873efc343 (patch)
treedf5ace9b3fb39b7e58145c185e63e2ce5a8d8466 /client/luawidget.cc
parentf3847624ee5f99a37cf60be52067ad19bcdb4446 (diff)
luaComboBox and luaDB fixes and improvements.
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} };