2008-10-28 18:51:45 -07:00
|
|
|
#include <Elementary.h>
|
|
|
|
#include "elm_priv.h"
|
|
|
|
|
2009-09-17 15:39:18 -07:00
|
|
|
/**
|
|
|
|
* @defgroup Bubble Bubble
|
|
|
|
*
|
2010-01-07 00:00:49 -08:00
|
|
|
* The Bubble is an widget used to show a text in a frame as speech is
|
2009-09-17 15:39:18 -07:00
|
|
|
* represented in comics.
|
2010-11-11 10:04:45 -08:00
|
|
|
*
|
|
|
|
* Signals that you can add callbacks for are:
|
|
|
|
*
|
elementry / entry, menu, notify, list, gengrid, actionslider, image, icon, anchorview, fileselector_button, calendar, photocam, anchorblock,
button, map, colorselector, hover, photo, diskselector, index, bubble, pager, hoversel, check, scrolled_entry, clock, flipselector
updated signal callback list in the doxygen.
should update genlist, progressbar ...
SVN revision: 58335
2011-04-04 09:34:18 -07:00
|
|
|
* "clicked" - This is called when a user has clicked the bubble.
|
2009-09-17 15:39:18 -07:00
|
|
|
*/
|
|
|
|
|
2008-10-28 18:51:45 -07:00
|
|
|
typedef struct _Widget_Data Widget_Data;
|
|
|
|
|
|
|
|
struct _Widget_Data
|
|
|
|
{
|
|
|
|
Evas_Object *bbl;
|
|
|
|
Evas_Object *content, *icon;
|
2010-11-11 10:04:08 -08:00
|
|
|
const char *label, *info, *corner;
|
2008-10-28 18:51:45 -07:00
|
|
|
};
|
|
|
|
|
2010-03-08 22:15:39 -08:00
|
|
|
static const char *widtype = NULL;
|
2008-10-28 18:51:45 -07:00
|
|
|
static void _del_hook(Evas_Object *obj);
|
2011-02-08 04:08:28 -08:00
|
|
|
static void _mirrored_set(Evas_Object *obj, Eina_Bool rtl);
|
2008-11-15 05:58:50 -08:00
|
|
|
static void _theme_hook(Evas_Object *obj);
|
2008-10-28 18:51:45 -07:00
|
|
|
static void _sizing_eval(Evas_Object *obj);
|
|
|
|
static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
|
|
|
static void _sub_del(void *data, Evas_Object *obj, void *event_info);
|
|
|
|
|
2010-11-11 10:04:45 -08:00
|
|
|
#define SIG_CLICKED "clicked"
|
|
|
|
static const Evas_Smart_Cb_Description _signals[] =
|
|
|
|
{
|
2011-04-01 04:35:07 -07:00
|
|
|
{SIG_CLICKED, ""},
|
|
|
|
{NULL, NULL}
|
2010-11-11 10:04:45 -08:00
|
|
|
};
|
|
|
|
|
2008-10-28 18:51:45 -07:00
|
|
|
static void
|
|
|
|
_del_hook(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2008-11-15 05:58:50 -08:00
|
|
|
if (wd->label) eina_stringshare_del(wd->label);
|
|
|
|
if (wd->info) eina_stringshare_del(wd->info);
|
2010-11-11 10:04:08 -08:00
|
|
|
if (wd->corner) eina_stringshare_del(wd->corner);
|
2008-10-28 18:51:45 -07:00
|
|
|
free(wd);
|
|
|
|
}
|
|
|
|
|
2011-02-08 04:08:28 -08:00
|
|
|
static void
|
|
|
|
_mirrored_set(Evas_Object *obj, Eina_Bool rtl)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return;
|
|
|
|
edje_object_mirrored_set(wd->bbl, rtl);
|
|
|
|
}
|
|
|
|
|
2008-11-15 05:58:50 -08:00
|
|
|
static void
|
|
|
|
_theme_hook(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2011-02-09 08:14:02 -08:00
|
|
|
_elm_widget_mirrored_reload(obj);
|
2011-02-08 04:08:28 -08:00
|
|
|
_mirrored_set(obj, elm_widget_mirrored_get(obj));
|
2010-11-11 10:04:08 -08:00
|
|
|
_elm_theme_object_set(obj, wd->bbl, "bubble", wd->corner,
|
|
|
|
elm_widget_style_get(obj));
|
2008-11-15 05:58:50 -08:00
|
|
|
edje_object_part_text_set(wd->bbl, "elm.text", wd->label);
|
2011-01-04 00:42:55 -08:00
|
|
|
if (wd->label) edje_object_signal_emit(wd->bbl, "elm,state,text,visible", "elm");
|
|
|
|
else edje_object_signal_emit(wd->bbl, "elm,state,text,hidden", "elm");
|
2008-11-15 05:58:50 -08:00
|
|
|
edje_object_part_text_set(wd->bbl, "elm.info", wd->info);
|
2011-01-04 00:42:55 -08:00
|
|
|
if (wd->info) edje_object_signal_emit(wd->bbl, "elm,state,info,visible", "elm");
|
|
|
|
else edje_object_signal_emit(wd->bbl, "elm,state,info,hidden", "elm");
|
2010-09-14 16:46:01 -07:00
|
|
|
if (wd->content)
|
|
|
|
{
|
|
|
|
edje_object_part_swallow(wd->bbl, "elm.swallow.content", wd->content);
|
2011-04-01 04:35:07 -07:00
|
|
|
edje_object_message_signal_process(wd->bbl);
|
2010-09-14 16:46:01 -07:00
|
|
|
}
|
2010-11-11 10:04:08 -08:00
|
|
|
if (wd->icon)
|
|
|
|
edje_object_signal_emit(wd->bbl, "elm,state,icon,visible", "elm");
|
2010-09-14 16:46:01 -07:00
|
|
|
else
|
2010-11-11 10:04:08 -08:00
|
|
|
edje_object_signal_emit(wd->bbl, "elm,state,icon,hidden", "elm");
|
|
|
|
edje_object_scale_set(wd->bbl,
|
|
|
|
elm_widget_scale_get(obj) * _elm_config->scale);
|
2008-11-15 05:58:50 -08:00
|
|
|
_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
2010-10-01 12:03:02 -07:00
|
|
|
static Eina_Bool
|
2010-10-06 13:24:19 -07:00
|
|
|
_elm_bubble_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
|
2010-10-01 12:03:02 -07:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
Evas_Object *cur;
|
|
|
|
|
|
|
|
if ((!wd) || (!wd->content))
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
cur = wd->content;
|
|
|
|
|
|
|
|
/* Try Focus cycle in subitem */
|
2010-10-06 13:24:13 -07:00
|
|
|
return elm_widget_focus_next_get(cur, dir, next);
|
2010-10-01 12:03:02 -07:00
|
|
|
}
|
|
|
|
|
2008-10-28 18:51:45 -07:00
|
|
|
static void
|
|
|
|
_sizing_eval(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2010-12-07 07:55:08 -08:00
|
|
|
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
|
|
|
|
edje_object_size_min_restricted_calc(wd->bbl, &minw, &minh, minw, minh);
|
2008-10-28 18:51:45 -07:00
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
|
|
|
evas_object_size_hint_max_set(obj, maxw, maxh);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2008-10-28 18:51:45 -07:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(data);
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2008-10-28 18:51:45 -07:00
|
|
|
_sizing_eval(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
|
2008-10-28 18:51:45 -07:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
Evas_Object *sub = event_info;
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2009-10-22 15:10:23 -07:00
|
|
|
evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
2011-04-01 04:35:07 -07:00
|
|
|
_changed_size_hints, obj);
|
2009-09-26 10:36:26 -07:00
|
|
|
if (sub == wd->content) wd->content = NULL;
|
2010-06-16 13:57:42 -07:00
|
|
|
else if (sub == wd->icon)
|
|
|
|
{
|
2011-04-01 04:35:07 -07:00
|
|
|
edje_object_signal_emit(wd->bbl, "elm,state,icon,hidden", "elm");
|
|
|
|
wd->icon = NULL;
|
|
|
|
edje_object_message_signal_process(wd->bbl);
|
2010-06-16 13:57:42 -07:00
|
|
|
}
|
2009-09-26 10:36:26 -07:00
|
|
|
_sizing_eval(obj);
|
2008-10-28 18:51:45 -07:00
|
|
|
}
|
|
|
|
|
2010-11-11 10:04:45 -08:00
|
|
|
static void
|
|
|
|
_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
|
|
|
{
|
|
|
|
Evas_Event_Mouse_Up *ev = event_info;
|
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
|
|
|
|
return;
|
|
|
|
evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
|
|
|
|
}
|
|
|
|
|
2009-09-17 15:39:18 -07:00
|
|
|
/**
|
|
|
|
* Add a new bubble to the parent
|
|
|
|
*
|
|
|
|
* @param parent The parent object
|
|
|
|
* @return The new object or NULL if it cannot be created
|
|
|
|
*
|
|
|
|
* This function adds a text bubble to the given parent evas object.
|
|
|
|
*
|
|
|
|
* @ingroup Bubble
|
|
|
|
*/
|
2008-10-28 18:51:45 -07:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_bubble_add(Evas_Object *parent)
|
|
|
|
{
|
|
|
|
Evas_Object *obj;
|
|
|
|
Evas *e;
|
|
|
|
Widget_Data *wd;
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2011-03-31 23:08:02 -07:00
|
|
|
ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
|
2011-04-01 04:35:07 -07:00
|
|
|
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_SET_WIDTYPE(widtype, "bubble");
|
2009-05-13 05:21:52 -07:00
|
|
|
elm_widget_type_set(obj, "bubble");
|
|
|
|
elm_widget_sub_object_add(parent, obj);
|
2008-10-28 18:51:45 -07:00
|
|
|
elm_widget_data_set(obj, wd);
|
|
|
|
elm_widget_del_hook_set(obj, _del_hook);
|
2008-11-15 05:58:50 -08:00
|
|
|
elm_widget_theme_hook_set(obj, _theme_hook);
|
2010-10-06 13:24:13 -07:00
|
|
|
elm_widget_focus_next_hook_set(obj, _elm_bubble_focus_next_hook);
|
2010-09-29 05:22:30 -07:00
|
|
|
elm_widget_can_focus_set(obj, EINA_FALSE);
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2010-11-11 10:04:08 -08:00
|
|
|
wd->corner = eina_stringshare_add("base");
|
|
|
|
|
2008-10-28 18:51:45 -07:00
|
|
|
wd->bbl = edje_object_add(e);
|
|
|
|
elm_widget_resize_object_set(obj, wd->bbl);
|
|
|
|
|
|
|
|
evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
|
2010-11-11 10:04:45 -08:00
|
|
|
evas_object_event_callback_add(wd->bbl, EVAS_CALLBACK_MOUSE_UP,
|
|
|
|
_mouse_up, obj);
|
2009-07-06 23:46:51 -07:00
|
|
|
|
2010-11-11 10:04:45 -08:00
|
|
|
evas_object_smart_callbacks_descriptions_set(obj, _signals);
|
2011-02-08 04:08:28 -08:00
|
|
|
_mirrored_set(obj, elm_widget_mirrored_get(obj));
|
|
|
|
_elm_theme_object_set(obj, wd->bbl, "bubble", wd->corner,
|
|
|
|
elm_widget_style_get(obj));
|
2008-10-28 18:51:45 -07:00
|
|
|
_sizing_eval(obj);
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
2009-09-17 15:39:18 -07:00
|
|
|
/**
|
|
|
|
* Set the label of the bubble
|
|
|
|
*
|
2010-04-12 01:12:02 -07:00
|
|
|
* @param obj The bubble object
|
2009-09-17 15:39:18 -07:00
|
|
|
* @param label The string to set in the label
|
|
|
|
*
|
2010-04-12 01:12:02 -07:00
|
|
|
* This function sets the title of the bubble that is shown on top of
|
2009-09-17 15:39:18 -07:00
|
|
|
* the bubble.
|
|
|
|
*
|
|
|
|
* @ingroup Bubble
|
|
|
|
*/
|
2008-10-28 18:51:45 -07:00
|
|
|
EAPI void
|
|
|
|
elm_bubble_label_set(Evas_Object *obj, const char *label)
|
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2008-10-28 18:51:45 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2010-03-13 13:01:26 -08:00
|
|
|
eina_stringshare_replace(&wd->label, label);
|
2008-10-28 18:51:45 -07:00
|
|
|
edje_object_part_text_set(wd->bbl, "elm.text", label);
|
2011-01-04 00:42:55 -08:00
|
|
|
if (label) edje_object_signal_emit(wd->bbl, "elm,state,text,visible", "elm");
|
|
|
|
else edje_object_signal_emit(wd->bbl, "elm,state,text,hidden", "elm");
|
2008-10-28 18:51:45 -07:00
|
|
|
_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
2010-04-12 01:12:02 -07:00
|
|
|
/**
|
|
|
|
* Get the label of the bubble
|
|
|
|
*
|
|
|
|
* @param obj The bubble object
|
|
|
|
* @return The string of set in the label
|
|
|
|
*
|
|
|
|
* This function gets the title of the bubble that is shown on top of
|
|
|
|
* the bubble.
|
|
|
|
*
|
|
|
|
* @ingroup Bubble
|
|
|
|
*/
|
2009-08-11 03:44:49 -07:00
|
|
|
EAPI const char*
|
2010-03-23 20:06:00 -07:00
|
|
|
elm_bubble_label_get(const Evas_Object *obj)
|
2009-08-11 03:44:49 -07:00
|
|
|
{
|
2010-03-09 03:42:53 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
2009-08-11 03:44:49 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return NULL;
|
|
|
|
return wd->label;
|
|
|
|
}
|
|
|
|
|
2009-09-17 15:39:18 -07:00
|
|
|
/**
|
|
|
|
* Set the info of the bubble
|
|
|
|
*
|
2010-04-12 01:12:02 -07:00
|
|
|
* @param obj The bubble object
|
2009-09-17 15:39:18 -07:00
|
|
|
* @param info The given info about the bubble
|
|
|
|
*
|
2010-04-12 01:12:02 -07:00
|
|
|
* This function sets the text shown on the top right of bubble.
|
|
|
|
* In the Anchorblock example of the Elementary tests application it
|
2009-09-17 15:39:18 -07:00
|
|
|
* shows time.
|
|
|
|
*
|
|
|
|
* @ingroup Bubble
|
|
|
|
*
|
|
|
|
*/
|
2008-10-28 18:51:45 -07:00
|
|
|
EAPI void
|
2008-11-15 05:58:50 -08:00
|
|
|
elm_bubble_info_set(Evas_Object *obj, const char *info)
|
2008-10-28 18:51:45 -07:00
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2008-10-28 18:51:45 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2010-03-13 13:01:26 -08:00
|
|
|
eina_stringshare_replace(&wd->info, info);
|
2008-11-15 05:58:50 -08:00
|
|
|
edje_object_part_text_set(wd->bbl, "elm.info", info);
|
2011-01-04 00:42:55 -08:00
|
|
|
if (info) edje_object_signal_emit(wd->bbl, "elm,state,info,visible", "elm");
|
|
|
|
else edje_object_signal_emit(wd->bbl, "elm,state,info,hidden", "elm");
|
2008-10-28 18:51:45 -07:00
|
|
|
_sizing_eval(obj);
|
|
|
|
}
|
2010-03-29 10:19:35 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the info of the bubble
|
|
|
|
*
|
2010-04-12 01:12:02 -07:00
|
|
|
* @param obj The bubble object
|
2010-03-29 10:19:35 -07:00
|
|
|
*
|
|
|
|
* @return The "info" string of the bubble
|
|
|
|
*
|
|
|
|
* This function gets the text set to be displayed at the top right of
|
|
|
|
* the bubble.
|
|
|
|
*
|
|
|
|
* @ingroup Bubble
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
EAPI const char *
|
|
|
|
elm_bubble_info_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->info;
|
|
|
|
}
|
|
|
|
|
2009-09-17 15:39:18 -07:00
|
|
|
/**
|
2010-06-16 13:58:09 -07:00
|
|
|
* Set the content to be shown in the bubble
|
|
|
|
*
|
|
|
|
* Once the content object is set, a previously set one will be deleted.
|
|
|
|
* If you want to keep the old content object, use the
|
|
|
|
* elm_bubble_content_unset() function.
|
2009-09-17 15:39:18 -07:00
|
|
|
*
|
2010-04-12 01:12:02 -07:00
|
|
|
* @param obj The bubble object
|
2010-06-16 13:58:09 -07:00
|
|
|
* @param content The given content of the bubble
|
2009-09-17 15:39:18 -07:00
|
|
|
*
|
2010-06-16 13:58:09 -07:00
|
|
|
* This function sets the content shown on the middle of the bubble.
|
|
|
|
* In the Anchorblock example of the Elementary tests application it
|
2009-09-17 15:39:18 -07:00
|
|
|
* shows time.
|
|
|
|
*
|
|
|
|
* @ingroup Bubble
|
|
|
|
*/
|
2008-10-28 18:51:45 -07:00
|
|
|
EAPI void
|
|
|
|
elm_bubble_content_set(Evas_Object *obj, Evas_Object *content)
|
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2008-10-28 18:51:45 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2010-06-16 13:58:09 -07:00
|
|
|
if (wd->content == content) return;
|
|
|
|
if (wd->content) evas_object_del(wd->content);
|
2008-10-28 18:51:45 -07:00
|
|
|
wd->content = content;
|
|
|
|
if (content)
|
|
|
|
{
|
2011-04-01 04:35:07 -07:00
|
|
|
elm_widget_sub_object_add(obj, content);
|
|
|
|
evas_object_event_callback_add(content, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_changed_size_hints, obj);
|
|
|
|
edje_object_part_swallow(wd->bbl, "elm.swallow.content", content);
|
2008-10-28 18:51:45 -07:00
|
|
|
}
|
2008-12-23 21:04:33 -08:00
|
|
|
_sizing_eval(obj);
|
2008-10-28 18:51:45 -07:00
|
|
|
}
|
|
|
|
|
2010-10-14 11:54:42 -07:00
|
|
|
/**
|
|
|
|
* Get the content shown in the bubble
|
|
|
|
*
|
|
|
|
* Return the content object which is set for this widget.
|
|
|
|
*
|
|
|
|
* @param obj The bubble object
|
|
|
|
* @return The content that is being used
|
|
|
|
*
|
|
|
|
* @ingroup Bubble
|
|
|
|
*/
|
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_bubble_content_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->content;
|
|
|
|
}
|
|
|
|
|
2010-06-16 13:58:09 -07:00
|
|
|
/**
|
|
|
|
* Unset the content shown in the bubble
|
|
|
|
*
|
|
|
|
* Unparent and return the content object which was set for this widget.
|
|
|
|
*
|
|
|
|
* @param obj The bubble object
|
|
|
|
* @return The content that was being used
|
|
|
|
*
|
|
|
|
* @ingroup Bubble
|
|
|
|
*/
|
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_bubble_content_unset(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
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;
|
2010-09-29 23:01:34 -07:00
|
|
|
elm_widget_sub_object_del(obj, content);
|
|
|
|
edje_object_part_unswallow(wd->bbl, content);
|
2010-06-16 13:58:09 -07:00
|
|
|
wd->content = NULL;
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
|
2009-09-17 15:39:18 -07:00
|
|
|
/**
|
|
|
|
* Set the icon of the bubble
|
|
|
|
*
|
2010-06-16 13:58:09 -07:00
|
|
|
* Once the icon object is set, a previously set one will be deleted.
|
2010-10-14 11:54:42 -07:00
|
|
|
* If you want to keep the old content object, use the
|
|
|
|
* elm_icon_content_unset() function.
|
2010-06-16 13:58:09 -07:00
|
|
|
*
|
2010-04-12 01:12:02 -07:00
|
|
|
* @param obj The bubble object
|
2009-09-17 15:39:18 -07:00
|
|
|
* @param icon The given icon for the bubble
|
|
|
|
*
|
|
|
|
* @ingroup Bubble
|
|
|
|
*/
|
2008-10-28 18:51:45 -07:00
|
|
|
EAPI void
|
|
|
|
elm_bubble_icon_set(Evas_Object *obj, Evas_Object *icon)
|
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2008-10-28 18:51:45 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 03:42:53 -08:00
|
|
|
if (!wd) return;
|
2010-06-16 13:58:09 -07:00
|
|
|
if (wd->icon == icon) return;
|
|
|
|
if (wd->icon) evas_object_del(wd->icon);
|
2008-10-28 18:51:45 -07:00
|
|
|
wd->icon = icon;
|
|
|
|
if (icon)
|
|
|
|
{
|
2011-04-01 04:35:07 -07:00
|
|
|
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);
|
2008-10-28 18:51:45 -07:00
|
|
|
}
|
2010-06-16 13:58:09 -07:00
|
|
|
_sizing_eval(obj);
|
2008-10-28 18:51:45 -07:00
|
|
|
}
|
2008-12-04 23:42:14 -08:00
|
|
|
|
2010-04-12 01:12:02 -07:00
|
|
|
/**
|
|
|
|
* Get the icon of the bubble
|
|
|
|
*
|
|
|
|
* @param obj The bubble object
|
|
|
|
* @return The icon for the bubble
|
|
|
|
*
|
|
|
|
* This function gets the icon shown on the top left of bubble.
|
|
|
|
*
|
|
|
|
* @ingroup Bubble
|
|
|
|
*/
|
2009-08-12 15:37:48 -07:00
|
|
|
EAPI Evas_Object *
|
2010-03-23 20:06:00 -07:00
|
|
|
elm_bubble_icon_get(const Evas_Object *obj)
|
2009-08-12 15:37:48 -07:00
|
|
|
{
|
2010-03-09 03:42:53 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
2009-08-12 15:37:48 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return NULL;
|
|
|
|
return wd->icon;
|
|
|
|
}
|
|
|
|
|
2010-10-14 11:54:42 -07:00
|
|
|
/**
|
|
|
|
* Unset the icon of the bubble
|
|
|
|
*
|
|
|
|
* Unparent and return the icon object which was set for this widget.
|
|
|
|
*
|
|
|
|
* @param obj The bubble object
|
|
|
|
* @return The icon that was being used
|
|
|
|
*
|
|
|
|
* @ingroup Bubble
|
|
|
|
*/
|
|
|
|
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);
|
|
|
|
edje_object_part_unswallow(wd->bbl, icon);
|
|
|
|
wd->icon = NULL;
|
|
|
|
return icon;
|
|
|
|
}
|
|
|
|
|
2009-09-17 15:39:18 -07:00
|
|
|
/**
|
|
|
|
* Set the corner of the bubble
|
|
|
|
*
|
2010-04-12 01:12:02 -07:00
|
|
|
* @param obj The bubble object.
|
2009-09-17 15:39:18 -07:00
|
|
|
* @param corner The given corner for the bubble.
|
|
|
|
*
|
|
|
|
* This function sets the corner of the bubble.
|
2010-11-11 10:04:08 -08:00
|
|
|
* The corner will be used to find the group in the theme
|
|
|
|
* For example, if you set the corner to "bottom_right",
|
|
|
|
* the following group will be searched:
|
|
|
|
* "elm/bubble/bottom_right/default",
|
|
|
|
* considering default style.
|
2009-09-17 15:39:18 -07:00
|
|
|
*
|
|
|
|
* @ingroup Bubble
|
|
|
|
*/
|
2008-12-04 23:42:14 -08:00
|
|
|
EAPI void
|
|
|
|
elm_bubble_corner_set(Evas_Object *obj, const char *corner)
|
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2008-12-04 23:42:14 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-12-03 06:08:33 -08:00
|
|
|
if (!wd) return;
|
|
|
|
EINA_SAFETY_ON_NULL_RETURN(corner);
|
2010-11-11 10:04:08 -08:00
|
|
|
eina_stringshare_replace(&wd->corner, corner);
|
|
|
|
_theme_hook(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the corner of the bubble
|
|
|
|
*
|
|
|
|
* @param obj The bubble object.
|
|
|
|
* @return The given corner for the bubble.
|
|
|
|
*
|
|
|
|
* This function gets the corner of the bubble.
|
|
|
|
*
|
|
|
|
* @ingroup Bubble
|
|
|
|
*/
|
|
|
|
EAPI const char*
|
|
|
|
elm_bubble_corner_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->corner;
|
2008-12-04 23:42:14 -08:00
|
|
|
}
|