static void _adjust_pos_y(Evas_Coord_Point *pos,
Evas_Coord_Point *base_size,
Evas_Coord_Rectangle *hover_area);
-<<<<<<< HEAD
-static void _ctxpopup_changed_size_hints(void *data __UNUSED__,
- Evas *e __UNUSED__, Evas_Object *obj,
- void *event_info __UNUSED__);
-=======
->>>>>>> remotes/origin/upstream
static Elm_Ctxpopup_Direction _calc_base_geometry(Evas_Object *obj,
Evas_Coord_Rectangle *rect);
static void _update_arrow(Evas_Object *obj,
Elm_Ctxpopup_Direction dir,
Evas_Coord_Rectangle rect);
static void _sizing_eval(Evas_Object *obj);
-<<<<<<< HEAD
-=======
static void _hide_signal_emit(Evas_Object *obj,
Elm_Ctxpopup_Direction dir);
static void _show_signal_emit(Evas_Object *obj,
Elm_Ctxpopup_Direction dir);
->>>>>>> remotes/origin/upstream
static void _shift_base_by_arrow(Evas_Object *arrow,
Elm_Ctxpopup_Direction dir,
Evas_Coord_Rectangle *rect);
Evas *e,
Evas_Object *obj,
void *event_info);
-<<<<<<< HEAD
-=======
static void _hide_finished(void *data,
Evas_Object *obj,
const char *emission,
const char *source __UNUSED__);
->>>>>>> remotes/origin/upstream
-static void _hide(Evas_Object *obj);
static void _ctxpopup_hide(void *data,
Evas *e,
Evas_Object *obj,
static void _list_del(Widget_Data *wd);
static void _list_new(Evas_Object *obj);
static void _remove_items(Widget_Data * wd);
+static void _disable_hook(Evas_Object *obj);
+static void _signal_emit_hook(Evas_Object *obj, const char *emission, const char *source);
+static void _signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data);
+static void _signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data);
static const char SIG_DISMISSED[] = "dismissed";
wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
- _hide(data);
+ evas_object_hide(data);
}
static void
pos->y = hover_area->y;
}
-<<<<<<< HEAD
-static void
-_ctxpopup_changed_size_hints(void *data __UNUSED__, Evas *e __UNUSED__,
- Evas_Object *obj, void *event_info __UNUSED__)
-{
- Widget_Data *wd;
-
- wd = elm_widget_data_get(obj);
- if (!wd) return;
-
- if (wd->visible)
- _sizing_eval(obj);
-}
-
-=======
->>>>>>> remotes/origin/upstream
static Elm_Ctxpopup_Direction
_calc_base_geometry(Evas_Object *obj, Evas_Coord_Rectangle *rect)
{
edje_object_part_swallow(wd->base,
"elm.swallow.arrow_left",
wd->arrow);
-<<<<<<< HEAD
-
- // if user does not use dragable part
- arrow_size.y = (y - (arrow_size.h * 0.5));
- arrow_size.x = x;
-
-=======
->>>>>>> remotes/origin/upstream
if (base_size.h > 0)
{
if (y < ((arrow_size.h * 0.5) + base_size.y))
edje_object_part_swallow(wd->base,
"elm.swallow.arrow_right",
wd->arrow);
-<<<<<<< HEAD
-
- // if user does not use dragable part
- arrow_size.y = (y - (arrow_size.h * 0.5));
- arrow_size.x = (x - arrow_size.w);
-
-=======
->>>>>>> remotes/origin/upstream
if (base_size.h > 0)
{
if (y < ((arrow_size.h * 0.5) + base_size.y))
case ELM_CTXPOPUP_DIRECTION_DOWN:
edje_object_signal_emit(wd->arrow, "elm,state,top", "elm");
edje_object_part_swallow(wd->base, "elm.swallow.arrow_up", wd->arrow);
-<<<<<<< HEAD
-
- // if user does not use dragable part
- arrow_size.x = (x - (arrow_size.w * 0.5));
- arrow_size.y = y;
-
-=======
->>>>>>> remotes/origin/upstream
if (base_size.w > 0)
{
if (x < ((arrow_size.w * 0.5) + base_size.x))
edje_object_part_swallow(wd->base,
"elm.swallow.arrow_down",
wd->arrow);
-<<<<<<< HEAD
-
- // if user does not use dragable part
- arrow_size.x = (x - (arrow_size.w * 0.5));
- arrow_size.y = (y - arrow_size.h);
-
-=======
->>>>>>> remotes/origin/upstream
if (base_size.w > 0)
{
if (x < ((arrow_size.w * 0.5) + base_size.x))
default:
break;
}
-<<<<<<< HEAD
-
- // if user does not use dragable part
- evas_object_move(wd->arrow, arrow_size.x, arrow_size.y);
}
//TODO: compress item - different from opensource
EINA_LIST_FOREACH(wd->items, elist, item)
{
edje_object_signal_emit(item->base.view, "elm,state,compress", "elm");
-=======
+ }
}
static void
break;
default:
break;
->>>>>>> remotes/origin/upstream
}
}
wd = elm_widget_data_get(obj);
if (!wd) return;
-<<<<<<< HEAD
if (!wd->parent) return;
-=======
->>>>>>> remotes/origin/upstream
//Box, Scroller
EINA_LIST_FOREACH(wd->items, elist, item)
//Base
wd->dir = _calc_base_geometry(obj, &rect);
-<<<<<<< HEAD
//TODO: compress item - different from opensource
if (!wd->horizontal && !wd->content)
_compress_item(obj);
-=======
_show_signal_emit(obj, wd->dir);
->>>>>>> remotes/origin/upstream
_update_arrow(obj, wd->dir, rect);
_shift_base_by_arrow(wd->arrow, wd->dir, &rect);
wd = elm_widget_data_get(obj);
if (!wd) return;
-<<<<<<< HEAD
evas_object_event_callback_del_full(wd->parent, EVAS_CALLBACK_RESIZE,
_parent_resize, obj);
evas_object_event_callback_del_full(wd->box, EVAS_CALLBACK_RESIZE,
_content_resize, obj);
-=======
- evas_object_event_callback_del_full(wd->box, EVAS_CALLBACK_RESIZE,
- _content_resize, obj);
->>>>>>> remotes/origin/upstream
_parent_cut_off(obj);
}
Widget_Data *wd;
Eina_List *elist;
Elm_Ctxpopup_Item *item;
-<<<<<<< HEAD
int idx = 0;
-=======
->>>>>>> remotes/origin/upstream
Eina_Bool rtl;
wd = elm_widget_data_get(obj);
if (elm_widget_item_disabled_get(item))
edje_object_signal_emit(VIEW(item), "elm,state,disabled", "elm");
-<<<<<<< HEAD
/*
* For separator, if the first item has visible separator,
* then it should be aligned with edge of the base part.
if (evas_object_visible_get(wd->bg))
edje_object_signal_emit(wd->bg, "elm,state,show", "elm");
-=======
- edje_object_message_signal_process(VIEW(item));
- }
-
->>>>>>> remotes/origin/upstream
if (wd->scr)
{
if (!strncmp(elm_object_style_get(obj), "default", strlen("default")))
static void
_item_text_set_hook(Elm_Object_Item *it, const char *part, const char *label)
{
-<<<<<<< HEAD
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-
-=======
->>>>>>> remotes/origin/upstream
Widget_Data *wd;
Elm_Ctxpopup_Item *ctxpopup_it;
if (part && strcmp(part, "default")) return;
-<<<<<<< HEAD
- ctxpopup_it = (Elm_Ctxpopup_Item *) it;
-=======
ctxpopup_it = (Elm_Ctxpopup_Item *)it;
->>>>>>> remotes/origin/upstream
wd = elm_widget_data_get(WIDGET(ctxpopup_it));
if (!wd) return;
static const char *
_item_text_get_hook(const Elm_Object_Item *it, const char *part)
{
-<<<<<<< HEAD
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
- Elm_Ctxpopup_Item *ctxpopup_it;
- if (part && strcmp(part, "default")) return NULL;
- ctxpopup_it = (Elm_Ctxpopup_Item *) it;
-=======
Elm_Ctxpopup_Item *ctxpopup_it;
if (part && strcmp(part, "default")) return NULL;
ctxpopup_it = (Elm_Ctxpopup_Item *)it;
->>>>>>> remotes/origin/upstream
return ctxpopup_it->label;
}
const char *part,
Evas_Object *content)
{
-<<<<<<< HEAD
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-=======
->>>>>>> remotes/origin/upstream
Widget_Data *wd;
Elm_Ctxpopup_Item *ctxpopup_it;
if (part && strcmp(part, "icon")) return;
-<<<<<<< HEAD
- ctxpopup_it = (Elm_Ctxpopup_Item *) it;
-=======
ctxpopup_it = (Elm_Ctxpopup_Item *)it;
->>>>>>> remotes/origin/upstream
wd = elm_widget_data_get(WIDGET(ctxpopup_it));
if (!wd) return;
static Evas_Object *
_item_content_get_hook(const Elm_Object_Item *it, const char *part)
{
-<<<<<<< HEAD
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
- Elm_Ctxpopup_Item *ctxpopup_it;
- if (part && strcmp(part, "icon")) return NULL;
- ctxpopup_it = (Elm_Ctxpopup_Item *) it;
-=======
Elm_Ctxpopup_Item *ctxpopup_it;
if (part && strcmp(part, "icon")) return NULL;
ctxpopup_it = (Elm_Ctxpopup_Item *)it;
->>>>>>> remotes/origin/upstream
return ctxpopup_it->icon;
}
static void
_item_disable_hook(Elm_Object_Item *it)
{
-<<<<<<< HEAD
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-
- Widget_Data *wd;
- Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *) it;
-=======
Widget_Data *wd;
Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *)it;
->>>>>>> remotes/origin/upstream
wd = elm_widget_data_get(WIDGET(ctxpopup_it));
if (!wd) return;
_item_signal_emit_hook(Elm_Object_Item *it, const char *emission,
const char *source)
{
-<<<<<<< HEAD
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
- Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *) it;
-=======
Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *)it;
->>>>>>> remotes/origin/upstream
edje_object_signal_emit(VIEW(ctxpopup_it), emission, source);
}
_bg_clicked_cb(void *data, Evas_Object *obj __UNUSED__,
const char *emission __UNUSED__, const char *source __UNUSED__)
{
-<<<<<<< HEAD
- evas_object_hide(data);
-=======
Widget_Data *wd = elm_widget_data_get(data);
if (!wd) return;
_hide_signal_emit(data, wd->dir);
->>>>>>> remotes/origin/upstream
}
static void
void *event_info __UNUSED__)
{
Widget_Data *wd;
-<<<<<<< HEAD
Eina_List *elist;
Elm_Ctxpopup_Item *item;
int idx = 0;
-=======
->>>>>>> remotes/origin/upstream
wd = elm_widget_data_get(obj);
if (!wd) return;
evas_object_show(wd->arrow);
edje_object_signal_emit(wd->bg, "elm,state,show", "elm");
-<<<<<<< HEAD
EINA_LIST_FOREACH(wd->items, elist, item)
{
edje_object_signal_emit(VIEW(item), "elm,state,horizontal", "elm");
}
}
-=======
+
edje_object_signal_emit(wd->base, "elm,state,show", "elm");
->>>>>>> remotes/origin/upstream
_sizing_eval(obj);
}
static void
-<<<<<<< HEAD
-_hide(Evas_Object *obj)
-{
- Widget_Data *wd = elm_widget_data_get(obj);
-
-=======
_hide_finished(void *data, Evas_Object *obj __UNUSED__,
const char *emission __UNUSED__, const char *source __UNUSED__)
{
- _hide(data);
-}
-
-static void
-_hide(Evas_Object *obj)
-{
- _ctxpopup_hide(NULL, NULL, obj, NULL);
- evas_object_smart_callback_call(obj, SIG_DISMISSED, NULL);
+ evas_object_hide(data);
+ evas_object_smart_callback_call(data, SIG_DISMISSED, NULL);
}
static void
void *event_info __UNUSED__)
{
Widget_Data *wd = elm_widget_data_get(obj);
->>>>>>> remotes/origin/upstream
if ((!wd) || (!wd->visible)) return;
evas_object_hide(wd->bg);
_scroller_size_reset(wd);
-<<<<<<< HEAD
- evas_object_smart_callback_call(obj, SIG_DISMISSED, NULL);
-=======
->>>>>>> remotes/origin/upstream
wd->visible = EINA_FALSE;
}
static void
-<<<<<<< HEAD
-_ctxpopup_hide(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
- void *event_info __UNUSED__)
-{
- _hide(obj);
-}
-
-static void
-=======
->>>>>>> remotes/origin/upstream
_content_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
void *event_info __UNUSED__)
{
if (elm_widget_item_disabled_get(item)) return;
if (item->func)
-<<<<<<< HEAD
- item->func((void*) item->base.data, WIDGET(item), data);
-=======
item->func((void*)item->base.data, WIDGET(item), data);
->>>>>>> remotes/origin/upstream
}
static void
_item_icon_set(Elm_Ctxpopup_Item *item, Evas_Object *icon)
{
if (item->icon)
-<<<<<<< HEAD
- {
- elm_widget_sub_object_del(VIEW(item), item->icon);
- evas_object_del(item->icon);
- }
-=======
evas_object_del(item->icon);
->>>>>>> remotes/origin/upstream
item->icon = icon;
if (!icon) return;
static Eina_Bool
_item_del_pre_hook(Elm_Object_Item *it)
{
-<<<<<<< HEAD
- ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
-
- Widget_Data *wd;
- Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *) it;
-=======
Widget_Data *wd;
Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *)it;
->>>>>>> remotes/origin/upstream
wd = elm_widget_data_get(WIDGET(ctxpopup_it));
if (!wd) return EINA_FALSE;
return EINA_TRUE;
}
+static void
+_disable_hook(Evas_Object *obj)
+{
+ Eina_List *l;
+ Elm_Object_Item *it;
+
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+
+ EINA_LIST_FOREACH(wd->items, l, it)
+ elm_object_item_disabled_set(it, elm_widget_disabled_get(obj));
+}
+
+static void
+_signal_emit_hook(Evas_Object *obj, const char *emission, const char *source)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ edje_object_signal_emit(wd->base, emission, source);
+}
+
+static void
+_signal_callback_add_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ edje_object_signal_callback_add(wd->base, emission, source, func_cb, data);
+}
+
+static void
+_signal_callback_del_hook(Evas_Object *obj, const char *emission, const char *source, Edje_Signal_Cb func_cb, void *data)
+{
+ Widget_Data *wd = elm_widget_data_get(obj);
+ if (!wd) return;
+ edje_object_signal_callback_del_full(wd->base, emission, source, func_cb, data);
+}
+
EAPI Evas_Object *
elm_ctxpopup_add(Evas_Object *parent)
{
Evas_Object *obj;
Evas *e;
Widget_Data *wd;
-<<<<<<< HEAD
- Evas_Coord x, y, w, h;
-=======
->>>>>>> remotes/origin/upstream
ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
ELM_SET_WIDTYPE(widtype, "ctxpopup");
elm_widget_type_set(obj, "ctxpopup");
-<<<<<<< HEAD
- elm_widget_sub_object_add(parent, obj);
-=======
->>>>>>> remotes/origin/upstream
elm_widget_data_set(obj, wd);
elm_widget_del_pre_hook_set(obj, _del_pre_hook);
elm_widget_del_hook_set(obj, _del_hook);
elm_widget_content_set_hook_set(obj, _content_set_hook);
elm_widget_content_unset_hook_set(obj, _content_unset_hook);
elm_widget_content_get_hook_set(obj, _content_get_hook);
+ elm_widget_disable_hook_set(obj, _disable_hook);
+ elm_widget_signal_emit_hook_set(obj, _signal_emit_hook);
+ elm_widget_signal_callback_add_hook_set(obj, _signal_callback_add_hook);
+ elm_widget_signal_callback_del_hook_set(obj, _signal_callback_del_hook);
//Background
wd->bg = edje_object_add(e);
elm_widget_sub_object_add(obj, wd->bg);
_elm_theme_object_set(obj, wd->bg, "ctxpopup", "bg", "default");
-<<<<<<< HEAD
- evas_object_geometry_get(parent, &x, &y, &w, &h);
- evas_object_move(wd->bg, x, y);
- evas_object_resize(wd->bg, w, h);
- edje_object_signal_callback_add(wd->bg, "elm,action,click", "",
- _bg_clicked_cb, obj);
-
-=======
edje_object_signal_callback_add(wd->bg,
"elm,action,click",
"",
_bg_clicked_cb,
obj);
->>>>>>> remotes/origin/upstream
//Base
wd->base = edje_object_add(e);
elm_widget_sub_object_add(obj, wd->base);
_elm_theme_object_set(obj, wd->base, "ctxpopup", "base", "default");
-<<<<<<< HEAD
-=======
edje_object_signal_callback_add(wd->base, "elm,action,hide,finished", "",
_hide_finished, obj);
->>>>>>> remotes/origin/upstream
//Arrow
wd->arrow = edje_object_add(e);
wd->dir_priority[1] = ELM_CTXPOPUP_DIRECTION_LEFT;
wd->dir_priority[2] = ELM_CTXPOPUP_DIRECTION_RIGHT;
wd->dir_priority[3] = ELM_CTXPOPUP_DIRECTION_DOWN;
-<<<<<<< HEAD
-
- evas_object_event_callback_add(parent, EVAS_CALLBACK_RESIZE, _parent_resize,
- obj);
-=======
->>>>>>> remotes/origin/upstream
wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _ctxpopup_show,
NULL);
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _ctxpopup_move,
NULL);
-<<<<<<< HEAD
- evas_object_event_callback_add(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
- _ctxpopup_changed_size_hints, NULL);
-=======
->>>>>>> remotes/origin/upstream
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESTACK, _restack, obj);
evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
return obj;
}
-<<<<<<< HEAD
-EAPI Evas_Object *
-elm_ctxpopup_item_icon_get(const Elm_Object_Item *it)
-{
- return _item_content_get_hook(it, "icon");
-}
-
-EAPI void
-elm_ctxpopup_item_icon_set(Elm_Object_Item *it, Evas_Object *icon)
-{
- _item_content_set_hook(it, "icon", icon);
-}
-
-EAPI const char *
-elm_ctxpopup_item_label_get(const Elm_Object_Item *it)
-{
- return _item_text_get_hook(it, NULL);
-}
-
-EAPI void
-elm_ctxpopup_item_label_set(Elm_Object_Item *it, const char *label)
-{
- _item_text_set_hook(it, NULL, label);
-}
-
-=======
->>>>>>> remotes/origin/upstream
EAPI void
elm_ctxpopup_hover_parent_set(Evas_Object *obj, Evas_Object *parent)
{
ELM_CHECK_WIDTYPE(obj, widtype);
Widget_Data *wd;
-<<<<<<< HEAD
Eina_List *elist;
Elm_Ctxpopup_Item *item;
int idx = 0;
-=======
->>>>>>> remotes/origin/upstream
wd = elm_widget_data_get(obj);
if (!wd) return;
{
elm_box_horizontal_set(wd->box, EINA_FALSE);
elm_scroller_bounce_set(wd->scr, EINA_FALSE, EINA_TRUE);
-<<<<<<< HEAD
EINA_LIST_FOREACH(wd->items, elist, item)
{
else
edje_object_signal_emit(VIEW(item), "elm,state,vertical", "elm");
}
-=======
->>>>>>> remotes/origin/upstream
}
else
{
elm_box_horizontal_set(wd->box, EINA_TRUE);
elm_scroller_bounce_set(wd->scr, EINA_TRUE, EINA_FALSE);
-<<<<<<< HEAD
EINA_LIST_FOREACH(wd->items, elist, item)
{
else
edje_object_signal_emit(VIEW(item), "elm,state,horizontal", "elm");
}
-=======
->>>>>>> remotes/origin/upstream
}
wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
_sizing_eval(obj);
}
-<<<<<<< HEAD
- return (Elm_Object_Item *) item;
-}
-
-EAPI void
-elm_ctxpopup_item_del(Elm_Object_Item *it)
-{
- elm_object_item_del(it);
-}
-
-EAPI void
-elm_ctxpopup_item_disabled_set(Elm_Object_Item *it, Eina_Bool disabled)
-{
- elm_object_item_disabled_set(it, disabled);
-}
-
-EAPI Eina_Bool
-elm_ctxpopup_item_disabled_get(const Elm_Object_Item *it)
-{
- return elm_object_item_disabled_get(it);
-}
-
-EAPI void
-elm_ctxpopup_content_set(Evas_Object *obj, Evas_Object *content)
-{
- elm_object_content_set(obj, content);
-}
-
-EAPI Evas_Object *
-elm_ctxpopup_content_unset(Evas_Object *obj)
-{
- return elm_object_content_unset(obj);
-=======
return (Elm_Object_Item *)item;
->>>>>>> remotes/origin/upstream
}
EAPI void
if (!wd) return ELM_CTXPOPUP_DIRECTION_UNKNOWN;
return wd->dir;
}
-<<<<<<< HEAD
-=======
EAPI void
elm_ctxpopup_dismiss(Evas_Object *obj)
if (!wd) return;
_hide_signal_emit(obj, wd->dir);
}
->>>>>>> remotes/origin/upstream