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 Elm_Win *win = elm_widget_data_get(obj);
199 evas_object_focus_set(win->img_obj, elm_widget_focus_get(obj));
201 evas_object_focus_set(obj, elm_widget_focus_get(obj));
205 _elm_win_event_cb(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
207 if (type == EVAS_CALLBACK_KEY_DOWN)
209 Evas_Event_Key_Down *ev = event_info;
210 if (!strcmp(ev->keyname, "Tab"))
212 if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
213 elm_widget_focus_cycle(obj, ELM_FOCUS_PREVIOUS);
215 elm_widget_focus_cycle(obj, ELM_FOCUS_NEXT);
216 ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
225 _deferred_ecore_evas_free(void *data)
227 ecore_evas_free(data);
228 _elm_win_deferred_free--;
232 _elm_win_obj_callback_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
234 elm_object_focus(obj);
238 _elm_win_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
245 else if (win->img_obj)
247 evas_object_hide(win->img_obj);
252 _elm_win_obj_callback_del(void *data, Evas *e, Evas_Object *obj, void *event_info __UNUSED__)
259 evas_object_event_callback_del_full(win->parent, EVAS_CALLBACK_DEL,
260 _elm_win_obj_callback_parent_del, win);
263 if (win->autodel_clear) *(win->autodel_clear) = -1;
264 _elm_win_list = eina_list_remove(_elm_win_list, win->win_obj);
265 while (win->subobjs) elm_win_resize_object_del(obj, win->subobjs->data);
268 ecore_evas_callback_delete_request_set(win->ee, NULL);
269 ecore_evas_callback_resize_set(win->ee, NULL);
271 if (win->deferred_resize_job) ecore_job_del(win->deferred_resize_job);
272 if (win->deferred_child_eval_job) ecore_job_del(win->deferred_child_eval_job);
273 while (((child = evas_object_bottom_get(win->evas))) &&
276 evas_object_del(child);
278 while (((child = evas_object_top_get(win->evas))) &&
281 evas_object_del(child);
283 #ifdef HAVE_ELEMENTARY_X
284 if (win->client_message_handler)
285 ecore_event_handler_del(win->client_message_handler);
287 // FIXME: Why are we flushing edje on every window destroy ??
288 // edje_file_cache_flush();
289 // edje_collection_cache_flush();
290 // evas_image_cache_flush(win->evas);
291 // evas_font_cache_flush(win->evas);
292 // FIXME: we are in the del handler for the object and delete the canvas
293 // that lives under it from the handler... nasty. deferring doesn't help either
303 ecore_job_add(_deferred_ecore_evas_free, win->ee);
304 _elm_win_deferred_free++;
308 _elm_win_focus_highlight_shutdown(win);
309 eina_stringshare_del(win->focus_highlight.style);
313 if ((!_elm_win_list) &&
314 (elm_policy_get(ELM_POLICY_QUIT) == ELM_POLICY_QUIT_LAST_WINDOW_CLOSED))
316 edje_file_cache_flush();
317 edje_collection_cache_flush();
318 evas_image_cache_flush(e);
319 evas_font_cache_flush(e);
325 _elm_win_obj_callback_img_obj_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
328 if (!win->img_obj) return;
329 evas_object_event_callback_del_full
330 (win->img_obj, EVAS_CALLBACK_DEL, _elm_win_obj_callback_img_obj_del, win);
331 evas_object_del(win->img_obj);
335 _elm_win_obj_callback_parent_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
338 if (obj == win->parent) win->parent = NULL;
342 _elm_win_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y)
353 evas_object_move(obj, x, y);
358 _elm_win_obj_intercept_show(void *data, Evas_Object *obj)
361 // this is called to make sure all smart containers have calculated their
362 // sizes BEFORE we show the window to make sure it initially appears at
363 // our desired size (ie min size is known first)
364 evas_smart_objects_calculate(evas_object_evas_get(obj));
365 evas_object_show(obj);
369 else if (win->img_obj)
371 evas_object_show(win->img_obj);
376 _elm_win_obj_callback_move(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
380 if (ecore_evas_override_get(win->ee))
384 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
387 evas_object_smart_callback_call(win->win_obj, "moved", NULL);
392 else if (win->img_obj)
396 evas_object_geometry_get(obj, &x, &y, NULL, NULL);
399 // evas_object_move(win->img_obj, x, y);
404 _elm_win_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
411 else if (win->img_obj)
413 Evas_Coord w = 1, h = 1;
415 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
418 evas_object_image_size_set(win->img_obj, w, h);
423 _elm_win_delete_request(Ecore_Evas *ee)
425 Evas_Object *obj = ecore_evas_object_associate_get(ee);
427 if (strcmp(elm_widget_type_get(obj), "win")) return;
429 win = elm_widget_data_get(obj);
431 int autodel = win->autodel;
432 win->autodel_clear = &autodel;
433 evas_object_smart_callback_call(win->win_obj, "delete-request", NULL); // FIXME: remove me
434 evas_object_smart_callback_call(win->win_obj, "delete,request", NULL);
435 // FIXME: if above callback deletes - then the below will be invalid
436 if (autodel) evas_object_del(win->win_obj);
437 else win->autodel_clear = NULL;
441 _elm_win_resize_job(void *data)
448 win->deferred_resize_job = NULL;
449 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
450 evas_object_resize(win->win_obj, w, h);
454 else if (win->img_obj)
457 EINA_LIST_FOREACH(win->subobjs, l, obj)
459 evas_object_move(obj, 0, 0);
460 evas_object_resize(obj, w, h);
464 #ifdef HAVE_ELEMENTARY_X
466 _elm_win_xwindow_get(Elm_Win *win)
470 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
471 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
473 if (win->ee) win->xwin = ecore_evas_software_x11_window_get(win->ee);
475 else if (ENGINE_COMPARE(ELM_SOFTWARE_X11) ||
476 ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
477 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE) ||
478 ENGINE_COMPARE(ELM_SOFTWARE_SDL) ||
479 ENGINE_COMPARE(ELM_SOFTWARE_16_SDL) ||
480 ENGINE_COMPARE(ELM_OPENGL_SDL))
483 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
485 if (win->ee) win->xwin = ecore_evas_software_x11_16_window_get(win->ee);
487 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
489 if (win->ee) win->xwin = ecore_evas_software_x11_8_window_get(win->ee);
491 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
493 if (win->ee) win->xwin = ecore_evas_xrender_x11_window_get(win->ee);
495 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
497 if (win->ee) win->xwin = ecore_evas_gl_x11_window_get(win->ee);
499 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
501 if (win->ee) win->xwin = (long)ecore_evas_win32_window_get(win->ee);
503 #undef ENGINE_COMPARE
507 #ifdef HAVE_ELEMENTARY_X
509 _elm_win_xwin_update(Elm_Win *win)
511 _elm_win_xwindow_get(win);
516 win2 = elm_widget_data_get(win->parent);
520 ecore_x_icccm_transient_for_set(win->xwin, win2->xwin);
524 if (!win->xwin) return; /* nothing more to do */
529 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NORMAL);
531 case ELM_WIN_DIALOG_BASIC:
532 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DIALOG);
534 case ELM_WIN_DESKTOP:
535 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DESKTOP);
538 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DOCK);
540 case ELM_WIN_TOOLBAR:
541 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLBAR);
544 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_MENU);
546 case ELM_WIN_UTILITY:
547 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_UTILITY);
550 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_SPLASH);
552 case ELM_WIN_DROPDOWN_MENU:
553 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DROPDOWN_MENU);
555 case ELM_WIN_POPUP_MENU:
556 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_POPUP_MENU);
558 case ELM_WIN_TOOLTIP:
559 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_TOOLTIP);
561 case ELM_WIN_NOTIFICATION:
562 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_NOTIFICATION);
565 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_COMBO);
568 ecore_x_netwm_window_type_set(win->xwin, ECORE_X_WINDOW_TYPE_DND);
573 ecore_x_e_virtual_keyboard_state_set
574 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
579 _elm_win_eval_subobjs(Evas_Object *obj)
582 const Evas_Object *child;
584 Elm_Win *win = elm_widget_data_get(obj);
585 Evas_Coord w, h, minw = -1, minh = -1, maxw = -1, maxh = -1;
589 EINA_LIST_FOREACH(win->subobjs, l, child)
591 evas_object_size_hint_weight_get(child, &wx, &wy);
592 if (wx == 0.0) xx = 0;
593 if (wy == 0.0) xy = 0;
595 evas_object_size_hint_min_get(child, &w, &h);
598 if (w > minw) minw = w;
599 if (h > minh) minh = h;
601 evas_object_size_hint_max_get(child, &w, &h);
604 if (maxw == -1) maxw = w;
605 else if ((w > 0) && (w < maxw)) maxw = w;
606 if (maxh == -1) maxh = h;
607 else if ((h > 0) && (h < maxh)) maxh = h;
609 if (!xx) maxw = minw;
611 if (!xy) maxh = minh;
613 evas_object_size_hint_min_set(obj, minw, minh);
614 evas_object_size_hint_max_set(obj, maxw, maxh);
615 evas_object_geometry_get(obj, NULL, NULL, &w, &h);
616 if (w < minw) w = minw;
617 if (h < minh) h = minh;
618 if ((maxw >= 0) && (w > maxw)) w = maxw;
619 if ((maxh >= 0) && (h > maxh)) h = maxh;
620 evas_object_resize(obj, w, h);
624 _elm_win_subobj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
626 Elm_Win *win = elm_widget_data_get(data);
627 win->subobjs = eina_list_remove(win->subobjs, obj);
628 _elm_win_eval_subobjs(win->win_obj);
632 _elm_win_subobj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
634 _elm_win_eval_subobjs(data);
638 _elm_win_shutdown(void)
640 while (_elm_win_list)
641 evas_object_del(_elm_win_list->data);
645 _elm_win_rescale(Elm_Theme *th, Eina_Bool use_theme)
652 EINA_LIST_FOREACH(_elm_win_list, l, obj)
653 elm_widget_theme(obj);
657 EINA_LIST_FOREACH(_elm_win_list, l, obj)
658 elm_widget_theme_specific(obj, th, EINA_FALSE);
662 #ifdef HAVE_ELEMENTARY_X
664 _elm_win_client_message(void *data, int type __UNUSED__, void *event)
667 Ecore_X_Event_Client_Message *e = event;
669 if (e->format != 32) return ECORE_CALLBACK_PASS_ON;
670 if (e->message_type == ECORE_X_ATOM_E_COMP_FLUSH)
672 if ((unsigned)e->data.l[0] == win->xwin)
674 Evas *evas = evas_object_evas_get(win->win_obj);
677 edje_file_cache_flush();
678 edje_collection_cache_flush();
679 evas_image_cache_flush(evas);
680 evas_font_cache_flush(evas);
684 else if (e->message_type == ECORE_X_ATOM_E_COMP_DUMP)
686 if ((unsigned)e->data.l[0] == win->xwin)
688 Evas *evas = evas_object_evas_get(win->win_obj);
691 edje_file_cache_flush();
692 edje_collection_cache_flush();
693 evas_image_cache_flush(evas);
694 evas_font_cache_flush(evas);
695 evas_render_dump(evas);
699 return ECORE_CALLBACK_PASS_ON;
704 _elm_win_focus_target_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
708 win->focus_highlight.geometry_changed = EINA_TRUE;
709 _elm_win_focus_highlight_reconfigure_job_start(win);
713 _elm_win_focus_target_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
717 win->focus_highlight.geometry_changed = EINA_TRUE;
718 _elm_win_focus_highlight_reconfigure_job_start(win);
722 _elm_win_focus_target_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
726 win->focus_highlight.cur.target = NULL;
728 _elm_win_focus_highlight_reconfigure_job_start(win);
732 _elm_win_focus_target_callbacks_add(Elm_Win *win)
734 Evas_Object *obj = win->focus_highlight.cur.target;
736 evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE,
737 _elm_win_focus_target_move, win);
738 evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE,
739 _elm_win_focus_target_resize, win);
740 evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL,
741 _elm_win_focus_target_del, win);
745 _elm_win_focus_target_callbacks_del(Elm_Win *win)
747 Evas_Object *obj = win->focus_highlight.cur.target;
749 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_MOVE,
750 _elm_win_focus_target_move, win);
751 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_RESIZE,
752 _elm_win_focus_target_resize, win);
753 evas_object_event_callback_del_full(obj, EVAS_CALLBACK_DEL,
754 _elm_win_focus_target_del, win);
758 _elm_win_focus_target_get(Evas_Object *obj)
760 Evas_Object *o = obj;
764 if (elm_widget_is(o))
766 if (!elm_widget_highlight_ignore_get(o))
768 o = elm_widget_parent_get(o);
770 o = evas_object_smart_parent_get(o);
774 o = elm_widget_parent_widget_get(o);
776 o = evas_object_smart_parent_get(o);
785 _elm_win_object_focus_in(void *data, Evas *e __UNUSED__, void *event_info)
787 Evas_Object *obj = event_info, *target;
790 if (win->focus_highlight.cur.target == obj)
793 target = _elm_win_focus_target_get(obj);
794 win->focus_highlight.cur.target = target;
795 if (elm_widget_highlight_in_theme_get(target))
796 win->focus_highlight.cur.handled = EINA_TRUE;
798 _elm_win_focus_target_callbacks_add(win);
800 _elm_win_focus_highlight_reconfigure_job_start(win);
804 _elm_win_object_focus_out(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__)
808 if (!win->focus_highlight.cur.target)
811 if (!win->focus_highlight.cur.handled)
812 _elm_win_focus_target_callbacks_del(win);
813 win->focus_highlight.cur.target = NULL;
814 win->focus_highlight.cur.handled = EINA_FALSE;
816 _elm_win_focus_highlight_reconfigure_job_start(win);
820 _elm_win_focus_highlight_hide(void *data __UNUSED__, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
822 evas_object_hide(obj);
826 _elm_win_focus_highlight_init(Elm_Win *win)
828 evas_event_callback_add(win->evas, EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
829 _elm_win_object_focus_in, win);
830 evas_event_callback_add(win->evas,
831 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
832 _elm_win_object_focus_out, win);
834 win->focus_highlight.cur.target = evas_focus_get(win->evas);
836 win->focus_highlight.top = edje_object_add(win->evas);
837 win->focus_highlight.changed_theme = EINA_TRUE;
838 edje_object_signal_callback_add(win->focus_highlight.top,
839 "elm,action,focus,hide,end", "",
840 _elm_win_focus_highlight_hide, NULL);
841 edje_object_signal_callback_add(win->focus_highlight.top,
842 "elm,action,focus,anim,end", "",
843 _elm_win_focus_highlight_anim_end, win);
844 _elm_win_focus_highlight_reconfigure_job_start(win);
848 _elm_win_focus_highlight_shutdown(Elm_Win *win)
850 _elm_win_focus_highlight_reconfigure_job_stop(win);
851 if (win->focus_highlight.cur.target)
853 _elm_win_focus_target_callbacks_del(win);
854 win->focus_highlight.cur.target = NULL;
856 if (win->focus_highlight.top)
858 evas_object_del(win->focus_highlight.top);
859 win->focus_highlight.top = NULL;
862 evas_event_callback_del_full(win->evas,
863 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
864 _elm_win_object_focus_in, win);
865 evas_event_callback_del_full(win->evas,
866 EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
867 _elm_win_object_focus_out, win);
871 _elm_win_focus_highlight_visible_set(Elm_Win *win, Eina_Bool visible)
875 top = win->focus_highlight.top;
880 evas_object_show(top);
881 edje_object_signal_emit(top, "elm,action,focus,show", "elm");
887 edje_object_signal_emit(top, "elm,action,focus,hide", "elm");
892 _elm_win_focus_highlight_reconfigure_job(void *data)
894 _elm_win_focus_highlight_reconfigure((Elm_Win *)data);
898 _elm_win_focus_highlight_reconfigure_job_start(Elm_Win *win)
900 if (win->focus_highlight.reconf_job)
901 ecore_job_del(win->focus_highlight.reconf_job);
902 win->focus_highlight.reconf_job = ecore_job_add(
903 _elm_win_focus_highlight_reconfigure_job, win);
907 _elm_win_focus_highlight_reconfigure_job_stop(Elm_Win *win)
909 if (win->focus_highlight.reconf_job)
910 ecore_job_del(win->focus_highlight.reconf_job);
911 win->focus_highlight.reconf_job = NULL;
915 _elm_win_focus_highlight_simple_setup(Elm_Win *win, Evas_Object *obj)
917 Evas_Object *clip, *target = win->focus_highlight.cur.target;
918 Evas_Coord x, y, w, h;
920 clip = evas_object_clip_get(target);
921 evas_object_geometry_get(target, &x, &y, &w, &h);
923 evas_object_move(obj, x, y);
924 evas_object_resize(obj, w, h);
925 evas_object_clip_set(obj, clip);
929 _elm_win_focus_highlight_anim_setup(Elm_Win *win, Evas_Object *obj)
931 Evas_Coord tx, ty, tw, th;
932 Evas_Coord w, h, px, py, pw, ph;
933 Edje_Message_Int_Set *m;
934 Evas_Object *previous = win->focus_highlight.prev.target;
935 Evas_Object *target = win->focus_highlight.cur.target;
937 evas_object_geometry_get(win->win_obj, NULL, NULL, &w, &h);
938 evas_object_geometry_get(target, &tx, &ty, &tw, &th);
939 evas_object_geometry_get(previous, &px, &py, &pw, &ph);
940 evas_object_move(obj, 0, 0);
941 evas_object_resize(obj, tw, th);
942 evas_object_clip_unset(obj);
944 m = alloca(sizeof(*m) + (sizeof(int) * 8));
954 edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, m);
958 _elm_win_focus_highlight_anim_end(void *data, Evas_Object *obj, const char *emission __UNUSED__, const char *source __UNUSED__)
961 _elm_win_focus_highlight_simple_setup(win, obj);
965 _elm_win_focus_highlight_reconfigure(Elm_Win *win)
967 Evas_Object *target = win->focus_highlight.cur.target;
968 Evas_Object *previous = win->focus_highlight.prev.target;
969 Evas_Object *top = win->focus_highlight.top;
970 Eina_Bool visible_changed;
971 Eina_Bool common_visible;
972 const char *sig = NULL;
974 _elm_win_focus_highlight_reconfigure_job_stop(win);
976 visible_changed = (win->focus_highlight.cur.visible !=
977 win->focus_highlight.prev.visible);
979 if ((target == previous) && (!visible_changed) &&
980 (!win->focus_highlight.geometry_changed))
983 if ((previous) && (win->focus_highlight.prev.handled))
984 elm_widget_signal_emit(previous, "elm,action,focus_highlight,hide", "elm");
987 common_visible = EINA_FALSE;
988 else if (win->focus_highlight.cur.handled)
990 common_visible = EINA_FALSE;
991 if (win->focus_highlight.cur.visible)
992 sig = "elm,action,focus_highlight,show";
994 sig = "elm,action,focus_highlight,hide";
997 common_visible = win->focus_highlight.cur.visible;
999 _elm_win_focus_highlight_visible_set(win, common_visible);
1001 elm_widget_signal_emit(target, sig, "elm");
1003 if ((!target) || (!common_visible) || (win->focus_highlight.cur.handled))
1006 if (win->focus_highlight.changed_theme)
1009 if (win->focus_highlight.style)
1010 str = win->focus_highlight.style;
1013 _elm_theme_object_set(win->win_obj, top, "focus_highlight", "top",
1015 win->focus_highlight.changed_theme = EINA_FALSE;
1017 if (_elm_config->focus_highlight_animate)
1019 str = edje_object_data_get(win->focus_highlight.top, "animate");
1020 win->focus_highlight.top_animate = ((str) && (!strcmp(str, "on")));
1024 if ((win->focus_highlight.top_animate) && (previous) &&
1025 (!win->focus_highlight.prev.handled))
1026 _elm_win_focus_highlight_anim_setup(win, top);
1028 _elm_win_focus_highlight_simple_setup(win, top);
1029 evas_object_raise(top);
1032 win->focus_highlight.geometry_changed = EINA_FALSE;
1033 win->focus_highlight.prev = win->focus_highlight.cur;
1038 _debug_key_down(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info)
1040 Evas_Event_Key_Down *ev = event_info;
1042 if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
1046 if ((strcmp(ev->keyname, "F12")) ||
1047 (!evas_key_modifier_is_set(ev->modifiers, "Control")))
1050 printf("Tree graph generated.\n");
1051 elm_object_tree_dot_dump(obj, "./dump.dot");
1056 _win_img_hide(void *data,
1058 Evas_Object *obj __UNUSED__,
1059 void *event_info __UNUSED__)
1061 Elm_Win *win = data;
1063 elm_widget_focus_hide_handle(win->win_obj);
1067 _win_img_mouse_down(void *data,
1069 Evas_Object *obj __UNUSED__,
1070 void *event_info __UNUSED__)
1072 Elm_Win *win = data;
1073 elm_widget_focus_mouse_down_handle(win->win_obj);
1077 _win_img_focus_in(void *data,
1079 Evas_Object *obj __UNUSED__,
1080 void *event_info __UNUSED__)
1082 Elm_Win *win = data;
1083 elm_widget_focus_steal(win->win_obj);
1087 _win_img_focus_out(void *data,
1089 Evas_Object *obj __UNUSED__,
1090 void *event_info __UNUSED__)
1092 Elm_Win *win = data;
1093 elm_widget_focused_object_clear(win->win_obj);
1097 _win_inlined_image_set(Elm_Win *win)
1099 evas_object_image_alpha_set(win->img_obj, EINA_FALSE);
1100 evas_object_image_filled_set(win->img_obj, EINA_TRUE);
1101 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_DEL,
1102 _elm_win_obj_callback_img_obj_del, win);
1104 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_HIDE,
1105 _win_img_hide, win);
1106 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_MOUSE_DOWN,
1107 _win_img_mouse_down, win);
1108 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_IN,
1109 _win_img_focus_in, win);
1110 evas_object_event_callback_add(win->img_obj, EVAS_CALLBACK_FOCUS_OUT,
1111 _win_img_focus_out, win);
1115 * Adds a window object. If this is the first window created, pass NULL as
1118 * @param parent Parent object to add the window to, or NULL
1119 * @param name The name of the window
1120 * @param type The window type, one of the following:
1122 * ELM_WIN_DIALOG_BASIC
1130 * @return The created object, or NULL on failure
1135 elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type)
1139 const char *fontpath;
1141 win = ELM_NEW(Elm_Win);
1143 #define FALLBACK_TRY(engine) \
1146 CRITICAL(engine " engine creation failed. Trying software X11."); \
1147 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1); \
1149 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1153 case ELM_WIN_INLINED_IMAGE:
1157 Evas *e = evas_object_evas_get(parent);
1160 Ecore_Evas *ee = ecore_evas_ecore_evas_get(e);
1163 win->img_obj = ecore_evas_object_image_new(ee);
1166 win->ee = ecore_evas_object_ecore_evas_get(win->img_obj);
1169 _win_inlined_image_set(win);
1173 evas_object_del(win->img_obj);
1174 win->img_obj = NULL;
1183 if (ENGINE_COMPARE(ELM_SOFTWARE_X11))
1185 win->ee = ecore_evas_software_x11_new(NULL, 0, 0, 0, 1, 1);
1186 #ifdef HAVE_ELEMENTARY_X
1187 win->client_message_handler = ecore_event_handler_add
1188 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1191 else if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1193 win->ee = ecore_evas_fb_new(NULL, 0, 1, 1);
1194 FALLBACK_TRY("Sofware FB");
1196 else if (ENGINE_COMPARE(ELM_SOFTWARE_DIRECTFB))
1198 win->ee = ecore_evas_directfb_new(NULL, 1, 0, 0, 1, 1);
1199 FALLBACK_TRY("Sofware DirectFB");
1201 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_X11))
1203 win->ee = ecore_evas_software_x11_16_new(NULL, 0, 0, 0, 1, 1);
1204 FALLBACK_TRY("Sofware-16");
1205 #ifdef HAVE_ELEMENTARY_X
1206 win->client_message_handler = ecore_event_handler_add
1207 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1210 else if (ENGINE_COMPARE(ELM_SOFTWARE_8_X11))
1212 win->ee = ecore_evas_software_x11_8_new(NULL, 0, 0, 0, 1, 1);
1213 FALLBACK_TRY("Sofware-8");
1214 #ifdef HAVE_ELEMENTARY_X
1215 win->client_message_handler = ecore_event_handler_add
1216 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1219 else if (ENGINE_COMPARE(ELM_XRENDER_X11))
1221 win->ee = ecore_evas_xrender_x11_new(NULL, 0, 0, 0, 1, 1);
1222 FALLBACK_TRY("XRender");
1223 #ifdef HAVE_ELEMENTARY_X
1224 win->client_message_handler = ecore_event_handler_add
1225 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1228 else if (ENGINE_COMPARE(ELM_OPENGL_X11))
1230 win->ee = ecore_evas_gl_x11_new(NULL, 0, 0, 0, 1, 1);
1231 FALLBACK_TRY("OpenGL");
1232 #ifdef HAVE_ELEMENTARY_X
1233 win->client_message_handler = ecore_event_handler_add
1234 (ECORE_X_EVENT_CLIENT_MESSAGE, _elm_win_client_message, win);
1237 else if (ENGINE_COMPARE(ELM_SOFTWARE_WIN32))
1239 win->ee = ecore_evas_software_gdi_new(NULL, 0, 0, 1, 1);
1240 FALLBACK_TRY("Sofware Win32");
1242 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1244 win->ee = ecore_evas_software_wince_gdi_new(NULL, 0, 0, 1, 1);
1245 FALLBACK_TRY("Sofware-16-WinCE");
1247 else if (ENGINE_COMPARE(ELM_SOFTWARE_SDL))
1249 win->ee = ecore_evas_sdl_new(NULL, 0, 0, 0, 0, 0, 1);
1250 FALLBACK_TRY("Sofware SDL");
1252 else if (ENGINE_COMPARE(ELM_SOFTWARE_16_SDL))
1254 win->ee = ecore_evas_sdl16_new(NULL, 0, 0, 0, 0, 0, 1);
1255 FALLBACK_TRY("Sofware-16-SDL");
1257 else if (ENGINE_COMPARE(ELM_OPENGL_SDL))
1259 win->ee = ecore_evas_gl_sdl_new(NULL, 1, 1, 0, 0);
1260 FALLBACK_TRY("OpenGL SDL");
1268 ERR("Cannot create window.");
1272 #ifdef HAVE_ELEMENTARY_X
1273 _elm_win_xwindow_get(win);
1275 if ((_elm_config->bgpixmap) && (!_elm_config->compositing))
1276 ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_EXPOSE);
1277 // bg pixmap done by x - has other issues like can be redrawn by x before it
1278 // is filled/ready by app
1279 // ecore_evas_avoid_damage_set(win->ee, ECORE_EVAS_AVOID_DAMAGE_BUILT_IN);
1282 win->parent = parent;
1284 evas_object_event_callback_add(win->parent, EVAS_CALLBACK_DEL,
1285 _elm_win_obj_callback_parent_del, win);
1287 win->evas = ecore_evas_get(win->ee);
1288 win->win_obj = elm_widget_add(win->evas);
1289 elm_widget_type_set(win->win_obj, "win");
1290 ELM_SET_WIDTYPE(widtype, "win");
1291 elm_widget_data_set(win->win_obj, win);
1292 elm_widget_event_hook_set(win->win_obj, _elm_win_event_cb);
1293 elm_widget_on_focus_hook_set(win->win_obj, _elm_win_on_focus_hook, NULL);
1294 elm_widget_can_focus_set(win->win_obj, EINA_TRUE);
1295 elm_widget_highlight_ignore_set(win->win_obj, EINA_TRUE);
1296 elm_widget_focus_next_hook_set(win->win_obj, _elm_win_focus_next_hook);
1297 evas_object_color_set(win->win_obj, 0, 0, 0, 0);
1298 evas_object_move(win->win_obj, 0, 0);
1299 evas_object_resize(win->win_obj, 1, 1);
1300 evas_object_layer_set(win->win_obj, 50);
1301 evas_object_pass_events_set(win->win_obj, EINA_TRUE);
1303 evas_object_intercept_move_callback_add(win->win_obj,
1304 _elm_win_obj_intercept_move, win);
1305 evas_object_intercept_show_callback_add(win->win_obj,
1306 _elm_win_obj_intercept_show, win);
1307 ecore_evas_object_associate(win->ee, win->win_obj,
1308 ECORE_EVAS_OBJECT_ASSOCIATE_BASE |
1309 ECORE_EVAS_OBJECT_ASSOCIATE_STACK |
1310 ECORE_EVAS_OBJECT_ASSOCIATE_LAYER);
1311 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_SHOW,
1312 _elm_win_obj_callback_show, win);
1313 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_HIDE,
1314 _elm_win_obj_callback_hide, win);
1315 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_DEL,
1316 _elm_win_obj_callback_del, win);
1317 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_MOVE,
1318 _elm_win_obj_callback_move, win);
1319 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_RESIZE,
1320 _elm_win_obj_callback_resize, win);
1322 ecore_evas_name_class_set(win->ee, name, _elm_appname);
1323 ecore_evas_callback_delete_request_set(win->ee, _elm_win_delete_request);
1324 ecore_evas_callback_resize_set(win->ee, _elm_win_resize);
1325 ecore_evas_callback_focus_in_set(win->ee, _elm_win_focus_in);
1326 ecore_evas_callback_focus_out_set(win->ee, _elm_win_focus_out);
1327 ecore_evas_callback_move_set(win->ee, _elm_win_move);
1328 evas_image_cache_set(win->evas, (_elm_config->image_cache * 1024));
1329 evas_font_cache_set(win->evas, (_elm_config->font_cache * 1024));
1330 EINA_LIST_FOREACH(_elm_config->font_dirs, l, fontpath)
1331 evas_font_path_append(win->evas, fontpath);
1332 if (!_elm_config->font_hinting)
1333 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_NONE);
1334 else if (_elm_config->font_hinting == 1)
1335 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_AUTO);
1336 else if (_elm_config->font_hinting == 2)
1337 evas_font_hinting_set(win->evas, EVAS_FONT_HINTING_BYTECODE);
1339 #ifdef HAVE_ELEMENTARY_X
1340 _elm_win_xwin_update(win);
1343 _elm_win_list = eina_list_append(_elm_win_list, win->win_obj);
1345 if (ENGINE_COMPARE(ELM_SOFTWARE_FB))
1347 ecore_evas_fullscreen_set(win->ee, 1);
1349 #undef ENGINE_COMPARE
1351 if (_elm_config->focus_highlight_enable)
1352 elm_win_focus_highlight_enabled_set(win->win_obj, EINA_TRUE);
1355 Evas_Modifier_Mask mask = evas_key_modifier_mask_get(win->evas, "Control");
1356 evas_object_event_callback_add(win->win_obj, EVAS_CALLBACK_KEY_DOWN,
1357 _debug_key_down, win);
1359 Eina_Bool ret = evas_object_key_grab(win->win_obj, "F12", mask, 0,
1361 printf("Key F12 exclusive for dot tree generation. (%d)\n", ret);
1363 return win->win_obj;
1367 * Add @p subobj as a resize object of window @p obj.
1369 * @param obj The window object
1370 * @param subobj The resize object to add
1375 elm_win_resize_object_add(Evas_Object *obj, Evas_Object *subobj)
1379 ELM_CHECK_WIDTYPE(obj, widtype);
1380 win = elm_widget_data_get(obj);
1382 win->subobjs = eina_list_append(win->subobjs, subobj);
1383 elm_widget_sub_object_add(obj, subobj);
1384 evas_object_event_callback_add(subobj, EVAS_CALLBACK_DEL,
1385 _elm_win_subobj_callback_del, obj);
1386 evas_object_event_callback_add(subobj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1387 _elm_win_subobj_callback_changed_size_hints,
1389 ecore_evas_geometry_get(win->ee, NULL, NULL, &w, &h);
1390 evas_object_move(subobj, 0, 0);
1391 evas_object_resize(subobj, w, h);
1392 _elm_win_eval_subobjs(obj);
1396 * Delete @p subobj as a resize object of window @p obj.
1398 * @param obj The window object
1399 * @param subobj The resize object to add
1404 elm_win_resize_object_del(Evas_Object *obj, Evas_Object *subobj)
1407 ELM_CHECK_WIDTYPE(obj, widtype);
1408 win = elm_widget_data_get(obj);
1410 evas_object_event_callback_del_full(subobj,
1411 EVAS_CALLBACK_CHANGED_SIZE_HINTS,
1412 _elm_win_subobj_callback_changed_size_hints,
1414 evas_object_event_callback_del_full(subobj, EVAS_CALLBACK_DEL,
1415 _elm_win_subobj_callback_del, obj);
1416 win->subobjs = eina_list_remove(win->subobjs, subobj);
1417 elm_widget_sub_object_del(obj, subobj);
1418 _elm_win_eval_subobjs(obj);
1422 * Set the title of the window
1424 * @param obj The window object
1425 * @param title The title to set
1430 elm_win_title_set(Evas_Object *obj, const char *title)
1433 ELM_CHECK_WIDTYPE(obj, widtype);
1434 win = elm_widget_data_get(obj);
1436 ecore_evas_title_set(win->ee, title);
1440 * Get the title of the window
1442 * @param obj The window object
1448 elm_win_title_get(const Evas_Object *obj)
1451 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
1452 win = elm_widget_data_get(obj);
1453 if (!win) return NULL;
1454 return ecore_evas_title_get(win->ee);
1458 * Set the window's autodel state.
1460 * @param obj The window object
1461 * @param autodel If true, the window will automatically delete itself when closed
1466 elm_win_autodel_set(Evas_Object *obj, Eina_Bool autodel)
1469 ELM_CHECK_WIDTYPE(obj, widtype);
1470 win = elm_widget_data_get(obj);
1472 win->autodel = autodel;
1476 * Get the window's autodel state.
1478 * @param obj The window object
1479 * @return If the window will automatically delete itself when closed
1484 elm_win_autodel_get(const Evas_Object *obj)
1487 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1488 win = elm_widget_data_get(obj);
1489 if (!win) return EINA_FALSE;
1490 return win->autodel;
1494 * Activate a window object.
1496 * @param obj The window object
1501 elm_win_activate(Evas_Object *obj)
1504 ELM_CHECK_WIDTYPE(obj, widtype);
1505 win = elm_widget_data_get(obj);
1507 ecore_evas_activate(win->ee);
1511 * Lower a window object.
1513 * @param obj The window object
1518 elm_win_lower(Evas_Object *obj)
1521 ELM_CHECK_WIDTYPE(obj, widtype);
1522 win = elm_widget_data_get(obj);
1524 ecore_evas_lower(win->ee);
1528 * Raise a window object.
1530 * @param obj The window object
1535 elm_win_raise(Evas_Object *obj)
1538 ELM_CHECK_WIDTYPE(obj, widtype);
1539 win = elm_widget_data_get(obj);
1541 ecore_evas_raise(win->ee);
1545 * Set the borderless state of a window.
1547 * @param obj The window object
1548 * @param borderless If true, the window is borderless
1553 elm_win_borderless_set(Evas_Object *obj, Eina_Bool borderless)
1556 ELM_CHECK_WIDTYPE(obj, widtype);
1557 win = elm_widget_data_get(obj);
1559 ecore_evas_borderless_set(win->ee, borderless);
1560 #ifdef HAVE_ELEMENTARY_X
1561 _elm_win_xwin_update(win);
1566 * Get the borderless state of a window.
1568 * @param obj The window object
1569 * @return If true, the window is borderless
1574 elm_win_borderless_get(const Evas_Object *obj)
1577 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1578 win = elm_widget_data_get(obj);
1579 if (!win) return EINA_FALSE;
1580 return ecore_evas_borderless_get(win->ee);
1584 * Set the shaped state of a window.
1586 * @param obj The window object
1587 * @param shaped If true, the window is shaped
1592 elm_win_shaped_set(Evas_Object *obj, Eina_Bool shaped)
1595 ELM_CHECK_WIDTYPE(obj, widtype);
1596 win = elm_widget_data_get(obj);
1598 ecore_evas_shaped_set(win->ee, shaped);
1599 #ifdef HAVE_ELEMENTARY_X
1600 _elm_win_xwin_update(win);
1605 * Get the shaped state of a window.
1607 * @param obj The window object
1608 * @return If true, the window is shaped
1613 elm_win_shaped_get(const Evas_Object *obj)
1616 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1617 win = elm_widget_data_get(obj);
1618 if (!win) return EINA_FALSE;
1619 return ecore_evas_shaped_get(win->ee);
1623 * Set the alpha channel state of a window.
1625 * @param obj The window object
1626 * @param alpha If true, the window has an alpha channel
1631 elm_win_alpha_set(Evas_Object *obj, Eina_Bool alpha)
1634 ELM_CHECK_WIDTYPE(obj, widtype);
1635 win = elm_widget_data_get(obj);
1640 else if (win->img_obj)
1642 evas_object_image_alpha_set(win->img_obj, alpha);
1646 #ifdef HAVE_ELEMENTARY_X
1651 if (!_elm_config->compositing)
1652 elm_win_shaped_set(obj, alpha);
1654 ecore_evas_alpha_set(win->ee, alpha);
1657 ecore_evas_alpha_set(win->ee, alpha);
1658 _elm_win_xwin_update(win);
1662 ecore_evas_alpha_set(win->ee, alpha);
1667 * Get the alpha channel state of a window.
1669 * @param obj The window object
1670 * @return If true, the window has an alpha channel
1675 elm_win_alpha_get(const Evas_Object *obj)
1678 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1679 win = elm_widget_data_get(obj);
1680 if (!win) return EINA_FALSE;
1681 return ecore_evas_alpha_get(win->ee);
1685 * Set the transparency state of a window.
1687 * @param obj The window object
1688 * @param transparent If true, the window is transparent
1693 elm_win_transparent_set(Evas_Object *obj, Eina_Bool transparent)
1696 ELM_CHECK_WIDTYPE(obj, widtype);
1697 win = elm_widget_data_get(obj);
1703 else if (win->img_obj)
1705 evas_object_image_alpha_set(win->img_obj, transparent);
1709 #ifdef HAVE_ELEMENTARY_X
1712 ecore_evas_transparent_set(win->ee, transparent);
1713 _elm_win_xwin_update(win);
1717 ecore_evas_transparent_set(win->ee, transparent);
1722 * Get the transparency state of a window.
1724 * @param obj The window object
1725 * @return If true, the window is transparent
1730 elm_win_transparent_get(const Evas_Object *obj)
1733 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1734 win = elm_widget_data_get(obj);
1735 if (!win) return EINA_FALSE;
1737 return ecore_evas_transparent_get(win->ee);
1741 * Set the override state of a window.
1743 * @param obj The window object
1744 * @param override If true, the window is overridden
1749 elm_win_override_set(Evas_Object *obj, Eina_Bool override)
1752 ELM_CHECK_WIDTYPE(obj, widtype);
1753 win = elm_widget_data_get(obj);
1755 ecore_evas_override_set(win->ee, override);
1756 #ifdef HAVE_ELEMENTARY_X
1757 _elm_win_xwin_update(win);
1762 * Get the override state of a window.
1764 * @param obj The window object
1765 * @return If true, the window is overridden
1770 elm_win_override_get(const Evas_Object *obj)
1773 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1774 win = elm_widget_data_get(obj);
1775 if (!win) return EINA_FALSE;
1776 return ecore_evas_override_get(win->ee);
1780 * Set the fullscreen state of a window.
1782 * @param obj The window object
1783 * @param fullscreen If true, the window is fullscreen
1788 elm_win_fullscreen_set(Evas_Object *obj, Eina_Bool fullscreen)
1791 ELM_CHECK_WIDTYPE(obj, widtype);
1792 win = elm_widget_data_get(obj);
1795 // YYY: handle if win->img_obj
1796 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1797 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1798 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1800 // these engines... can ONLY be fullscreen
1805 ecore_evas_fullscreen_set(win->ee, fullscreen);
1806 #ifdef HAVE_ELEMENTARY_X
1807 _elm_win_xwin_update(win);
1810 #undef ENGINE_COMPARE
1814 * Get the fullscreen state of a window.
1816 * @param obj The window object
1817 * @return If true, the window is fullscreen
1822 elm_win_fullscreen_get(const Evas_Object *obj)
1825 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1826 win = elm_widget_data_get(obj);
1827 if (!win) return EINA_FALSE;
1829 #define ENGINE_COMPARE(name) (!strcmp(_elm_config->engine, name))
1830 if (ENGINE_COMPARE(ELM_SOFTWARE_FB) ||
1831 ENGINE_COMPARE(ELM_SOFTWARE_16_WINCE))
1833 // these engines... can ONLY be fullscreen
1838 return ecore_evas_fullscreen_get(win->ee);
1840 #undef ENGINE_COMPARE
1844 * Set the maximized state of a window.
1846 * @param obj The window object
1847 * @param maximized If true, the window is maximized
1852 elm_win_maximized_set(Evas_Object *obj, Eina_Bool maximized)
1855 ELM_CHECK_WIDTYPE(obj, widtype);
1856 win = elm_widget_data_get(obj);
1858 // YYY: handle if win->img_obj
1859 ecore_evas_maximized_set(win->ee, maximized);
1860 #ifdef HAVE_ELEMENTARY_X
1861 _elm_win_xwin_update(win);
1866 * Get the maximized state of a window.
1868 * @param obj The window object
1869 * @return If true, the window is maximized
1874 elm_win_maximized_get(const Evas_Object *obj)
1877 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1878 win = elm_widget_data_get(obj);
1879 if (!win) return EINA_FALSE;
1880 return ecore_evas_maximized_get(win->ee);
1884 * Set the iconified state of a window.
1886 * @param obj The window object
1887 * @param iconified If true, the window is iconified
1892 elm_win_iconified_set(Evas_Object *obj, Eina_Bool iconified)
1895 ELM_CHECK_WIDTYPE(obj, widtype);
1896 win = elm_widget_data_get(obj);
1898 ecore_evas_iconified_set(win->ee, iconified);
1899 #ifdef HAVE_ELEMENTARY_X
1900 _elm_win_xwin_update(win);
1905 * Get the iconified state of a window.
1907 * @param obj The window object
1908 * @return If true, the window is iconified
1913 elm_win_iconified_get(const Evas_Object *obj)
1916 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
1917 win = elm_widget_data_get(obj);
1918 if (!win) return EINA_FALSE;
1919 return ecore_evas_iconified_get(win->ee);
1923 * Set the layer of the window.
1925 * @param obj The window object
1926 * @param layer The layer of the window
1931 elm_win_layer_set(Evas_Object *obj, int layer)
1934 ELM_CHECK_WIDTYPE(obj, widtype);
1935 win = elm_widget_data_get(obj);
1937 ecore_evas_layer_set(win->ee, layer);
1938 #ifdef HAVE_ELEMENTARY_X
1939 _elm_win_xwin_update(win);
1944 * Get the layer of the window.
1946 * @param obj The window object
1947 * @return The layer of the window
1952 elm_win_layer_get(const Evas_Object *obj)
1955 ELM_CHECK_WIDTYPE(obj, widtype) -1;
1956 win = elm_widget_data_get(obj);
1957 if (!win) return -1;
1958 return ecore_evas_layer_get(win->ee);
1962 * Set the rotation of the window.
1964 * @param obj The window object
1965 * @param rotation The rotation of the window, in degrees (0-360)
1970 elm_win_rotation_set(Evas_Object *obj, int rotation)
1973 ELM_CHECK_WIDTYPE(obj, widtype);
1974 win = elm_widget_data_get(obj);
1976 if (win->rot == rotation) return;
1977 win->rot = rotation;
1978 ecore_evas_rotation_set(win->ee, rotation);
1979 evas_object_size_hint_min_set(obj, -1, -1);
1980 evas_object_size_hint_max_set(obj, -1, -1);
1981 _elm_win_eval_subobjs(obj);
1982 #ifdef HAVE_ELEMENTARY_X
1983 _elm_win_xwin_update(win);
1988 * Rotates the window and resizes it
1990 * @param obj The window object
1991 * @param layer The rotation of the window in degrees (0-360)
1996 elm_win_rotation_with_resize_set(Evas_Object *obj, int rotation)
1999 ELM_CHECK_WIDTYPE(obj, widtype);
2000 win = elm_widget_data_get(obj);
2002 if (win->rot == rotation) return;
2003 win->rot = rotation;
2004 ecore_evas_rotation_with_resize_set(win->ee, rotation);
2005 evas_object_size_hint_min_set(obj, -1, -1);
2006 evas_object_size_hint_max_set(obj, -1, -1);
2007 _elm_win_eval_subobjs(obj);
2008 #ifdef HAVE_ELEMENTARY_X
2009 _elm_win_xwin_update(win);
2014 * Get the rotation of the window.
2016 * @param obj The window object
2017 * @return The rotation of the window in degrees (0-360)
2022 elm_win_rotation_get(const Evas_Object *obj)
2025 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2026 win = elm_widget_data_get(obj);
2027 if (!win) return -1;
2032 * Set the sticky state of the window.
2034 * @param obj The window object
2035 * @param sticky If true, the window's sticky state is enabled
2040 elm_win_sticky_set(Evas_Object *obj, Eina_Bool sticky)
2043 ELM_CHECK_WIDTYPE(obj, widtype);
2044 win = elm_widget_data_get(obj);
2046 ecore_evas_sticky_set(win->ee, sticky);
2047 #ifdef HAVE_ELEMENTARY_X
2048 _elm_win_xwin_update(win);
2053 * Get the sticky state of the window.
2055 * @param obj The window object
2056 * @return If true, the window's sticky state is enabled
2061 elm_win_sticky_get(const Evas_Object *obj)
2064 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2065 win = elm_widget_data_get(obj);
2066 if (!win) return EINA_FALSE;
2067 return ecore_evas_sticky_get(win->ee);
2071 * Sets the keyboard mode of the window.
2073 * @param obj The window object
2074 * @param mode The mode to set; one of:
2075 * ELM_WIN_KEYBOARD_UNKNOWN
2076 * ELM_WIN_KEYBOARD_OFF
2077 * ELM_WIN_KEYBOARD_ON
2078 * ELM_WIN_KEYBOARD_ALPHA
2079 * ELM_WIN_KEYBOARD_NUMERIC
2080 * ELM_WIN_KEYBOARD_PIN
2081 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2082 * ELM_WIN_KEYBOARD_HEX
2083 * ELM_WIN_KEYBOARD_TERMINAL
2084 * ELM_WIN_KEYBOARD_PASSWORD
2085 * ELM_WIN_KEYBOARD_IP
2086 * ELM_WIN_KEYBOARD_HOST
2087 * ELM_WIN_KEYBOARD_FILE
2088 * ELM_WIN_KEYBOARD_URL
2089 * ELM_WIN_KEYBOARD_KEYPAD
2090 * ELM_WIN_KEYBOARD_J2ME
2095 elm_win_keyboard_mode_set(Evas_Object *obj, Elm_Win_Keyboard_Mode mode)
2098 ELM_CHECK_WIDTYPE(obj, widtype);
2099 win = elm_widget_data_get(obj);
2101 if (mode == win->kbdmode) return;
2102 #ifdef HAVE_ELEMENTARY_X
2103 _elm_win_xwindow_get(win);
2105 win->kbdmode = mode;
2106 #ifdef HAVE_ELEMENTARY_X
2108 ecore_x_e_virtual_keyboard_state_set
2109 (win->xwin, (Ecore_X_Virtual_Keyboard_State)win->kbdmode);
2114 * Gets the keyboard mode of the window.
2116 * @param obj The window object
2117 * @return The mode; one of:
2118 * ELM_WIN_KEYBOARD_UNKNOWN
2119 * ELM_WIN_KEYBOARD_OFF
2120 * ELM_WIN_KEYBOARD_ON
2121 * ELM_WIN_KEYBOARD_ALPHA
2122 * ELM_WIN_KEYBOARD_NUMERIC
2123 * ELM_WIN_KEYBOARD_PIN
2124 * ELM_WIN_KEYBOARD_PHONE_NUMBER
2125 * ELM_WIN_KEYBOARD_HEX
2126 * ELM_WIN_KEYBOARD_TERMINAL
2127 * ELM_WIN_KEYBOARD_PASSWORD
2128 * ELM_WIN_KEYBOARD_IP
2129 * ELM_WIN_KEYBOARD_HOST
2130 * ELM_WIN_KEYBOARD_FILE
2131 * ELM_WIN_KEYBOARD_URL
2132 * ELM_WIN_KEYBOARD_KEYPAD
2133 * ELM_WIN_KEYBOARD_J2ME
2137 EAPI Elm_Win_Keyboard_Mode
2138 elm_win_keyboard_mode_get(const Evas_Object *obj)
2141 ELM_CHECK_WIDTYPE(obj, widtype) ELM_WIN_KEYBOARD_UNKNOWN;
2142 win = elm_widget_data_get(obj);
2143 if (!win) return ELM_WIN_KEYBOARD_UNKNOWN;
2144 return win->kbdmode;
2148 * Sets whether the window is a keyboard.
2150 * @param obj The window object
2151 * @param is_keyboard If true, the window is a virtual keyboard
2156 elm_win_keyboard_win_set(Evas_Object *obj, Eina_Bool is_keyboard)
2159 ELM_CHECK_WIDTYPE(obj, widtype);
2160 win = elm_widget_data_get(obj);
2162 #ifdef HAVE_ELEMENTARY_X
2163 _elm_win_xwindow_get(win);
2165 ecore_x_e_virtual_keyboard_set(win->xwin, is_keyboard);
2170 * Gets whether the window is a keyboard.
2172 * @param obj The window object
2173 * @return If the window is a virtual keyboard
2178 elm_win_keyboard_win_get(const Evas_Object *obj)
2181 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2182 win = elm_widget_data_get(obj);
2183 if (!win) return EINA_FALSE;
2184 #ifdef HAVE_ELEMENTARY_X
2185 _elm_win_xwindow_get(win);
2187 return ecore_x_e_virtual_keyboard_get(win->xwin);
2193 * Get the screen position of a window.
2195 * @param obj The window object
2196 * @param x The int to store the x coordinate to
2197 * @param y The int to store the y coordinate to
2202 elm_win_screen_position_get(const Evas_Object *obj, int *x, int *y)
2205 ELM_CHECK_WIDTYPE(obj, widtype);
2206 win = elm_widget_data_get(obj);
2208 if (x) *x = win->screen.x;
2209 if (y) *y = win->screen.y;
2213 * Set if this window is an illume conformant window
2215 * @param obj The window object
2216 * @param conformant The conformant flag (1 = conformant, 0 = non-conformant)
2221 elm_win_conformant_set(Evas_Object *obj, Eina_Bool conformant)
2224 ELM_CHECK_WIDTYPE(obj, widtype);
2225 win = elm_widget_data_get(obj);
2227 #ifdef HAVE_ELEMENTARY_X
2228 _elm_win_xwindow_get(win);
2230 ecore_x_e_illume_conformant_set(win->xwin, conformant);
2235 * Get if this window is an illume conformant window
2237 * @param obj The window object
2238 * @return A boolean if this window is illume conformant or not
2243 elm_win_conformant_get(const Evas_Object *obj)
2246 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2247 win = elm_widget_data_get(obj);
2248 if (!win) return EINA_FALSE;
2249 #ifdef HAVE_ELEMENTARY_X
2250 _elm_win_xwindow_get(win);
2252 return ecore_x_e_illume_conformant_get(win->xwin);
2258 * Set a window to be an illume quickpanel window
2260 * By default window objects are not quickpanel windows.
2262 * @param obj The window object
2263 * @param quickpanel The quickpanel flag (1 = quickpanel, 0 = normal window)
2268 elm_win_quickpanel_set(Evas_Object *obj, Eina_Bool quickpanel)
2271 ELM_CHECK_WIDTYPE(obj, widtype);
2272 win = elm_widget_data_get(obj);
2274 #ifdef HAVE_ELEMENTARY_X
2275 _elm_win_xwindow_get(win);
2278 ecore_x_e_illume_quickpanel_set(win->xwin, quickpanel);
2281 Ecore_X_Window_State states[2];
2283 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2284 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2285 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2286 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2293 * Get if this window is a quickpanel or not
2295 * @param obj The window object
2296 * @return A boolean if this window is a quickpanel or not
2301 elm_win_quickpanel_get(const Evas_Object *obj)
2304 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2305 win = elm_widget_data_get(obj);
2306 if (!win) return EINA_FALSE;
2307 #ifdef HAVE_ELEMENTARY_X
2308 _elm_win_xwindow_get(win);
2310 return ecore_x_e_illume_quickpanel_get(win->xwin);
2316 * Set the major priority of a quickpanel window
2318 * @param obj The window object
2319 * @param priority The major priority for this quickpanel
2324 elm_win_quickpanel_priority_major_set(Evas_Object *obj, int priority)
2327 ELM_CHECK_WIDTYPE(obj, widtype);
2328 win = elm_widget_data_get(obj);
2330 #ifdef HAVE_ELEMENTARY_X
2331 _elm_win_xwindow_get(win);
2333 ecore_x_e_illume_quickpanel_priority_major_set(win->xwin, priority);
2338 * Get the major priority of a quickpanel window
2340 * @param obj The window object
2341 * @return The major priority of this quickpanel
2346 elm_win_quickpanel_priority_major_get(const Evas_Object *obj)
2349 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2350 win = elm_widget_data_get(obj);
2351 if (!win) return -1;
2352 #ifdef HAVE_ELEMENTARY_X
2353 _elm_win_xwindow_get(win);
2355 return ecore_x_e_illume_quickpanel_priority_major_get(win->xwin);
2361 * Set the minor priority of a quickpanel window
2363 * @param obj The window object
2364 * @param priority The minor priority for this quickpanel
2369 elm_win_quickpanel_priority_minor_set(Evas_Object *obj, int priority)
2372 ELM_CHECK_WIDTYPE(obj, widtype);
2373 win = elm_widget_data_get(obj);
2375 #ifdef HAVE_ELEMENTARY_X
2376 _elm_win_xwindow_get(win);
2378 ecore_x_e_illume_quickpanel_priority_minor_set(win->xwin, priority);
2383 * Get the minor priority of a quickpanel window
2385 * @param obj The window object
2386 * @return The minor priority of this quickpanel
2391 elm_win_quickpanel_priority_minor_get(const Evas_Object *obj)
2394 ELM_CHECK_WIDTYPE(obj, widtype) -1;
2395 win = elm_widget_data_get(obj);
2396 if (!win) return -1;
2397 #ifdef HAVE_ELEMENTARY_X
2398 _elm_win_xwindow_get(win);
2400 return ecore_x_e_illume_quickpanel_priority_minor_get(win->xwin);
2406 * Set which zone this quickpanel should appear in
2408 * @param obj The window object
2409 * @param zone The requested zone for this quickpanel
2414 elm_win_quickpanel_zone_set(Evas_Object *obj, int zone)
2417 ELM_CHECK_WIDTYPE(obj, widtype);
2418 win = elm_widget_data_get(obj);
2420 #ifdef HAVE_ELEMENTARY_X
2421 _elm_win_xwindow_get(win);
2423 ecore_x_e_illume_quickpanel_zone_set(win->xwin, zone);
2428 * Get which zone this quickpanel should appear in
2430 * @param obj The window object
2431 * @return The requested zone for this quickpanel
2436 elm_win_quickpanel_zone_get(const Evas_Object *obj)
2439 ELM_CHECK_WIDTYPE(obj, widtype) 0;
2440 win = elm_widget_data_get(obj);
2442 #ifdef HAVE_ELEMENTARY_X
2443 _elm_win_xwindow_get(win);
2445 return ecore_x_e_illume_quickpanel_zone_get(win->xwin);
2451 * Set the window to be skipped by keyboard focus
2453 * This sets the window to be skipped by normal keyboard input. This means
2454 * a window manager will be asked to not focus this window as well as omit
2455 * it from things like the taskbar, pager, "alt-tab" list etc. etc.
2457 * Call this and enable it on a window BEFORE you show it for the first time,
2458 * otherwise it may have no effect.
2460 * Use this for windows that have only output information or might only be
2461 * interacted with by the mouse or fingers, and never for typing input.
2462 * Be careful that this may have side-effects like making the window
2463 * non-accessible in some cases unless the window is specially handled. Use
2466 * @param obj The window object
2467 * @param skip The skip flag state (EINA_TRUE if it is to be skipped)
2472 elm_win_prop_focus_skip_set(Evas_Object *obj, Eina_Bool skip)
2475 ELM_CHECK_WIDTYPE(obj, widtype);
2476 win = elm_widget_data_get(obj);
2478 #ifdef HAVE_ELEMENTARY_X
2479 _elm_win_xwindow_get(win);
2484 Ecore_X_Window_State states[2];
2486 ecore_x_icccm_hints_set(win->xwin, 0, 0, 0, 0, 0, 0, 0);
2487 states[0] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
2488 states[1] = ECORE_X_WINDOW_STATE_SKIP_PAGER;
2489 ecore_x_netwm_window_state_set(win->xwin, states, 2);
2496 * Send a command to the windowing environment
2498 * This is intended to work in touchscreen or small screen device environments
2499 * where there is a more simplistic window management policy in place. This
2500 * uses the window object indicated to select which part of the environment
2501 * to control (the part that this window lives in), and provides a command
2502 * and an optional parameter structure (use NULL for this if not needed).
2504 * @param obj The window object that lives in the environment to control
2505 * @param command The command to send
2506 * @param params Optional parameters for the command
2511 elm_win_illume_command_send(Evas_Object *obj, Elm_Illume_Command command, void *params __UNUSED__)
2514 ELM_CHECK_WIDTYPE(obj, widtype);
2515 win = elm_widget_data_get(obj);
2517 #ifdef HAVE_ELEMENTARY_X
2518 _elm_win_xwindow_get(win);
2523 case ELM_ILLUME_COMMAND_FOCUS_BACK:
2524 ecore_x_e_illume_focus_back_send(win->xwin);
2526 case ELM_ILLUME_COMMAND_FOCUS_FORWARD:
2527 ecore_x_e_illume_focus_forward_send(win->xwin);
2529 case ELM_ILLUME_COMMAND_FOCUS_HOME:
2530 ecore_x_e_illume_focus_home_send(win->xwin);
2532 case ELM_ILLUME_COMMAND_CLOSE:
2533 ecore_x_e_illume_close_send(win->xwin);
2543 * Get the inlined image object handle
2545 * When you create a window with elm_win_add() of type ELM_WIN_INLINED_IMAGE,
2546 * then the window is in fact an evas image object inlined in the parent
2547 * canvas. You can get this object (be careful to not manipulate it as it
2548 * is under control of elementary), and use it to do things like get pixel
2549 * data, save the image to a file, etc.
2551 * @param obj The window object to get the inlined image from
2552 * @return The inlined image object, or NULL if none exists
2557 elm_win_inlined_image_object_get(Evas_Object *obj)
2560 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2561 win = elm_widget_data_get(obj);
2562 if (!win) return NULL;
2563 return win->img_obj;
2567 * Set the enabled status for the focus highlight in a window
2569 * This function will enable or disable the focus highlight only for the
2570 * given window, regardless of the global setting for it
2572 * @param obj The window where to enable the highlight
2573 * @param enabled The enabled value for the highlight
2578 elm_win_focus_highlight_enabled_set(Evas_Object *obj, Eina_Bool enabled)
2582 ELM_CHECK_WIDTYPE(obj, widtype);
2584 win = elm_widget_data_get(obj);
2585 enabled = !!enabled;
2586 if (win->focus_highlight.enabled == enabled)
2589 win->focus_highlight.enabled = enabled;
2591 if (win->focus_highlight.enabled)
2592 _elm_win_focus_highlight_init(win);
2594 _elm_win_focus_highlight_shutdown(win);
2598 * Get the enabled value of the focus highlight for this window
2600 * @param obj The window in which to check if the focus highlight is enabled
2602 * @return EINA_TRUE if enabled, EINA_FALSE otherwise
2607 elm_win_focus_highlight_enabled_get(const Evas_Object *obj)
2611 ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
2613 win = elm_widget_data_get(obj);
2614 return win->focus_highlight.enabled;
2618 * Set the style for the focus highlight on this window
2620 * Sets the style to use for theming the highlight of focused objects on
2621 * the given window. If @p style is NULL, the default will be used.
2623 * @param obj The window where to set the style
2624 * @param style The style to set
2629 elm_win_focus_highlight_style_set(Evas_Object *obj, const char *style)
2633 ELM_CHECK_WIDTYPE(obj, widtype);
2635 win = elm_widget_data_get(obj);
2636 eina_stringshare_replace(&win->focus_highlight.style, style);
2637 win->focus_highlight.changed_theme = EINA_TRUE;
2638 _elm_win_focus_highlight_reconfigure_job_start(win);
2642 * Get the style set for the focus highlight object
2644 * Gets the style set for this windows highilght object, or NULL if none
2647 * @param obj The window to retrieve the highlights style from
2649 * @return The style set or NULL if none was. Default is used in that case.
2654 elm_win_focus_highlight_style_get(const Evas_Object *obj)
2658 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2660 win = elm_widget_data_get(obj);
2661 return win->focus_highlight.style;
2664 typedef struct _Widget_Data Widget_Data;
2669 Evas_Object *content;
2672 static void _del_hook(Evas_Object *obj);
2673 static void _theme_hook(Evas_Object *obj);
2674 static void _sizing_eval(Evas_Object *obj);
2675 static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
2676 static void _sub_del(void *data, Evas_Object *obj, void *event_info);
2678 static const char *widtype2 = NULL;
2681 _del_hook(Evas_Object *obj)
2683 Widget_Data *wd = elm_widget_data_get(obj);
2689 _theme_hook(Evas_Object *obj)
2691 Widget_Data *wd = elm_widget_data_get(obj);
2692 _elm_theme_object_set(obj, wd->frm, "win", "inwin", elm_widget_style_get(obj));
2694 edje_object_part_swallow(wd->frm, "elm.swallow.content", wd->content);
2699 _elm_inwin_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
2701 Widget_Data *wd = elm_widget_data_get(obj);
2706 /* Try Focus cycle in subitem */
2709 elm_widget_focus_next_get(wd->content, dir, next);
2714 *next = (Evas_Object *)obj;
2719 _sizing_eval(Evas_Object *obj)
2721 Widget_Data *wd = elm_widget_data_get(obj);
2722 Evas_Coord minw = -1, minh = -1;
2724 evas_object_size_hint_min_get(wd->content, &minw, &minh);
2725 edje_object_size_min_calc(wd->frm, &minw, &minh);
2726 evas_object_size_hint_min_set(obj, minw, minh);
2727 evas_object_size_hint_max_set(obj, -1, -1);
2731 _changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
2737 _sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
2739 Widget_Data *wd = elm_widget_data_get(obj);
2740 Evas_Object *sub = event_info;
2741 if (sub == wd->content)
2743 evas_object_event_callback_del_full
2744 (sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints, obj);
2751 * @defgroup Inwin Inwin
2753 * An inwin is a window inside a window that is useful for a quick popup. It does not hover.
2756 elm_win_inwin_add(Evas_Object *obj)
2762 ELM_CHECK_WIDTYPE(obj, widtype) NULL;
2763 win = elm_widget_data_get(obj);
2764 if (!win) return NULL;
2765 wd = ELM_NEW(Widget_Data);
2766 obj2 = elm_widget_add(win->evas);
2767 elm_widget_type_set(obj2, "inwin");
2768 ELM_SET_WIDTYPE(widtype2, "inwin");
2769 elm_widget_sub_object_add(obj, obj2);
2770 evas_object_size_hint_weight_set(obj2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
2771 evas_object_size_hint_align_set(obj2, EVAS_HINT_FILL, EVAS_HINT_FILL);
2772 elm_win_resize_object_add(obj, obj2);
2774 elm_widget_data_set(obj2, wd);
2775 elm_widget_del_hook_set(obj2, _del_hook);
2776 elm_widget_theme_hook_set(obj2, _theme_hook);
2777 elm_widget_focus_next_hook_set(obj2, _elm_inwin_focus_next_hook);
2778 elm_widget_can_focus_set(obj2, EINA_TRUE);
2779 elm_widget_highlight_ignore_set(obj2, EINA_TRUE);
2781 wd->frm = edje_object_add(win->evas);
2782 _elm_theme_object_set(obj, wd->frm, "win", "inwin", "default");
2783 elm_widget_resize_object_set(obj2, wd->frm);
2785 evas_object_smart_callback_add(obj2, "sub-object-del", _sub_del, obj2);
2792 * Activates an inwin object
2794 * @param obj The inwin to activate
2799 elm_win_inwin_activate(Evas_Object *obj)
2801 ELM_CHECK_WIDTYPE(obj, widtype2);
2802 Widget_Data *wd = elm_widget_data_get(obj);
2804 evas_object_raise(obj);
2805 evas_object_show(obj);
2806 edje_object_signal_emit(wd->frm, "elm,action,show", "elm");
2807 elm_object_focus(obj);
2811 * Set the content of an inwin object.
2813 * Once the content object is set, a previously set one will be deleted.
2814 * If you want to keep that old content object, use the
2815 * elm_win_inwin_content_unset() function.
2817 * @param obj The inwin object
2818 * @param content The object to set as content
2823 elm_win_inwin_content_set(Evas_Object *obj, Evas_Object *content)
2825 ELM_CHECK_WIDTYPE(obj, widtype2);
2826 Widget_Data *wd = elm_widget_data_get(obj);
2828 if (wd->content == content) return;
2829 if (wd->content) evas_object_del(wd->content);
2830 wd->content = content;
2833 elm_widget_sub_object_add(obj, content);
2834 evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
2835 _changed_size_hints, obj);
2836 edje_object_part_swallow(wd->frm, "elm.swallow.content", content);
2842 * Get the content of an inwin object.
2844 * Return the content object which is set for this widget.
2846 * @param obj The inwin object
2847 * @return The content that is being used
2852 elm_win_inwin_content_get(const Evas_Object *obj)
2854 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2855 Widget_Data *wd = elm_widget_data_get(obj);
2856 if (!wd) return NULL;
2861 * Unset the content of an inwin object.
2863 * Unparent and return the content object which was set for this widget.
2865 * @param obj The inwin object
2866 * @return The content that was being used
2871 elm_win_inwin_content_unset(Evas_Object *obj)
2873 ELM_CHECK_WIDTYPE(obj, widtype2) NULL;
2874 Widget_Data *wd = elm_widget_data_get(obj);
2875 if (!wd) return NULL;
2876 if (!wd->content) return NULL;
2877 Evas_Object *content = wd->content;
2878 elm_widget_sub_object_del(obj, wd->content);
2879 edje_object_part_unswallow(wd->frm, wd->content);
2884 /* windowing spcific calls - shall we do this differently? */
2886 static Ecore_X_Window
2887 _elm_ee_win_get(const Evas_Object *obj)
2890 #ifdef HAVE_ELEMENTARY_X
2891 Ecore_Evas *ee = ecore_evas_ecore_evas_get(evas_object_evas_get(obj));
2892 if (ee) return (Ecore_X_Window)ecore_evas_window_get(ee);
2898 * Get the Ecore_X_Window of an Evas_Object
2900 * @param obj The object
2902 * @return The Ecore_X_Window of @p obj
2907 elm_win_xwindow_get(const Evas_Object *obj)
2909 Ecore_X_Window xwin = 0;
2914 type = elm_widget_type_get(obj);
2915 if (!type) return 0;
2916 if (type != widtype) return _elm_ee_win_get(obj);
2917 #ifdef HAVE_ELEMENTARY_X
2918 win = elm_widget_data_get(obj);
2919 if (!win) return xwin;
2920 if (win->xwin) return win->xwin;
2921 if (win->parent) return elm_win_xwindow_get(win->parent);