aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
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
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')
-rw-r--r--src/GuiLua/GuiLua.c39
-rw-r--r--src/libraries/winFang.c10
-rw-r--r--src/libraries/winFang.h2
3 files changed, 49 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);
diff --git a/src/libraries/winFang.c b/src/libraries/winFang.c
index dc5188a..0d1622d 100644
--- a/src/libraries/winFang.c
+++ b/src/libraries/winFang.c
@@ -199,6 +199,16 @@ void winFangShow(winFang *win)
199 evas_object_show(win->hand[i]); 199 evas_object_show(win->hand[i]);
200} 200}
201 201
202void widgetHide(Widget *wid)
203{
204 evas_object_hide(wid->obj);
205}
206
207void widgetShow(Widget *wid)
208{
209 evas_object_show(wid->obj);
210}
211
202winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, char *name, EPhysics_World *world) 212winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, char *name, EPhysics_World *world)
203{ 213{
204 winFang *result; 214 winFang *result;
diff --git a/src/libraries/winFang.h b/src/libraries/winFang.h
index bae3082..f3f4170 100644
--- a/src/libraries/winFang.h
+++ b/src/libraries/winFang.h
@@ -94,6 +94,8 @@ void HamrTime(void *elm_main, char *domain);
94winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, char *name, EPhysics_World *world); 94winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, char *name, EPhysics_World *world);
95void winFangHide(winFang *win); 95void winFangHide(winFang *win);
96void winFangShow(winFang *win); 96void winFangShow(winFang *win);
97void widgetHide(Widget *wid);
98void widgetShow(Widget *wid);
97void winFangCalcMinSize(winFang *win); 99void winFangCalcMinSize(winFang *win);
98void winFangDel(winFang *win); 100void winFangDel(winFang *win);
99 101