elementary/bubble - applied missed content_set/get/unset APIs

SVN revision: 64925
This commit is contained in:
ChunEon Park 2011-11-08 01:05:01 +00:00
parent 42a7aea27c
commit 05486ccca7
10 changed files with 116 additions and 68 deletions

View File

@ -9,7 +9,7 @@ elm_object_text_set(o, "Bubble");
Evas_Object *o2 = elm_icon_add(win); Evas_Object *o2 = elm_icon_add(win);
elm_icon_standard_set(o2, "home"); elm_icon_standard_set(o2, "home");
elm_bubble_icon_set(o, o2); elm_object_content_part_set(o, ELM_BUBBLE_CONTENT_ICON, o2);
evas_object_show(o2); evas_object_show(o2);
#include "widget_preview_tmpl_foot.c" #include "widget_preview_tmpl_foot.c"

View File

@ -7,7 +7,7 @@ evas_object_show(o);
Evas_Object *o2 = elm_icon_add(win); Evas_Object *o2 = elm_icon_add(win);
elm_icon_standard_set(o2, "home"); elm_icon_standard_set(o2, "home");
elm_bubble_icon_set(o, o2); elm_object_content_part_set(o, ELM_BUBBLE_CONTENT_ICON, o2);
evas_object_show(o2); evas_object_show(o2);
#include "widget_preview_tmpl_foot.c" #include "widget_preview_tmpl_foot.c"

View File

@ -149,7 +149,7 @@ test_anchorblock(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event
bb = elm_bubble_add(win); bb = elm_bubble_add(win);
elm_object_text_set(bb, "Message 3"); elm_object_text_set(bb, "Message 3");
elm_object_text_part_set(bb, "info", "10:32 4/11/2008"); elm_object_text_part_set(bb, "info", "10:32 4/11/2008");
elm_bubble_icon_set(bb, ic); elm_object_content_part_set(bb, ELM_BUBBLE_CONTENT_ICON, ic);
evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL); evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL);
evas_object_show(ic); evas_object_show(ic);
evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
@ -176,7 +176,7 @@ test_anchorblock(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event
bb = elm_bubble_add(win); bb = elm_bubble_add(win);
elm_object_text_set(bb, "Message 2"); elm_object_text_set(bb, "Message 2");
elm_object_text_part_set(bb, "info", "7:16 27/10/2008"); elm_object_text_part_set(bb, "info", "7:16 27/10/2008");
elm_bubble_icon_set(bb, ic); elm_object_content_part_set(bb, ELM_BUBBLE_CONTENT_ICON, ic);
evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL); evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL);
evas_object_show(ic); evas_object_show(ic);
evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
@ -213,7 +213,7 @@ test_anchorblock(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event
bb = elm_bubble_add(win); bb = elm_bubble_add(win);
elm_object_text_set(bb, "Message 1"); elm_object_text_set(bb, "Message 1");
elm_object_text_part_set(bb, "info", "20:47 18/6/2008"); elm_object_text_part_set(bb, "info", "20:47 18/6/2008");
elm_bubble_icon_set(bb, ic); elm_object_content_part_set(bb, ELM_BUBBLE_CONTENT_ICON, ic);
evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL); evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL);
evas_object_show(ic); evas_object_show(ic);
evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);

View File

@ -39,7 +39,7 @@ test_bubble(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
bb = elm_bubble_add(win); bb = elm_bubble_add(win);
elm_object_text_set(bb, "Message 1"); elm_object_text_set(bb, "Message 1");
elm_object_text_part_set(bb, "info", "Corner: bottom_right"); elm_object_text_part_set(bb, "info", "Corner: bottom_right");
elm_bubble_icon_set(bb, ic); elm_object_content_part_set(bb, ELM_BUBBLE_CONTENT_ICON, ic);
elm_bubble_corner_set(bb, "bottom_right"); elm_bubble_corner_set(bb, "bottom_right");
evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL); evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL);
evas_object_show(ic); evas_object_show(ic);

View File

@ -102,20 +102,17 @@ test_flip(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info _
elm_flip_content_back_set(fl, ly); elm_flip_content_back_set(fl, ly);
evas_object_show(ly); evas_object_show(ly);
bt = elm_button_add(win); bt = elm_button_add(ly);
elm_object_text_set(bt, "Button 1"); elm_object_text_set(bt, "Button 1");
elm_object_content_part_set(ly, "element1", bt); elm_object_content_part_set(ly, "element1", bt);
evas_object_show(bt);
bt = elm_button_add(win); bt = elm_button_add(ly);
elm_object_text_set(bt, "Button 2"); elm_object_text_set(bt, "Button 2");
elm_object_content_part_set(ly, "element2", bt); elm_object_content_part_set(ly, "element2", bt);
evas_object_show(bt);
bt = elm_button_add(win); bt = elm_button_add(ly);
elm_object_text_set(bt, "Button 3"); elm_object_text_set(bt, "Button 3");
elm_object_content_part_set(ly, "element3", bt); elm_object_content_part_set(ly, "element3", bt);
evas_object_show(bt);
evas_object_show(fl); evas_object_show(fl);

View File

@ -55,7 +55,7 @@ fill(Evas_Object *win, Eina_Bool do_bg)
bb = elm_bubble_add(win); bb = elm_bubble_add(win);
elm_object_text_set(bb, "Message 3"); elm_object_text_set(bb, "Message 3");
elm_object_text_part_set(bb, "info", "10:32 4/11/2008"); elm_object_text_part_set(bb, "info", "10:32 4/11/2008");
elm_bubble_icon_set(bb, ic); elm_object_content_part_set(bb, ELM_BUBBLE_CONTENT_ICON, ic);
evas_object_show(ic); evas_object_show(ic);
evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
@ -79,7 +79,7 @@ fill(Evas_Object *win, Eina_Bool do_bg)
bb = elm_bubble_add(win); bb = elm_bubble_add(win);
elm_object_text_set(bb, "Message 2"); elm_object_text_set(bb, "Message 2");
elm_object_text_part_set(bb, "info", "7:16 27/10/2008"); elm_object_text_part_set(bb, "info", "7:16 27/10/2008");
elm_bubble_icon_set(bb, ic); elm_object_content_part_set(bb, ELM_BUBBLE_CONTENT_ICON, ic);
evas_object_show(ic); evas_object_show(ic);
evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
@ -114,7 +114,7 @@ fill(Evas_Object *win, Eina_Bool do_bg)
bb = elm_bubble_add(win); bb = elm_bubble_add(win);
elm_object_text_set(bb, "Message 1"); elm_object_text_set(bb, "Message 1");
elm_object_text_part_set(bb, "info", "20:47 18/6/2008"); elm_object_text_part_set(bb, "info", "20:47 18/6/2008");
elm_bubble_icon_set(bb, ic); elm_object_content_part_set(bb, ELM_BUBBLE_CONTENT_ICON, ic);
evas_object_show(ic); evas_object_show(ic);
evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0); evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);

View File

@ -19,7 +19,8 @@ external_bubble_state_set(void *data __UNUSED__, Evas_Object *obj, const void *f
else return; else return;
if (p->label) elm_object_text_set(obj, p->label); if (p->label) elm_object_text_set(obj, p->label);
if (p->icon) elm_bubble_icon_set(obj, p->icon); if (p->icon)
elm_object_content_part_set(obj, ELM_BUBBLE_CONTENT_ICON, p->icon);
if (p->info) elm_object_text_part_set(obj, "info", p->info); if (p->info) elm_object_text_part_set(obj, "info", p->info);
if (p->content) elm_object_content_set(obj, p->content); if (p->content) elm_object_content_set(obj, p->content);
} }
@ -41,7 +42,8 @@ external_bubble_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_Ex
{ {
Evas_Object *icon = external_common_param_icon_get(obj, param); Evas_Object *icon = external_common_param_icon_get(obj, param);
if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE; if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE;
elm_bubble_icon_set(obj, icon); elm_object_content_part_set(obj, ELM_BUBBLE_CONTENT_ICON,
icon);
return EINA_TRUE; return EINA_TRUE;
} }
} }

View File

@ -40,7 +40,7 @@ elm_main(int argc, char **argv)
evas_object_show(icon); evas_object_show(icon);
bubble = elm_bubble_add(win); bubble = elm_bubble_add(win);
elm_bubble_icon_set(bubble, icon); elm_object_content_part_set(bubble, ELM_BUBBLE_CONTENT_ICON, icon);
elm_bubble_info_set(bubble, "INFO"); elm_bubble_info_set(bubble, "INFO");
elm_object_text_set(bubble, "LABEL"); elm_object_text_set(bubble, "LABEL");
elm_bubble_content_set(bubble, label); elm_bubble_content_set(bubble, label);

View File

@ -12464,6 +12464,9 @@ extern "C" {
* *
* @{ * @{
*/ */
#define ELM_BUBBLE_CONTENT_ICON "elm.swallow.icon"
/** /**
* Add a new bubble to the parent * Add a new bubble to the parent
* *
@ -12565,8 +12568,11 @@ extern "C" {
* *
* @param obj The bubble object * @param obj The bubble object
* @param icon The given icon for the bubble * @param icon The given icon for the bubble
*
* @deprecated use elm_object_content_part_set() instead
*
*/ */
EAPI void elm_bubble_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1); EINA_DEPRECATED EAPI void elm_bubble_icon_set(Evas_Object *obj, Evas_Object *icon) EINA_ARG_NONNULL(1);
/** /**
* Get the icon of the bubble * Get the icon of the bubble
* *
@ -12574,8 +12580,11 @@ extern "C" {
* @return The icon for the bubble * @return The icon for the bubble
* *
* This function gets the icon shown on the top left of bubble. * This function gets the icon shown on the top left of bubble.
*
* @deprecated use elm_object_content_part_get() instead
*
*/ */
EAPI Evas_Object *elm_bubble_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1); EINA_DEPRECATED EAPI Evas_Object *elm_bubble_icon_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
/** /**
* Unset the icon of the bubble * Unset the icon of the bubble
* *
@ -12583,8 +12592,11 @@ extern "C" {
* *
* @param obj The bubble object * @param obj The bubble object
* @return The icon that was being used * @return The icon that was being used
*
* @deprecated use elm_object_content_part_unset() instead
*
*/ */
EAPI Evas_Object *elm_bubble_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1); EINA_DEPRECATED EAPI Evas_Object *elm_bubble_icon_unset(Evas_Object *obj) EINA_ARG_NONNULL(1);
/** /**
* Set the corner of the bubble * Set the corner of the bubble
* *

View File

@ -78,11 +78,11 @@ _theme_hook(Evas_Object *obj)
} }
static void static void
_content_set_hook(Evas_Object *obj, const char *part __UNUSED__, Evas_Object *content) _content_set(Evas_Object *obj, Evas_Object *content)
{ {
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;
if (wd->content == content) return; if (wd->content == content) return;
if (wd->content) evas_object_del(wd->content); if (wd->content) evas_object_del(wd->content);
wd->content = content; wd->content = content;
@ -98,31 +98,97 @@ _content_set_hook(Evas_Object *obj, const char *part __UNUSED__, Evas_Object *co
} }
static Evas_Object * static Evas_Object *
_content_get_hook(const Evas_Object *obj, const char *part __UNUSED__) _content_unset(Evas_Object *obj)
{ {
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return NULL;
return wd->content;
}
static Evas_Object *
_content_unset_hook(Evas_Object *obj, const char *part __UNUSED__)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj); Widget_Data *wd = elm_widget_data_get(obj);
Evas_Object *content; Evas_Object *content;
if (!wd) return NULL; if (!wd) return NULL;
if (!wd->content) return NULL; if (!wd->content) return NULL;
content = wd->content; content = wd->content;
elm_widget_sub_object_del(obj, content); elm_widget_sub_object_del(obj, content);
evas_object_event_callback_del_full(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS, evas_object_event_callback_del_full(content,
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_changed_size_hints, obj); _changed_size_hints, obj);
edje_object_part_unswallow(wd->bbl, content); edje_object_part_unswallow(wd->bbl, content);
wd->content = NULL; wd->content = NULL;
return content; return content;
} }
static void
_icon_set(Evas_Object *obj, Evas_Object* icon)
{
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (wd->icon == icon) return;
if (wd->icon) evas_object_del(wd->icon);
wd->icon = icon;
if (icon)
{
elm_widget_sub_object_add(obj, icon);
edje_object_part_swallow(wd->bbl, "elm.swallow.icon", icon);
evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_changed_size_hints, obj);
edje_object_signal_emit(wd->bbl, "elm,state,icon,visible", "elm");
edje_object_message_signal_process(wd->bbl);
}
_sizing_eval(obj);
}
static Evas_Object *
_icon_unset(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Object *icon;
if (!wd) return NULL;
if (!wd->icon) return NULL;
icon = wd->icon;
elm_widget_sub_object_del(obj, icon);
evas_object_event_callback_del_full(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_changed_size_hints, obj);
edje_object_part_unswallow(wd->bbl, icon);
wd->icon = NULL;
return icon;
}
static void
_content_set_hook(Evas_Object *obj, const char *part, Evas_Object *content)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if ((!part) || !strcmp(part, "elm.swallow.content"))
_content_set(obj, content);
else if(!strcmp(part, "elm.swallow.icon"))
_icon_set(obj, content);
}
static Evas_Object *
_content_get_hook(const Evas_Object *obj, const char *part)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return NULL;
if ((!part) || !strcmp(part, "elm.swallow.content"))
return wd->content;
else if(!strcmp(part, "elm.swallow.icon"))
return wd->icon;
return NULL;
}
static Evas_Object *
_content_unset_hook(Evas_Object *obj, const char *part)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return NULL;
if ((!part) || !strcmp(part, "elm.swallow.content"))
return _content_unset(obj);
else if(!strcmp(part, "elm.swallow.icon"))
return _icon_unset(obj);
return NULL;
}
static Eina_Bool static Eina_Bool
_elm_bubble_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next) _elm_bubble_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
{ {
@ -316,48 +382,19 @@ elm_bubble_content_unset(Evas_Object *obj)
EAPI void EAPI void
elm_bubble_icon_set(Evas_Object *obj, Evas_Object *icon) elm_bubble_icon_set(Evas_Object *obj, Evas_Object *icon)
{ {
ELM_CHECK_WIDTYPE(obj, widtype); _content_set_hook(obj, "elm.swallow.icon", icon);
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return;
if (wd->icon == icon) return;
if (wd->icon) evas_object_del(wd->icon);
wd->icon = icon;
if (icon)
{
elm_widget_sub_object_add(obj, icon);
edje_object_part_swallow(wd->bbl, "elm.swallow.icon", icon);
evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_changed_size_hints, obj);
edje_object_signal_emit(wd->bbl, "elm,state,icon,visible", "elm");
edje_object_message_signal_process(wd->bbl);
}
_sizing_eval(obj);
} }
EAPI Evas_Object * EAPI Evas_Object *
elm_bubble_icon_get(const Evas_Object *obj) elm_bubble_icon_get(const Evas_Object *obj)
{ {
ELM_CHECK_WIDTYPE(obj, widtype) NULL; return _content_get_hook(obj, "elm.swallow.icon");
Widget_Data *wd = elm_widget_data_get(obj);
if (!wd) return NULL;
return wd->icon;
} }
EAPI Evas_Object * EAPI Evas_Object *
elm_bubble_icon_unset(Evas_Object *obj) elm_bubble_icon_unset(Evas_Object *obj)
{ {
ELM_CHECK_WIDTYPE(obj, widtype) NULL; return _content_unset_hook(obj, "elm.swallow.icon");
Widget_Data *wd = elm_widget_data_get(obj);
Evas_Object *icon;
if (!wd) return NULL;
if (!wd->icon) return NULL;
icon = wd->icon;
elm_widget_sub_object_del(obj, icon);
evas_object_event_callback_del_full(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
_changed_size_hints, obj);
edje_object_part_unswallow(wd->bbl, icon);
wd->icon = NULL;
return icon;
} }
EAPI void EAPI void