summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackDanielZ <daniel.zaoui@yahoo.com>2014-09-27 22:15:16 +0300
committerYakov Goldberg <yakov.g@samsung.com>2014-10-02 15:36:40 +0300
commit06247875a2651d59f0b70e20dec27eedaa257a8f (patch)
tree7af02a94766d88d04c776351d611b1a3c96f8ce5
parentc929b67423d27cdd4eed0a32db0286163a06b234 (diff)
Main Widgets: generalize the main object (not just win)
For the moment, non-win objects can be created as main objects but a bug is present: - If an object is selected during factory widget creation, we check that it is a win or a container, so we know if the new object has to be a child or a main object. The problem is that button... are considered as containers and so can be parent. That shouldn't be imo.
-rw-r--r--src/bin/egui_gui/editor.c256
-rw-r--r--src/bin/egui_gui/egui_logic.c5
-rw-r--r--src/bin/egui_gui/egui_logic_private.h5
-rw-r--r--src/bin/egui_gui/props_helper.c2
-rw-r--r--src/lib/ffi_abstraction.c3
-rw-r--r--src/lib/ffi_abstraction.h2
-rw-r--r--src/lib/gui_widget.c26
-rw-r--r--src/lib/gui_widget.h4
-rw-r--r--src/lib/simulator.c2
9 files changed, 153 insertions, 152 deletions
diff --git a/src/bin/egui_gui/editor.c b/src/bin/egui_gui/editor.c
index 8d42fd3..d089d54 100644
--- a/src/bin/egui_gui/editor.c
+++ b/src/bin/egui_gui/editor.c
@@ -16,7 +16,7 @@
16 16
17#include "elm_widget.h" 17#include "elm_widget.h"
18 18
19#define WIN_INFO "win_info_key" 19#define MAIN_WDG_INFO "main_wdg_info_key"
20 20
21static Gui_Context *_active_ctx = NULL; 21static Gui_Context *_active_ctx = NULL;
22static const Egui_Layout_Widgets *g; 22static const Egui_Layout_Widgets *g;
@@ -53,25 +53,25 @@ typedef enum {
53 53
54} Border_Type; 54} Border_Type;
55 55
56typedef struct _Win_Info 56typedef struct _Main_Wdg_Info
57{ 57{
58 Eo *frame; 58 Eo *frame;
59} Win_Info; 59} Main_Wdg_Info;
60 60
61static Win_Info* 61static Main_Wdg_Info*
62win_info_new() 62main_wdg_info_new()
63{ 63{
64 return calloc(1, sizeof(Win_Info)); 64 return calloc(1, sizeof(Main_Wdg_Info));
65} 65}
66 66
67static void 67static void
68win_info_frame_set(Win_Info *wi, Eo *fr) 68main_wdg_info_frame_set(Main_Wdg_Info *wi, Eo *fr)
69{ 69{
70 wi->frame = fr; 70 wi->frame = fr;
71} 71}
72 72
73static Eo* 73static Eo*
74win_info_frame_get(const Win_Info *wi) 74main_wdg_info_frame_get(const Main_Wdg_Info *wi)
75{ 75{
76 return wi->frame; 76 return wi->frame;
77} 77}
@@ -108,11 +108,11 @@ _canvas_free_coords_get(const Gui_Context *ctx, Evas_Coord x_fix, Evas_Coord y_f
108 Evas_Coord fx, fy, fw, fh; 108 Evas_Coord fx, fy, fw, fh;
109 Gui_Widget *wdg = wdg_get(wdg_id); 109 Gui_Widget *wdg = wdg_get(wdg_id);
110 if (!wdg) continue; 110 if (!wdg) continue;
111 Win_Info *wi = wdg_data_get(wdg, WIN_INFO); 111 Main_Wdg_Info *wi = wdg_data_get(wdg, MAIN_WDG_INFO);
112 if (wi) 112 if (wi)
113 { 113 {
114 eo_do(win_info_frame_get(wi), evas_obj_size_get(&fw, &fh)); 114 eo_do(main_wdg_info_frame_get(wi), evas_obj_size_get(&fw, &fh));
115 eo_do(win_info_frame_get(wi), evas_obj_position_get(&fx, &fy)); 115 eo_do(main_wdg_info_frame_get(wi), evas_obj_position_get(&fx, &fy));
116 if ((fx + fw) < (x0 + w0 - 100)) 116 if ((fx + fw) < (x0 + w0 - 100))
117 { 117 {
118 retx = fx + fw; 118 retx = fx + fw;
@@ -154,17 +154,16 @@ static Eina_Bool
154_marker_mouse_out(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info); 154_marker_mouse_out(void *data, Eo *obj, const Eo_Event_Description *desc, void *event_info);
155#define STR(par) #par 155#define STR(par) #par
156 156
157#define LINE(base_obj, id, x, y, l, w, visibility) \ 157#define LINE(id, x, y, l, w, visibility) \
158 ({\ 158 ({\
159 Eo *line = NULL;\ 159 Eo *line = NULL;\
160 eo_do(base_obj, line = eo_key_data_get(STR(id)));\ 160 eo_do(g->main_win->main_win, line = eo_key_data_get(STR(id)));\
161 if (!line)\ 161 if (!line)\
162 {\ 162 {\
163 line = eo_add(EVAS_RECTANGLE_CLASS, evas_object_evas_get(base_obj));\ 163 line = eo_add(EVAS_RECTANGLE_CLASS, g->main_win->main_win);\
164 eo_do(base_obj, eo_key_data_set(STR(id), line, NULL));\ 164 eo_do(g->main_win->main_win, eo_key_data_set(STR(id), line, NULL));\
165 eo_do(line, evas_obj_color_set(0, 255, 0, 255));\ 165 eo_do(line, evas_obj_color_set(0, 255, 0, 255));\
166 if (base_obj == canvas_get())\ 166 eo_do(evas_object_smart_parent_get(g->main_win->main_box), evas_obj_smart_member_add(line)); \
167 eo_do(evas_object_smart_parent_get(g->main_win->main_box), evas_obj_smart_member_add(line)); \
168 }\ 167 }\
169 eo_do(line, evas_obj_visibility_set(visibility));\ 168 eo_do(line, evas_obj_visibility_set(visibility));\
170 eo_do(line, evas_obj_position_set(x, y));\ 169 eo_do(line, evas_obj_position_set(x, y));\
@@ -172,22 +171,21 @@ _marker_mouse_out(void *data, Eo *obj, const Eo_Event_Description *desc, void *e
172 eo_do(line, evas_obj_raise());\ 171 eo_do(line, evas_obj_raise());\
173 }) 172 })
174 173
175#define MARKER(base_obj, id, x, y, visibility) \ 174#define MARKER(id, x, y, visibility) \
176 ({ \ 175 ({ \
177 Eo *_m = NULL;\ 176 Eo *_m = NULL;\
178 eo_do(base_obj, _m = eo_key_data_get(STR(id)));\ 177 eo_do(g->main_win->main_win, _m = eo_key_data_get(STR(id)));\
179 if (!_m)\ 178 if (!_m)\
180 {\ 179 {\
181 _m = eo_add(EVAS_RECTANGLE_CLASS, evas_object_evas_get(base_obj));\ 180 _m = eo_add(EVAS_RECTANGLE_CLASS, g->main_win->main_win);\
182 eo_do(base_obj, eo_key_data_set(STR(id), _m, NULL));\ 181 eo_do(g->main_win->main_win, eo_key_data_set(STR(id), _m, NULL));\
183 eo_do(_m, evas_obj_color_set(0, 255, 0, 255));\ 182 eo_do(_m, evas_obj_color_set(0, 255, 0, 255));\
184 eo_do(_m, evas_obj_size_set(7, 7));\ 183 eo_do(_m, evas_obj_size_set(7, 7));\
185 eo_do(_m, eo_event_callback_add(EVAS_OBJECT_EVENT_MOUSE_DOWN, _marker_mouse_down, (void *) (intptr_t) id)); \ 184 eo_do(_m, eo_event_callback_add(EVAS_OBJECT_EVENT_MOUSE_DOWN, _marker_mouse_down, (void *) (intptr_t) id)); \
186 eo_do(_m, eo_event_callback_add(EVAS_OBJECT_EVENT_MOUSE_UP, _marker_mouse_up, (void *) (intptr_t) id)); \ 185 eo_do(_m, eo_event_callback_add(EVAS_OBJECT_EVENT_MOUSE_UP, _marker_mouse_up, (void *) (intptr_t) id)); \
187 eo_do(_m, eo_event_callback_add(EVAS_OBJECT_EVENT_MOUSE_IN, _marker_mouse_in, (void *) (intptr_t) id)); \ 186 eo_do(_m, eo_event_callback_add(EVAS_OBJECT_EVENT_MOUSE_IN, _marker_mouse_in, (void *) (intptr_t) id)); \
188 eo_do(_m, eo_event_callback_add(EVAS_OBJECT_EVENT_MOUSE_OUT, _marker_mouse_out, (void *) (intptr_t) id)); \ 187 eo_do(_m, eo_event_callback_add(EVAS_OBJECT_EVENT_MOUSE_OUT, _marker_mouse_out, (void *) (intptr_t) id)); \
189 if (base_obj == canvas_get())\ 188 eo_do(evas_object_smart_parent_get(g->main_win->main_box), evas_obj_smart_member_add(_m)); \
190 eo_do(evas_object_smart_parent_get(g->main_win->main_box), evas_obj_smart_member_add(_m)); \
191 }\ 189 }\
192 eo_do(_m, evas_obj_position_set(x, y)); \ 190 eo_do(_m, evas_obj_position_set(x, y)); \
193 eo_do(_m, evas_obj_raise());\ 191 eo_do(_m, evas_obj_raise());\
@@ -197,8 +195,28 @@ _marker_mouse_out(void *data, Eo *obj, const Eo_Event_Description *desc, void *e
197/* Draws border around obj, Evas is taken from base_obj; 195/* Draws border around obj, Evas is taken from base_obj;
198 * markers and lines are saved in base_obj*/ 196 * markers and lines are saved in base_obj*/
199static void 197static void
200_border_draw(const Eo *base_obj, Eo *obj, Eina_Bool visibility) 198_wdg_border_draw(const Gui_Widget *wdg, Eina_Bool visibility)
201{ 199{
200 const Gui_Session *session = gui_context_editor_session_get(_active_context_get());
201 Eo *obj = NULL;
202 Eo *win_wdg_eo = NULL;
203 if (wdg)
204 {
205 if (IS_MAIN(wdg))
206 {
207 Main_Wdg_Info *wi = wdg_data_get(wdg, MAIN_WDG_INFO);
208 if (wi) obj = main_wdg_info_frame_get(wi);
209 }
210 else
211 {
212 const Gui_Widget *win_wdg = wdg_main_wdg_get(wdg);
213 Main_Wdg_Info *wi = wdg_data_get(win_wdg, MAIN_WDG_INFO);
214 if (wi) win_wdg_eo = main_wdg_info_frame_get(wi);
215 obj = session_eo_get(session, wdg);
216 win_wdg_eo = elm_object_content_get(win_wdg_eo);
217 }
218 }
219
202 Evas_Coord ox = 0, oy = 0, ow = 0, oh = 0, minw = 0, minh = 0; 220 Evas_Coord ox = 0, oy = 0, ow = 0, oh = 0, minw = 0, minh = 0;
203 Evas_Coord lw = 0 , lh = 0, hs = 5; 221 Evas_Coord lw = 0 , lh = 0, hs = 5;
204 222
@@ -209,12 +227,20 @@ _border_draw(const Eo *base_obj, Eo *obj, Eina_Bool visibility)
209 /* This is made, to have opportunity to pass NULL and hide border.*/ 227 /* This is made, to have opportunity to pass NULL and hide border.*/
210 if (obj) 228 if (obj)
211 { 229 {
230 Evas_Coord bx = 0, by = 0, bw = 0, bh = 0;
231 if (win_wdg_eo) eo_do(win_wdg_eo,
232 evas_obj_position_get(&bx, &by),
233 evas_obj_size_get(&bw, &bh));
234
212 eo_do(obj, evas_obj_position_get(&ox, &oy)); 235 eo_do(obj, evas_obj_position_get(&ox, &oy));
213 eo_do(obj, evas_obj_size_hint_min_get(&minw, &minh)); 236 eo_do(obj, evas_obj_size_hint_min_get(&minw, &minh));
214 eo_do(obj, evas_obj_size_get(&ow, &oh)); 237 eo_do(obj, evas_obj_size_get(&ow, &oh));
215 if (ow < minw) ow = minw; 238 if (ow < minw) ow = minw;
216 if (oh < minh) oh = minh; 239 if (oh < minh) oh = minh;
217 240
241 ox += bx;
242 oy += by;
243
218 lw = ow + 2; 244 lw = ow + 2;
219 lh = oh + 2; 245 lh = oh + 2;
220 /* Redraw border only if coords or object were changed. */ 246 /* Redraw border only if coords or object were changed. */
@@ -234,32 +260,19 @@ _border_draw(const Eo *base_obj, Eo *obj, Eina_Bool visibility)
234 } 260 }
235 } 261 }
236 262
237 LINE(base_obj, BORDER_TOP, ox - 1, oy - 1, lw, 1, visibility); 263 LINE(BORDER_TOP, ox - 1, oy - 1, lw, 1, visibility);
238 LINE(base_obj, BORDER_BOTTOM, ox - 1, oy + oh + 1, lw, 1, visibility); 264 LINE(BORDER_BOTTOM, ox - 1, oy + oh + 1, lw, 1, visibility);
239 LINE(base_obj, BORDER_RIGHT, ox + ow + 1, oy - 1, 1, lh, visibility); 265 LINE(BORDER_RIGHT, ox + ow + 1, oy - 1, 1, lh, visibility);
240 LINE(base_obj, BORDER_LEFT, ox - 1, oy - 1, 1, lh, visibility); 266 LINE(BORDER_LEFT, ox - 1, oy - 1, 1, lh, visibility);
241
242 MARKER(base_obj, BORDER_MARKER_TOP_LEFT, ox - 1 - hs - 1, oy - 1 - hs - 1, visibility);
243 MARKER(base_obj, BORDER_MARKER_TOP, ox + ow / 2 - hs / 2, oy - 1 - hs - 1, visibility);
244 MARKER(base_obj, BORDER_MARKER_TOP_RIGHT, ox + ow + 1, oy - 1 - hs - 1, visibility);
245 MARKER(base_obj, BORDER_MARKER_RIGHT, ox + ow + 1, oy + oh / 2 - hs / 2, visibility);
246 MARKER(base_obj, BORDER_MARKER_BOTTOM_RIGHT, ox + ow + 1, oy + oh + 1, visibility);
247 MARKER(base_obj, BORDER_MARKER_BOTTOM, ox + ow / 2 - hs / 2, oy + oh + 1, visibility);
248 MARKER(base_obj, BORDER_MARKER_BOTTOM_LEFT, ox - 1 - hs - 1, oy + oh + 1, visibility);
249 MARKER(base_obj, BORDER_MARKER_LEFT, ox - 1 - hs - 1 , oy + oh / 2 - hs / 2, visibility);
250}
251 267
252static void 268 MARKER(BORDER_MARKER_TOP_LEFT, ox - 1 - hs - 1, oy - 1 - hs - 1, visibility);
253_wdg_border_draw(const Gui_Widget *wdg, Eina_Bool visibility) 269 MARKER(BORDER_MARKER_TOP, ox + ow / 2 - hs / 2, oy - 1 - hs - 1, visibility);
254{ 270 MARKER(BORDER_MARKER_TOP_RIGHT, ox + ow + 1, oy - 1 - hs - 1, visibility);
255 const Gui_Session *session = gui_context_editor_session_get(_active_context_get()); 271 MARKER(BORDER_MARKER_RIGHT, ox + ow + 1, oy + oh / 2 - hs / 2, visibility);
256 Eo *obj = session_eo_get(session, wdg); 272 MARKER(BORDER_MARKER_BOTTOM_RIGHT, ox + ow + 1, oy + oh + 1, visibility);
257 if (!obj) return; 273 MARKER(BORDER_MARKER_BOTTOM, ox + ow / 2 - hs / 2, oy + oh + 1, visibility);
258 const Gui_Widget *win_wdg = wdg_parent_win_wdg_get(wdg); 274 MARKER(BORDER_MARKER_BOTTOM_LEFT, ox - 1 - hs - 1, oy + oh + 1, visibility);
259 if (!win_wdg) return; 275 MARKER(BORDER_MARKER_LEFT, ox - 1 - hs - 1 , oy + oh / 2 - hs / 2, visibility);
260 Eo *win_wdg_eo;
261 win_wdg_eo = session_eo_get(session, win_wdg);
262 _border_draw(win_wdg_eo, obj, visibility);
263} 276}
264#undef LINE 277#undef LINE
265#undef MARKER 278#undef MARKER
@@ -332,9 +345,6 @@ _frame_mouse_move(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *fr,
332 gui_value_int_set(val, oy); 345 gui_value_int_set(val, oy);
333 propview_item_update(prop); 346 propview_item_update(prop);
334 } 347 }
335
336 /* Redraw win border, when moving frame. */
337 _border_draw(canvas_get(), fr, EINA_TRUE);
338} 348}
339 349
340const Gui_Widget* 350const Gui_Widget*
@@ -354,26 +364,14 @@ _editor_wdg_selected_set(const Gui_Widget *wdg)
354 /* Hide previous border*/ 364 /* Hide previous border*/
355 if (old_wdg) 365 if (old_wdg)
356 { 366 {
357 if (IS_WIN(old_wdg)) 367 _wdg_border_draw(old_wdg, EINA_FALSE);
358 {
359 Win_Info *wi = wdg_data_get(old_wdg, WIN_INFO);
360 if (wi)
361 {
362 Eo *fr = win_info_frame_get(wi);
363 _border_draw(canvas_get(), fr, EINA_FALSE);
364 }
365 }
366 else
367 {
368 _wdg_border_draw(old_wdg, EINA_FALSE);
369 }
370 } 368 }
371 else 369 else
372 { 370 {
373 /* During context call _win_resize() will be called. 371 /* During context call _win_resize() will be called.
374 * It will draw border around win, but widget was not selected yet. 372 * It will draw border around win, but widget was not selected yet.
375 * So need to hide border. */ 373 * So need to hide border. */
376 _border_draw(canvas_get(), NULL, EINA_FALSE); 374 _wdg_border_draw(NULL, EINA_FALSE);
377 } 375 }
378 376
379 /* Show new border*/ 377 /* Show new border*/
@@ -387,17 +385,6 @@ _editor_wdg_selected_set(const Gui_Widget *wdg)
387 // eo_do(obj, evas_obj_raise()); 385 // eo_do(obj, evas_obj_raise());
388 /* Set focus */ 386 /* Set focus */
389 eo_do(obj, evas_obj_focus_set(EINA_TRUE)); 387 eo_do(obj, evas_obj_focus_set(EINA_TRUE));
390 if (IS_WIN(wdg))
391 {
392 Win_Info *wi = wdg_data_get(wdg, WIN_INFO);
393 Eo *fr = win_info_frame_get(wi);
394
395 _border_draw(canvas_get(), fr, EINA_TRUE);
396 }
397 else
398 {
399 _wdg_border_draw(wdg, EINA_TRUE);
400 }
401 } 388 }
402 else 389 else
403 { 390 {
@@ -423,12 +410,12 @@ _iter_widget_delete(Gui_Widget *wdg)
423 Eo *win_inlined_image = NULL; 410 Eo *win_inlined_image = NULL;
424 /* Each time we iterate over widgets in order to delete them, we set window's frame invisible. 411 /* Each time we iterate over widgets in order to delete them, we set window's frame invisible.
425 * DUring creation it will be visible again. Frame deleted only when project is closed. */ 412 * DUring creation it will be visible again. Frame deleted only when project is closed. */
426 if (IS_WIN(wdg)) 413 if (IS_MAIN(wdg))
427 { 414 {
428 Win_Info *wi = wdg_data_get(wdg, WIN_INFO); 415 Main_Wdg_Info *wi = wdg_data_get(wdg, MAIN_WDG_INFO);
429 if (wi) 416 if (wi)
430 { 417 {
431 Eo *fr = win_info_frame_get(wi); 418 Eo *fr = main_wdg_info_frame_get(wi);
432 if (fr) 419 if (fr)
433 { 420 {
434 win_inlined_image = elm_object_content_unset(fr); 421 win_inlined_image = elm_object_content_unset(fr);
@@ -502,11 +489,11 @@ _marker_mouse_move(void *data, Eo *marker EINA_UNUSED, const Eo_Event_Descriptio
502 * base object is win's Eo for widget, 489 * base object is win's Eo for widget,
503 * and canvas(main window) for frame. */ 490 * and canvas(main window) for frame. */
504 const Eo *base_obj; 491 const Eo *base_obj;
505 if (IS_WIN(wdg)) 492 if (IS_MAIN(wdg))
506 { 493 {
507 base_obj = canvas_get(); 494 base_obj = canvas_get();
508 Win_Info *wi = wdg_data_get(wdg, WIN_INFO); 495 Main_Wdg_Info *wi = wdg_data_get(wdg, MAIN_WDG_INFO);
509 weo = win_info_frame_get(wi); 496 weo = main_wdg_info_frame_get(wi);
510 497
511 /* When resizing frame, we need to get min width and height form window. 498 /* When resizing frame, we need to get min width and height form window.
512 * And don't forget deltas*/ 499 * And don't forget deltas*/
@@ -520,7 +507,7 @@ _marker_mouse_move(void *data, Eo *marker EINA_UNUSED, const Eo_Event_Descriptio
520 } 507 }
521 else 508 else
522 { 509 {
523 const Gui_Widget *win_wdg = wdg_parent_win_wdg_get(wdg); 510 const Gui_Widget *win_wdg = wdg_main_wdg_get(wdg);
524 base_obj = session_eo_get(session, win_wdg); 511 base_obj = session_eo_get(session, win_wdg);
525 /* Eo object of widget. */ 512 /* Eo object of widget. */
526 weo = session_eo_get(session, wdg); 513 weo = session_eo_get(session, wdg);
@@ -569,7 +556,7 @@ _marker_mouse_move(void *data, Eo *marker EINA_UNUSED, const Eo_Event_Descriptio
569 eo_do(weo, evas_obj_position_set(ox, oy)); 556 eo_do(weo, evas_obj_position_set(ox, oy));
570 eo_do(weo, evas_obj_size_set(ow, oh)); 557 eo_do(weo, evas_obj_size_set(ow, oh));
571 558
572 if (IS_WIN(wdg)) 559 if (IS_MAIN(wdg))
573 { 560 {
574 Gui_Widget_Property *prop; 561 Gui_Widget_Property *prop;
575 Gui_Value *val; 562 Gui_Value *val;
@@ -648,13 +635,13 @@ _marker_mouse_in(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_Des
648 const Gui_Widget *wdg = _editor_wdg_selected_get(); 635 const Gui_Widget *wdg = _editor_wdg_selected_get();
649 636
650 const Eo *base_obj; 637 const Eo *base_obj;
651 if (IS_WIN(wdg)) 638 if (IS_MAIN(wdg))
652 { 639 {
653 base_obj = canvas_get(); 640 base_obj = canvas_get();
654 } 641 }
655 else 642 else
656 { 643 {
657 const Gui_Widget *win_wdg = wdg_parent_win_wdg_get(wdg); 644 const Gui_Widget *win_wdg = wdg_main_wdg_get(wdg);
658 base_obj = session_eo_get(session, win_wdg); 645 base_obj = session_eo_get(session, win_wdg);
659 } 646 }
660 647
@@ -696,13 +683,13 @@ _marker_mouse_out(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, const Eo_Event_De
696 const Gui_Widget *wdg = _editor_wdg_selected_get(); 683 const Gui_Widget *wdg = _editor_wdg_selected_get();
697 684
698 const Eo *base_obj; 685 const Eo *base_obj;
699 if (IS_WIN(wdg)) 686 if (IS_MAIN(wdg))
700 { 687 {
701 base_obj = canvas_get(); 688 base_obj = canvas_get();
702 } 689 }
703 else 690 else
704 { 691 {
705 const Gui_Widget *win_wdg = wdg_parent_win_wdg_get(wdg); 692 const Gui_Widget *win_wdg = wdg_main_wdg_get(wdg);
706 const Gui_Session *session = gui_context_editor_session_get(_active_context_get()); 693 const Gui_Session *session = gui_context_editor_session_get(_active_context_get());
707 base_obj = session_eo_get(session, win_wdg); 694 base_obj = session_eo_get(session, win_wdg);
708 } 695 }
@@ -855,9 +842,12 @@ _win_resize(void *data EINA_UNUSED, Eo *o, const Eo_Event_Description *desc EINA
855 if (ow < minw) ow = minw; 842 if (ow < minw) ow = minw;
856 if (oh < minh) oh = minh; 843 if (oh < minh) oh = minh;
857 844
858 Eo *inwin_img = elm_win_inlined_image_object_get(o); 845 if (eo_isa(o, ELM_WIN_CLASS))
859 /* FIXME: comment it? */ 846 {
860 eo_do(inwin_img, evas_obj_size_set(ow, oh)); 847 Eo *inwin_img = elm_win_inlined_image_object_get(o);
848 /* FIXME: comment it? */
849 eo_do(inwin_img, evas_obj_size_set(ow, oh));
850 }
861 eo_do(o, fr = eo_key_data_get("frame")); 851 eo_do(o, fr = eo_key_data_get("frame"));
862 852
863 intptr_t dw, dh; 853 intptr_t dw, dh;
@@ -865,7 +855,6 @@ _win_resize(void *data EINA_UNUSED, Eo *o, const Eo_Event_Description *desc EINA
865 eo_do(fr, dh = (intptr_t) eo_key_data_get("dh")); 855 eo_do(fr, dh = (intptr_t) eo_key_data_get("dh"));
866 eo_do(fr, evas_obj_size_set(ow + dw, oh + dh)); 856 eo_do(fr, evas_obj_size_set(ow + dw, oh + dh));
867 857
868 _border_draw(canvas_get(), fr, EINA_TRUE);
869 return EO_CALLBACK_CONTINUE; 858 return EO_CALLBACK_CONTINUE;
870} 859}
871 860
@@ -874,7 +863,7 @@ _widget_prop_add(Gui_Session *session, const Gui_Widget *wdg, const Gui_Widget_P
874{ 863{
875 Eina_Bool ret = _ffi_eo_do(session, wdg, prop); 864 Eina_Bool ret = _ffi_eo_do(session, wdg, prop);
876 865
877 if (IS_WIN(wdg)) 866 if (IS_MAIN(wdg) && IS_WIN(wdg))
878 { 867 {
879 Eo *fr = NULL, *o = session_eo_get(session, wdg); 868 Eo *fr = NULL, *o = session_eo_get(session, wdg);
880 eo_do(o, fr = eo_key_data_get("frame")); 869 eo_do(o, fr = eo_key_data_get("frame"));
@@ -979,9 +968,9 @@ static Eina_Bool
979_widget_add(Gui_Session *session, const Gui_Widget *wdg, void *data) 968_widget_add(Gui_Session *session, const Gui_Widget *wdg, void *data)
980{ 969{
981 Eo *o; 970 Eo *o;
982 if (!IS_WIN(wdg)) 971 if (!IS_MAIN(wdg))
983 { 972 {
984 o = _ffi_eo_add(session, wdg); 973 o = _ffi_eo_add(session, wdg, NULL);
985 if (!o) return EINA_FALSE; 974 if (!o) return EINA_FALSE;
986 evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN, _key_down, wdg_context_get(wdg)); 975 evas_object_event_callback_add(o, EVAS_CALLBACK_KEY_DOWN, _key_down, wdg_context_get(wdg));
987 evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, wdg_context_get(wdg)); 976 evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _mouse_down, wdg_context_get(wdg));
@@ -1008,14 +997,22 @@ _widget_add(Gui_Session *session, const Gui_Widget *wdg, void *data)
1008 } 997 }
1009 */ 998 */
1010 999
1011 o = eo_add(ELM_WIN_CLASS, parent_win, elm_obj_win_constructor(NULL, ELM_WIN_INLINED_IMAGE)); 1000 Eo *io = NULL;
1001 if (IS_WIN(wdg))
1002 o = eo_add(ELM_WIN_CLASS, parent_win, elm_obj_win_constructor(NULL, ELM_WIN_INLINED_IMAGE));
1003 else
1004 o = _ffi_eo_add(session, wdg, parent_win);
1012 1005
1013 if (!o) return EINA_FALSE; 1006 if (!o) return EINA_FALSE;
1014 1007
1015 Eo *io = elm_win_inlined_image_object_get(o); 1008 if (IS_WIN(wdg))
1016 eo_do(io, evas_obj_propagate_events_set(EINA_FALSE)); 1009 {
1010 io = elm_win_inlined_image_object_get(o);
1011 eo_do(io, evas_obj_propagate_events_set(EINA_FALSE));
1012 }
1013 else io = o;
1017 1014
1018 Win_Info *wi = wdg_data_get(wdg, WIN_INFO); 1015 Main_Wdg_Info *wi = wdg_data_get(wdg, MAIN_WDG_INFO);
1019 1016
1020 if (!wi) 1017 if (!wi)
1021 { 1018 {
@@ -1032,14 +1029,18 @@ _widget_add(Gui_Session *session, const Gui_Widget *wdg, void *data)
1032 _canvas_free_coords_get(wdg_context_get(wdg), x_par, y_par, &x, &y); 1029 _canvas_free_coords_get(wdg_context_get(wdg), x_par, y_par, &x, &y);
1033 eo_do(fr, evas_obj_position_set(x, y)); 1030 eo_do(fr, evas_obj_position_set(x, y));
1034 1031
1035 wi = win_info_new(); 1032 wi = main_wdg_info_new();
1036 win_info_frame_set(wi, fr); 1033 main_wdg_info_frame_set(wi, fr);
1037 wdg_data_set(wdg, WIN_INFO, wi); 1034 wdg_data_set(wdg, MAIN_WDG_INFO, wi);
1038 1035
1039 1036
1040 //evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 1037 //evas_object_size_hint_weight_set(fr, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1041 //evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL); 1038 //evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
1042 elm_object_text_set(fr, elm_win_title_get(o)); 1039 const char *fr_title = wdg_name_get(wdg);
1040 if (IS_WIN(wdg))
1041 fr_title = elm_win_title_get(o);
1042
1043 elm_object_text_set(fr, fr_title);
1043 eo_do(fr, 1044 eo_do(fr,
1044 evas_obj_visibility_set(EINA_TRUE), 1045 evas_obj_visibility_set(EINA_TRUE),
1045 elm_obj_frame_autocollapse_set(EINA_TRUE)); 1046 elm_obj_frame_autocollapse_set(EINA_TRUE));
@@ -1048,7 +1049,7 @@ _widget_add(Gui_Session *session, const Gui_Widget *wdg, void *data)
1048 eo_do(fr, eo_event_callback_add(EVAS_OBJECT_EVENT_MOUSE_UP, _frame_mouse_up, NULL)); 1049 eo_do(fr, eo_event_callback_add(EVAS_OBJECT_EVENT_MOUSE_UP, _frame_mouse_up, NULL));
1049 eo_do(fr, eo_key_data_set("winwdg", wdg, NULL)); 1050 eo_do(fr, eo_key_data_set("winwdg", wdg, NULL));
1050 } 1051 }
1051 fr = win_info_frame_get(wi); 1052 fr = main_wdg_info_frame_get(wi);
1052 eo_do(fr, evas_obj_visibility_set(EINA_TRUE)); 1053 eo_do(fr, evas_obj_visibility_set(EINA_TRUE));
1053 eo_do(o, eo_key_data_set("frame", fr, NULL)); 1054 eo_do(o, eo_key_data_set("frame", fr, NULL));
1054 elm_object_content_set(fr, io); 1055 elm_object_content_set(fr, io);
@@ -1120,14 +1121,14 @@ _editor_widget_clear(Gui_Widget *wdg)
1120static void 1121static void
1121_wdg_parent_win_reload(const Gui_Widget *wdg) 1122_wdg_parent_win_reload(const Gui_Widget *wdg)
1122{ 1123{
1123 Gui_Widget *pwin = (Gui_Widget *) wdg_parent_win_wdg_get(wdg); 1124 Gui_Widget *pwin = (Gui_Widget *) wdg_main_wdg_get(wdg);
1124 if (!pwin) return; 1125 if (!pwin) return;
1125 /* Remove all Eo of current window. */ 1126 /* Remove all Eo of current window. */
1126 _editor_widget_clear(pwin); 1127 _editor_widget_clear(pwin);
1127 /* Create window from beginning. */ 1128 /* Create window from beginning. */
1128 _iter_widget_create(pwin, canvas_get()); 1129 _iter_widget_create(pwin, canvas_get());
1129 /* Hide border of window, which is drawn when win is recreated and resized */ 1130 /* Hide border of window, which is drawn when win is recreated and resized */
1130 _border_draw(canvas_get(), NULL, EINA_FALSE); 1131 _wdg_border_draw(NULL, EINA_FALSE);
1131} 1132}
1132 1133
1133static void 1134static void
@@ -1556,12 +1557,11 @@ _editor_selected_wdg_del_cb()
1556} 1557}
1557 1558
1558static void 1559static void
1559_editor_factory_wdg_create(const char *class_name) 1560_editor_factory_wdg_create(const char *class_name, const Gui_Widget *focused_wdg)
1560{ 1561{
1561 const Gui_Widget *parent_win = NULL; 1562 const Gui_Widget *parent_win = NULL;
1562 const char *parent_name = NULL; 1563 const char *parent_name = NULL;
1563 Gui_Widget *wdg; 1564 Gui_Widget *wdg;
1564 const Gui_Widget *focused_wdg = _editor_wdg_selected_get();
1565 const Gui_Context *ctx = _active_context_get(); 1565 const Gui_Context *ctx = _active_context_get();
1566 Gui_Session *session = (Gui_Session *) gui_context_editor_session_get(ctx); 1566 Gui_Session *session = (Gui_Session *) gui_context_editor_session_get(ctx);
1567 1567
@@ -1571,19 +1571,24 @@ _editor_factory_wdg_create(const char *class_name)
1571 return; 1571 return;
1572 } 1572 }
1573 1573
1574 /*If adding non window widget*/
1575 if (strcmp(class_name, DB_DEF_WIN_CLASS))
1576 {
1577 if (!focused_wdg) return;
1578 parent_win = wdg_parent_win_wdg_get(focused_wdg);
1579 parent_name = wdg_name_get(parent_win);
1580 }
1581
1582 char *new_name = gui_context_free_name_get(ctx, class_name); 1574 char *new_name = gui_context_free_name_get(ctx, class_name);
1583 1575
1584 Dep_Id *dep_id = gui_context_dep_data_set(ctx, new_name, DEP_TYPE_WIDGET); 1576 Dep_Id *dep_id = gui_context_dep_data_set(ctx, new_name, DEP_TYPE_WIDGET);
1585 wdg = wdg_new((Gui_Context *) ctx, class_name, dep_id); 1577 wdg = wdg_new((Gui_Context *) ctx, class_name, dep_id);
1586 free(new_name); 1578 free(new_name);
1579
1580 /* If a widget is selected during creation */
1581 if (focused_wdg)
1582 {
1583 parent_win = wdg_main_wdg_get(focused_wdg);
1584 /* FIXME: We have to check the parent validity. This is not fully operational.
1585 * What happens is that button, check... can be containers and so be considered
1586 * as parents. We need to find a way to forbid that.
1587 */
1588 if (IS_WIN(wdg) || (!IS_WIN(parent_win) && !IS_CONTAINER(parent_win))) parent_win = NULL;
1589 else parent_name = wdg_name_get(parent_win);
1590 }
1591
1587 wdg_parent_set(wdg, parent_name); 1592 wdg_parent_set(wdg, parent_name);
1588 1593
1589 Gui_Memento *memento; 1594 Gui_Memento *memento;
@@ -1666,7 +1671,7 @@ _editor_factory_wdg_create(const char *class_name)
1666 eina_list_free(kl_list); 1671 eina_list_free(kl_list);
1667 1672
1668 Eo *pw = NULL; 1673 Eo *pw = NULL;
1669 if (IS_WIN(wdg)) pw = (Eo *)canvas_get(); 1674 if (!parent_win) pw = (Eo *)canvas_get();
1670 manager_widget_create(session, wdg, MODE_EDITOR, pw); 1675 manager_widget_create(session, wdg, MODE_EDITOR, pw);
1671 1676
1672 _editor_wdg_selected_set(wdg); 1677 _editor_wdg_selected_set(wdg);
@@ -1842,7 +1847,7 @@ _prop_update_from_propview(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Descr
1842 /* Special case, change widget's parent if property : RESIZE_OBJECT_ADD */ 1847 /* Special case, change widget's parent if property : RESIZE_OBJECT_ADD */
1843 if (!strcmp(db_op_desc_op_name_get(op), RESIZE_OBJECT_ADD)) 1848 if (!strcmp(db_op_desc_op_name_get(op), RESIZE_OBJECT_ADD))
1844 { 1849 {
1845 const Gui_Widget* parent_win = wdg_parent_win_wdg_get(new_param_wdg); 1850 const Gui_Widget* parent_win = wdg_main_wdg_get(new_param_wdg);
1846 if (cur_param_wdg) 1851 if (cur_param_wdg)
1847 { 1852 {
1848 wdg_parent_set(cur_param_wdg, wdg_name_get(parent_win)); 1853 wdg_parent_set(cur_param_wdg, wdg_name_get(parent_win));
@@ -1918,7 +1923,7 @@ _prop_update_from_propview(void *data EINA_UNUSED, Eo *obj, const Eo_Event_Descr
1918 else 1923 else
1919 { 1924 {
1920 /* Don't do anything with win if prop is VISIBILITY*/ 1925 /* Don't do anything with win if prop is VISIBILITY*/
1921 if (IS_WIN(wdg) && (!strcmp(prop_name_get(prop), VISIBILITY_SET))) 1926 if (IS_MAIN(wdg) && (!strcmp(prop_name_get(prop), VISIBILITY_SET)))
1922 { 1927 {
1923 } 1928 }
1924 else 1929 else
@@ -1956,7 +1961,7 @@ _prop_del_from_propview(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Descript
1956 Gui_Widget *param_wdg = wdg_get(dep_id); 1961 Gui_Widget *param_wdg = wdg_get(dep_id);
1957 if (param_wdg) 1962 if (param_wdg)
1958 { 1963 {
1959 const Gui_Widget *parent_win = wdg_parent_win_wdg_get(param_wdg); 1964 const Gui_Widget *parent_win = wdg_main_wdg_get(param_wdg);
1960 /* Do it to update list. */ 1965 /* Do it to update list. */
1961 wdg_parent_set(param_wdg, wdg_name_get(parent_win)); 1966 wdg_parent_set(param_wdg, wdg_name_get(parent_win));
1962 objtree_item_selected_set(wdg); 1967 objtree_item_selected_set(wdg);
@@ -2310,7 +2315,7 @@ _content_del_from_propview(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Descr
2310 * Set parent window as parent for widget. */ 2315 * Set parent window as parent for widget. */
2311 if (param_wdg) 2316 if (param_wdg)
2312 { 2317 {
2313 const Gui_Widget *parent_win = wdg_parent_win_wdg_get(param_wdg); 2318 const Gui_Widget *parent_win = wdg_main_wdg_get(param_wdg);
2314 /* Do it to update list. */ 2319 /* Do it to update list. */
2315 wdg_parent_set(param_wdg, wdg_name_get(parent_win)); 2320 wdg_parent_set(param_wdg, wdg_name_get(parent_win));
2316 objtree_item_selected_set(wdg); 2321 objtree_item_selected_set(wdg);
@@ -2641,7 +2646,7 @@ _project_close(const Gui_Context *ctx)
2641 _editor_wdg_selected_set(NULL); 2646 _editor_wdg_selected_set(NULL);
2642 _editor_layout_clear(_active_ctx); 2647 _editor_layout_clear(_active_ctx);
2643 2648
2644 /* Iterate over windows and delete Win_Info */ 2649 /* Iterate over windows and delete Main_Wdg_Info */
2645 Eina_List *list, *itr, *itr2; 2650 Eina_List *list, *itr, *itr2;
2646 Dep_Id *wdg_id; 2651 Dep_Id *wdg_id;
2647 list = gui_context_main_widgets_get(_active_ctx); 2652 list = gui_context_main_widgets_get(_active_ctx);
@@ -2650,7 +2655,7 @@ _project_close(const Gui_Context *ctx)
2650 Gui_Widget *wdg = wdg_get(wdg_id); 2655 Gui_Widget *wdg = wdg_get(wdg_id);
2651 if (wdg) 2656 if (wdg)
2652 { 2657 {
2653 Win_Info *wi = wdg_data_get(wdg, WIN_INFO); 2658 Main_Wdg_Info *wi = wdg_data_get(wdg, MAIN_WDG_INFO);
2654 eo_del(wi->frame); 2659 eo_del(wi->frame);
2655 free(wi); 2660 free(wi);
2656 } 2661 }
@@ -2734,7 +2739,7 @@ Eina_Bool
2734_wdg_border_draw_on_idle(void *data EINA_UNUSED) 2739_wdg_border_draw_on_idle(void *data EINA_UNUSED)
2735{ 2740{
2736 const Gui_Widget *wdg = _editor_wdg_selected_get(); 2741 const Gui_Widget *wdg = _editor_wdg_selected_get();
2737 if (wdg && !IS_WIN(wdg)) 2742 if (wdg)
2738 { 2743 {
2739 _wdg_border_draw(wdg, EINA_TRUE); 2744 _wdg_border_draw(wdg, EINA_TRUE);
2740 } 2745 }
@@ -2775,6 +2780,7 @@ editor_init(GuiLogicCbs *_guilogic_cbs)
2775 _guilogic_cbs->_editor_ctx_call = _editor_ctx_call; 2780 _guilogic_cbs->_editor_ctx_call = _editor_ctx_call;
2776 _guilogic_cbs->_editor_selected_wdg_del_cb = _editor_selected_wdg_del_cb; 2781 _guilogic_cbs->_editor_selected_wdg_del_cb = _editor_selected_wdg_del_cb;
2777 _guilogic_cbs->_editor_factory_wdg_create = _editor_factory_wdg_create; 2782 _guilogic_cbs->_editor_factory_wdg_create = _editor_factory_wdg_create;
2783 _guilogic_cbs->_editor_selected_wdg_get = _editor_wdg_selected_get;
2778 _guilogic_cbs->_project_close = _project_close; 2784 _guilogic_cbs->_project_close = _project_close;
2779 _guilogic_cbs->_project_new = _project_new; 2785 _guilogic_cbs->_project_new = _project_new;
2780 2786
diff --git a/src/bin/egui_gui/egui_logic.c b/src/bin/egui_gui/egui_logic.c
index c65f24a..836b25a 100644
--- a/src/bin/egui_gui/egui_logic.c
+++ b/src/bin/egui_gui/egui_logic.c
@@ -60,7 +60,7 @@ enum
60 FACTORY_VIEW_SWITCH 60 FACTORY_VIEW_SWITCH
61}; 61};
62 62
63const Eo * 63Eo *
64canvas_get() 64canvas_get()
65{ 65{
66 return g->main_win->main_win; 66 return g->main_win->main_win;
@@ -411,7 +411,8 @@ Eina_Bool
411_on_factory_item_down(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED) 411_on_factory_item_down(void *data, Eo *obj EINA_UNUSED, const Eo_Event_Description *desc EINA_UNUSED, void *event_info EINA_UNUSED)
412{ 412{
413 const char *class_name = data; 413 const char *class_name = data;
414 _guilogic_cbs->_editor_factory_wdg_create(class_name); 414 _guilogic_cbs->_editor_factory_wdg_create(class_name,
415 _guilogic_cbs->_editor_selected_wdg_get());
415 return EO_CALLBACK_CONTINUE; 416 return EO_CALLBACK_CONTINUE;
416} 417}
417 418
diff --git a/src/bin/egui_gui/egui_logic_private.h b/src/bin/egui_gui/egui_logic_private.h
index d51efde..bf978ae 100644
--- a/src/bin/egui_gui/egui_logic_private.h
+++ b/src/bin/egui_gui/egui_logic_private.h
@@ -14,7 +14,8 @@ typedef struct
14 Eina_Bool (*_layout_clear)(const Gui_Context *ctx); 14 Eina_Bool (*_layout_clear)(const Gui_Context *ctx);
15 Eina_Bool (*_editor_ctx_call)(const Gui_Context *ctx); 15 Eina_Bool (*_editor_ctx_call)(const Gui_Context *ctx);
16 void (*_editor_selected_wdg_del_cb)(); 16 void (*_editor_selected_wdg_del_cb)();
17 void (*_editor_factory_wdg_create)(const char *class_name); 17 void (*_editor_factory_wdg_create)(const char *class_name, const Gui_Widget *focused_wdg);
18 const Gui_Widget *(*_editor_selected_wdg_get)();
18 19
19 void (*_project_close)(const Gui_Context *ctx); 20 void (*_project_close)(const Gui_Context *ctx);
20 Eina_Bool (*_project_new)(const char *filename); 21 Eina_Bool (*_project_new)(const char *filename);
@@ -29,7 +30,7 @@ _active_context_set(Gui_Context *ctx);
29Gui_Context * 30Gui_Context *
30_active_context_get(); 31_active_context_get();
31 32
32const Eo * 33Eo *
33canvas_get(); 34canvas_get();
34 35
35GuiLogicCbs * 36GuiLogicCbs *
diff --git a/src/bin/egui_gui/props_helper.c b/src/bin/egui_gui/props_helper.c
index 8774fcd..154dad2 100644
--- a/src/bin/egui_gui/props_helper.c
+++ b/src/bin/egui_gui/props_helper.c
@@ -134,7 +134,7 @@ props_hoversel_objects_add(Eo *box, Eo *hover_parent, const char *default_val, c
134 Gui_Widget *w = wdg_get(wid); 134 Gui_Widget *w = wdg_get(wid);
135 if (!w) continue; 135 if (!w) continue;
136 if (!wdg || ((w != wdg) && 136 if (!wdg || ((w != wdg) &&
137 (wdg_parent_win_wdg_get(wdg) == wdg_parent_win_wdg_get(w)) && 137 (wdg_main_wdg_get(wdg) == wdg_main_wdg_get(w)) &&
138 (!IS_WIN(w)))) 138 (!IS_WIN(w))))
139 { 139 {
140 /* w - iterated widget; 140 /* w - iterated widget;
diff --git a/src/lib/ffi_abstraction.c b/src/lib/ffi_abstraction.c
index 42c6981..23d7eda 100644
--- a/src/lib/ffi_abstraction.c
+++ b/src/lib/ffi_abstraction.c
@@ -267,14 +267,13 @@ end:
267} 267}
268 268
269Eo* 269Eo*
270_ffi_eo_add(const Gui_Session *session, const Gui_Widget *wdg) 270_ffi_eo_add(const Gui_Session *session, const Gui_Widget *wdg, Eo *parent_eo)
271{ 271{
272 Eina_Stringshare *class_id; 272 Eina_Stringshare *class_id;
273 char *constr_id = NULL; 273 char *constr_id = NULL;
274 const Eo_Class *kl; 274 const Eo_Class *kl;
275 Eo *ret = NULL; 275 Eo *ret = NULL;
276 276
277 Eo *parent_eo = NULL;
278 const Gui_Widget *parent_wdg = NULL; 277 const Gui_Widget *parent_wdg = NULL;
279 278
280 if (!strcmp(wdg_class_name_get(wdg), DB_DEF_MENU_CLASS)) 279 if (!strcmp(wdg_class_name_get(wdg), DB_DEF_MENU_CLASS))
diff --git a/src/lib/ffi_abstraction.h b/src/lib/ffi_abstraction.h
index 872571d..4eab9d7 100644
--- a/src/lib/ffi_abstraction.h
+++ b/src/lib/ffi_abstraction.h
@@ -13,7 +13,7 @@ Eina_Bool
13_ffi_eo_do_content(const Gui_Session *session, const Gui_Widget *wdg, const Gui_Widget_Property *prop, const Op_Desc *op_desc); 13_ffi_eo_do_content(const Gui_Session *session, const Gui_Widget *wdg, const Gui_Widget_Property *prop, const Op_Desc *op_desc);
14 14
15Eo* 15Eo*
16_ffi_eo_add(const Gui_Session *session, const Gui_Widget *wdg); 16_ffi_eo_add(const Gui_Session *session, const Gui_Widget *wdg, Eo *parent_eo);
17 17
18Elm_Object_Item* 18Elm_Object_Item*
19_ffi_eo_item_add(const Gui_Session *session, const Gui_Widget *wdg, const Item_Container_Item *item, void *data); 19_ffi_eo_item_add(const Gui_Session *session, const Gui_Widget *wdg, const Item_Container_Item *item, void *data);
diff --git a/src/lib/gui_widget.c b/src/lib/gui_widget.c
index b870838..295cd0a 100644
--- a/src/lib/gui_widget.c
+++ b/src/lib/gui_widget.c
@@ -1388,22 +1388,14 @@ wdg_parent_set(Gui_Widget *wdg, const char *parent_name)
1388} 1388}
1389 1389
1390const Gui_Widget* 1390const Gui_Widget*
1391wdg_parent_win_wdg_get(const Gui_Widget *wdg) 1391wdg_main_wdg_get(const Gui_Widget *wdg)
1392{ 1392{
1393 EINA_SAFETY_ON_NULL_RETURN_VAL(wdg, NULL); 1393 EINA_SAFETY_ON_NULL_RETURN_VAL(wdg, NULL);
1394 if (IS_WIN(wdg)) 1394 do {
1395 { 1395 const Gui_Widget *parent = wdg_parent_get(wdg);
1396 return wdg; 1396 if (!parent) return wdg;
1397 } 1397 else wdg = parent;
1398 else 1398 } while (EINA_TRUE);
1399 {
1400 const Gui_Widget *parent= wdg_parent_get(wdg);
1401 while (parent)
1402 {
1403 if (IS_WIN(parent)) return parent;
1404 parent = wdg_parent_get(parent);
1405 }
1406 }
1407 return NULL; 1399 return NULL;
1408} 1400}
1409 1401
@@ -1556,7 +1548,7 @@ wdg_obj_container_item_remove(const Gui_Widget *wdg, Object_Container_Item *ci)
1556 Gui_Widget *w = wdg_get(dep_id); 1548 Gui_Widget *w = wdg_get(dep_id);
1557 if (w) 1549 if (w)
1558 { 1550 {
1559 const Gui_Widget *parent_win = wdg_parent_win_wdg_get(w); 1551 const Gui_Widget *parent_win = wdg_main_wdg_get(w);
1560 wdg_parent_set(w, wdg_name_get(parent_win)); 1552 wdg_parent_set(w, wdg_name_get(parent_win));
1561 } 1553 }
1562} 1554}
@@ -1652,7 +1644,7 @@ wdg_obj_container_unset(Gui_Widget *wdg)
1652 if (dep_id) w = wdg_get(dep_id); 1644 if (dep_id) w = wdg_get(dep_id);
1653 if (w) 1645 if (w)
1654 { 1646 {
1655 const Gui_Widget *parent_win = wdg_parent_win_wdg_get(w); 1647 const Gui_Widget *parent_win = wdg_main_wdg_get(w);
1656 wdg_parent_set(w, wdg_name_get(parent_win)); 1648 wdg_parent_set(w, wdg_name_get(parent_win));
1657 } 1649 }
1658 } 1650 }
@@ -1796,7 +1788,7 @@ Eina_Bool
1796wdg_is_content_of(const Gui_Widget *container, const Gui_Widget *wdg) 1788wdg_is_content_of(const Gui_Widget *container, const Gui_Widget *wdg)
1797{ 1789{
1798 const Gui_Widget *c; 1790 const Gui_Widget *c;
1799 if (container == wdg_parent_win_wdg_get(wdg)) return EINA_TRUE; 1791 if (container == wdg_main_wdg_get(wdg)) return EINA_TRUE;
1800 c = wdg_parent_get(wdg); 1792 c = wdg_parent_get(wdg);
1801 while (c) 1793 while (c)
1802 { 1794 {
diff --git a/src/lib/gui_widget.h b/src/lib/gui_widget.h
index 640512f..66608cb 100644
--- a/src/lib/gui_widget.h
+++ b/src/lib/gui_widget.h
@@ -33,6 +33,8 @@ typedef struct _Item_Container_Item Item_Container_Item;
33 33
34#define GUI_VALUE(val) ((Gui_Value *) (val)) 34#define GUI_VALUE(val) ((Gui_Value *) (val))
35 35
36#define IS_MAIN(wdg) ((wdg) && !wdg_parent_get(wdg))
37
36#define IS_WIN(wdg) ((wdg) && !strcmp(DB_DEF_WIN_CLASS, wdg_class_name_get((wdg)))) 38#define IS_WIN(wdg) ((wdg) && !strcmp(DB_DEF_WIN_CLASS, wdg_class_name_get((wdg))))
37#define IS_LAYOUT(wdg) ((wdg) && !strcmp(DB_DEF_LAYOUT_CLASS, wdg_class_name_get((wdg)))) 39#define IS_LAYOUT(wdg) ((wdg) && !strcmp(DB_DEF_LAYOUT_CLASS, wdg_class_name_get((wdg))))
38 40
@@ -391,7 +393,7 @@ Eina_Bool
391wdg_parent_set(Gui_Widget *wdg, const char *parent_name); 393wdg_parent_set(Gui_Widget *wdg, const char *parent_name);
392 394
393const Gui_Widget* 395const Gui_Widget*
394wdg_parent_win_wdg_get(const Gui_Widget *wdg); 396wdg_main_wdg_get(const Gui_Widget *wdg);
395 397
396void 398void
397wdg_parent_resolve(Gui_Widget *wdg); 399wdg_parent_resolve(Gui_Widget *wdg);
diff --git a/src/lib/simulator.c b/src/lib/simulator.c
index 8e4bb22..9ac4462 100644
--- a/src/lib/simulator.c
+++ b/src/lib/simulator.c
@@ -131,7 +131,7 @@ _widget_add(Gui_Session *session, const Gui_Widget *wdg, void *data EINA_UNUSED)
131 Eo *o = NULL; 131 Eo *o = NULL;
132 if (!IS_WIN(wdg)) 132 if (!IS_WIN(wdg))
133 { 133 {
134 o = _ffi_eo_add(session, wdg); 134 o = _ffi_eo_add(session, wdg, NULL);
135 } 135 }
136 else 136 else
137 { 137 {