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;
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);
Evas_Object *bbl;
Evas_Object *content, *icon;
const char *label, *info, *corner;
+ Elm_Bubble_Pos pos;
};
static const char *widtype = NULL;
{NULL, NULL}
};
+static const char *corner_string[] =
+{
+ "top_left",
+ "top_right",
+ "bottom_left",
+ "bottom_right"
+};
+
static void
_del_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");
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);
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;
+ 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 NULL;
- return wd->corner;
+ if (!wd) return ELM_BUBBLE_POS_INVALID;
+ return wd->pos;
}
*/
/**
+ * 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
*
* @param parent The parent object
* 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
*
* 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);
/**
* @}
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);
+
+/**
* @}
*/