};
static void
-_elm_ctxpopup_smart_translate(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
+_elm_ctxpopup_smart_translate(Eo *obj, void *_pd, va_list *list)
{
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
+ Elm_Ctxpopup_Smart_Data *sd = _pd;
+ Eina_List *l;
+ Elm_Ctxpopup_Item *it;
+
evas_object_hide(obj);
+ EINA_LIST_FOREACH(sd->items, l, it)
+ elm_widget_item_translate(it);
+
if (ret) *ret = EINA_TRUE;
}
_elm_ctxpopup_smart_focus_direction_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
{
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
- *ret = EINA_FALSE;
+ *ret = EINA_TRUE;
}
static void
Elm_Ctxpopup_Smart_Data *sd = _pd;
Elm_Focus_Direction dir = va_arg(*list, Elm_Focus_Direction);
- Evas_Object **next = va_arg(*list, Evas_Object **);
+ Evas_Object **next = va_arg(*list, Evas_Object **);
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
if (ret) *ret = EINA_FALSE;
}
static void
+_elm_ctxpopup_smart_focus_direction(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
+{
+ Elm_Ctxpopup_Smart_Data *sd = _pd;
+
+ Evas_Object *base = va_arg(*list, Evas_Object *);
+ double degree = va_arg(*list, double);
+ Evas_Object **direction = va_arg(*list, Evas_Object **);
+ double *weight = va_arg(*list, double *);
+ Eina_Bool *ret = va_arg(*list, Eina_Bool *);
+ if (ret) *ret = EINA_FALSE;
+ Eina_Bool int_ret;
+
+ Eina_List *l = NULL;
+ void *(*list_data_get)(const Eina_List *list);
+
+ if (!sd)
+ return;
+
+ list_data_get = eina_list_data_get;
+
+ l = eina_list_append(l, sd->box);
+
+ int_ret = elm_widget_focus_list_direction_get
+ (obj, base, l, list_data_get, degree, direction, weight);
+ if (ret) *ret = int_ret;
+ eina_list_free(l);
+}
+
+
+static void
_elm_ctxpopup_smart_event(Eo *obj, void *_pd, va_list *list)
{
Evas_Object *src = va_arg(*list, Evas_Object *);
int idx;
ELM_CTXPOPUP_DATA_GET(obj, sd);
- Elm_Widget_Smart_Data *wd = eo_data_get(obj, ELM_OBJ_WIDGET_CLASS);
+ Elm_Widget_Smart_Data *wd = eo_data_scope_get(obj, ELM_OBJ_WIDGET_CLASS);
- if (!rect) return ELM_CTXPOPUP_DIRECTION_DOWN;
+ if (!rect || !sd->parent) return ELM_CTXPOPUP_DIRECTION_DOWN;
edje_object_part_geometry_get
(sd->arrow, "ctxpopup_arrow", NULL, NULL, &arrow_size.x, &arrow_size.y);
evas_object_geometry_get
(sd->parent, &hover_area.x, &hover_area.y, &hover_area.w,
&hover_area.h);
+ if (!strcmp(evas_object_type_get(sd->parent), "elm_win"))
+ hover_area.x = hover_area.y = 0;
evas_object_geometry_get(obj, &pos.x, &pos.y, NULL, NULL);
double drag;
ELM_CTXPOPUP_DATA_GET(obj, sd);
- Elm_Widget_Smart_Data *wd = eo_data_get(obj, ELM_OBJ_WIDGET_CLASS);
+ Elm_Widget_Smart_Data *wd = eo_data_scope_get(obj, ELM_OBJ_WIDGET_CLASS);
evas_object_geometry_get(obj, &x, &y, NULL, NULL);
evas_object_geometry_get
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
Eina_Bool int_ret;
- eo_do_super(obj, elm_wdg_sub_object_add(sobj, &int_ret));
+ eo_do_super(obj, MY_CLASS, elm_wdg_sub_object_add(sobj, &int_ret));
if (ret) *ret = int_ret;
}
Evas_Coord_Point list_size = { 0, 0 };
Elm_Ctxpopup_Smart_Data *sd = _pd;
- Elm_Widget_Smart_Data *wd = eo_data_get(obj, ELM_OBJ_WIDGET_CLASS);
+ Elm_Widget_Smart_Data *wd = eo_data_scope_get(obj, ELM_OBJ_WIDGET_CLASS);
if (!sd->arrow) return; /* simple way to flag "under deletion" */
+ if (!sd->parent) return; /* do not calculate sizes unless parent is set */
//Base
sd->dir = _base_geometry_calc(obj, &rect);
Eina_Bool *ret = va_arg(*list, Eina_Bool *);
if (ret) *ret = EINA_FALSE;
- eo_do_super(obj, elm_wdg_theme(&int_ret));
+ eo_do_super(obj, MY_CLASS, elm_wdg_theme(&int_ret));
if (!int_ret) return;
elm_widget_theme_object_set
if ((part) && (strcmp(part, "default")))
{
- eo_do_super(obj, elm_obj_container_content_set(part, content, &int_ret));
+ eo_do_super(obj, MY_CLASS, elm_obj_container_content_set(part, content, &int_ret));
goto end;
}
if ((part) && (strcmp(part, "default")))
{
- eo_do_super(obj, elm_obj_container_content_get(part, ret));
+ eo_do_super(obj, MY_CLASS, elm_obj_container_content_get(part, ret));
return;
}
if ((part) && (strcmp(part, "default")))
{
- eo_do_super(obj, elm_obj_container_content_unset(part, &content));
+ eo_do_super(obj, MY_CLASS, elm_obj_container_content_unset(part, &content));
goto end;
}
{
elm_list_go(sd->list);
sd->visible = EINA_TRUE;
- elm_object_focus_set(obj, EINA_TRUE);
+ elm_object_focus_set(sd->list, EINA_TRUE);
return;
}
if (ret) *ret = EINA_FALSE;
Eina_Bool int_ret;
- eo_do_super(obj, elm_wdg_disable(&int_ret));
+ eo_do_super(obj, MY_CLASS, elm_wdg_disable(&int_ret));
if (!int_ret) return;
elm_object_disabled_set(sd->list, elm_widget_disabled_get(obj));
{
Elm_Ctxpopup_Smart_Data *priv = _pd;
- eo_do_super(obj, evas_obj_smart_add());
+ eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
if (!elm_layout_theme_set
(obj, "ctxpopup", "base", elm_widget_style_get(obj)))
/* box will be our content placeholder, thus the parent's version call */
Eina_Bool ret;
- eo_do_super(obj, elm_obj_container_content_set("elm.swallow.content", priv->box, &ret));
+ eo_do_super(obj, MY_CLASS, elm_obj_container_content_set("elm.swallow.content", priv->box, &ret));
evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _on_show, NULL);
evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _on_hide, NULL);
evas_object_del(sd->bg);
sd->bg = NULL;
- EINA_LIST_FREE (sd->items, it)
+ EINA_LIST_FREE(sd->items, it)
elm_widget_item_free(it);
- eo_do_super(obj, evas_obj_smart_del());
+ eo_do_super(obj, MY_CLASS, evas_obj_smart_del());
}
static void
/* access: parent could be any object such as elm_list which does
not know elc_ctxpopup as its child object in the focus_next(); */
- Elm_Widget_Smart_Data *wd = eo_data_get(obj, ELM_OBJ_WIDGET_CLASS);
+ Elm_Widget_Smart_Data *wd = eo_data_scope_get(obj, ELM_OBJ_WIDGET_CLASS);
wd->highlight_root = EINA_TRUE;
return obj;
static void
_constructor(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
{
- eo_do_super(obj, eo_constructor());
+ eo_do_super(obj, MY_CLASS, eo_constructor());
eo_do(obj,
evas_obj_type_set(MY_CLASS_NAME),
evas_obj_smart_callbacks_descriptions_set(_smart_callbacks, NULL));
- if (!elm_widget_sub_object_add(eo_parent_get(obj), obj))
- ERR("could not add %p as sub object of %p", obj, eo_parent_get(obj));
+ elm_widget_sub_object_add(eo_parent_get(obj), obj);
}
EAPI void
//Update Background
evas_object_geometry_get(parent, &x, &y, &w, &h);
+ if (!strcmp(evas_object_type_get(parent), "elm_win"))
+ x = y = 0;
evas_object_move(sd->bg, x, y);
evas_object_resize(sd->bg, w, h);
EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_NEXT_MANAGER_IS), _elm_ctxpopup_smart_focus_next_manager_is),
EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_NEXT), _elm_ctxpopup_smart_focus_next),
EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_DIRECTION_MANAGER_IS), _elm_ctxpopup_smart_focus_direction_manager_is),
+ EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_DIRECTION), _elm_ctxpopup_smart_focus_direction),
EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_TRANSLATE), _elm_ctxpopup_smart_translate),
EO_OP_FUNC(ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_SET), _elm_ctxpopup_smart_content_set),