summaryrefslogtreecommitdiff
path: root/client/widgets/combobox.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/widgets/combobox.cc')
-rw-r--r--client/widgets/combobox.cc57
1 files changed, 57 insertions, 0 deletions
diff --git a/client/widgets/combobox.cc b/client/widgets/combobox.cc
index c06e145..768f035 100644
--- a/client/widgets/combobox.cc
+++ b/client/widgets/combobox.cc
@@ -40,6 +40,7 @@
#include "common.h"
#include "debug.h"
+#include "luawidget.h"
// Enable this to make the combobox drawn in windows style.
// This will make its background red even when not expanded.
@@ -267,3 +268,59 @@ void ComboBox::setLineEditValue(QString value)
}
ignoreChangeEvents = false;
}
+
+int cmb_clear(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;
+ cmb->clear();
+
+ return 0;
+}
+
+int cmb_add_item(lua_State *L)
+{
+ wdg_userdata *wdgu;
+
+ wdgu = (wdg_userdata *)luaL_isudata(L, 1, "ComboBox");
+ luaL_argcheck(L, wdgu, 1, "combobox expected");
+
+ QString val = luaL_checkstring(L, 2);
+
+ ComboBox *cmb = (ComboBox*)wdgu->widget;
+ cmb->addItem(val);
+
+ return 0;
+}
+
+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;
+}
+
+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;
+}