summaryrefslogtreecommitdiff
path: root/client/widgets/combobox.cc
diff options
context:
space:
mode:
authordeva <deva>2011-03-18 07:18:56 +0000
committerdeva <deva>2011-03-18 07:18:56 +0000
commit165afd0d36abc8729b28e303077ed285b577caea (patch)
treeb35787b28a2e7c9dedd96ebcdb1687425efc6e1e /client/widgets/combobox.cc
parent97d32901efc2b6cbec3ab41f78fa409d2ce78804 (diff)
Moved lua methods into their respective Qt widget implementation files.
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;
+}