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);
64 elm_widget_can_focus_set(obj, EINA_FALSE);
65 elm_widget_highlight_ignore_set(obj, EINA_TRUE);
67 evas_object_size_hint_weight_set(obj, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
68 evas_object_size_hint_align_set(obj, EVAS_HINT_FILL, EVAS_HINT_FILL);
69 elm_layout_theme_set(obj, "win", "inwin", elm_object_style_get(obj));
73 _elm_inwin_smart_parent_set(Evas_Object *obj,
76 elm_win_resize_object_add(parent, obj);
78 elm_layout_sizing_eval(obj);
82 _elm_inwin_smart_set_user(Elm_Inwin_Smart_Class *sc)
84 ELM_WIDGET_CLASS(sc)->base.add = _elm_inwin_smart_add;
86 ELM_WIDGET_CLASS(sc)->focus_next = _elm_inwin_smart_focus_next;
87 ELM_WIDGET_CLASS(sc)->parent_set = _elm_inwin_smart_parent_set;
89 ELM_LAYOUT_CLASS(sc)->sizing_eval = _elm_inwin_smart_sizing_eval;
91 ELM_LAYOUT_CLASS(sc)->content_aliases = _content_aliases;
94 EAPI const Elm_Inwin_Smart_Class *
95 elm_inwin_smart_class_get(void)
97 static Elm_Inwin_Smart_Class _sc =
98 ELM_INWIN_SMART_CLASS_INIT_NAME_VERSION(ELM_INWIN_SMART_NAME);
99 static const Elm_Inwin_Smart_Class *class = NULL;
104 _elm_inwin_smart_set(&_sc);
111 elm_win_inwin_add(Evas_Object *parent)
115 if (!parent || !elm_widget_type_check((parent), "elm_win", __func__))
116 return NULL; /* *has* to have a parent window */
118 obj = elm_widget_add(_elm_inwin_smart_class_new(), parent);
119 if (!obj) return NULL;
121 if (!elm_widget_sub_object_add(parent, obj))
122 ERR("could not add %p as sub object of %p", obj, parent);
128 elm_win_inwin_activate(Evas_Object *obj)
130 ELM_INWIN_CHECK(obj);
131 ELM_INWIN_DATA_GET_OR_RETURN(obj, sd);
133 evas_object_raise(obj);
134 evas_object_show(obj);
135 edje_object_signal_emit
136 (ELM_WIDGET_DATA(sd)->resize_obj, "elm,action,show", "elm");
137 elm_object_focus_set(obj, EINA_TRUE);
141 elm_win_inwin_content_set(Evas_Object *obj,
142 Evas_Object *content)
144 ELM_INWIN_CHECK(obj);
145 ELM_INWIN_DATA_GET_OR_RETURN(obj, sd);
147 ELM_CONTAINER_CLASS(_elm_inwin_parent_sc)->content_set(obj, NULL, content);
151 elm_win_inwin_content_get(const Evas_Object *obj)
153 ELM_INWIN_CHECK(obj) NULL;
154 ELM_INWIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
156 return ELM_CONTAINER_CLASS(_elm_inwin_parent_sc)->content_get(obj, NULL);
160 elm_win_inwin_content_unset(Evas_Object *obj)
162 ELM_INWIN_CHECK(obj) NULL;
163 ELM_INWIN_DATA_GET_OR_RETURN_VAL(obj, sd, NULL);
165 return ELM_CONTAINER_CLASS(_elm_inwin_parent_sc)->content_unset(obj, NULL);