aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ClientHamr
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-04-17 15:11:16 +1000
committerDavid Walter Seikel2014-04-17 15:11:16 +1000
commitd3774aa29ab94d763a3276a23ea0f59c550c9dc5 (patch)
tree51974fd5af823f7100ca8dd9d9124cab79cb85bd /ClientHamr
parentGive more info in dumpStack(). (diff)
downloadSledjHamr-d3774aa29ab94d763a3276a23ea0f59c550c9dc5.zip
SledjHamr-d3774aa29ab94d763a3276a23ea0f59c550c9dc5.tar.gz
SledjHamr-d3774aa29ab94d763a3276a23ea0f59c550c9dc5.tar.bz2
SledjHamr-d3774aa29ab94d763a3276a23ea0f59c550c9dc5.tar.xz
Move skang.window() to widget.window(), and make it work.
Diffstat (limited to 'ClientHamr')
-rw-r--r--ClientHamr/GuiLua/GuiLua.c16
-rw-r--r--ClientHamr/GuiLua/skang.lua6
-rw-r--r--ClientHamr/GuiLua/test.skang2
3 files changed, 14 insertions, 10 deletions
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
521 elm_exit(); 521 elm_exit();
522} 522}
523 523
524static int openWindow(lua_State *L) 524static int window(lua_State *L)
525{ 525{
526 globals *ourGlobals; 526 globals *ourGlobals;
527 char *title = NULL;
528 int w = WIDTH, h = HEIGHT;
527 529
528 lua_getfield(L, LUA_REGISTRYINDEX, "ourGlobals"); 530 lua_getfield(L, LUA_REGISTRYINDEX, "ourGlobals");
529 ourGlobals = lua_touserdata(L, -1); 531 ourGlobals = lua_touserdata(L, -1);
@@ -531,11 +533,15 @@ static int openWindow(lua_State *L)
531 533
532 loggingStartup(ourGlobals); 534 loggingStartup(ourGlobals);
533 PI("GuiLua running as an application.\n"); 535 PI("GuiLua running as an application.\n");
536 if (pull_lua(L, 1, "%w %h $title", &w, &h, &title) > 0)
537 PI("Setting window to %d %d %s", w, h, title);
538 else
539 title = "GuiLua test harness";
534 540
535 if ((ourGlobals->win = elm_win_util_standard_add("GuiLua", "GuiLua test harness"))) 541 if ((ourGlobals->win = elm_win_util_standard_add("GuiLua", title)))
536 { 542 {
537 evas_object_smart_callback_add(ourGlobals->win, "delete,request", _on_done, ourGlobals); 543 evas_object_smart_callback_add(ourGlobals->win, "delete,request", _on_done, ourGlobals);
538 evas_object_resize(ourGlobals->win, WIDTH, HEIGHT); 544 evas_object_resize(ourGlobals->win, w, h);
539 evas_object_move(ourGlobals->win, 0, 0); 545 evas_object_move(ourGlobals->win, 0, 0);
540 evas_object_show(ourGlobals->win); 546 evas_object_show(ourGlobals->win);
541 } 547 }
@@ -622,15 +628,13 @@ int luaopen_widget(lua_State *L)
622 lua_setfield(L, LUA_REGISTRYINDEX, ourName); 628 lua_setfield(L, LUA_REGISTRYINDEX, ourName);
623 629
624 // Define our functions. 630 // Define our functions.
625 push_lua(L, "@ ( @ $ $ & )", skang, "thingasm", LUA_REGISTRYINDEX, ourName, "openWindow", "Opens our window.", openWindow, 0); 631 push_lua(L, "@ ( @ $ $ & $ )", skang, "thingasm", LUA_REGISTRYINDEX, ourName, "window", "Opens our window.", window, "number,number,string", 0);
626 push_lua(L, "@ ( @ $ $ & )", skang, "thingasm", LUA_REGISTRYINDEX, ourName, "loopWindow", "Run our windows main loop.", loopWindow, 0); 632 push_lua(L, "@ ( @ $ $ & )", skang, "thingasm", LUA_REGISTRYINDEX, ourName, "loopWindow", "Run our windows main loop.", loopWindow, 0);
627 push_lua(L, "@ ( @ $ $ & )", skang, "thingasm", LUA_REGISTRYINDEX, ourName, "closeWindow", "Closes our window.", closeWindow, 0); 633 push_lua(L, "@ ( @ $ $ & )", skang, "thingasm", LUA_REGISTRYINDEX, ourName, "closeWindow", "Closes our window.", closeWindow, 0);
628 634
629 // A test of the array building stuff. 635 // A test of the array building stuff.
630 push_lua(L, "@ ( { @ $ $ % $widget !required } )", skang, "thingasm", LUA_REGISTRYINDEX, ourName, "wibble", "It's wibbly!", 1, "'edit', 'The wibblinator:', 1, 1, 10, 50", 1, 0); 636 push_lua(L, "@ ( { @ $ $ % $widget !required } )", skang, "thingasm", LUA_REGISTRYINDEX, ourName, "wibble", "It's wibbly!", 1, "'edit', 'The wibblinator:', 1, 1, 10, 50", 1, 0);
631 637
632 lua_pop(L, openWindow(L));
633
634 push_lua(L, "@ ( @ )", skang, "moduleEnd", LUA_REGISTRYINDEX, ourName, 0); 638 push_lua(L, "@ ( @ )", skang, "moduleEnd", LUA_REGISTRYINDEX, ourName, 0);
635 639
636 return 1; 640 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
988-- TODO - Some function stubs, for now. Fill them up later. 988-- TODO - Some function stubs, for now. Fill them up later.
989clear = function () 989clear = function ()
990end 990end
991window = function (width, height, title) 991--window = function (width, height, title)
992end 992--end
993 993
994skang = function (name) 994skang = function (name)
995end 995end
@@ -997,7 +997,7 @@ quit = function ()
997end 997end
998 998
999thingasm('clear', 'The current skin is cleared of all widgets.', clear) 999thingasm('clear', 'The current skin is cleared of all widgets.', clear)
1000thingasm{'window', 'The size and title of the application Frame.', window, 'x,y,name', acl='GGG'} 1000--thingasm{'window', 'The size and title of the application Frame.', window, 'x,y,name', acl='GGG'}
1001thingasm('skang', 'Parse the contents of a skang file or URL.', skang, 'URL') 1001thingasm('skang', 'Parse the contents of a skang file or URL.', skang, 'URL')
1002thingasm('quit', 'Quit, exit, remove thyself.', quit) 1002thingasm('quit', 'Quit, exit, remove thyself.', quit)
1003 1003
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'
7-- local other = require 'otherPackageName' 7-- local other = require 'otherPackageName'
8 8
9skang.clear() 9skang.clear()
10skang.window(200, 200, "G'day planet.") 10widget.window(500, 500, "G'day planet.")
11 11
12--quitter = widget.button('Quit', 0.5, 0.5, 0.5, 0.5) 12--quitter = widget.button('Quit', 0.5, 0.5, 0.5, 0.5)
13--quitter:action('quit') -- 'quit' is looked up in ThingSpace.commands, and translated into the Lua 'skang.quit()'. 13--quitter:action('quit') -- 'quit' is looked up in ThingSpace.commands, and translated into the Lua 'skang.quit()'.