bubble_corner_set/get params from char * to bubble_pos_set/get enum.
Signed-off-by: Sanjeev BA <eflelev8@gmail.com> SVN revision: 68528
This commit is contained in:
parent
86207ebc34
commit
d884cb1923
|
@ -38,19 +38,19 @@ set_api_state(api_data *api)
|
|||
switch(api->state)
|
||||
{ /* Put all api-changes under switch */
|
||||
case BUBBLE_SET_CORNER_1:
|
||||
elm_bubble_corner_set(eina_list_nth(items, 0), "bottom_left");
|
||||
elm_bubble_pos_set(eina_list_nth(items, 0), ELM_BUBBLE_POS_BOTTOM_LEFT);
|
||||
elm_object_text_set(elm_object_content_get(eina_list_nth(items, 0)),
|
||||
"Corner: base (bottom-left) - with icon");
|
||||
elm_bubble_corner_set(eina_list_nth(items, 1), "top_right");
|
||||
elm_bubble_pos_set(eina_list_nth(items, 1), ELM_BUBBLE_POS_TOP_RIGHT);
|
||||
elm_object_text_set(elm_object_content_get(eina_list_nth(items, 1)),
|
||||
"Corner: base (top-right) - no icon");
|
||||
break;
|
||||
|
||||
case BUBBLE_SET_CORNER_2:
|
||||
elm_bubble_corner_set(eina_list_nth(items, 0), "top_right");
|
||||
elm_bubble_pos_set(eina_list_nth(items, 0), ELM_BUBBLE_POS_TOP_RIGHT);
|
||||
elm_object_text_set(elm_object_content_get(eina_list_nth(items, 0)),
|
||||
"Corner: base (top-right) - with icon");
|
||||
elm_bubble_corner_set(eina_list_nth(items, 1), "bottom_left");
|
||||
elm_bubble_pos_set(eina_list_nth(items, 1), ELM_BUBBLE_POS_BOTTOM_LEFT);
|
||||
elm_object_text_set(elm_object_content_get(eina_list_nth(items, 1)),
|
||||
"Corner: base (bottom-left) - no icon");
|
||||
break;
|
||||
|
@ -149,7 +149,7 @@ test_bubble(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
|
|||
elm_object_text_set(bb, "Message 1");
|
||||
elm_object_part_text_set(bb, "info", "Corner: bottom_right");
|
||||
elm_object_part_content_set(bb, "icon", ic);
|
||||
elm_bubble_corner_set(bb, "bottom_right");
|
||||
elm_bubble_pos_set(bb, ELM_BUBBLE_POS_BOTTOM_RIGHT);
|
||||
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);
|
||||
|
|
|
@ -8,6 +8,7 @@ struct _Widget_Data
|
|||
Evas_Object *bbl;
|
||||
Evas_Object *content, *icon;
|
||||
const char *label, *info, *corner;
|
||||
Elm_Bubble_Pos pos;
|
||||
};
|
||||
|
||||
static const char *widtype = NULL;
|
||||
|
@ -29,6 +30,14 @@ static const Evas_Smart_Cb_Description _signals[] =
|
|||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static const char *corner_string[] =
|
||||
{
|
||||
"top_left",
|
||||
"top_right",
|
||||
"bottom_left",
|
||||
"bottom_right"
|
||||
};
|
||||
|
||||
static void
|
||||
_del_hook(Evas_Object *obj)
|
||||
{
|
||||
|
@ -55,7 +64,7 @@ _theme_hook(Evas_Object *obj)
|
|||
if (!wd) return;
|
||||
_elm_widget_mirrored_reload(obj);
|
||||
_mirrored_set(obj, elm_widget_mirrored_get(obj));
|
||||
_elm_theme_object_set(obj, wd->bbl, "bubble", wd->corner,
|
||||
_elm_theme_object_set(obj, wd->bbl, "bubble", corner_string[wd->pos],
|
||||
elm_widget_style_get(obj));
|
||||
edje_object_part_text_set(wd->bbl, "elm.text", wd->label);
|
||||
if (wd->label) edje_object_signal_emit(wd->bbl, "elm,state,text,visible", "elm");
|
||||
|
@ -321,6 +330,7 @@ elm_bubble_add(Evas_Object *parent)
|
|||
elm_widget_content_unset_hook_set(obj, _content_unset_hook);
|
||||
|
||||
wd->corner = eina_stringshare_add("base");
|
||||
wd->pos = ELM_BUBBLE_POS_TOP_LEFT; //default
|
||||
|
||||
wd->bbl = edje_object_add(e);
|
||||
elm_widget_resize_object_set(obj, wd->bbl);
|
||||
|
@ -397,22 +407,39 @@ elm_bubble_icon_unset(Evas_Object *obj)
|
|||
return _content_unset_hook(obj, "icon");
|
||||
}
|
||||
|
||||
EAPI void
|
||||
EINA_DEPRECATED EAPI void
|
||||
elm_bubble_corner_set(Evas_Object *obj, const char *corner)
|
||||
{
|
||||
int i = 0;
|
||||
for (i=ELM_BUBBLE_POS_TOP_LEFT; i<=ELM_BUBBLE_POS_BOTTOM_RIGHT; i++)
|
||||
{
|
||||
if (!strcmp(corner,corner_string[i]))
|
||||
elm_bubble_pos_set(obj, i);
|
||||
}
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_bubble_pos_set(Evas_Object *obj, Elm_Bubble_Pos pos)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype);
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return;
|
||||
EINA_SAFETY_ON_NULL_RETURN(corner);
|
||||
eina_stringshare_replace(&wd->corner, corner);
|
||||
if(pos<ELM_BUBBLE_POS_TOP_LEFT || pos>ELM_BUBBLE_POS_BOTTOM_RIGHT) return;
|
||||
wd->pos = pos;
|
||||
_theme_hook(obj);
|
||||
}
|
||||
|
||||
EAPI const char*
|
||||
EINA_DEPRECATED 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;
|
||||
return corner_string[elm_bubble_pos_get(obj)];
|
||||
}
|
||||
|
||||
EAPI Elm_Bubble_Pos
|
||||
elm_bubble_pos_get(const Evas_Object *obj)
|
||||
{
|
||||
ELM_CHECK_WIDTYPE(obj, widtype) ELM_BUBBLE_POS_INVALID;
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (!wd) return ELM_BUBBLE_POS_INVALID;
|
||||
return wd->pos;
|
||||
}
|
||||
|
|
|
@ -51,6 +51,21 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Defines the corner values for a bubble.
|
||||
*
|
||||
* The corner will be used to determine where the arrow of the
|
||||
* bubble points to.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
ELM_BUBBLE_POS_INVALID = -1,
|
||||
ELM_BUBBLE_POS_TOP_LEFT,
|
||||
ELM_BUBBLE_POS_TOP_RIGHT,
|
||||
ELM_BUBBLE_POS_BOTTOM_LEFT,
|
||||
ELM_BUBBLE_POS_BOTTOM_RIGHT,
|
||||
} Elm_Bubble_Pos;
|
||||
|
||||
/**
|
||||
* Add a new bubble to the parent
|
||||
*
|
||||
|
@ -71,14 +86,8 @@ EAPI Evas_Object *elm_bubble_add(Evas_Object *parent);
|
|||
* determine where the arrow in the frame points to and where label, icon and
|
||||
* info are shown.
|
||||
*
|
||||
* Possible values for corner are:
|
||||
* @li "top_left" - Default
|
||||
* @li "top_right"
|
||||
* @li "bottom_left"
|
||||
* @li "bottom_right"
|
||||
*/
|
||||
// XXX: use enum for corner parameter instead of const char *
|
||||
EAPI void elm_bubble_corner_set(Evas_Object *obj, const char *corner);
|
||||
EAPI void elm_bubble_pos_set(Evas_Object *obj, Elm_Bubble_Pos pos);
|
||||
|
||||
/**
|
||||
* Get the corner of the bubble
|
||||
|
@ -88,8 +97,7 @@ EAPI void elm_bubble_corner_set(Evas_Object *obj, const
|
|||
*
|
||||
* This function gets the selected corner of the bubble.
|
||||
*/
|
||||
// XXX: use enum for return value instead of const char *
|
||||
EAPI const char *elm_bubble_corner_get(const Evas_Object *obj);
|
||||
EAPI Elm_Bubble_Pos elm_bubble_pos_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
@ -4288,6 +4288,27 @@ EINA_DEPRECATED EAPI double elm_tooltip_delay_get(void);
|
|||
*/
|
||||
EINA_DEPRECATED EAPI Eina_Bool elm_tooltip_delay_set(double delay);
|
||||
|
||||
/**
|
||||
* Set the corner of the bubble
|
||||
*
|
||||
* @param obj The bubble object.
|
||||
* @param corner The given corner for the bubble.
|
||||
*
|
||||
* @deprecated Use elm_bubble_pos_set()
|
||||
*
|
||||
*/
|
||||
EINA_DEPRECATED EAPI void elm_bubble_corner_set(Evas_Object *obj, const char *corner);
|
||||
|
||||
/**
|
||||
* Get the corner of the bubble
|
||||
*
|
||||
* @param obj The bubble object.
|
||||
* @return The given corner for the bubble.
|
||||
*
|
||||
* @deprecated Use elm_bubble_pos_get()
|
||||
*/
|
||||
EINA_DEPRECATED EAPI const char *elm_bubble_corner_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue