diff options
author | David Walter Seikel | 2014-05-06 16:53:17 +1000 |
---|---|---|
committer | David Walter Seikel | 2014-05-06 16:53:17 +1000 |
commit | 20f851e6e2ceed52739ffcad85e10fa4c183bff1 (patch) | |
tree | dff97aa7a2b694e27e8c32ae58489e375805bade /src/libraries | |
parent | Disable the non working Elm input callback, and TODO++. (diff) | |
download | SledjHamr-20f851e6e2ceed52739ffcad85e10fa4c183bff1.zip SledjHamr-20f851e6e2ceed52739ffcad85e10fa4c183bff1.tar.gz SledjHamr-20f851e6e2ceed52739ffcad85e10fa4c183bff1.tar.bz2 SledjHamr-20f851e6e2ceed52739ffcad85e10fa4c183bff1.tar.xz |
Every window is a winFang now, and winFangs delete their own children.
Diffstat (limited to 'src/libraries')
-rw-r--r-- | src/libraries/winFang.c | 16 | ||||
-rw-r--r-- | src/libraries/winFang.h | 3 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/libraries/winFang.c b/src/libraries/winFang.c index 4d54627..33d5ea6 100644 --- a/src/libraries/winFang.c +++ b/src/libraries/winFang.c | |||
@@ -72,7 +72,7 @@ void winFangShow(winFang *win) | |||
72 | evas_object_show(win->hand[i]); | 72 | evas_object_show(win->hand[i]); |
73 | } | 73 | } |
74 | 74 | ||
75 | winFang *winFangAdd(Evas_Object *parent, int x, int y, int w, int h, char *title, char *name) | 75 | winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, char *name) |
76 | { | 76 | { |
77 | winFang *result; | 77 | winFang *result; |
78 | Evas_Object *obj, *obj2, *bg; | 78 | Evas_Object *obj, *obj2, *bg; |
@@ -81,6 +81,7 @@ winFang *winFangAdd(Evas_Object *parent, int x, int y, int w, int h, char *title | |||
81 | 81 | ||
82 | result = calloc(1, sizeof(winFang)); | 82 | result = calloc(1, sizeof(winFang)); |
83 | eina_clist_init(&result->widgets); | 83 | eina_clist_init(&result->widgets); |
84 | eina_clist_init(&result->winFangs); | ||
84 | 85 | ||
85 | if (parent) result->internal = EINA_TRUE; | 86 | if (parent) result->internal = EINA_TRUE; |
86 | 87 | ||
@@ -94,7 +95,8 @@ winFang *winFangAdd(Evas_Object *parent, int x, int y, int w, int h, char *title | |||
94 | // elm_config_engine_set("ews"); | 95 | // elm_config_engine_set("ews"); |
95 | if (result->internal) | 96 | if (result->internal) |
96 | { | 97 | { |
97 | result->win = elm_win_add(parent, name, ELM_WIN_INLINED_IMAGE); | 98 | result->win = elm_win_add(parent->win, name, ELM_WIN_INLINED_IMAGE); |
99 | eina_clist_add_head(&parent->winFangs, &result->node); | ||
98 | obj = elm_win_inlined_image_object_get(result->win); | 100 | obj = elm_win_inlined_image_object_get(result->win); |
99 | // On mouse down we try to shift focus to the backing image, this seems to be the correct thing to force focus onto it's widgets. | 101 | // On mouse down we try to shift focus to the backing image, this seems to be the correct thing to force focus onto it's widgets. |
100 | // According to the Elm inlined image window example, this is what's needed to. | 102 | // According to the Elm inlined image window example, this is what's needed to. |
@@ -144,7 +146,7 @@ winFang *winFangAdd(Evas_Object *parent, int x, int y, int w, int h, char *title | |||
144 | } | 146 | } |
145 | else | 147 | else |
146 | { | 148 | { |
147 | result->win = elm_win_add(parent, name, ELM_WIN_BASIC); | 149 | result->win = elm_win_add(NULL, name, ELM_WIN_BASIC); |
148 | evas_object_move(result->win, result->x, result->y); | 150 | evas_object_move(result->win, result->x, result->y); |
149 | evas_object_smart_callback_add(result->win, "delete,request", _on_done, NULL); | 151 | evas_object_smart_callback_add(result->win, "delete,request", _on_done, NULL); |
150 | } | 152 | } |
@@ -168,10 +170,16 @@ winFang *winFangAdd(Evas_Object *parent, int x, int y, int w, int h, char *title | |||
168 | 170 | ||
169 | void winFangDel(winFang *win) | 171 | void winFangDel(winFang *win) |
170 | { | 172 | { |
171 | Widget *wid; | 173 | winFang *wf; |
174 | Widget *wid; | ||
172 | 175 | ||
173 | if (!win) return; | 176 | if (!win) return; |
174 | 177 | ||
178 | EINA_CLIST_FOR_EACH_ENTRY(wf, &win->winFangs, winFang, node) | ||
179 | { | ||
180 | winFangDel(wf); | ||
181 | } | ||
182 | |||
175 | // Elm will delete our widgets, but if we are using eo, we need to unref them. | 183 | // Elm will delete our widgets, but if we are using eo, we need to unref them. |
176 | EINA_CLIST_FOR_EACH_ENTRY(wid, &win->widgets, Widget, node) | 184 | EINA_CLIST_FOR_EACH_ENTRY(wid, &win->widgets, Widget, node) |
177 | { | 185 | { |
diff --git a/src/libraries/winFang.h b/src/libraries/winFang.h index 38487cc..f3c4861 100644 --- a/src/libraries/winFang.h +++ b/src/libraries/winFang.h | |||
@@ -19,6 +19,7 @@ typedef struct _winFang | |||
19 | { | 19 | { |
20 | Evas_Object *win; | 20 | Evas_Object *win; |
21 | Eina_Clist widgets; | 21 | Eina_Clist widgets; |
22 | Eina_Clist winFangs; | ||
22 | int x, y, w, h; | 23 | int x, y, w, h; |
23 | Eina_Bool internal; | 24 | Eina_Bool internal; |
24 | 25 | ||
@@ -45,7 +46,7 @@ typedef struct _Widget | |||
45 | Evas_Smart_Cb on_del; | 46 | Evas_Smart_Cb on_del; |
46 | } Widget; | 47 | } Widget; |
47 | 48 | ||
48 | winFang *winFangAdd(Evas_Object *parent, int x, int y, int w, int h, char *title, char *name); | 49 | winFang *winFangAdd(winFang *parent, int x, int y, int w, int h, char *title, char *name); |
49 | void winFangHide(winFang *win); | 50 | void winFangHide(winFang *win); |
50 | void winFangShow(winFang *win); | 51 | void winFangShow(winFang *win); |
51 | void winFangDel(winFang *win); | 52 | void winFangDel(winFang *win); |