1 #include <Elementary.h>
3 #include "elm_widget_inwin.h"
5 EAPI const char ELM_INWIN_SMART_NAME[] = "elm_inwin";
7 EVAS_SMART_SUBCLASS_NEW
8 (ELM_INWIN_SMART_NAME, _elm_inwin, Elm_Inwin_Smart_Class,
9 Elm_Layout_Smart_Class, elm_layout_smart_class_get, NULL);
11 static const Elm_Layout_Part_Alias_Description _content_aliases[] =
13 {"default", "elm.swallow.content"},
18 _elm_inwin_smart_sizing_eval(Evas_Object *obj)
21 Evas_Coord minw = -1, minh = -1;
23 ELM_INWIN_DATA_GET(obj, sd);
25 content = elm_layout_content_get(obj, NULL);
29 evas_object_size_hint_min_get(content, &minw, &minh);
30 edje_object_size_min_calc(ELM_WIDGET_DATA(sd)->resize_obj, &minw, &minh);
32 evas_object_size_hint_min_set(obj, minw, minh);
33 evas_object_size_hint_max_set(obj, -1, -1);
37 _elm_inwin_smart_focus_next(const Evas_Object *obj,
38 Elm_Focus_Direction dir,
43 content = elm_layout_content_get(obj, NULL);
45 /* attempt to follow focus cycle into sub-object */
48 elm_widget_focus_next_get(content, dir, next);
53 *next = (Evas_Object *)obj;
58 _elm_inwin_smart_add(Evas_Object *obj)
60 EVAS_SMART_DATA_ALLOC(obj, Elm_Inwin_Smart_Data);
62 ELM_WIDGET_CLASS(_elm_inwin_parent_sc)->base.add(obj);
66 _elm_inwin_smart_parent_set(Evas_Object *obj,
69 elm_win_resize_object_add(parent, obj);
71 elm_layout_sizing_eval(obj);
75 _elm_inwin_smart_set_user(Elm_Inwin_Smart_Class *sc)
77 ELM_WIDGET_CLASS(sc)->base.add = _elm_inwin_smart_add;
79 ELM_WIDGET_CLASS(sc)->focus_next = _elm_inwin_smart_focus_next;
80 ELM_WIDGET_CLASS(sc)->parent_set = _elm_inwin_smart_parent_set;
82 ELM_LAYOUT_CLASS(sc)->sizing_eval = _elm_inwin_smart_sizing_eval;
84 ELM_LAYOUT_CLASS(sc)->content_aliases = _content_aliases;
87 EAPI const Elm_Inwin_Smart_Class *
88 elm_inwin_smart_class_get(void)
90 static Elm_Inwin_Smart_Class _sc =
91 ELM_INWIN_SMART_CLASS_INIT_NAME_VERSION(ELM_INWIN_SMART_NAME);
92 static const Elm_Inwin_Smart_Class *class = NULL;
97 _elm_inwin_smart_set(&_sc);
104 elm_win_inwin_add(Evas_Object *parent)
108 if (!parent || !elm_widget_type_check((parent), "elm_win", __func__))
109 return NULL; /* *has* to have a parent window */
111 obj = elm_widget_add(_elm_inwin_smart_class_new(), parent);
112 if (!obj) return NULL;
114 if (!elm_widget_sub_object_add(parent, obj))
115 ERR("could not add %p as sub object of %p", obj, parent);
117 elm_widget_can_focus_set(obj, EINA_FALSE);
118 elm_widget_highlight_ignore_set(obj, EINA_TRUE);
120 evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
121 evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, EVAS_HINT_FILL);
122 elm_layout_theme_set(obj, "win", "inwin", elm_object_style_get(obj));
124 //Tizen Only: This should be removed when eo is applied.
125 ELM_WIDGET_DATA_GET(obj, wsd);
126 wsd->on_create = EINA_FALSE;
132 elm_win_inwin_activate(Evas_Object *obj)
134 ELM_INWIN_CHECK(obj);
135 ELM_INWIN_DATA_GET_OR_RETURN(obj, sd);
137 evas_object_raise(obj);
138 evas_object_show(obj);
139 edje_object_signal_emit
140 (ELM_WIDGET_DATA(sd)->resize_obj, "elm,action,show", "elm");
141 elm_object_focus_set(obj, EINA_TRUE);
145 elm_win_inwin_content_set(Evas_Object *obj,
146 Evas_Object *content)
148 ELM_INWIN_CHECK(obj);
149 ELM_INWIN_DATA_GET_OR_RETURN(obj, sd);
151 ELM_CONTAINER_CLASS(_elm_inwin_parent_sc)->content_set(obj, NULL, content);
155 elm_win_inwin_content_get(const Evas_Object *obj)
157 ELM_INWIN_CHECK(obj) NULL;
158 ELM_INWIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
160 return ELM_CONTAINER_CLASS(_elm_inwin_parent_sc)->content_get(obj, NULL);
164 elm_win_inwin_content_unset(Evas_Object *obj)
166 ELM_INWIN_CHECK(obj) NULL;
167 ELM_INWIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
169 return ELM_CONTAINER_CLASS(_elm_inwin_parent_sc)->content_unset(obj, NULL);