aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/GuiLua/GuiLua.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-05-18 01:57:28 +1000
committerDavid Walter Seikel2014-05-18 01:57:28 +1000
commit85eaa17d79ce4eb399470a0a20d6dc59f9b07c43 (patch)
tree5f92065ff73944f47236a59f601b23446225c403 /src/GuiLua/GuiLua.c
parentGet rid of the last of the artificial delays. (diff)
downloadSledjHamr-85eaa17d79ce4eb399470a0a20d6dc59f9b07c43.zip
SledjHamr-85eaa17d79ce4eb399470a0a20d6dc59f9b07c43.tar.gz
SledjHamr-85eaa17d79ce4eb399470a0a20d6dc59f9b07c43.tar.bz2
SledjHamr-85eaa17d79ce4eb399470a0a20d6dc59f9b07c43.tar.xz
Add widget hide, show, and text setting functions.
Diffstat (limited to 'src/GuiLua/GuiLua.c')
-rw-r--r--src/GuiLua/GuiLua.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/src/GuiLua/GuiLua.c b/src/GuiLua/GuiLua.c
index ae9af48..5a30ff9 100644
--- a/src/GuiLua/GuiLua.c
+++ b/src/GuiLua/GuiLua.c
@@ -216,6 +216,37 @@ static int colour(lua_State *L)
216 return 0; 216 return 0;
217} 217}
218 218
219static int widHide(lua_State *L)
220{
221 Widget *wid = lua_touserdata(L, 1);
222
223 if (wid && strcmp(wid->magic, "Widget") == 0)
224 widgetHide(wid);
225 return 0;
226}
227
228static int widShow(lua_State *L)
229{
230 Widget *wid = lua_touserdata(L, 1);
231
232 if (wid && strcmp(wid->magic, "Widget") == 0)
233 widgetShow(wid);
234 return 0;
235}
236
237static int text(lua_State *L)
238{
239 Widget *wid = lua_touserdata(L, 1);
240 char *text = "";
241
242 pull_lua(L, 2, "$", &text);
243 if (wid && strcmp(wid->magic, "Widget") == 0)
244 {
245 elm_object_text_set(wid->obj, text);
246 }
247 return 0;
248}
249
219/* userdata vs light userdata 250/* userdata vs light userdata
220 Lua wants to allocate the memory for userdata itself. 251 Lua wants to allocate the memory for userdata itself.
221 Light user data an actual pointer. 252 Light user data an actual pointer.
@@ -358,11 +389,15 @@ PD("GuiLua 2");
358// push_lua(L, "@ ( = $ $ & $ )", skang, THINGASM, skang, "widget", "Create a widget.", widget, "userdata,string,string,number,number,number,number"); 389// push_lua(L, "@ ( = $ $ & $ )", skang, THINGASM, skang, "widget", "Create a widget.", widget, "userdata,string,string,number,number,number,number");
359 push_lua(L, "@ ( = $ $ & )", skang, THINGASM, skang, "widget", "Create a widget.", widget, 0); 390 push_lua(L, "@ ( = $ $ & )", skang, THINGASM, skang, "widget", "Create a widget.", widget, 0);
360PD("GuiLua 3"); 391PD("GuiLua 3");
361 push_lua(L, "@ ( = $ $ & )", skang, THINGASM, skang, "action", "Add an action to a widget.", action, 0); 392 push_lua(L, "@ ( = $ $ & $ )", skang, THINGASM, skang, "action", "Add an action to a widget.", action, "string", 0);
362 push_lua(L, "@ ( = $ $ & )", skang, THINGASM, skang, "Colour", "Change widget colours.", colour, 0); 393 push_lua(L, "@ ( = $ $ & )", skang, THINGASM, skang, "Colour", "Change widget colours.", colour, 0);
394 push_lua(L, "@ ( = $ $ & )", skang, THINGASM, skang, "hide", "Hide a widget.", widHide, 0);
395 push_lua(L, "@ ( = $ $ & )", skang, THINGASM, skang, "show", "Show a widget.", widShow, 0);
396 push_lua(L, "@ ( = $ $ & $ )", skang, THINGASM, skang, "text", "Set the text for a widget.", text, "string", 0);
397
363 push_lua(L, "@ ( = $ $ & )", skang, THINGASM, skang, "loopWindow", "Run our windows main loop.", loopWindow, 0); 398 push_lua(L, "@ ( = $ $ & )", skang, THINGASM, skang, "loopWindow", "Run our windows main loop.", loopWindow, 0);
364 push_lua(L, "@ ( = $ $ & )", skang, THINGASM, skang, "quit", "Quit, exit, remove thyself.", quit, 0); 399 push_lua(L, "@ ( = $ $ & )", skang, THINGASM, skang, "quit", "Quit, exit, remove thyself.", quit, 0);
365 push_lua(L, "@ ( = $ $ & $ )", skang, THINGASM, skang, "closeWindow", "Closes a window.", closeWindow, "userdata", 0); // TODO - closeWindow, "userdata"); 400 push_lua(L, "@ ( = $ $ & $ )", skang, THINGASM, skang, "closeWindow", "Closes a window.", closeWindow, "userdata", 0); // TODO - closeWindow, "userdata");
366 401
367 // A test of the array building stuff. 402 // A test of the array building stuff.
368 push_lua(L, "@ ( { = $ $ % $widget !required } )", skang, THINGASM, skang, "wibble", "It's wibbly!", 1, "'edit', 'The wibblinator:', 1, 1, 10, 50", 1, 0); 403 push_lua(L, "@ ( { = $ $ % $widget !required } )", skang, THINGASM, skang, "wibble", "It's wibbly!", 1, "'edit', 'The wibblinator:', 1, 1, 10, 50", 1, 0);