summaryrefslogtreecommitdiff
path: root/client/widgets/lineedit.cc
diff options
context:
space:
mode:
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;
+}