forked from enlightenment/efl
elm elm_object: Fixed part content set hooks.
1. delete old content object 2. check whether new content object is same as old content object 3. added some doxygen description. SVN revision: 69743
This commit is contained in:
parent
6733c92556
commit
4801d7f5c1
|
@ -774,13 +774,11 @@ _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
|
||||||
{
|
{
|
||||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||||
Evas_Coord min_w = -1, min_h = -1;
|
Evas_Coord min_w = -1, min_h = -1;
|
||||||
|
|
||||||
Widget_Data *wd;
|
Widget_Data *wd;
|
||||||
|
|
||||||
if ((part) && (strcmp(part, "default"))) return;
|
if ((part) && (strcmp(part, "default"))) return;
|
||||||
|
|
||||||
wd = elm_widget_data_get(obj);
|
wd = elm_widget_data_get(obj);
|
||||||
if ((!wd) || (!content)) return;
|
if ((!wd) || (!content)) return;
|
||||||
|
if (content == wd->content) return;
|
||||||
|
|
||||||
//TODO: wd->list
|
//TODO: wd->list
|
||||||
if (wd->content) evas_object_del(wd->content);
|
if (wd->content) evas_object_del(wd->content);
|
||||||
|
|
|
@ -280,6 +280,7 @@ _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
|
||||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||||
Widget_Data *wd = elm_widget_data_get(obj);
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
if (!wd) return;
|
if (!wd) return;
|
||||||
|
|
||||||
elm_object_part_content_set(wd->btn, part, content);
|
elm_object_part_content_set(wd->btn, part, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -464,12 +464,14 @@ _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
|
||||||
if (part && strcmp(part, "video")) return;
|
if (part && strcmp(part, "video")) return;
|
||||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||||
Widget_Data *wd = elm_widget_data_get(obj);
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
|
if (!wd) return;
|
||||||
double pos, length;
|
double pos, length;
|
||||||
Eina_Bool seekable;
|
Eina_Bool seekable;
|
||||||
|
|
||||||
if (!_elm_video_check(content)) return;
|
if (!_elm_video_check(content)) return;
|
||||||
|
if (wd->video == content) return;
|
||||||
|
|
||||||
|
if (wd->video) evas_object_del(wd->video);
|
||||||
_cleanup_callback(wd);
|
_cleanup_callback(wd);
|
||||||
|
|
||||||
wd->video = content;
|
wd->video = content;
|
||||||
|
@ -542,6 +544,7 @@ elm_player_add(Evas_Object *parent)
|
||||||
elm_widget_can_focus_set(obj, EINA_TRUE);
|
elm_widget_can_focus_set(obj, EINA_TRUE);
|
||||||
elm_widget_event_hook_set(obj, _event_hook);
|
elm_widget_event_hook_set(obj, _event_hook);
|
||||||
elm_widget_content_set_hook_set(obj, _content_set_hook);
|
elm_widget_content_set_hook_set(obj, _content_set_hook);
|
||||||
|
/* TODO: add content_unset and content_get hook */
|
||||||
|
|
||||||
wd->layout = edje_object_add(e);
|
wd->layout = edje_object_add(e);
|
||||||
_elm_theme_object_set(obj, wd->layout, "player", "base", "default");
|
_elm_theme_object_set(obj, wd->layout, "player", "base", "default");
|
||||||
|
|
|
@ -699,11 +699,8 @@ _title_icon_set(Evas_Object *obj, Evas_Object *icon)
|
||||||
if (!wd) return;
|
if (!wd) return;
|
||||||
if (wd->title_icon == icon) return;
|
if (wd->title_icon == icon) return;
|
||||||
title_visibility_old = (wd->title_text) || (wd->title_icon);
|
title_visibility_old = (wd->title_text) || (wd->title_icon);
|
||||||
if (wd->title_icon)
|
if (wd->title_icon) evas_object_del(wd->title_icon);
|
||||||
{
|
|
||||||
evas_object_del(wd->title_icon);
|
|
||||||
wd->title_icon = NULL;
|
|
||||||
}
|
|
||||||
wd->title_icon = icon;
|
wd->title_icon = icon;
|
||||||
title_visibility_current = (wd->title_text) || (wd->title_icon);
|
title_visibility_current = (wd->title_text) || (wd->title_icon);
|
||||||
elm_object_part_content_set(wd->base, "elm.swallow.title.icon",
|
elm_object_part_content_set(wd->base, "elm.swallow.title.icon",
|
||||||
|
|
|
@ -122,19 +122,16 @@ _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
|
||||||
{
|
{
|
||||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||||
Widget_Data *wd;
|
Widget_Data *wd;
|
||||||
|
|
||||||
if (part && strcmp(part, "overlay")) return;
|
if (part && strcmp(part, "overlay")) return;
|
||||||
|
|
||||||
wd = elm_widget_data_get(obj);
|
wd = elm_widget_data_get(obj);
|
||||||
if (!wd) return;
|
if (!wd) return;
|
||||||
if (wd->overlay)
|
|
||||||
{
|
if (content == wd->overlay) return;
|
||||||
evas_object_del(wd->overlay);
|
if (wd->overlay) evas_object_del(wd->overlay);
|
||||||
wd->overlay = NULL;
|
|
||||||
}
|
wd->overlay = content;
|
||||||
if (content)
|
if (content)
|
||||||
{
|
{
|
||||||
wd->overlay = content;
|
|
||||||
edje_object_part_swallow(wd->base, "elm.swallow.content", content);
|
edje_object_part_swallow(wd->base, "elm.swallow.content", content);
|
||||||
elm_widget_sub_object_add(obj, content);
|
elm_widget_sub_object_add(obj, content);
|
||||||
}
|
}
|
||||||
|
|
|
@ -855,6 +855,7 @@ _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
|
||||||
{
|
{
|
||||||
Widget_Data *wd = elm_widget_data_get(obj);
|
Widget_Data *wd = elm_widget_data_get(obj);
|
||||||
Evas_Object *edje;
|
Evas_Object *edje;
|
||||||
|
Evas_Object *prev_content;
|
||||||
if ((!wd) || (!content)) return;
|
if ((!wd) || (!content)) return;
|
||||||
|
|
||||||
if (wd->scroll)
|
if (wd->scroll)
|
||||||
|
@ -862,23 +863,20 @@ _content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
|
||||||
else
|
else
|
||||||
edje = wd->ent;
|
edje = wd->ent;
|
||||||
|
|
||||||
/* Delete the currently swallowed object */
|
|
||||||
Evas_Object *cswallow;
|
|
||||||
|
|
||||||
if (!part || !strcmp(part, "icon"))
|
if (!part || !strcmp(part, "icon"))
|
||||||
{
|
{
|
||||||
cswallow = edje_object_part_swallow_get(edje, "elm.swallow.icon");
|
prev_content = edje_object_part_swallow_get(edje, "elm.swallow.icon");
|
||||||
edje_object_signal_emit(edje, "elm,action,show,icon", "elm");
|
edje_object_signal_emit(edje, "elm,action,show,icon", "elm");
|
||||||
}
|
}
|
||||||
else if (!strcmp(part, "end"))
|
else if (!strcmp(part, "end"))
|
||||||
{
|
{
|
||||||
cswallow = edje_object_part_swallow_get(edje, "elm.swallow.end");
|
prev_content = edje_object_part_swallow_get(edje, "elm.swallow.end");
|
||||||
edje_object_signal_emit(edje, "elm,action,show,end", "elm");
|
edje_object_signal_emit(edje, "elm,action,show,end", "elm");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
cswallow = edje_object_part_swallow_get(edje, part);
|
prev_content = edje_object_part_swallow_get(edje, part);
|
||||||
|
|
||||||
if (cswallow) evas_object_del(cswallow);
|
if (prev_content) evas_object_del(prev_content);
|
||||||
|
|
||||||
evas_event_freeze(evas_object_evas_get(obj));
|
evas_event_freeze(evas_object_evas_get(obj));
|
||||||
elm_widget_sub_object_add(obj, content);
|
elm_widget_sub_object_add(obj, content);
|
||||||
|
|
|
@ -35,6 +35,10 @@ EAPI const char *elm_object_part_text_get(const Evas_Object *ob
|
||||||
* @param part The content part name to set (NULL for the default content)
|
* @param part The content part name to set (NULL for the default content)
|
||||||
* @param content The new content of the object
|
* @param content The new content of the object
|
||||||
*
|
*
|
||||||
|
* This sets a new object to a widget as a content object. If any object was
|
||||||
|
* already set as a content object in the same part, previous object will be
|
||||||
|
* deleted automatically.
|
||||||
|
*
|
||||||
* @note Elementary objects may have many contents
|
* @note Elementary objects may have many contents
|
||||||
*
|
*
|
||||||
* @ingroup General
|
* @ingroup General
|
||||||
|
|
Loading…
Reference in New Issue