From 2073fbca6ae3fb1f202df32d4f14771f8866660d Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Fri, 16 May 2014 19:00:15 +1000 Subject: Put module name in winFang and winFang in Widget, plus related tweakage and use. --- lib/skang.lua | 3 ++- src/GuiLua/GuiLua.c | 6 ++++-- src/libraries/winFang.c | 1 + src/libraries/winFang.h | 2 ++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/skang.lua b/lib/skang.lua index 5c4aec7..d4a9fec 100644 --- a/lib/skang.lua +++ b/lib/skang.lua @@ -1089,12 +1089,13 @@ Store the winFang a widget is in in Widget. ]] window = function(w, h, title, name) + local caller = getfenv(2)._NAME name = name or 'myWindow' local win = {} win = copy(widgets, name) local wMum, wThingy = getStuffed(win.W, 'a') wThingy.isValid = aIsValid - win.window = Cwindow(w, h, title, name) + win.window = Cwindow(caller, w, h, title, name) return win end diff --git a/src/GuiLua/GuiLua.c b/src/GuiLua/GuiLua.c index f2de1ea..211f4e7 100644 --- a/src/GuiLua/GuiLua.c +++ b/src/GuiLua/GuiLua.c @@ -233,12 +233,13 @@ static int window(lua_State *L) winFang *win = NULL; winFang *parent = NULL; EPhysics_World *world = NULL; + char *module = NULL; char *name = "GuiLua"; char *title = "GuiLua test harness"; int w = WIDTH, h = HEIGHT; GuiLua *gl; - pull_lua(L, 1, "%w %h $title $name", &w, &h, &title, &name); + pull_lua(L, 1, "$module %w %h $title $name", &module, &w, &h, &title, &name); lua_getfield(L, LUA_REGISTRYINDEX, glName); gl = lua_touserdata(L, -1); @@ -250,6 +251,7 @@ static int window(lua_State *L) } win = winFangAdd(parent, 25, 55, w, h, title, name, world); + win->module = module; if (gl) { // If there's no parent, we become the parent. @@ -347,7 +349,7 @@ printf("**********************require GuiLua\n"); // Define our functions. //thingasm{'window', 'The size and title of the application Frame.', window, 'x,y,name', acl='GGG'} - push_lua(L, "@ ( { = $ $ & $ $acl } )", skang, THINGASM, skang, "Cwindow", "Opens our window.", window, "number,number,string", "GGG", 0); + push_lua(L, "@ ( { = $ $ & $ $acl } )", skang, THINGASM, skang, "Cwindow", "Opens our window.", window, "string,number,number,string", "GGG", 0); push_lua(L, "@ ( = $ $ & )", skang, THINGASM, skang, "clear", "The current skin is cleared of all widgets.", clear, 0); PD("GuiLua 2"); // TODO - This one crashes sometimes. Figure out why later. diff --git a/src/libraries/winFang.c b/src/libraries/winFang.c index d7feb39..5662970 100644 --- a/src/libraries/winFang.c +++ b/src/libraries/winFang.c @@ -395,6 +395,7 @@ Widget *widgetAdd(winFang *win, char *type , char *title, int x, int y, int w, i strcpy(result->magic, "Widget"); strcpy(result->type, type); eina_clist_add_head(&win->widgets, &result->node); + result->win = win; result->obj = eo_add(klass, win->win, evas_obj_size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND), diff --git a/src/libraries/winFang.h b/src/libraries/winFang.h index edec11b..3d721ef 100644 --- a/src/libraries/winFang.h +++ b/src/libraries/winFang.h @@ -61,6 +61,7 @@ typedef struct _winFang EPhysics_Body *body; Eina_Clist widgets; Eina_Clist winFangs; + char *module; int x, y, w, h, mw, mh; Evas_Object *hand[4]; @@ -75,6 +76,7 @@ typedef struct _Widget char magic[8]; char type[16]; Evas_Object *obj; + winFang *win; char *label, *look, *action, *help; // foreground / background colour -- cgit v1.1