}
}
}
+
+group { name: "elm/popup/base/subpopup";
+ inherit: "elm/popup/base/default";
+ parts {
+ part { name: "pad.closebtn"; type: SPACER;
+ description { state: "default" 0.0;
+ rel1.to: "base";
+ rel1.relative: 1 0;
+ rel2.to: "base";
+ rel2.relative: 1 0;
+ min: 2 2;
+ max: 2 2;
+ fixed: 1 1;
+ align: 0 1;
+ }
+ }
+ part { name: "elm.swallow.closebtn"; type: SWALLOW;
+ scale: 1;
+ description { state: "default" 0.0;
+ rel1.to: "pad.closebtn";
+ rel1.relative: 1 0;
+ rel2.to: "pad.closebtn";
+ rel2.relative: 1 0;
+ align: 0 1;
+ fixed: 1 1;
+ }
+ }
+ }
+}
+
+group { name: "elm/popup/content/popup/subpopup";
+ inherit: "elm/popup/content/popup/default";
+}
+
+group { name: "elm/popup/buttons1/popup/subpopup";
+ inherit: "elm/popup/buttons1/popup/default";
+}
+group { name: "elm/popup/buttons2/popup/subpopup";
+ inherit: "elm/popup/buttons2/popup/default";
+}
+group { name: "elm/popup/buttons3/popup/subpopup";
+ inherit: "elm/popup/buttons3/popup/default";
+}
evas_object_show(popup);
}
+static void
+_subpopup_cb(void *data, Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ Evas_Object *popup;
+ Evas_Object *btn, *btnclose;
+
+ popup = elm_popup_add(data);
+ elm_object_style_set(popup, "subpopup");
+ elm_object_part_text_set(popup, "title,text", "Title");
+
+ // button as a popup content
+ btn = elm_button_add(popup);
+ elm_object_text_set(btn, "content");
+ elm_object_part_content_set(popup, "elm.swallow.content", btn);
+
+ // popup buttons
+ btn = elm_button_add(popup);
+ elm_object_text_set(btn, "OK");
+ elm_object_part_content_set(popup, "button1", btn);
+ evas_object_smart_callback_add(btn, "clicked", _popup_close_cb, popup);
+
+ //popup-base close button
+ btnclose = elm_button_add(popup);
+ //TODO: write a X style button theme
+ elm_object_text_set(btnclose, "x");
+ elm_object_part_content_set(popup, "elm.swallow.closebtn", btnclose);
+ evas_object_smart_callback_add(btnclose, "clicked", _popup_close_cb, popup);
+
+ // popup show should be called after adding all the contents and the buttons
+ // of popup to set the focus into popup's contents correctly.
+ evas_object_show(popup);
+}
+
void
test_popup(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
Evas_Object *win, *list;
win = elm_win_util_standard_add("popup", "Popup");
+ elm_win_focus_highlight_enabled_set(win, EINA_TRUE);
+ elm_win_focus_highlight_animate_set(win, EINA_TRUE);
elm_win_autodel_set(win, EINA_TRUE);
list = elm_list_add(win);
elm_list_item_append(list, "popup-center-title + list content + 1 button",
NULL, NULL, _popup_center_title_list_content_1button_cb,
win);
+ elm_list_item_append(list, "subpopup + X button",
+ NULL, NULL, _subpopup_cb,
+ win);
elm_list_go(list);
evas_object_show(list);
content = _action_button_get(obj, i);
}
else
+ {
+ eo_do_super(obj, MY_CLASS,
+ elm_obj_container_content_get(part, &content));
+ }
+
+ if (!content)
goto err;
*ret = content;
{
Evas_Object *ao;
Eina_List *items = NULL;
+ Eina_List *base_items = NULL;
Elm_Popup_Smart_Data *sd = _pd;
/* action area */
if (sd->action_area) items = eina_list_append(items, sd->action_area);
+ /* base */
+ eo_do_super(obj, MY_CLASS, elm_obj_container_content_swallow_list_get(&base_items));
+
+ items = eina_list_merge(items, base_items);
+
if (!elm_widget_focus_list_next_get(obj, items, eina_list_data_get, dir, next))
*next = obj;
+ eina_list_free(items);
return;
}
{
Evas_Object *ao;
Eina_List *items = NULL;
-
+ Eina_List *base_items = NULL;
Elm_Popup_Smart_Data *sd = _pd;
Evas_Object *base = va_arg(*list, Evas_Object *);
/* action area */
if (sd->action_area) items = eina_list_append(items, sd->action_area);
+ /* base*/
+ eo_do_super(obj, MY_CLASS, elm_obj_container_content_swallow_list_get(&base_items));
+
+ items = eina_list_merge(items, base_items);
+
elm_widget_focus_list_direction_get
(obj, base, items, eina_list_data_get, degree, direction, weight);
+ eina_list_free(items);
return;
}
EO_OP_DESCRIPTION(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_SET, "Set the content on part of a given container widget."),
EO_OP_DESCRIPTION(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_GET, "Get the content on a part of a given container widget"),
EO_OP_DESCRIPTION(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_UNSET, "Unset the content on a part of a given container widget"),
+ EO_OP_DESCRIPTION(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_SWALLOW_LIST_GET, "Get the list of swallow parts of a given container widget"),
EO_OP_DESCRIPTION_SENTINEL
};
}
}
+EAPI Eina_List *
+elm_layout_content_swallow_list_get(const Evas_Object *obj)
+{
+ ELM_LAYOUT_CHECK(obj) NULL;
+ Eina_List *ret = NULL;
+ eo_do(obj, elm_obj_container_content_swallow_list_get(&ret));
+ return ret;
+}
+
+static void
+_elm_layout_smart_content_swallow_list_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
+{
+ Elm_Layout_Smart_Data *sd = _pd;
+
+ Eina_List **ret = va_arg(*list, Eina_List **);
+ if (ret) *ret = NULL;
+
+ Elm_Layout_Sub_Object_Data *sub_d = NULL;
+ Eina_List *l = NULL;
+
+ EINA_LIST_FOREACH(sd->subs, l, sub_d)
+ {
+ if (sub_d->type == SWALLOW)
+ *ret = eina_list_append(*ret, sub_d->obj);
+ }
+}
+
EAPI Eina_Bool
elm_layout_text_set(Evas_Object *obj,
const char *part,
EO_OP_FUNC(ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_SET), _elm_layout_smart_content_set),
EO_OP_FUNC(ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_GET), _elm_layout_smart_content_get),
EO_OP_FUNC(ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_UNSET), _elm_layout_smart_content_unset),
+ EO_OP_FUNC(ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_SWALLOW_LIST_GET), _elm_layout_smart_content_swallow_list_get),
EO_OP_FUNC(ELM_OBJ_LAYOUT_ID(ELM_OBJ_LAYOUT_SUB_ID_FILE_SET), _elm_layout_smart_file_set),
EO_OP_FUNC(ELM_OBJ_LAYOUT_ID(ELM_OBJ_LAYOUT_SUB_ID_THEME_SET), _elm_layout_smart_theme_set),
*/
EAPI const char *elm_layout_text_get(const Evas_Object *obj, const char *part);
+/**
+ * Get the list of swallow parts of a given container widget
+ *
+ * @param obj The layout object
+ *
+ * @return list of swallow parts which should be freed by the user program with elm_list_free()
+ *
+ * @since 1.9
+ *
+ * @ingroup Layout
+ */
+EAPI Eina_List *elm_layout_content_swallow_list_get(const Evas_Object *obj);
ELM_OBJ_CONTAINER_SUB_ID_CONTENT_SET,
ELM_OBJ_CONTAINER_SUB_ID_CONTENT_GET,
ELM_OBJ_CONTAINER_SUB_ID_CONTENT_UNSET,
+ ELM_OBJ_CONTAINER_SUB_ID_CONTENT_SWALLOW_LIST_GET,
ELM_OBJ_CONTAINER_SUB_ID_LAST
};
/**
*/
#define elm_obj_container_content_unset(name, ret) ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_UNSET), EO_TYPECHECK(const char*, name), EO_TYPECHECK(Evas_Object **,ret)
+/**
+ * @def elm_obj_container_content_list_get
+ * @since 1.9
+ *
+ * No description supplied by the EAPI.
+ *
+ * @param[out] ret Eina_List **
+ *
+ */
+#define elm_obj_container_content_swallow_list_get(ret) ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_SWALLOW_LIST_GET), EO_TYPECHECK(Eina_List **,ret)
+
#endif