diff options
Diffstat (limited to '')
-rw-r--r-- | src/GuiLua/GuiLua.c | 39 |
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 | ||
219 | static 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 | |||
228 | static 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 | |||
237 | static 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); |
360 | PD("GuiLua 3"); | 391 | PD("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); |