EAPI Eina_Bool elm_ctxpopup_horizontal_get(Evas_Object *obj);
EAPI void elm_ctxpopup_item_icon_set(Elm_Ctxpopup_Item *item, Evas_Object *icon);
EAPI void elm_ctxpopup_item_label_set(Elm_Ctxpopup_Item *item, const char *label);
- EAPI Elm_Ctxpopup_Item* elm_ctxpopup_item_add(Evas_Object *obj, Evas_Object *icon, const char* label, void (*func) (void *data, Evas_Object *obj, void *event_info), void *data);
- EAPI Elm_Ctxpopup_Item* elm_ctxpopup_icon_add(Evas_Object *obj, Evas_Object *icon, void (*func) (void *data, Evas_Object *obj, void *event_info), void *data);
- EAPI Elm_Ctxpopup_Item* elm_ctxpopup_label_add(Evas_Object *obj, const char *label, void (*func) (void *data, Evas_Object *obj, void *event_info), void* data);
+ EAPI Elm_Ctxpopup_Item* elm_ctxpopup_item_add(Evas_Object *obj, Evas_Object *icon, const char* label, Evas_Smart_Cb func, const void *data);
+ EAPI Elm_Ctxpopup_Item* elm_ctxpopup_icon_add(Evas_Object *obj, Evas_Object *icon, Evas_Smart_Cb func, const void *data);
+ EAPI Elm_Ctxpopup_Item* elm_ctxpopup_label_add(Evas_Object *obj, const char *label, Evas_Smart_Cb func, const void *data);
EAPI void elm_ctxpopup_item_del(Elm_Ctxpopup_Item *item);
EAPI void elm_ctxpopup_item_disabled_set(Elm_Ctxpopup_Item *item, Eina_Bool disabled);
EAPI void elm_ctxpopup_clear(Evas_Object *obj);
EAPI void elm_ctxpopup_screen_dimmed_disabled_set(Evas_Object *obj, Eina_Bool disabled);
EAPI void elm_ctxpopup_align_set(Evas_Object *obj, double align_x, double align_y);
EAPI void elm_ctxpopup_align_get(Evas_Object *obj, double *align_x, double *align_y);
-// EAPI void elm_ctxpopup_button_append(Evas_Object *obj, const char *label);
+ EAPI void elm_ctxpopup_button_append(Evas_Object *obj, const char *label, Evas_Smart_Cb func, const void *data);
/* QuickContactBadge */
*
*Signals that you can add callbacks for are:
*
- * ctxpopup,hide - This is called whenever the ctxpopup is hided.
+ * hide - This is called whenever the ctxpopup is hided.
*
*/
static void _update_arrow_obj(Evas_Object *obj, Arrow_Direction arrow_dir);
static void _shift_base_by_arrow(Evas_Object *arrow, Arrow_Direction arrow_dir, Evas_Coord_Rectangle *rect);
static void _btn_layout_create(Evas_Object *obj);
+static void _btn_clicked(void *data, Evas_Object *obj, void *event_info);
+
static void
_separator_obj_del(Widget_Data *wd, Elm_Ctxpopup_Item *remove_item)
{
static void
_bg_clicked_cb(void *data, Evas_Object *obj, const char *emission, const char *source)
{
- evas_object_smart_callback_call(data, "ctxpopup,hide", NULL);
+ evas_object_smart_callback_call(data, "hide", NULL);
evas_object_hide(data);
}
const char *source)
{
Elm_Ctxpopup_Item *item = (Elm_Ctxpopup_Item *) data;
-
if (!item)
return;
if (item->disabled)
return;
- if (item->func)
- item->func((void *)(item->data), item->ctxpopup, item);
+ if (item->func) {
+ item->func(item->data, item->ctxpopup, item);
+ }
}
static void
evas_object_show(item->base);
}
+
+static void
+_btn_clicked(void *data, Evas_Object *obj, void *event_info)
+{
+ evas_object_smart_callback_call(data, "response", data);
+}
+
+
+
/**
* Get the icon object for the given item.
*
* @ingroup Ctxpopup
*/
EAPI Elm_Ctxpopup_Item *
-elm_ctxpopup_item_add(Evas_Object *obj, Evas_Object *icon, const char* label, void (*func) (void *data, Evas_Object *obj, void *event_info), void* data)
+elm_ctxpopup_item_add(Evas_Object *obj, Evas_Object *icon, const char* label, Evas_Smart_Cb func, const void *data)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Elm_Ctxpopup_Item *item;
*/
EAPI Elm_Ctxpopup_Item *
elm_ctxpopup_icon_add(Evas_Object *obj, Evas_Object *icon,
- void (*func) (void *data, Evas_Object *obj,
- void *event_info), void *data)
+ Evas_Smart_Cb func, const void *data)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Elm_Ctxpopup_Item *item;
*/
EAPI Elm_Ctxpopup_Item *
elm_ctxpopup_label_add(Evas_Object *obj, const char *label,
- void (*func) (void *data, Evas_Object *obj,
- void *event_info), void *data)
+ Evas_Smart_Cb func, const void *data)
{
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
Elm_Ctxpopup_Item *item;
elm_box_pack_end(wd->box, item->base);
elm_ctxpopup_item_label_set(item, label);
-
-
return item;
}
}
EAPI void
-elm_ctxpopup_button_append(Evas_Object *obj, const char *label)
+elm_ctxpopup_button_append(Evas_Object *obj, const char *label, Evas_Smart_Cb func, const void *data)
{
ELM_CHECK_WIDTYPE(obj, widtype);
btn = elm_button_add(obj);
elm_object_style_set(btn, "text_only/style1");
elm_button_label_set(btn, label);
+ evas_object_smart_callback_add(btn, "clicked", func, data);
sprintf(buf, "actionbtn%d", wd->btn_cnt);
edje_object_part_swallow(wd->btn_layout, buf, btn);
}