forked from enlightenment/efl
elementary/bubble - applied missed content_set/get/unset APIs
SVN revision: 64925
This commit is contained in:
parent
42a7aea27c
commit
05486ccca7
|
@ -9,7 +9,7 @@ elm_object_text_set(o, "Bubble");
|
|||
|
||||
Evas_Object *o2 = elm_icon_add(win);
|
||||
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);
|
||||
|
||||
#include "widget_preview_tmpl_foot.c"
|
||||
|
|
|
@ -7,7 +7,7 @@ evas_object_show(o);
|
|||
|
||||
Evas_Object *o2 = elm_icon_add(win);
|
||||
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);
|
||||
|
||||
#include "widget_preview_tmpl_foot.c"
|
||||
|
|
|
@ -149,7 +149,7 @@ test_anchorblock(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event
|
|||
bb = elm_bubble_add(win);
|
||||
elm_object_text_set(bb, "Message 3");
|
||||
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_show(ic);
|
||||
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);
|
||||
elm_object_text_set(bb, "Message 2");
|
||||
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_show(ic);
|
||||
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);
|
||||
elm_object_text_set(bb, "Message 1");
|
||||
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_show(ic);
|
||||
evas_object_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
|
||||
|
|
|
@ -39,7 +39,7 @@ test_bubble(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
|
|||
bb = elm_bubble_add(win);
|
||||
elm_object_text_set(bb, "Message 1");
|
||||
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");
|
||||
evas_object_smart_callback_add(bb, "clicked", _print_clicked, NULL);
|
||||
evas_object_show(ic);
|
||||
|
|
|
@ -102,20 +102,17 @@ test_flip(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info _
|
|||
elm_flip_content_back_set(fl, ly);
|
||||
evas_object_show(ly);
|
||||
|
||||
bt = elm_button_add(win);
|
||||
bt = elm_button_add(ly);
|
||||
elm_object_text_set(bt, "Button 1");
|
||||
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_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_content_part_set(ly, "element3", bt);
|
||||
evas_object_show(bt);
|
||||
|
||||
evas_object_show(fl);
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ fill(Evas_Object *win, Eina_Bool do_bg)
|
|||
bb = elm_bubble_add(win);
|
||||
elm_object_text_set(bb, "Message 3");
|
||||
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_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
|
||||
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);
|
||||
elm_object_text_set(bb, "Message 2");
|
||||
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_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
|
||||
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);
|
||||
elm_object_text_set(bb, "Message 1");
|
||||
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_size_hint_weight_set(bb, EVAS_HINT_EXPAND, 0.0);
|
||||
evas_object_size_hint_align_set(bb, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||
|
|
|
@ -19,7 +19,8 @@ external_bubble_state_set(void *data __UNUSED__, Evas_Object *obj, const void *f
|
|||
else return;
|
||||
|
||||
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->content) elm_object_content_set(obj, p->content);
|
||||
}
|
||||
|
@ -41,8 +42,9 @@ external_bubble_param_set(void *data __UNUSED__, Evas_Object *obj, const Edje_Ex
|
|||
{
|
||||
Evas_Object *icon = external_common_param_icon_get(obj, param);
|
||||
if ((strcmp(param->s, "")) && (!icon)) return EINA_FALSE;
|
||||
elm_bubble_icon_set(obj, icon);
|
||||
return EINA_TRUE;
|
||||
elm_object_content_part_set(obj, ELM_BUBBLE_CONTENT_ICON,
|
||||
icon);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(param->name, "info"))
|
||||
|
|
|
@ -40,7 +40,7 @@ elm_main(int argc, char **argv)
|
|||
evas_object_show(icon);
|
||||
|
||||
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_object_text_set(bubble, "LABEL");
|
||||
elm_bubble_content_set(bubble, label);
|
||||
|
|
|
@ -12464,6 +12464,9 @@ extern "C" {
|
|||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define ELM_BUBBLE_CONTENT_ICON "elm.swallow.icon"
|
||||
|
||||
/**
|
||||
* Add a new bubble to the parent
|
||||
*
|
||||
|
@ -12565,8 +12568,11 @@ extern "C" {
|
|||
*
|
||||
* @param obj The bubble object
|
||||
* @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
|
||||
*
|
||||
|
@ -12574,8 +12580,11 @@ extern "C" {
|
|||
* @return The icon for the 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
|
||||
*
|
||||
|
@ -12583,8 +12592,11 @@ extern "C" {
|
|||
*
|
||||
* @param obj The bubble object
|
||||
* @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
|
||||
*
|
||||
|
|
|
@ -78,11 +78,11 @@ _theme_hook(Evas_Object *obj)
|
|||
}
|
||||
|
||||
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);
|
||||
if (!wd) return;
|
||||
|
||||
if (wd->content == content) return;
|
||||
if (wd->content) evas_object_del(wd->content);
|
||||
wd->content = content;
|
||||
|
@ -98,31 +98,97 @@ _content_set_hook(Evas_Object *obj, const char *part __UNUSED__, Evas_Object *co
|
|||
}
|
||||
|
||||
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);
|
||||
Evas_Object *content;
|
||||
if (!wd) return NULL;
|
||||
if (!wd->content) return NULL;
|
||||
content = wd->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);
|
||||
edje_object_part_unswallow(wd->bbl, content);
|
||||
wd->content = NULL;
|
||||
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
|
||||
_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
|
||||
elm_bubble_icon_set(Evas_Object *obj, Evas_Object *icon)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||
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);
|
||||
_content_set_hook(obj, "elm.swallow.icon", icon);
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
elm_bubble_icon_get(const Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return NULL;
|
||||
return wd->icon;
|
||||
return _content_get_hook(obj, "elm.swallow.icon");
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
elm_bubble_icon_unset(Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
||||
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;
|
||||
return _content_unset_hook(obj, "elm.swallow.icon");
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
|
Loading…
Reference in New Issue