From d3774aa29ab94d763a3276a23ea0f59c550c9dc5 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Thu, 17 Apr 2014 15:11:16 +1000 Subject: Move skang.window() to widget.window(), and make it work. --- ClientHamr/GuiLua/GuiLua.c | 16 ++++++++++------ ClientHamr/GuiLua/skang.lua | 6 +++--- ClientHamr/GuiLua/test.skang | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) (limited to 'ClientHamr') diff --git a/ClientHamr/GuiLua/GuiLua.c b/ClientHamr/GuiLua/GuiLua.c index 3c068c7..c441fcf 100644 --- a/ClientHamr/GuiLua/GuiLua.c +++ b/ClientHamr/GuiLua/GuiLua.c @@ -521,9 +521,11 @@ static void _on_done(void *data, Evas_Object *obj EINA_UNUSED, void *event_info elm_exit(); } -static int openWindow(lua_State *L) +static int window(lua_State *L) { globals *ourGlobals; + char *title = NULL; + int w = WIDTH, h = HEIGHT; lua_getfield(L, LUA_REGISTRYINDEX, "ourGlobals"); ourGlobals = lua_touserdata(L, -1); @@ -531,11 +533,15 @@ static int openWindow(lua_State *L) loggingStartup(ourGlobals); PI("GuiLua running as an application.\n"); + if (pull_lua(L, 1, "%w %h $title", &w, &h, &title) > 0) + PI("Setting window to %d %d %s", w, h, title); + else + title = "GuiLua test harness"; - if ((ourGlobals->win = elm_win_util_standard_add("GuiLua", "GuiLua test harness"))) + if ((ourGlobals->win = elm_win_util_standard_add("GuiLua", title))) { evas_object_smart_callback_add(ourGlobals->win, "delete,request", _on_done, ourGlobals); - evas_object_resize(ourGlobals->win, WIDTH, HEIGHT); + evas_object_resize(ourGlobals->win, w, h); evas_object_move(ourGlobals->win, 0, 0); evas_object_show(ourGlobals->win); } @@ -622,15 +628,13 @@ int luaopen_widget(lua_State *L) lua_setfield(L, LUA_REGISTRYINDEX, ourName); // Define our functions. - push_lua(L, "@ ( @ $ $ & )", skang, "thingasm", LUA_REGISTRYINDEX, ourName, "openWindow", "Opens our window.", openWindow, 0); + push_lua(L, "@ ( @ $ $ & $ )", skang, "thingasm", LUA_REGISTRYINDEX, ourName, "window", "Opens our window.", window, "number,number,string", 0); push_lua(L, "@ ( @ $ $ & )", skang, "thingasm", LUA_REGISTRYINDEX, ourName, "loopWindow", "Run our windows main loop.", loopWindow, 0); push_lua(L, "@ ( @ $ $ & )", skang, "thingasm", LUA_REGISTRYINDEX, ourName, "closeWindow", "Closes our window.", closeWindow, 0); // A test of the array building stuff. push_lua(L, "@ ( { @ $ $ % $widget !required } )", skang, "thingasm", LUA_REGISTRYINDEX, ourName, "wibble", "It's wibbly!", 1, "'edit', 'The wibblinator:', 1, 1, 10, 50", 1, 0); - lua_pop(L, openWindow(L)); - push_lua(L, "@ ( @ )", skang, "moduleEnd", LUA_REGISTRYINDEX, ourName, 0); return 1; diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua index 632074b..70d7778 100644 --- a/ClientHamr/GuiLua/skang.lua +++ b/ClientHamr/GuiLua/skang.lua @@ -988,8 +988,8 @@ thingasm('nada', 'Do nothing.', function () --[[ This function intentionally lef -- TODO - Some function stubs, for now. Fill them up later. clear = function () end -window = function (width, height, title) -end +--window = function (width, height, title) +--end skang = function (name) end @@ -997,7 +997,7 @@ quit = function () end thingasm('clear', 'The current skin is cleared of all widgets.', clear) -thingasm{'window', 'The size and title of the application Frame.', window, 'x,y,name', acl='GGG'} +--thingasm{'window', 'The size and title of the application Frame.', window, 'x,y,name', acl='GGG'} thingasm('skang', 'Parse the contents of a skang file or URL.', skang, 'URL') thingasm('quit', 'Quit, exit, remove thyself.', quit) diff --git a/ClientHamr/GuiLua/test.skang b/ClientHamr/GuiLua/test.skang index 015b3b9..6d7aab7 100644 --- a/ClientHamr/GuiLua/test.skang +++ b/ClientHamr/GuiLua/test.skang @@ -7,7 +7,7 @@ local widget = require 'widget' -- local other = require 'otherPackageName' skang.clear() -skang.window(200, 200, "G'day planet.") +widget.window(500, 500, "G'day planet.") --quitter = widget.button('Quit', 0.5, 0.5, 0.5, 0.5) --quitter:action('quit') -- 'quit' is looked up in ThingSpace.commands, and translated into the Lua 'skang.quit()'. -- cgit v1.1