1 #include <Elementary.h>
7 * The window class of Elementary. Contains functions to manipulate
10 * Signals that you can add callbacks for are:
12 * "delete,request" - the user requested to delete the window
13 * "focus,in" - window got focus
14 * "focus,out" - window lost focus
15 * "moved" - window that holds the canvas was moved
18 typedef struct _Elm_Win Elm_Win;
24 Evas_Object *parent, *win_obj, *img_obj, *frame_obj;
26 #ifdef HAVE_ELEMENTARY_X
28 Ecore_Event_Handler *client_message_handler;
30 Ecore_Job *deferred_resize_job;
31 Ecore_Job *deferred_child_eval_job;
34 Elm_Win_Keyboard_Mode kbdmode;
35 Eina_Bool autodel : 1;
36 int *autodel_clear, rot;
46 Eina_Bool visible : 1;
47 Eina_Bool handled : 1;
51 Ecore_Job *reconf_job;
53 Eina_Bool enabled : 1;
54 Eina_Bool changed_theme : 1;
55 Eina_Bool top_animate : 1;
56 Eina_Bool geometry_changed : 1;
60 static const char *widtype = NULL;
61 static void _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
62 static void _elm_win_obj_callback_img_obj_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
63 static void _elm_win_obj_callback_parent_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
64 static void _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y);
65 static void _elm_win_obj_intercept_show(void *data, Evas_Object *obj);
66 static void _elm_win_move(Ecore_Evas *ee);
67 static void _elm_win_resize(Ecore_Evas *ee);
68 static void _elm_win_delete_request(Ecore_Evas *ee);
69 static void _elm_win_resize_job(void *data);
70 #ifdef HAVE_ELEMENTARY_X
71 static void _elm_win_xwin_update(Elm_Win *win);
73 static void _elm_win_eval_subobjs(Evas_Object *obj);
74 static void _elm_win_subobj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info);
75 static void _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
76 static void _elm_win_focus_highlight_init(Elm_Win *win);
77 static void _elm_win_focus_highlight_shutdown(Elm_Win *win);
78 static void _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible);
79 static void _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win);
80 static void _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win);
81 static void _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission, const char *source);
82 static void _elm_win_focus_highlight_reconfigure(Elm_Win *win);
84 Eina_List *_elm_win_list = NULL;
85 int _elm_win_deferred_free = 0;
88 _elm_win_move(Ecore_Evas *ee)
90 Evas_Object *obj = ecore_evas_object_associate_get(ee);
95 win = elm_widget_data_get(obj);
97 ecore_evas_geometry_get(ee, &x, &y, NULL, NULL);
100 evas_object_smart_callback_call(win->win_obj, "moved", NULL);
104 _elm_win_resize(Ecore_Evas *ee)
106 Evas_Object *obj = ecore_evas_object_associate_get(ee);
110 win = elm_widget_data_get(obj);
112 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
113 win->deferred_resize_job = ecore_job_add(_elm_win_resize_job, win);
117 _elm_win_focus_in(Ecore_Evas *ee)
119 Evas_Object *obj = ecore_evas_object_associate_get(ee);
123 win = elm_widget_data_get(obj);
125 /*NB: Why two different "focus signals" here ??? */
126 evas_object_smart_callback_call(win->win_obj, "focus-in", NULL); // FIXME: remove me
127 evas_object_smart_callback_call(win->win_obj, "focus,in", NULL);
128 win->focus_highlight.cur.visible = EINA_TRUE;
129 _elm_win_focus_highlight_reconfigure_job_start(win);
133 else if (win->img_obj)
140 _elm_win_focus_out(Ecore_Evas *ee)
142 Evas_Object *obj = ecore_evas_object_associate_get(ee);
146 win = elm_widget_data_get(obj);
148 evas_object_smart_callback_call(win->win_obj, "focus-out", NULL); // FIXME: remove me
149 evas_object_smart_callback_call(win->win_obj, "focus,out", NULL);
150 win->focus_highlight.cur.visible = EINA_FALSE;
151 _elm_win_focus_highlight_reconfigure_job_start(win);
155 else if (win->img_obj)
162 _elm_win_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
164 Elm_Win *wd = elm_widget_data_get(obj);
165 const Eina_List *items;
166 void *(*list_data_get) (const Eina_List *list);
174 if (!(items = elm_widget_focus_custom_chain_get(obj)))
180 list_data_get = eina_list_data_get;
182 elm_widget_focus_list_next_get(obj, items, list_data_get, dir, next);
188 *next = (Evas_Object *)obj;
193 _elm_win_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
195 if (elm_widget_focus_get(obj))
196 evas_object_focus_set(obj, EINA_TRUE);
198 evas_object_focus_set(obj, EINA_FALSE);
202 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
204 if (type == EVAS_CALLBACK_KEY_DOWN)
206 Evas_Event_Key_Down *ev = event_info;
207 if (!strcmp(ev->keyname, "Tab"))
209 if(evas_key_modifier_is_set(ev->modifiers, "Shift"))
210 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
212 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
213 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
222 _deferred_ecore_evas_free(void *data)
224 ecore_evas_free(data);
225 _elm_win_deferred_free--;
229 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
231 elm_object_focus(obj);
235 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
242 else if (win->img_obj)
244 evas_object_hide(win->img_obj);
249 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
256 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
257 _elm_win_obj_callback_parent_del, win);
260 if (win->autodel_clear) *(win->autodel_clear) = -1;
261 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
262 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
265 ecore_evas_callback_delete_request_set(win->ee, NULL);
266 ecore_evas_callback_resize_set(win->ee, NULL);
268 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
269 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
270 while (((child = evas_object_bottom_get(win->evas))) &&
273 evas_object_del(child);
275 while (((child = evas_object_top_get(win->evas))) &&
278 evas_object_del(child);
280 #ifdef HAVE_ELEMENTARY_X
281 if (win->client_message_handler)
282 ecore_event_handler_del(win->client_message_handler);
284 // FIXME: Why are we flushing edje on every window destroy ??
285 // edje_file_cache_flush();
286 // edje_collection_cache_flush();
287 // evas_image_cache_flush(win->evas);
288 // evas_font_cache_flush(win->evas);
289 // FIXME: we are in the del handler for the object and delete the canvas
290 // that lives under it from the handler... nasty. deferring doesn't help either
300 ecore_job_add(_deferred_ecore_evas_free, win->ee);
301 _elm_win_deferred_free++;
305 _elm_win_focus_highlight_shutdown(win);
306 eina_stringshare_del(win->focus_highlight.style);
310 if ((!_elm_win_list) &&
311 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
313 edje_file_cache_flush();
314 edje_collection_cache_flush();
315 evas_image_cache_flush(e);
316 evas_font_cache_flush(e);
322 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
325 if (!win->img_obj) return;
326 evas_object_event_callback_del_full
327 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
328 evas_object_del(win->img_obj);
332 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
335 if (obj == win->parent) win->parent = NULL;
339 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
350 evas_object_move(obj, x, y);
355 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
358 // this is called to make sure all smart containers have calculated their
359 // sizes BEFORE we show the window to make sure it initially appears at
360 // our desired size (ie min size is known first)
361 evas_smart_objects_calculate(evas_object_evas_get(obj));
362 evas_object_show(obj);
366 else if (win->img_obj)
368 evas_object_show(win->img_obj);
373 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
377 if (ecore_evas_override_get(win->ee))
381 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
384 evas_object_smart_callback_call(win->win_obj, "moved", NULL);
389 else if (win->img_obj)
393 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
396 // evas_object_move(win->img_obj, x, y);
401 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
408 else if (win->img_obj)
410 Evas_Coord w = 1, h = 1;
412 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
415 evas_object_image_size_set(win->img_obj, w, h);
420 _elm_win_delete_request(Ecore_Evas *ee)
422 Evas_Object *obj = ecore_evas_object_associate_get(ee);
424 if (strcmp(elm_widget_type_get(obj), "win")) return;
426 win = elm_widget_data_get(obj);
428 int autodel = win->autodel;
429 win->autodel_clear = &autodel;
430 evas_object_smart_callback_call(win->win_obj, "delete-request", NULL); // FIXME: remove me
431 evas_object_smart_callback_call(win->win_obj, "delete,request", NULL);
432 // FIXME: if above callback deletes - then the below will be invalid
433 if (autodel) evas_object_del(win->win_obj);
434 else win->autodel_clear = NULL;
438 _elm_win_resize_job(void *data)
445 win->deferred_resize_job = NULL;
446 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
447 evas_object_resize(win->win_obj, w, h);
451 else if (win->img_obj)
454 EINA_LIST_FOREACH(win->subobjs, l, obj)
456 evas_object_move(obj, 0, 0);
457 evas_object_resize(obj, w, h);
461 #ifdef HAVE_ELEMENTARY_X
463 _elm_win_xwindow_get(Elm_Win *win)
467 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
468 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
470 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
472 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
473 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
474 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
475 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
476 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
477 ENGINE_COMPARE(ELM_OPENGL_SDL))
480 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
482 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
484 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
486 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
488 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
490 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
492 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
494 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
496 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
498 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
500 #undef ENGINE_COMPARE
504 #ifdef HAVE_ELEMENTARY_X
506 _elm_win_xwin_update(Elm_Win *win)
508 _elm_win_xwindow_get(win);
513 win2 = elm_widget_data_get(win->parent);
517 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
521 if (!win->xwin) return; /* nothing more to do */
526 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
528 case ELM_WIN_DIALOG_BASIC:
529 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
531 case ELM_WIN_DESKTOP:
532 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
535 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
537 case ELM_WIN_TOOLBAR:
538 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
541 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
543 case ELM_WIN_UTILITY:
544 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
547 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
549 case ELM_WIN_DROPDOWN_MENU:
550 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
552 case ELM_WIN_POPUP_MENU:
553 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
555 case ELM_WIN_TOOLTIP:
556 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
558 case ELM_WIN_NOTIFICATION:
559 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
562 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
565 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
570 ecore_x_e_virtual_keyboard_state_set
571 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
576 _elm_win_eval_subobjs(Evas_Object *obj)
579 const Evas_Object *child;
581 Elm_Win *win = elm_widget_data_get(obj);
582 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
586 EINA_LIST_FOREACH(win->subobjs, l, child)
588 evas_object_size_hint_weight_get(child, &wx, &wy);
589 if (wx == 0.0) xx = 0;
590 if (wy == 0.0) xy = 0;
592 evas_object_size_hint_min_get(child, &w, &h);
595 if (w > minw) minw = w;
596 if (h > minh) minh = h;
598 evas_object_size_hint_max_get(child, &w, &h);
601 if (maxw == -1) maxw = w;
602 else if ((w > 0) && (w < maxw)) maxw = w;
603 if (maxh == -1) maxh = h;
604 else if ((h > 0) && (h < maxh)) maxh = h;
606 if (!xx) maxw = minw;
608 if (!xy) maxh = minh;
610 evas_object_size_hint_min_set(obj, minw, minh);
611 evas_object_size_hint_max_set(obj, maxw, maxh);
612 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
613 if (w < minw) w = minw;
614 if (h < minh) h = minh;
615 if ((maxw >= 0) && (w > maxw)) w = maxw;
616 if ((maxh >= 0) && (h > maxh)) h = maxh;
617 evas_object_resize(obj, w, h);
621 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
623 Elm_Win *win = elm_widget_data_get(data);
624 win->subobjs = eina_list_remove(win->subobjs, obj);
625 _elm_win_eval_subobjs(win->win_obj);
629 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
631 _elm_win_eval_subobjs(data);
635 _elm_win_shutdown(void)
637 while (_elm_win_list)
638 evas_object_del(_elm_win_list->data);
642 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
649 EINA_LIST_FOREACH(_elm_win_list, l, obj)
650 elm_widget_theme(obj);
654 EINA_LIST_FOREACH(_elm_win_list, l, obj)
655 elm_widget_theme_specific(obj, th, EINA_FALSE);
659 #ifdef HAVE_ELEMENTARY_X
661 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
664 Ecore_X_Event_Client_Message *e = event;
666 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
667 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
669 if ((unsigned)e->data.l[0] == win->xwin)
671 Evas *evas = evas_object_evas_get(win->win_obj);
674 edje_file_cache_flush();
675 edje_collection_cache_flush();
676 evas_image_cache_flush(evas);
677 evas_font_cache_flush(evas);
681 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
683 if ((unsigned)e->data.l[0] == win->xwin)
685 Evas *evas = evas_object_evas_get(win->win_obj);
688 edje_file_cache_flush();
689 edje_collection_cache_flush();
690 evas_image_cache_flush(evas);
691 evas_font_cache_flush(evas);
692 evas_render_dump(evas);
696 return ECORE_CALLBACK_PASS_ON;
701 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
705 win->focus_highlight.geometry_changed = EINA_TRUE;
706 _elm_win_focus_highlight_reconfigure_job_start(win);
710 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
714 win->focus_highlight.geometry_changed = EINA_TRUE;
715 _elm_win_focus_highlight_reconfigure_job_start(win);
719 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
723 win->focus_highlight.cur.target = NULL;
725 _elm_win_focus_highlight_reconfigure_job_start(win);
729 _elm_win_focus_target_callbacks_add(Elm_Win *win)
731 Evas_Object *obj = win->focus_highlight.cur.target;
733 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
734 _elm_win_focus_target_move, win);
735 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
736 _elm_win_focus_target_resize, win);
737 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
738 _elm_win_focus_target_del, win);
742 _elm_win_focus_target_callbacks_del(Elm_Win *win)
744 Evas_Object *obj = win->focus_highlight.cur.target;
746 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
747 _elm_win_focus_target_move, win);
748 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
749 _elm_win_focus_target_resize, win);
750 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
751 _elm_win_focus_target_del, win);
755 _elm_win_focus_target_get(Evas_Object *obj)
757 Evas_Object *o = obj;
761 if (elm_widget_is(o))
763 if (!elm_widget_highlight_ignore_get(o))
765 o = elm_widget_parent_get(o);
767 o = evas_object_smart_parent_get(o);
771 o = elm_widget_parent_widget_get(o);
773 o = evas_object_smart_parent_get(o);
782 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
784 Evas_Object *obj = event_info, *target;
787 if (win->focus_highlight.cur.target == obj)
790 target = _elm_win_focus_target_get(obj);
791 win->focus_highlight.cur.target = target;
792 if (elm_widget_highlight_in_theme_get(target))
793 win->focus_highlight.cur.handled = EINA_TRUE;
795 _elm_win_focus_target_callbacks_add(win);
797 _elm_win_focus_highlight_reconfigure_job_start(win);
801 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
805 if (!win->focus_highlight.cur.target)
808 if (!win->focus_highlight.cur.handled)
809 _elm_win_focus_target_callbacks_del(win);
810 win->focus_highlight.cur.target = NULL;
811 win->focus_highlight.cur.handled = EINA_FALSE;
813 _elm_win_focus_highlight_reconfigure_job_start(win);
817 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
819 evas_object_hide(obj);
823 _elm_win_focus_highlight_init(Elm_Win *win)
825 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
826 _elm_win_object_focus_in, win);
827 evas_event_callback_add(win->evas,
828 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
829 _elm_win_object_focus_out, win);
831 win->focus_highlight.cur.target = evas_focus_get(win->evas);
833 win->focus_highlight.top = edje_object_add(win->evas);
834 win->focus_highlight.changed_theme = EINA_TRUE;
835 edje_object_signal_callback_add(win->focus_highlight.top,
836 "elm,action,focus,hide,end", "",
837 _elm_win_focus_highlight_hide, NULL);
838 edje_object_signal_callback_add(win->focus_highlight.top,
839 "elm,action,focus,anim,end", "",
840 _elm_win_focus_highlight_anim_end, win);
841 _elm_win_focus_highlight_reconfigure_job_start(win);
845 _elm_win_focus_highlight_shutdown(Elm_Win *win)
847 _elm_win_focus_highlight_reconfigure_job_stop(win);
848 if (win->focus_highlight.cur.target)
850 _elm_win_focus_target_callbacks_del(win);
851 win->focus_highlight.cur.target = NULL;
853 if (win->focus_highlight.top)
855 evas_object_del(win->focus_highlight.top);
856 win->focus_highlight.top = NULL;
859 evas_event_callback_del_full(win->evas,
860 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
861 _elm_win_object_focus_in, win);
862 evas_event_callback_del_full(win->evas,
863 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
864 _elm_win_object_focus_out, win);
868 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
872 top = win->focus_highlight.top;
877 evas_object_show(top);
878 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
884 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
889 _elm_win_focus_highlight_reconfigure_job(void *data)
891 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
895 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
897 if (win->focus_highlight.reconf_job)
898 ecore_job_del(win->focus_highlight.reconf_job);
899 win->focus_highlight.reconf_job = ecore_job_add(
900 _elm_win_focus_highlight_reconfigure_job, win);
904 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
906 if (win->focus_highlight.reconf_job)
907 ecore_job_del(win->focus_highlight.reconf_job);
908 win->focus_highlight.reconf_job = NULL;
912 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
914 Evas_Object *clip, *target = win->focus_highlight.cur.target;
915 Evas_Coord x, y, w, h;
917 clip = evas_object_clip_get(target);
918 evas_object_geometry_get(target, &x, &y, &w, &h);
920 evas_object_move(obj, x, y);
921 evas_object_resize(obj, w, h);
922 evas_object_clip_set(obj, clip);
926 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
928 Evas_Coord tx, ty, tw, th;
929 Evas_Coord w, h, px, py, pw, ph;
930 Edje_Message_Int_Set *m;
931 Evas_Object *previous = win->focus_highlight.prev.target;
932 Evas_Object *target = win->focus_highlight.cur.target;
934 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
935 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
936 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
937 evas_object_move(obj, 0, 0);
938 evas_object_resize(obj, tw, th);
939 evas_object_clip_unset(obj);
941 m = alloca(sizeof(*m) + (sizeof(int) * 8));
951 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
955 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
958 _elm_win_focus_highlight_simple_setup(win, obj);
962 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
964 Evas_Object *target = win->focus_highlight.cur.target;
965 Evas_Object *previous = win->focus_highlight.prev.target;
966 Evas_Object *top = win->focus_highlight.top;
967 Eina_Bool visible_changed;
968 Eina_Bool common_visible;
969 const char *sig = NULL;
971 _elm_win_focus_highlight_reconfigure_job_stop(win);
973 visible_changed = (win->focus_highlight.cur.visible !=
974 win->focus_highlight.prev.visible);
976 if ((target == previous) && (!visible_changed) &&
977 (!win->focus_highlight.geometry_changed))
980 if ((previous) && (win->focus_highlight.prev.handled))
981 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
984 common_visible = EINA_FALSE;
985 else if (win->focus_highlight.cur.handled)
987 common_visible = EINA_FALSE;
988 if (win->focus_highlight.cur.visible)
989 sig = "elm,action,focus_highlight,show";
991 sig = "elm,action,focus_highlight,hide";
994 common_visible = win->focus_highlight.cur.visible;
996 _elm_win_focus_highlight_visible_set(win, common_visible);
998 elm_widget_signal_emit(target, sig, "elm");
1000 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1003 if (win->focus_highlight.changed_theme)
1006 if (win->focus_highlight.style)
1007 str = win->focus_highlight.style;
1010 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1012 win->focus_highlight.changed_theme = EINA_FALSE;
1014 if (_elm_config->focus_highlight_animate)
1016 str = edje_object_data_get(win->focus_highlight.top, "animate");
1017 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1021 if ((win->focus_highlight.top_animate) && (previous) &&
1022 (!win->focus_highlight.prev.handled))
1023 _elm_win_focus_highlight_anim_setup(win, top);
1025 _elm_win_focus_highlight_simple_setup(win, top);
1026 evas_object_raise(top);
1029 win->focus_highlight.geometry_changed = EINA_FALSE;
1030 win->focus_highlight.prev = win->focus_highlight.cur;
1035 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1037 Evas_Event_Key_Down *ev = event_info;
1039 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1043 if ((strcmp(ev->keyname, "F12")) ||
1044 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1047 printf("Tree graph generated.\n");
1048 elm_object_tree_dot_dump(obj, "./dump.dot");
1053 * Adds a window object. If this is the first window created, pass NULL as
1056 * @param parent Parent object to add the window to, or NULL
1057 * @param name The name of the window
1058 * @param type The window type, one of the following:
1060 * ELM_WIN_DIALOG_BASIC
1068 * @return The created object, or NULL on failure
1073 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1077 const char *fontpath;
1079 win = ELM_NEW(Elm_Win);
1081 #define FALLBACK_TRY(engine) \
1084 CRITICAL(engine " engine creation failed. Trying software X11."); \
1085 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
1087 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1091 case ELM_WIN_INLINED:
1092 // FIXME: implement. same as ELM_WIN_INLINED_IMAGE but with border
1095 case ELM_WIN_INLINED_IMAGE:
1099 Evas *e = evas_object_evas_get(parent);
1102 Ecore_Evas *ee = ecore_evas_ecore_evas_get(e);
1105 win->img_obj = ecore_evas_object_image_new(ee);
1108 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1111 evas_object_image_alpha_set
1112 (win->img_obj, EINA_FALSE);
1113 evas_object_image_filled_set
1114 (win->img_obj, EINA_TRUE);
1115 evas_object_event_callback_add
1116 (win->img_obj, EVAS_CALLBACK_DEL,
1117 _elm_win_obj_callback_img_obj_del,
1122 evas_object_del(win->img_obj);
1123 win->img_obj = NULL;
1131 case ELM_WIN_MEMORY:
1135 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1137 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1138 #ifdef HAVE_ELEMENTARY_X
1139 win->client_message_handler = ecore_event_handler_add
1140 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1143 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1145 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1146 FALLBACK_TRY("Sofware FB");
1148 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1150 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1151 FALLBACK_TRY("Sofware DirectFB");
1153 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1155 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1156 FALLBACK_TRY("Sofware-16");
1157 #ifdef HAVE_ELEMENTARY_X
1158 win->client_message_handler = ecore_event_handler_add
1159 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1162 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1164 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1165 FALLBACK_TRY("Sofware-8");
1166 #ifdef HAVE_ELEMENTARY_X
1167 win->client_message_handler = ecore_event_handler_add
1168 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1171 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1173 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1174 FALLBACK_TRY("XRender");
1175 #ifdef HAVE_ELEMENTARY_X
1176 win->client_message_handler = ecore_event_handler_add
1177 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1180 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1182 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1183 FALLBACK_TRY("OpenGL");
1184 #ifdef HAVE_ELEMENTARY_X
1185 win->client_message_handler = ecore_event_handler_add
1186 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1189 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1191 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1192 FALLBACK_TRY("Sofware Win32");
1194 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1196 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1197 FALLBACK_TRY("Sofware-16-WinCE");
1199 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1201 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1202 FALLBACK_TRY("Sofware SDL");
1204 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1206 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1207 FALLBACK_TRY("Sofware-16-SDL");
1209 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1211 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1212 FALLBACK_TRY("OpenGL SDL");
1220 ERR("Cannot create window.");
1224 #ifdef HAVE_ELEMENTARY_X
1225 _elm_win_xwindow_get(win);
1227 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1228 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1229 // bg pixmap done by x - has other issues like can be redrawn by x before it
1230 // is filled/ready by app
1231 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1234 win->parent = parent;
1236 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1237 _elm_win_obj_callback_parent_del, win);
1239 win->evas = ecore_evas_get(win->ee);
1240 win->win_obj = elm_widget_add(win->evas);
1241 elm_widget_type_set(win->win_obj, "win");
1242 ELM_SET_WIDTYPE(widtype, "win");
1243 elm_widget_data_set(win->win_obj, win);
1244 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1245 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1246 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1247 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1248 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1249 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1250 evas_object_move(win->win_obj, 0, 0);
1251 evas_object_resize(win->win_obj, 1, 1);
1252 evas_object_layer_set(win->win_obj, 50);
1253 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1255 evas_object_intercept_move_callback_add(win->win_obj,
1256 _elm_win_obj_intercept_move, win);
1257 evas_object_intercept_show_callback_add(win->win_obj,
1258 _elm_win_obj_intercept_show, win);
1259 ecore_evas_object_associate(win->ee, win->win_obj,
1260 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1261 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1262 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1263 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1264 _elm_win_obj_callback_show, win);
1265 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1266 _elm_win_obj_callback_hide, win);
1267 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1268 _elm_win_obj_callback_del, win);
1269 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1270 _elm_win_obj_callback_move, win);
1271 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1272 _elm_win_obj_callback_resize, win);
1274 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1275 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1276 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1277 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1278 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1279 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1280 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1281 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1282 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1283 evas_font_path_append(win->evas, fontpath);
1284 if (!_elm_config->font_hinting)
1285 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1286 else if (_elm_config->font_hinting == 1)
1287 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1288 else if (_elm_config->font_hinting == 2)
1289 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1291 #ifdef HAVE_ELEMENTARY_X
1292 _elm_win_xwin_update(win);
1295 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1297 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1299 ecore_evas_fullscreen_set(win->ee, 1);
1301 #undef ENGINE_COMPARE
1303 if (_elm_config->focus_highlight_enable)
1304 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1307 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1308 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1309 _debug_key_down, win);
1311 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1313 printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
1315 return win->win_obj;
1319 * Add @p subobj as a resize object of window @p obj.
1321 * @param obj The window object
1322 * @param subobj The resize object to add
1327 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1331 ELM_CHECK_WIDTYPE(obj, widtype);
1332 win = elm_widget_data_get(obj);
1334 win->subobjs = eina_list_append(win->subobjs, subobj);
1335 elm_widget_sub_object_add(obj, subobj);
1336 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1337 _elm_win_subobj_callback_del, obj);
1338 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1339 _elm_win_subobj_callback_changed_size_hints,
1341 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1342 evas_object_move(subobj, 0, 0);
1343 evas_object_resize(subobj, w, h);
1344 _elm_win_eval_subobjs(obj);
1348 * Delete @p subobj as a resize object of window @p obj.
1350 * @param obj The window object
1351 * @param subobj The resize object to add
1356 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1359 ELM_CHECK_WIDTYPE(obj, widtype);
1360 win = elm_widget_data_get(obj);
1362 evas_object_event_callback_del_full(subobj,
1363 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1364 _elm_win_subobj_callback_changed_size_hints,
1366 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1367 _elm_win_subobj_callback_del, obj);
1368 win->subobjs = eina_list_remove(win->subobjs, subobj);
1369 elm_widget_sub_object_del(obj, subobj);
1370 _elm_win_eval_subobjs(obj);
1374 * Set the title of the window
1376 * @param obj The window object
1377 * @param title The title to set
1382 elm_win_title_set(Evas_Object *obj, const char *title)
1385 ELM_CHECK_WIDTYPE(obj, widtype);
1386 win = elm_widget_data_get(obj);
1388 ecore_evas_title_set(win->ee, title);
1392 * Get the title of the window
1394 * @param obj The window object
1400 elm_win_title_get(const Evas_Object *obj)
1403 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1404 win = elm_widget_data_get(obj);
1405 if (!win) return NULL;
1406 return ecore_evas_title_get(win->ee);
1410 * Set the window's autodel state.
1412 * @param obj The window object
1413 * @param autodel If true, the window will automatically delete itself when closed
1418 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1421 ELM_CHECK_WIDTYPE(obj, widtype);
1422 win = elm_widget_data_get(obj);
1424 win->autodel = autodel;
1428 * Get the window's autodel state.
1430 * @param obj The window object
1431 * @return If the window will automatically delete itself when closed
1436 elm_win_autodel_get(const Evas_Object *obj)
1439 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1440 win = elm_widget_data_get(obj);
1441 if (!win) return EINA_FALSE;
1442 return win->autodel;
1446 * Activate a window object.
1448 * @param obj The window object
1453 elm_win_activate(Evas_Object *obj)
1456 ELM_CHECK_WIDTYPE(obj, widtype);
1457 win = elm_widget_data_get(obj);
1459 ecore_evas_activate(win->ee);
1463 * Lower a window object.
1465 * @param obj The window object
1470 elm_win_lower(Evas_Object *obj)
1473 ELM_CHECK_WIDTYPE(obj, widtype);
1474 win = elm_widget_data_get(obj);
1476 ecore_evas_lower(win->ee);
1480 * Raise a window object.
1482 * @param obj The window object
1487 elm_win_raise(Evas_Object *obj)
1490 ELM_CHECK_WIDTYPE(obj, widtype);
1491 win = elm_widget_data_get(obj);
1493 ecore_evas_raise(win->ee);
1497 * Set the borderless state of a window.
1499 * @param obj The window object
1500 * @param borderless If true, the window is borderless
1505 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1508 ELM_CHECK_WIDTYPE(obj, widtype);
1509 win = elm_widget_data_get(obj);
1511 ecore_evas_borderless_set(win->ee, borderless);
1512 #ifdef HAVE_ELEMENTARY_X
1513 _elm_win_xwin_update(win);
1518 * Get the borderless state of a window.
1520 * @param obj The window object
1521 * @return If true, the window is borderless
1526 elm_win_borderless_get(const Evas_Object *obj)
1529 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1530 win = elm_widget_data_get(obj);
1531 if (!win) return EINA_FALSE;
1532 return ecore_evas_borderless_get(win->ee);
1536 * Set the shaped state of a window.
1538 * @param obj The window object
1539 * @param shaped If true, the window is shaped
1544 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1547 ELM_CHECK_WIDTYPE(obj, widtype);
1548 win = elm_widget_data_get(obj);
1550 ecore_evas_shaped_set(win->ee, shaped);
1551 #ifdef HAVE_ELEMENTARY_X
1552 _elm_win_xwin_update(win);
1557 * Get the shaped state of a window.
1559 * @param obj The window object
1560 * @return If true, the window is shaped
1565 elm_win_shaped_get(const Evas_Object *obj)
1568 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1569 win = elm_widget_data_get(obj);
1570 if (!win) return EINA_FALSE;
1571 return ecore_evas_shaped_get(win->ee);
1575 * Set the alpha channel state of a window.
1577 * @param obj The window object
1578 * @param alpha If true, the window has an alpha channel
1583 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1586 ELM_CHECK_WIDTYPE(obj, widtype);
1587 win = elm_widget_data_get(obj);
1592 else if (win->img_obj)
1594 evas_object_image_alpha_set(win->img_obj, alpha);
1598 #ifdef HAVE_ELEMENTARY_X
1603 if (!_elm_config->compositing)
1604 elm_win_shaped_set(obj, alpha);
1606 ecore_evas_alpha_set(win->ee, alpha);
1609 ecore_evas_alpha_set(win->ee, alpha);
1610 _elm_win_xwin_update(win);
1614 ecore_evas_alpha_set(win->ee, alpha);
1619 * Get the alpha channel state of a window.
1621 * @param obj The window object
1622 * @return If true, the window has an alpha channel
1627 elm_win_alpha_get(const Evas_Object *obj)
1630 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1631 win = elm_widget_data_get(obj);
1632 if (!win) return EINA_FALSE;
1633 return ecore_evas_alpha_get(win->ee);
1637 * Set the transparency state of a window.
1639 * @param obj The window object
1640 * @param transparent If true, the window is transparent
1645 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1648 ELM_CHECK_WIDTYPE(obj, widtype);
1649 win = elm_widget_data_get(obj);
1655 else if (win->img_obj)
1657 evas_object_image_alpha_set(win->img_obj, transparent);
1661 #ifdef HAVE_ELEMENTARY_X
1664 ecore_evas_transparent_set(win->ee, transparent);
1665 _elm_win_xwin_update(win);
1669 ecore_evas_transparent_set(win->ee, transparent);
1674 * Get the transparency state of a window.
1676 * @param obj The window object
1677 * @return If true, the window is transparent
1682 elm_win_transparent_get(const Evas_Object *obj)
1685 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1686 win = elm_widget_data_get(obj);
1687 if (!win) return EINA_FALSE;
1689 return ecore_evas_transparent_get(win->ee);
1693 * Set the override state of a window.
1695 * @param obj The window object
1696 * @param override If true, the window is overridden
1701 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1704 ELM_CHECK_WIDTYPE(obj, widtype);
1705 win = elm_widget_data_get(obj);
1707 ecore_evas_override_set(win->ee, override);
1708 #ifdef HAVE_ELEMENTARY_X
1709 _elm_win_xwin_update(win);
1714 * Get the override state of a window.
1716 * @param obj The window object
1717 * @return If true, the window is overridden
1722 elm_win_override_get(const Evas_Object *obj)
1725 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1726 win = elm_widget_data_get(obj);
1727 if (!win) return EINA_FALSE;
1728 return ecore_evas_override_get(win->ee);
1732 * Set the fullscreen state of a window.
1734 * @param obj The window object
1735 * @param fullscreen If true, the window is fullscreen
1740 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1743 ELM_CHECK_WIDTYPE(obj, widtype);
1744 win = elm_widget_data_get(obj);
1747 // YYY: handle if win->img_obj
1748 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1749 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1750 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1752 // these engines... can ONLY be fullscreen
1757 ecore_evas_fullscreen_set(win->ee, fullscreen);
1758 #ifdef HAVE_ELEMENTARY_X
1759 _elm_win_xwin_update(win);
1762 #undef ENGINE_COMPARE
1766 * Get the fullscreen state of a window.
1768 * @param obj The window object
1769 * @return If true, the window is fullscreen
1774 elm_win_fullscreen_get(const Evas_Object *obj)
1777 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1778 win = elm_widget_data_get(obj);
1779 if (!win) return EINA_FALSE;
1781 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1782 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1783 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1785 // these engines... can ONLY be fullscreen
1790 return ecore_evas_fullscreen_get(win->ee);
1792 #undef ENGINE_COMPARE
1796 * Set the maximized state of a window.
1798 * @param obj The window object
1799 * @param maximized If true, the window is maximized
1804 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1807 ELM_CHECK_WIDTYPE(obj, widtype);
1808 win = elm_widget_data_get(obj);
1810 // YYY: handle if win->img_obj
1811 ecore_evas_maximized_set(win->ee, maximized);
1812 #ifdef HAVE_ELEMENTARY_X
1813 _elm_win_xwin_update(win);
1818 * Get the maximized state of a window.
1820 * @param obj The window object
1821 * @return If true, the window is maximized
1826 elm_win_maximized_get(const Evas_Object *obj)
1829 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1830 win = elm_widget_data_get(obj);
1831 if (!win) return EINA_FALSE;
1832 return ecore_evas_maximized_get(win->ee);
1836 * Set the iconified state of a window.
1838 * @param obj The window object
1839 * @param iconified If true, the window is iconified
1844 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1847 ELM_CHECK_WIDTYPE(obj, widtype);
1848 win = elm_widget_data_get(obj);
1850 ecore_evas_iconified_set(win->ee, iconified);
1851 #ifdef HAVE_ELEMENTARY_X
1852 _elm_win_xwin_update(win);
1857 * Get the iconified state of a window.
1859 * @param obj The window object
1860 * @return If true, the window is iconified
1865 elm_win_iconified_get(const Evas_Object *obj)
1868 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1869 win = elm_widget_data_get(obj);
1870 if (!win) return EINA_FALSE;
1871 return ecore_evas_iconified_get(win->ee);
1875 * Set the layer of the window.
1877 * @param obj The window object
1878 * @param layer The layer of the window
1883 elm_win_layer_set(Evas_Object *obj, int layer)
1886 ELM_CHECK_WIDTYPE(obj, widtype);
1887 win = elm_widget_data_get(obj);
1889 ecore_evas_layer_set(win->ee, layer);
1890 #ifdef HAVE_ELEMENTARY_X
1891 _elm_win_xwin_update(win);
1896 * Get the layer of the window.
1898 * @param obj The window object
1899 * @return The layer of the window
1904 elm_win_layer_get(const Evas_Object *obj)
1907 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1908 win = elm_widget_data_get(obj);
1909 if (!win) return -1;
1910 return ecore_evas_layer_get(win->ee);
1914 * Set the rotation of the window.
1916 * @param obj The window object
1917 * @param rotation The rotation of the window, in degrees (0-360)
1922 elm_win_rotation_set(Evas_Object *obj, int rotation)
1925 ELM_CHECK_WIDTYPE(obj, widtype);
1926 win = elm_widget_data_get(obj);
1928 if (win->rot == rotation) return;
1929 win->rot = rotation;
1930 ecore_evas_rotation_set(win->ee, rotation);
1931 evas_object_size_hint_min_set(obj, -1, -1);
1932 evas_object_size_hint_max_set(obj, -1, -1);
1933 _elm_win_eval_subobjs(obj);
1934 #ifdef HAVE_ELEMENTARY_X
1935 _elm_win_xwin_update(win);
1940 * Rotates the window and resizes it
1942 * @param obj The window object
1943 * @param layer The rotation of the window in degrees (0-360)
1948 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
1951 ELM_CHECK_WIDTYPE(obj, widtype);
1952 win = elm_widget_data_get(obj);
1954 if (win->rot == rotation) return;
1955 win->rot = rotation;
1956 ecore_evas_rotation_with_resize_set(win->ee, rotation);
1957 evas_object_size_hint_min_set(obj, -1, -1);
1958 evas_object_size_hint_max_set(obj, -1, -1);
1959 _elm_win_eval_subobjs(obj);
1960 #ifdef HAVE_ELEMENTARY_X
1961 _elm_win_xwin_update(win);
1966 * Get the rotation of the window.
1968 * @param obj The window object
1969 * @return The rotation of the window in degrees (0-360)
1974 elm_win_rotation_get(const Evas_Object *obj)
1977 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1978 win = elm_widget_data_get(obj);
1979 if (!win) return -1;
1984 * Set the sticky state of the window.
1986 * @param obj The window object
1987 * @param sticky If true, the window's sticky state is enabled
1992 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
1995 ELM_CHECK_WIDTYPE(obj, widtype);
1996 win = elm_widget_data_get(obj);
1998 ecore_evas_sticky_set(win->ee, sticky);
1999 #ifdef HAVE_ELEMENTARY_X
2000 _elm_win_xwin_update(win);
2005 * Get the sticky state of the window.
2007 * @param obj The window object
2008 * @return If true, the window's sticky state is enabled
2013 elm_win_sticky_get(const Evas_Object *obj)
2016 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2017 win = elm_widget_data_get(obj);
2018 if (!win) return EINA_FALSE;
2019 return ecore_evas_sticky_get(win->ee);
2023 * Sets the keyboard mode of the window.
2025 * @param obj The window object
2026 * @param mode The mode to set; one of:
2027 * ELM_WIN_KEYBOARD_UNKNOWN
2028 * ELM_WIN_KEYBOARD_OFF
2029 * ELM_WIN_KEYBOARD_ON
2030 * ELM_WIN_KEYBOARD_ALPHA
2031 * ELM_WIN_KEYBOARD_NUMERIC
2032 * ELM_WIN_KEYBOARD_PIN
2033 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2034 * ELM_WIN_KEYBOARD_HEX
2035 * ELM_WIN_KEYBOARD_TERMINAL
2036 * ELM_WIN_KEYBOARD_PASSWORD
2037 * ELM_WIN_KEYBOARD_IP
2038 * ELM_WIN_KEYBOARD_HOST
2039 * ELM_WIN_KEYBOARD_FILE
2040 * ELM_WIN_KEYBOARD_URL
2041 * ELM_WIN_KEYBOARD_KEYPAD
2042 * ELM_WIN_KEYBOARD_J2ME
2047 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2050 ELM_CHECK_WIDTYPE(obj, widtype);
2051 win = elm_widget_data_get(obj);
2053 if (mode == win->kbdmode) return;
2054 #ifdef HAVE_ELEMENTARY_X
2055 _elm_win_xwindow_get(win);
2057 win->kbdmode = mode;
2058 #ifdef HAVE_ELEMENTARY_X
2060 ecore_x_e_virtual_keyboard_state_set
2061 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2066 * Gets the keyboard mode of the window.
2068 * @param obj The window object
2069 * @return The mode; one of:
2070 * ELM_WIN_KEYBOARD_UNKNOWN
2071 * ELM_WIN_KEYBOARD_OFF
2072 * ELM_WIN_KEYBOARD_ON
2073 * ELM_WIN_KEYBOARD_ALPHA
2074 * ELM_WIN_KEYBOARD_NUMERIC
2075 * ELM_WIN_KEYBOARD_PIN
2076 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2077 * ELM_WIN_KEYBOARD_HEX
2078 * ELM_WIN_KEYBOARD_TERMINAL
2079 * ELM_WIN_KEYBOARD_PASSWORD
2080 * ELM_WIN_KEYBOARD_IP
2081 * ELM_WIN_KEYBOARD_HOST
2082 * ELM_WIN_KEYBOARD_FILE
2083 * ELM_WIN_KEYBOARD_URL
2084 * ELM_WIN_KEYBOARD_KEYPAD
2085 * ELM_WIN_KEYBOARD_J2ME
2089 EAPI Elm_Win_Keyboard_Mode
2090 elm_win_keyboard_mode_get(const Evas_Object *obj)
2093 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2094 win = elm_widget_data_get(obj);
2095 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2096 return win->kbdmode;
2100 * Sets whether the window is a keyboard.
2102 * @param obj The window object
2103 * @param is_keyboard If true, the window is a virtual keyboard
2108 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2111 ELM_CHECK_WIDTYPE(obj, widtype);
2112 win = elm_widget_data_get(obj);
2114 #ifdef HAVE_ELEMENTARY_X
2115 _elm_win_xwindow_get(win);
2117 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2122 * Gets whether the window is a keyboard.
2124 * @param obj The window object
2125 * @return If the window is a virtual keyboard
2130 elm_win_keyboard_win_get(const Evas_Object *obj)
2133 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2134 win = elm_widget_data_get(obj);
2135 if (!win) return EINA_FALSE;
2136 #ifdef HAVE_ELEMENTARY_X
2137 _elm_win_xwindow_get(win);
2139 return ecore_x_e_virtual_keyboard_get(win->xwin);
2145 * Get the screen position of a window.
2147 * @param obj The window object
2148 * @param x The int to store the x coordinate to
2149 * @param y The int to store the y coordinate to
2154 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2157 ELM_CHECK_WIDTYPE(obj, widtype);
2158 win = elm_widget_data_get(obj);
2160 if (x) *x = win->screen.x;
2161 if (y) *y = win->screen.y;
2165 * Set if this window is an illume conformant window
2167 * @param obj The window object
2168 * @param conformant The conformant flag (1 = conformant, 0 = non-conformant)
2173 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2176 ELM_CHECK_WIDTYPE(obj, widtype);
2177 win = elm_widget_data_get(obj);
2179 #ifdef HAVE_ELEMENTARY_X
2180 _elm_win_xwindow_get(win);
2182 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2187 * Get if this window is an illume conformant window
2189 * @param obj The window object
2190 * @return A boolean if this window is illume conformant or not
2195 elm_win_conformant_get(const Evas_Object *obj)
2198 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2199 win = elm_widget_data_get(obj);
2200 if (!win) return EINA_FALSE;
2201 #ifdef HAVE_ELEMENTARY_X
2202 _elm_win_xwindow_get(win);
2204 return ecore_x_e_illume_conformant_get(win->xwin);
2210 * Set a window to be an illume quickpanel window
2212 * By default window objects are not quickpanel windows.
2214 * @param obj The window object
2215 * @param quickpanel The quickpanel flag (1 = quickpanel, 0 = normal window)
2220 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2223 ELM_CHECK_WIDTYPE(obj, widtype);
2224 win = elm_widget_data_get(obj);
2226 #ifdef HAVE_ELEMENTARY_X
2227 _elm_win_xwindow_get(win);
2230 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2233 Ecore_X_Window_State states[2];
2235 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2236 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2237 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2238 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2245 * Get if this window is a quickpanel or not
2247 * @param obj The window object
2248 * @return A boolean if this window is a quickpanel or not
2253 elm_win_quickpanel_get(const Evas_Object *obj)
2256 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2257 win = elm_widget_data_get(obj);
2258 if (!win) return EINA_FALSE;
2259 #ifdef HAVE_ELEMENTARY_X
2260 _elm_win_xwindow_get(win);
2262 return ecore_x_e_illume_quickpanel_get(win->xwin);
2268 * Set the major priority of a quickpanel window
2270 * @param obj The window object
2271 * @param priority The major priority for this quickpanel
2276 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2279 ELM_CHECK_WIDTYPE(obj, widtype);
2280 win = elm_widget_data_get(obj);
2282 #ifdef HAVE_ELEMENTARY_X
2283 _elm_win_xwindow_get(win);
2285 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2290 * Get the major priority of a quickpanel window
2292 * @param obj The window object
2293 * @return The major priority of this quickpanel
2298 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2301 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2302 win = elm_widget_data_get(obj);
2303 if (!win) return -1;
2304 #ifdef HAVE_ELEMENTARY_X
2305 _elm_win_xwindow_get(win);
2307 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2313 * Set the minor priority of a quickpanel window
2315 * @param obj The window object
2316 * @param priority The minor priority for this quickpanel
2321 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2324 ELM_CHECK_WIDTYPE(obj, widtype);
2325 win = elm_widget_data_get(obj);
2327 #ifdef HAVE_ELEMENTARY_X
2328 _elm_win_xwindow_get(win);
2330 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2335 * Get the minor priority of a quickpanel window
2337 * @param obj The window object
2338 * @return The minor priority of this quickpanel
2343 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2346 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2347 win = elm_widget_data_get(obj);
2348 if (!win) return -1;
2349 #ifdef HAVE_ELEMENTARY_X
2350 _elm_win_xwindow_get(win);
2352 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2358 * Set which zone this quickpanel should appear in
2360 * @param obj The window object
2361 * @param zone The requested zone for this quickpanel
2366 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2369 ELM_CHECK_WIDTYPE(obj, widtype);
2370 win = elm_widget_data_get(obj);
2372 #ifdef HAVE_ELEMENTARY_X
2373 _elm_win_xwindow_get(win);
2375 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2380 * Get which zone this quickpanel should appear in
2382 * @param obj The window object
2383 * @return The requested zone for this quickpanel
2388 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2391 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2392 win = elm_widget_data_get(obj);
2394 #ifdef HAVE_ELEMENTARY_X
2395 _elm_win_xwindow_get(win);
2397 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2403 * Set the window to be skipped by keyboard focus
2405 * This sets the window to be skipped by normal keyboard input. This means
2406 * a window manager will be asked to not focus this window as well as omit
2407 * it from things like the taskbar, pager, "alt-tab" list etc. etc.
2409 * Call this and enable it on a window BEFORE you show it for the first time,
2410 * otherwise it may have no effect.
2412 * Use this for windows that have only output information or might only be
2413 * interacted with by the mouse or fingers, and never for typing input.
2414 * Be careful that this may have side-effects like making the window
2415 * non-accessible in some cases unless the window is specially handled. Use
2418 * @param obj The window object
2419 * @param skip The skip flag state (EINA_TRUE if it is to be skipped)
2424 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2427 ELM_CHECK_WIDTYPE(obj, widtype);
2428 win = elm_widget_data_get(obj);
2430 #ifdef HAVE_ELEMENTARY_X
2431 _elm_win_xwindow_get(win);
2436 Ecore_X_Window_State states[2];
2438 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2439 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2440 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2441 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2448 * Send a command to the windowing environment
2450 * This is intended to work in touchscreen or small screen device environments
2451 * where there is a more simplistic window management policy in place. This
2452 * uses the window object indicated to select which part of the environment
2453 * to control (the part that this window lives in), and provides a command
2454 * and an optional parameter structure (use NULL for this if not needed).
2456 * @param obj The window object that lives in the environment to control
2457 * @param command The command to send
2458 * @param params Optional parameters for the command
2463 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2466 ELM_CHECK_WIDTYPE(obj, widtype);
2467 win = elm_widget_data_get(obj);
2469 #ifdef HAVE_ELEMENTARY_X
2470 _elm_win_xwindow_get(win);
2475 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2476 ecore_x_e_illume_focus_back_send(win->xwin);
2478 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2479 ecore_x_e_illume_focus_forward_send(win->xwin);
2481 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2482 ecore_x_e_illume_focus_home_send(win->xwin);
2484 case ELM_ILLUME_COMMAND_CLOSE:
2485 ecore_x_e_illume_close_send(win->xwin);
2495 * Get the inlined image object handle
2497 * When you create a window with elm_win_add() of type ELM_WIN_INLINED_IMAGE,
2498 * then the window is in fact an evas image object inlined in the parent
2499 * canvas. You can get this object (be careful to not manipulate it as it
2500 * is under control of elementary), and use it to do things like get pixel
2501 * data, save the image to a file, etc.
2503 * @param obj The window object to get the inlined image from
2504 * @return The inlined image object, or NULL if none exists
2509 elm_win_inlined_image_object_get(Evas_Object *obj)
2512 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2513 win = elm_widget_data_get(obj);
2514 if (!win) return NULL;
2515 return win->img_obj;
2519 * Set the enabled status for the focus highlight in a window
2521 * This function will enable or disable the focus highlight only for the
2522 * given window, regardless of the global setting for it
2524 * @param obj The window where to enable the highlight
2525 * @param enabled The enabled value for the highlight
2530 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2534 ELM_CHECK_WIDTYPE(obj, widtype);
2536 win = elm_widget_data_get(obj);
2537 enabled = !!enabled;
2538 if (win->focus_highlight.enabled == enabled)
2541 win->focus_highlight.enabled = enabled;
2543 if (win->focus_highlight.enabled)
2544 _elm_win_focus_highlight_init(win);
2546 _elm_win_focus_highlight_shutdown(win);
2550 * Get the enabled value of the focus highlight for this window
2552 * @param obj The window in which to check if the focus highlight is enabled
2554 * @return EINA_TRUE if enabled, EINA_FALSE otherwise
2559 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2563 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2565 win = elm_widget_data_get(obj);
2566 return win->focus_highlight.enabled;
2570 * Set the style for the focus highlight on this window
2572 * Sets the style to use for theming the highlight of focused objects on
2573 * the given window. If @p style is NULL, the default will be used.
2575 * @param obj The window where to set the style
2576 * @param style The style to set
2581 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2585 ELM_CHECK_WIDTYPE(obj, widtype);
2587 win = elm_widget_data_get(obj);
2588 eina_stringshare_replace(&win->focus_highlight.style, style);
2589 win->focus_highlight.changed_theme = EINA_TRUE;
2590 _elm_win_focus_highlight_reconfigure_job_start(win);
2594 * Get the style set for the focus highlight object
2596 * Gets the style set for this windows highilght object, or NULL if none
2599 * @param obj The window to retrieve the highlights style from
2601 * @return The style set or NULL if none was. Default is used in that case.
2606 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2610 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2612 win = elm_widget_data_get(obj);
2613 return win->focus_highlight.style;
2616 typedef struct _Widget_Data Widget_Data;
2621 Evas_Object *content;
2624 static void _del_hook(Evas_Object *obj);
2625 static void _theme_hook(Evas_Object *obj);
2626 static void _sizing_eval(Evas_Object *obj);
2627 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2628 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2630 static const char *widtype2 = NULL;
2633 _del_hook(Evas_Object *obj)
2635 Widget_Data *wd = elm_widget_data_get(obj);
2641 _theme_hook(Evas_Object *obj)
2643 Widget_Data *wd = elm_widget_data_get(obj);
2644 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2646 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2651 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2653 Widget_Data *wd = elm_widget_data_get(obj);
2658 /* Try Focus cycle in subitem */
2661 elm_widget_focus_next_get(wd->content, dir, next);
2666 *next = (Evas_Object *)obj;
2671 _sizing_eval(Evas_Object *obj)
2673 Widget_Data *wd = elm_widget_data_get(obj);
2674 Evas_Coord minw = -1, minh = -1;
2676 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2677 edje_object_size_min_calc(wd->frm, &minw, &minh);
2678 evas_object_size_hint_min_set(obj, minw, minh);
2679 evas_object_size_hint_max_set(obj, -1, -1);
2683 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2689 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2691 Widget_Data *wd = elm_widget_data_get(obj);
2692 Evas_Object *sub = event_info;
2693 if (sub == wd->content)
2695 evas_object_event_callback_del_full
2696 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2703 * @defgroup Inwin Inwin
2705 * An inwin is a window inside a window that is useful for a quick popup. It does not hover.
2708 elm_win_inwin_add(Evas_Object *obj)
2714 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2715 win = elm_widget_data_get(obj);
2716 if (!win) return NULL;
2717 wd = ELM_NEW(Widget_Data);
2718 obj2 = elm_widget_add(win->evas);
2719 elm_widget_type_set(obj2, "inwin");
2720 ELM_SET_WIDTYPE(widtype2, "inwin");
2721 elm_widget_sub_object_add(obj, obj2);
2722 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2723 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2724 elm_win_resize_object_add(obj, obj2);
2726 elm_widget_data_set(obj2, wd);
2727 elm_widget_del_hook_set(obj2, _del_hook);
2728 elm_widget_theme_hook_set(obj2, _theme_hook);
2729 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2730 elm_widget_can_focus_set(obj2, EINA_TRUE);
2731 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2733 wd->frm = edje_object_add(win->evas);
2734 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2735 elm_widget_resize_object_set(obj2, wd->frm);
2737 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2744 * Activates an inwin object
2746 * @param obj The inwin to activate
2751 elm_win_inwin_activate(Evas_Object *obj)
2753 ELM_CHECK_WIDTYPE(obj, widtype2);
2754 Widget_Data *wd = elm_widget_data_get(obj);
2756 evas_object_raise(obj);
2757 evas_object_show(obj);
2758 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2759 elm_object_focus(obj);
2763 * Set the content of an inwin object.
2765 * Once the content object is set, a previously set one will be deleted.
2766 * If you want to keep that old content object, use the
2767 * elm_win_inwin_content_unset() function.
2769 * @param obj The inwin object
2770 * @param content The object to set as content
2775 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2777 ELM_CHECK_WIDTYPE(obj, widtype2);
2778 Widget_Data *wd = elm_widget_data_get(obj);
2780 if (wd->content == content) return;
2781 if (wd->content) evas_object_del(wd->content);
2782 wd->content = content;
2785 elm_widget_sub_object_add(obj, content);
2786 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2787 _changed_size_hints, obj);
2788 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2794 * Get the content of an inwin object.
2796 * Return the content object which is set for this widget.
2798 * @param obj The inwin object
2799 * @return The content that is being used
2804 elm_win_inwin_content_get(const Evas_Object *obj)
2806 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2807 Widget_Data *wd = elm_widget_data_get(obj);
2808 if (!wd) return NULL;
2813 * Unset the content of an inwin object.
2815 * Unparent and return the content object which was set for this widget.
2817 * @param obj The inwin object
2818 * @return The content that was being used
2823 elm_win_inwin_content_unset(Evas_Object *obj)
2825 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2826 Widget_Data *wd = elm_widget_data_get(obj);
2827 if (!wd) return NULL;
2828 if (!wd->content) return NULL;
2829 Evas_Object *content = wd->content;
2830 elm_widget_sub_object_del(obj, wd->content);
2831 edje_object_part_unswallow(wd->frm, wd->content);
2836 /* windowing spcific calls - shall we do this differently? */
2838 static Ecore_X_Window
2839 _elm_ee_win_get(const Evas_Object *obj)
2842 #ifdef HAVE_ELEMENTARY_X
2843 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2844 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2850 * Get the Ecore_X_Window of an Evas_Object
2852 * @param obj The object
2854 * @return The Ecore_X_Window of @p obj
2859 elm_win_xwindow_get(const Evas_Object *obj)
2861 Ecore_X_Window xwin = 0;
2866 type = evas_object_type_get(obj);
2867 if (!type) return 0;
2868 if (type != widtype) return _elm_ee_win_get(obj);
2869 #ifdef HAVE_ELEMENTARY_X
2870 win = elm_widget_data_get(obj);
2871 if (!win) return xwin;
2872 if (win->parent) return elm_win_xwindow_get(win->parent);