summaryrefslogtreecommitdiff
path: root/client/widgets/lineedit.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/lineedit.cc
parent97d32901efc2b6cbec3ab41f78fa409d2ce78804 (diff)
Moved lua methods into their respective Qt widget implementation files.
Diffstat (limited to 'client/widgets/lineedit.cc')
-rw-r--r--client/widgets/lineedit.cc59
1 files changed, 59 insertions, 0 deletions
diff --git a/client/widgets/lineedit.cc b/client/widgets/lineedit.cc
index d6aa619..e50f9cd 100644
--- a/client/widgets/lineedit.cc
+++ b/client/widgets/lineedit.cc
@@ -37,6 +37,7 @@
#include "common.h"
#include "debug.h"
+#include "luawidget.h"
LineEdit::LineEdit(QDomNode &node, MacroWindow *macrowindow)
: Widget(node, macrowindow)
@@ -173,3 +174,61 @@ void LineEdit::showSuggestions()
QCompleter *comp = lineedit->completer();
comp->complete();
}
+
+
+int lin_clear_suggestions(lua_State *L)
+{
+ wdg_userdata *wdgu;
+
+ wdgu = (wdg_userdata *)luaL_isudata(L, 1, "LineEdit");
+ luaL_argcheck(L, wdgu, 1, "lineedit expected");
+
+ LineEdit *led = (LineEdit*)wdgu->widget;
+ led->clearSuggestions();
+
+ return 0;
+}
+
+int lin_show_suggestions(lua_State *L)
+{
+ wdg_userdata *wdgu;
+
+ wdgu = (wdg_userdata *)luaL_isudata(L, 1, "LineEdit");
+ luaL_argcheck(L, wdgu, 1, "lineedit expected");
+
+ LineEdit *led = (LineEdit*)wdgu->widget;
+ led->showSuggestions();
+
+ return 0;
+}
+
+int lin_is_suggested(lua_State *L)
+{
+ wdg_userdata *wdgu;
+
+ wdgu = (wdg_userdata *)luaL_isudata(L, 1, "LineEdit");
+ luaL_argcheck(L, wdgu, 1, "lineedit expected");
+
+ const char *val = luaL_checkstring(L, 2);
+
+ LineEdit *led = (LineEdit*)wdgu->widget;
+
+ lua_pushboolean(L, led->isSuggested(val));
+
+ return 1;
+}
+
+int lin_add_suggestion(lua_State *L)
+{
+ wdg_userdata *wdgu;
+
+ wdgu = (wdg_userdata *)luaL_isudata(L, 1, "LineEdit");
+ luaL_argcheck(L, wdgu, 1, "lineedit expected");
+
+ const char *val = luaL_checkstring(L, 2);
+
+ LineEdit *led = (LineEdit*)wdgu->widget;
+ led->addSuggestion(val);
+
+ return 0;
+}