forked from enlightenment/efl
elm bubble: add the elm_object_text_set/get hooks.
deprecate: elm_bubble_indicator_label_set/get. SVN revision: 60995
This commit is contained in:
parent
3ee5d802ab
commit
4351a2d2cc
|
@ -3716,8 +3716,9 @@ extern "C" {
|
|||
*
|
||||
* This function sets the title of the bubble. Where this appears depends on
|
||||
* the selected corner.
|
||||
* @deprecated use elm_object_text_set() instead.
|
||||
*/
|
||||
EAPI void elm_bubble_label_set(Evas_Object *obj, const char *label) EINA_ARG_NONNULL(1);
|
||||
EINA_DEPRECATED EAPI void elm_bubble_label_set(Evas_Object *obj, const char *label) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* Get the label of the bubble
|
||||
*
|
||||
|
@ -3725,8 +3726,9 @@ extern "C" {
|
|||
* @return The string of set in the label
|
||||
*
|
||||
* This function gets the title of the bubble.
|
||||
* @deprecated use elm_object_text_set() instead.
|
||||
*/
|
||||
EAPI const char *elm_bubble_label_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EINA_DEPRECATED EAPI const char *elm_bubble_label_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* Set the info of the bubble
|
||||
*
|
||||
|
@ -3735,8 +3737,9 @@ extern "C" {
|
|||
*
|
||||
* This function sets the info of the bubble. Where this appears depends on
|
||||
* the selected corner.
|
||||
* @deprecated use elm_object_text_set() instead.
|
||||
*/
|
||||
EAPI void elm_bubble_info_set(Evas_Object *obj, const char *info) EINA_ARG_NONNULL(1);
|
||||
EINA_DEPRECATED EAPI void elm_bubble_info_set(Evas_Object *obj, const char *info) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* Get the info of the bubble
|
||||
*
|
||||
|
@ -3745,8 +3748,9 @@ extern "C" {
|
|||
* @return The "info" string of the bubble
|
||||
*
|
||||
* This function gets the info text.
|
||||
* @deprecated use elm_object_text_set() instead.
|
||||
*/
|
||||
EAPI const char *elm_bubble_info_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
EINA_DEPRECATED EAPI const char *elm_bubble_info_get(const Evas_Object *obj) EINA_ARG_NONNULL(1);
|
||||
/**
|
||||
* Set the content to be shown in the bubble
|
||||
*
|
||||
|
|
|
@ -136,6 +136,52 @@ _mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *eve
|
|||
evas_object_smart_callback_call(data, SIG_CLICKED, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_bubble_label_set(Evas_Object *obj, const char *item, const char *label)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return;
|
||||
|
||||
if (!item)
|
||||
{
|
||||
eina_stringshare_replace(&wd->label, label);
|
||||
edje_object_part_text_set(wd->bbl, "elm.text", label);
|
||||
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");
|
||||
_sizing_eval(obj);
|
||||
}
|
||||
else if (!strcmp(item, "info"))
|
||||
{
|
||||
eina_stringshare_replace(&wd->info, label);
|
||||
edje_object_part_text_set(wd->bbl, "elm.info", label);
|
||||
if (label) edje_object_signal_emit(wd->bbl, "elm,state,info,visible",
|
||||
"elm");
|
||||
else edje_object_signal_emit(wd->bbl, "elm,state,info,hidden", "elm");
|
||||
_sizing_eval(obj);
|
||||
}
|
||||
}
|
||||
|
||||
static const char*
|
||||
_elm_bubble_label_get(const Evas_Object *obj, const char *item)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return NULL;
|
||||
|
||||
if (!item)
|
||||
{
|
||||
return wd->label;
|
||||
}
|
||||
else if (!strcmp(item, "info"))
|
||||
{
|
||||
return wd->info;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
elm_bubble_add(Evas_Object *parent)
|
||||
{
|
||||
|
@ -153,6 +199,8 @@ elm_bubble_add(Evas_Object *parent)
|
|||
elm_widget_theme_hook_set(obj, _theme_hook);
|
||||
elm_widget_focus_next_hook_set(obj, _elm_bubble_focus_next_hook);
|
||||
elm_widget_can_focus_set(obj, EINA_FALSE);
|
||||
elm_widget_text_set_hook_set(obj, _elm_bubble_label_set);
|
||||
elm_widget_text_get_hook_set(obj, _elm_bubble_label_get);
|
||||
|
||||
wd->corner = eina_stringshare_add("base");
|
||||
|
||||
|
@ -174,45 +222,25 @@ elm_bubble_add(Evas_Object *parent)
|
|||
EAPI void
|
||||
elm_bubble_label_set(Evas_Object *obj, const char *label)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return;
|
||||
eina_stringshare_replace(&wd->label, label);
|
||||
edje_object_part_text_set(wd->bbl, "elm.text", label);
|
||||
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");
|
||||
_sizing_eval(obj);
|
||||
_elm_bubble_label_set(obj, NULL, label);
|
||||
}
|
||||
|
||||
EAPI const char*
|
||||
elm_bubble_label_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->label;
|
||||
return _elm_bubble_label_get(obj, NULL);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_bubble_info_set(Evas_Object *obj, const char *info)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return;
|
||||
eina_stringshare_replace(&wd->info, info);
|
||||
edje_object_part_text_set(wd->bbl, "elm.info", info);
|
||||
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");
|
||||
_sizing_eval(obj);
|
||||
_elm_bubble_label_set(obj, "info", info);
|
||||
}
|
||||
|
||||
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;
|
||||
return _elm_bubble_label_get(obj, "info");
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
|
Loading…
Reference in New Issue