forked from enlightenment/efl
focus: Added focus_highlight_geometry_get() into elm_widget.
Summary: Currently, elm_win was handling focus_highlight geometry of widgets. Removed elm_win_focus_highlight_geometry_get() from elm_win and now elm_widget handles focus highlight geometry. This is required to support the focus highlight on elm widget items. Test Plan: elementary_test -> focus Reviewers: seoz, raster, woohyun CC: nirajkr Differential Revision: https://phab.enlightenment.org/D530
This commit is contained in:
parent
1f0567af98
commit
431b15cd48
|
@ -4860,6 +4860,49 @@ _elm_widget_newest_focus_order_get(Eo *obj, void *_pd, va_list *list)
|
|||
return;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_widget_focus_highlight_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
||||
{
|
||||
ELM_WIDGET_CHECK(obj);
|
||||
eo_do(obj, elm_wdg_focus_highlight_geometry_get(x, y, w, h));
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_widget_focus_highlight_geometry_get(Eo *obj, void *_pd, va_list *list)
|
||||
{
|
||||
Evas_Coord *x = va_arg(*list, Evas_Coord *);
|
||||
Evas_Coord *y = va_arg(*list, Evas_Coord *);
|
||||
Evas_Coord *w = va_arg(*list, Evas_Coord *);
|
||||
Evas_Coord *h = va_arg(*list, Evas_Coord *);
|
||||
|
||||
Evas_Coord tx = 0, ty = 0, tw = 0, th = 0;
|
||||
const char *target_hl_part = NULL;
|
||||
Evas_Object *edje_obj = NULL;
|
||||
Elm_Widget_Smart_Data *sd = _pd;
|
||||
|
||||
evas_object_geometry_get(obj, x, y, w, h);
|
||||
if (sd->resize_obj && eo_isa(sd->resize_obj, EDJE_OBJ_CLASS))
|
||||
{
|
||||
edje_obj = sd->resize_obj;
|
||||
if (!(target_hl_part = edje_object_data_get(edje_obj, "focus_part")))
|
||||
return;
|
||||
}
|
||||
else if (sd->resize_obj && eo_isa(sd->resize_obj, ELM_OBJ_LAYOUT_CLASS))
|
||||
{
|
||||
edje_obj = elm_layout_edje_get(sd->resize_obj);
|
||||
if (!(target_hl_part = elm_layout_data_get(sd->resize_obj, "focus_part")))
|
||||
return;
|
||||
}
|
||||
else return;
|
||||
|
||||
edje_object_part_geometry_get(edje_obj, target_hl_part,
|
||||
&tx, &ty, &tw, &th);
|
||||
*x += tx;
|
||||
*y += ty;
|
||||
if (tw != *w) *w = tw;
|
||||
if (th != *h) *h = th;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_widget_activate(Evas_Object *obj, Elm_Activate act)
|
||||
{
|
||||
|
@ -6614,6 +6657,7 @@ _class_constructor(Eo_Class *klass)
|
|||
|
||||
EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_CAN_FOCUS_CHILD_LIST_GET), _elm_widget_can_focus_child_list_get),
|
||||
EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_NEWEST_FOCUS_ORDER_GET), _elm_widget_newest_focus_order_get),
|
||||
EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_HIGHLIGHT_GEOMETRY_GET), _elm_widget_focus_highlight_geometry_get),
|
||||
|
||||
EO_OP_FUNC_SENTINEL
|
||||
};
|
||||
|
@ -6767,6 +6811,7 @@ static const Eo_Op_Description op_desc[] = {
|
|||
|
||||
EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_CAN_FOCUS_CHILD_LIST_GET, "Get the list of focusable child objects."),
|
||||
EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_NEWEST_FOCUS_ORDER_GET, "Get the newest focused object and its order."),
|
||||
EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_FOCUS_HIGHLIGHT_GEOMETRY_GET, "Get the focus highlight geometry of widget."),
|
||||
|
||||
EO_OP_DESCRIPTION_SENTINEL
|
||||
};
|
||||
|
|
|
@ -736,6 +736,7 @@ EAPI const char *elm_widget_access_info_get(const Evas_Object *obj);
|
|||
EAPI void elm_widget_orientation_set(Evas_Object *obj, int rotation);
|
||||
EAPI void elm_widget_orientation_mode_disabled_set(Evas_Object *obj, Eina_Bool disabled);
|
||||
EAPI Eina_Bool elm_widget_orientation_mode_disabled_get(const Evas_Object *obj);
|
||||
EAPI void elm_widget_focus_highlight_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
|
||||
EAPI Elm_Widget_Item *_elm_widget_item_new(Evas_Object *parent, size_t alloc_size);
|
||||
EAPI void _elm_widget_item_free(Elm_Widget_Item *item);
|
||||
EAPI Evas_Object *_elm_widget_item_widget_get(const Elm_Widget_Item *item);
|
||||
|
@ -1274,6 +1275,7 @@ enum
|
|||
|
||||
ELM_WIDGET_SUB_ID_CAN_FOCUS_CHILD_LIST_GET,
|
||||
ELM_WIDGET_SUB_ID_NEWEST_FOCUS_ORDER_GET,
|
||||
ELM_WIDGET_SUB_ID_FOCUS_HIGHLIGHT_GEOMETRY_GET,
|
||||
#if 0
|
||||
ELM_WIDGET_SUB_ID_THEME_APPLY, /* API + virtual*/
|
||||
ELM_WIDGET_SUB_ID_THEME_SPECIFIC,
|
||||
|
@ -2671,5 +2673,18 @@ typedef void * (*list_data_get_func_type)(const Eina_List * l);
|
|||
*/
|
||||
#define elm_wdg_orientation_mode_disabled_get(ret) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ORIENTATION_MODE_DISABLED_GET), EO_TYPECHECK(Eina_Bool *, ret)
|
||||
|
||||
#endif
|
||||
/**
|
||||
* @def elm_wdg_focus_highlight_geometry_get
|
||||
* @since 1.9
|
||||
*
|
||||
* Get the focus highlight geometry of widget.
|
||||
*
|
||||
* @param[in] x
|
||||
* @param[in] y
|
||||
* @param[in] w
|
||||
* @param[in] z
|
||||
*
|
||||
*/
|
||||
#define elm_wdg_focus_highlight_geometry_get(x, y, w, h) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_HIGHLIGHT_GEOMETRY_GET), EO_TYPECHECK(Evas_Coord *, x), EO_TYPECHECK(Evas_Coord *, y), EO_TYPECHECK(Evas_Coord *, w), EO_TYPECHECK(Evas_Coord *, h)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -682,37 +682,6 @@ _elm_win_focus_highlight_visible_set(Elm_Win_Smart_Data *sd,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_win_focus_highlight_geometry_get(Evas_Object *target, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h)
|
||||
{
|
||||
Evas_Coord tx = 0, ty = 0, tw = 0, th = 0;
|
||||
const char *target_hl_part = NULL;
|
||||
Evas_Object *edje_obj = NULL;
|
||||
ELM_WIDGET_DATA_GET_OR_RETURN(target, wd);
|
||||
|
||||
evas_object_geometry_get(target, x, y, w, h);
|
||||
if (wd->resize_obj && eo_isa(wd->resize_obj, EDJE_OBJ_CLASS))
|
||||
{
|
||||
edje_obj = wd->resize_obj;
|
||||
if (!(target_hl_part = edje_object_data_get(edje_obj, "focus_part")))
|
||||
return;
|
||||
}
|
||||
else if (wd->resize_obj && eo_isa(wd->resize_obj, ELM_OBJ_LAYOUT_CLASS))
|
||||
{
|
||||
edje_obj = elm_layout_edje_get(wd->resize_obj);
|
||||
if (!(target_hl_part = elm_layout_data_get(wd->resize_obj, "focus_part")))
|
||||
return;
|
||||
}
|
||||
else return;
|
||||
|
||||
edje_object_part_geometry_get(edje_obj, target_hl_part,
|
||||
&tx, &ty, &tw, &th);
|
||||
*x += tx;
|
||||
*y += ty;
|
||||
if (tw != *w) *w = tw;
|
||||
if (th != *h) *h = th;
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_win_focus_highlight_anim_setup(Elm_Win_Smart_Data *sd,
|
||||
Evas_Object *obj)
|
||||
|
@ -724,8 +693,8 @@ _elm_win_focus_highlight_anim_setup(Elm_Win_Smart_Data *sd,
|
|||
Evas_Object *target = sd->focus_highlight.cur.target;
|
||||
|
||||
evas_object_geometry_get(sd->obj, NULL, NULL, &w, &h);
|
||||
_elm_win_focus_highlight_geometry_get(target, &tx, &ty, &tw, &th);
|
||||
_elm_win_focus_highlight_geometry_get(previous, &px, &py, &pw, &ph);
|
||||
elm_widget_focus_highlight_geometry_get(target, &tx, &ty, &tw, &th);
|
||||
elm_widget_focus_highlight_geometry_get(previous, &px, &py, &pw, &ph);
|
||||
evas_object_move(obj, tx, ty);
|
||||
evas_object_resize(obj, tw, th);
|
||||
evas_object_clip_unset(obj);
|
||||
|
@ -751,7 +720,7 @@ _elm_win_focus_highlight_simple_setup(Elm_Win_Smart_Data *sd,
|
|||
Evas_Coord x, y, w, h;
|
||||
|
||||
clip = evas_object_clip_get(target);
|
||||
_elm_win_focus_highlight_geometry_get(target, &x, &y, &w, &h);
|
||||
elm_widget_focus_highlight_geometry_get(target, &x, &y, &w, &h);
|
||||
|
||||
evas_object_move(obj, x, y);
|
||||
evas_object_resize(obj, w, h);
|
||||
|
|
Loading…
Reference in New Issue