forked from enlightenment/efl
list: implemented widget item focus feature.
@feature Summary: # Added "item,focused" and "item,unfocused" smart callbacks. # Added elm_object_focused_item_get() in elm_widget # Added elm_object_item_focus_set and elm_object_item_focus_get() APIs for # Added one argument in existing _focus_highlight_geometry_get(...,is_next) This is required to find out previous and current widget item. # Added a elm_win function _focus_highlight_start() which starts the focus Test Plan: elementary_test->List Focus , List Horizontal Focus Reviewers: seoz, woohyun Reviewers Comments: SeoZ - there are some known bugs. we will actively fix them in a near future. CC: nirajkr Differential Revision: https://phab.enlightenment.org/D532
This commit is contained in:
parent
b22dd17eed
commit
069a3de27d
|
@ -97,6 +97,7 @@
|
|||
|
||||
group { name: "elm/list/item/default";
|
||||
data.item: "selectraise" "on";
|
||||
data.item: "focusraise" "on";
|
||||
images.image: "bevel_curved_horiz_out.png" COMP;
|
||||
images.image: "shadow_rounded_horiz.png" COMP;
|
||||
images.image: "vgrad_med_dark.png" COMP;
|
||||
|
@ -410,6 +411,7 @@ COMPRESS_ODD("elm/list/item_compress_odd/default", "elm/list/item/default")
|
|||
|
||||
group { name: "elm/list/h_item/default";
|
||||
data.item: "selectraise" "on";
|
||||
data.item: "focusraise" "on";
|
||||
images.image: "bevel_curved_vert_out.png" COMP;
|
||||
images.image: "shadow_rounded_vert.png" COMP;
|
||||
images.image: "vgrad_med_dark.png" COMP;
|
||||
|
|
|
@ -1285,6 +1285,22 @@ test_list8_focus_animate_check_changed(void *data, Evas_Object *obj, void *event
|
|||
elm_check_state_get(obj));
|
||||
}
|
||||
|
||||
static void
|
||||
_item_focused_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||
{
|
||||
Elm_Object_Item *it = event_info;
|
||||
|
||||
printf("item,focused: %p\n", it);
|
||||
}
|
||||
|
||||
static void
|
||||
_item_unfocused_cb(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||
{
|
||||
Elm_Object_Item *it = event_info;
|
||||
|
||||
printf("item,unfocused: %p\n", it);
|
||||
}
|
||||
|
||||
void test_list_focus(const char *name, const char *title, Eina_Bool horiz)
|
||||
{
|
||||
Evas_Object *win, *li, *bx, *bxx, *chk;
|
||||
|
@ -1308,6 +1324,8 @@ void test_list_focus(const char *name, const char *title, Eina_Bool horiz)
|
|||
elm_list_horizontal_set(li, horiz);
|
||||
elm_box_pack_end(bxx, li);
|
||||
evas_object_show(li);
|
||||
evas_object_smart_callback_add(li, "item,focused", _item_focused_cb, NULL);
|
||||
evas_object_smart_callback_add(li, "item,unfocused", _item_unfocused_cb, NULL);
|
||||
|
||||
bx = elm_box_add(win);
|
||||
evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0);
|
||||
|
|
|
@ -317,3 +317,48 @@ EAPI Eina_Bool elm_object_focus_highlight_style_set(Evas_Object *obj, const c
|
|||
*/
|
||||
EAPI const char *elm_object_focus_highlight_style_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* Get the focused object item
|
||||
*
|
||||
* This returns the focused object item.
|
||||
*
|
||||
* @param obj The container object
|
||||
* @return The focused item, or @c NULL if none
|
||||
*
|
||||
* The focused item can be unfocused with function
|
||||
* elm_object_item_focus_set().
|
||||
*
|
||||
* see @elm_object_item_focus_set()
|
||||
* see @elm_object_item_focus_get()
|
||||
*
|
||||
* @ingroup Focus
|
||||
* @since 1.10
|
||||
*/
|
||||
EAPI Elm_Object_Item *elm_object_focused_item_get(const Evas_Object *obj);
|
||||
|
||||
/**
|
||||
* Set the object item focused
|
||||
*
|
||||
* @param it The object item
|
||||
* @param focused The focused state
|
||||
*
|
||||
* @see elm_object_item_focus_get()
|
||||
*
|
||||
* @ingroup Focus
|
||||
* @since 1.10
|
||||
*/
|
||||
EAPI void elm_object_item_focus_set(Elm_Object_Item *it, Eina_Bool focused);
|
||||
|
||||
/**
|
||||
* Get whether the @p it is focused or not.
|
||||
*
|
||||
* @param it The object item
|
||||
* @return @c EINA_TRUE means item is focused. @c EINA_FALSE indicates
|
||||
* it's not. If @p obj is @c NULL, @c EINA_FALSE is returned.
|
||||
*
|
||||
* @see elm_object_item_focus_set()
|
||||
*
|
||||
* @ingroup Focus
|
||||
* @since 1.10
|
||||
*/
|
||||
EAPI Eina_Bool elm_object_item_focus_get(const Elm_Object_Item *it);
|
||||
|
|
|
@ -29,6 +29,8 @@ static const char SIG_EDGE_RIGHT[] = "edge,right";
|
|||
static const char SIG_SWIPE[] = "swipe";
|
||||
static const char SIG_HIGHLIGHTED[] = "highlighted";
|
||||
static const char SIG_UNHIGHLIGHTED[] = "unhighlighted";
|
||||
static const char SIG_ITEM_FOCUSED[] = "item,focused";
|
||||
static const char SIG_ITEM_UNFOCUSED[] = "item,unfocused";
|
||||
static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
||||
{SIG_ACTIVATED, ""},
|
||||
{SIG_CLICKED_DOUBLE, ""},
|
||||
|
@ -42,6 +44,8 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
|
|||
{SIG_SWIPE, ""},
|
||||
{SIG_HIGHLIGHTED, ""},
|
||||
{SIG_UNHIGHLIGHTED, ""},
|
||||
{SIG_ITEM_FOCUSED, ""},
|
||||
{SIG_ITEM_UNFOCUSED, ""},
|
||||
{SIG_WIDGET_LANG_CHANGED, ""}, /**< handled by elm_widget */
|
||||
{SIG_WIDGET_ACCESS_CHANGED, ""}, /**< handled by elm_widget */
|
||||
{SIG_LAYOUT_FOCUSED, ""}, /**< handled by elm_layout */
|
||||
|
@ -97,12 +101,10 @@ _item_multi_select_up(Elm_List_Smart_Data *sd)
|
|||
{
|
||||
elm_list_item_selected_set(sd->last_selected_item, EINA_FALSE);
|
||||
sd->last_selected_item = prev;
|
||||
elm_list_item_show(sd->last_selected_item);
|
||||
}
|
||||
else
|
||||
{
|
||||
elm_list_item_selected_set(prev, EINA_TRUE);
|
||||
elm_list_item_show(prev);
|
||||
}
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -122,12 +124,10 @@ _item_multi_select_down(Elm_List_Smart_Data *sd)
|
|||
{
|
||||
elm_list_item_selected_set(sd->last_selected_item, EINA_FALSE);
|
||||
sd->last_selected_item = next;
|
||||
elm_list_item_show(sd->last_selected_item);
|
||||
}
|
||||
else
|
||||
{
|
||||
elm_list_item_selected_set(next, EINA_TRUE);
|
||||
elm_list_item_show(next);
|
||||
}
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -164,7 +164,6 @@ _item_single_select_up(Elm_List_Smart_Data *sd)
|
|||
_all_items_unselect(sd);
|
||||
|
||||
elm_list_item_selected_set(prev, EINA_TRUE);
|
||||
elm_list_item_show(prev);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -189,7 +188,6 @@ _item_single_select_down(Elm_List_Smart_Data *sd)
|
|||
_all_items_unselect(sd);
|
||||
|
||||
elm_list_item_selected_set(next, EINA_TRUE);
|
||||
elm_list_item_show(next);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -197,9 +195,10 @@ _item_single_select_down(Elm_List_Smart_Data *sd)
|
|||
static Eina_Bool
|
||||
_elm_list_item_focus_set(Elm_List_Item *it, Elm_Focus_Direction dir, Eina_Bool h_mode)
|
||||
{
|
||||
ELM_LIST_DATA_GET(WIDGET(it), sd);
|
||||
if (!it) return EINA_FALSE;
|
||||
|
||||
if (!it->sd->focus_on_selection_enabled) return EINA_FALSE;
|
||||
if (!sd->focus_on_selection_enabled) return EINA_FALSE;
|
||||
|
||||
int focus_objs = 0;
|
||||
Evas_Object *focus_chain[2];
|
||||
|
@ -255,6 +254,70 @@ _elm_list_item_focus_set(Elm_List_Item *it, Elm_Focus_Direction dir, Eina_Bool h
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_item_focused_next(Evas_Object *obj, Elm_Focus_Direction dir)
|
||||
{
|
||||
ELM_LIST_DATA_GET_OR_RETURN_VAL(obj, sd, EINA_FALSE);
|
||||
Elm_List_Item *it = NULL;
|
||||
|
||||
sd->prev_focused_item = sd->focused_item;
|
||||
if (!sd->h_mode)
|
||||
{
|
||||
if ((dir == ELM_FOCUS_UP) || (dir == ELM_FOCUS_DOWN))
|
||||
{
|
||||
Eina_List *l = eina_list_data_find_list(sd->items, sd->focused_item);
|
||||
if (sd->focused_item)
|
||||
{
|
||||
if (dir == ELM_FOCUS_DOWN)
|
||||
it = (Elm_List_Item *)eina_list_data_get(eina_list_next(l));
|
||||
else it = (Elm_List_Item *)eina_list_data_get(eina_list_prev(l));
|
||||
if (!it)
|
||||
return EINA_FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dir == ELM_FOCUS_DOWN)
|
||||
it = (Elm_List_Item *)eina_list_data_get(sd->items);
|
||||
else it = (Elm_List_Item *)eina_list_data_get(eina_list_last(sd->items));
|
||||
}
|
||||
if (elm_object_item_disabled_get((Elm_Object_Item *)it))
|
||||
return EINA_TRUE;
|
||||
elm_object_item_focus_set((Elm_Object_Item *)it, EINA_TRUE);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
else if ((dir == ELM_FOCUS_LEFT) || (dir == ELM_FOCUS_RIGHT))
|
||||
return EINA_FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((dir == ELM_FOCUS_LEFT) || (dir == ELM_FOCUS_RIGHT))
|
||||
{
|
||||
Eina_List *l = eina_list_data_find_list(sd->items, sd->focused_item);
|
||||
if (sd->focused_item)
|
||||
{
|
||||
if (dir == ELM_FOCUS_RIGHT)
|
||||
it = (Elm_List_Item *)eina_list_data_get(eina_list_next(l));
|
||||
else it = (Elm_List_Item *)eina_list_data_get(eina_list_prev(l));
|
||||
if (!it)
|
||||
return EINA_FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dir == ELM_FOCUS_RIGHT)
|
||||
it = (Elm_List_Item *)eina_list_data_get(sd->items);
|
||||
else it = (Elm_List_Item *)eina_list_data_get(eina_list_last(sd->items));
|
||||
}
|
||||
if (elm_object_item_disabled_get((Elm_Object_Item *)it))
|
||||
return EINA_TRUE;
|
||||
elm_object_item_focus_set((Elm_Object_Item *)it, EINA_TRUE);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
else if ((dir == ELM_FOCUS_UP) || (dir == ELM_FOCUS_DOWN))
|
||||
return EINA_FALSE;
|
||||
}
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_list_smart_event(Eo *obj, void *_pd, va_list *list)
|
||||
{
|
||||
|
@ -295,17 +358,23 @@ _elm_list_smart_event(Eo *obj, void *_pd, va_list *list)
|
|||
it = (Elm_List_Item *)elm_list_selected_item_get(obj);
|
||||
Eina_Bool focused = _elm_list_item_focus_set(it, ELM_FOCUS_LEFT, sd->h_mode);
|
||||
|
||||
if ((sd->h_mode && !focused) &&
|
||||
(((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
|
||||
(_item_multi_select_up(sd)))
|
||||
|| (_item_single_select_up(sd))))
|
||||
if ((sd->h_mode && !focused))
|
||||
{
|
||||
if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
|
||||
_item_multi_select_up(sd);
|
||||
else
|
||||
_item_single_select_up(sd);
|
||||
}
|
||||
if (_item_focused_next(obj, ELM_FOCUS_LEFT))
|
||||
{
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return;
|
||||
}
|
||||
else
|
||||
x -= step_x;
|
||||
{
|
||||
if (ret) *ret = EINA_FALSE;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if ((!strcmp(ev->key, "Right")) ||
|
||||
((!strcmp(ev->key, "KP_Right")) && !ev->string))
|
||||
|
@ -313,17 +382,23 @@ _elm_list_smart_event(Eo *obj, void *_pd, va_list *list)
|
|||
it = (Elm_List_Item *)elm_list_selected_item_get(obj);
|
||||
Eina_Bool focused = _elm_list_item_focus_set(it, ELM_FOCUS_RIGHT, sd->h_mode);
|
||||
|
||||
if ((sd->h_mode && !focused) &&
|
||||
(((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
|
||||
(_item_multi_select_down(sd)))
|
||||
|| (_item_single_select_down(sd))))
|
||||
if (sd->h_mode && !focused)
|
||||
{
|
||||
if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
|
||||
_item_multi_select_down(sd);
|
||||
else
|
||||
_item_single_select_down(sd);
|
||||
}
|
||||
if (_item_focused_next(obj, ELM_FOCUS_RIGHT))
|
||||
{
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return;
|
||||
}
|
||||
else
|
||||
x += step_x;
|
||||
{
|
||||
if (ret) *ret = EINA_FALSE;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if ((!strcmp(ev->key, "Up")) ||
|
||||
((!strcmp(ev->key, "KP_Up")) && !ev->string))
|
||||
|
@ -331,17 +406,23 @@ _elm_list_smart_event(Eo *obj, void *_pd, va_list *list)
|
|||
it = (Elm_List_Item *)elm_list_selected_item_get(obj);
|
||||
Eina_Bool focused = _elm_list_item_focus_set(it, ELM_FOCUS_UP, sd->h_mode);
|
||||
|
||||
if ((!sd->h_mode && !focused) &&
|
||||
(((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
|
||||
(_item_multi_select_up(sd)))
|
||||
|| (_item_single_select_up(sd))))
|
||||
if (!sd->h_mode && !focused)
|
||||
{
|
||||
if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
|
||||
_item_multi_select_up(sd);
|
||||
else
|
||||
_item_single_select_up(sd);
|
||||
}
|
||||
if (_item_focused_next(obj, ELM_FOCUS_UP))
|
||||
{
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return;
|
||||
}
|
||||
else
|
||||
y -= step_y;
|
||||
{
|
||||
if (ret) *ret = EINA_FALSE;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if ((!strcmp(ev->key, "Down")) ||
|
||||
((!strcmp(ev->key, "KP_Down")) && !ev->string))
|
||||
|
@ -349,17 +430,23 @@ _elm_list_smart_event(Eo *obj, void *_pd, va_list *list)
|
|||
it = (Elm_List_Item *)elm_list_selected_item_get(obj);
|
||||
Eina_Bool focused = _elm_list_item_focus_set(it, ELM_FOCUS_DOWN, sd->h_mode);
|
||||
|
||||
if ((!sd->h_mode && !focused) &&
|
||||
(((evas_key_modifier_is_set(ev->modifiers, "Shift")) &&
|
||||
(_item_multi_select_down(sd)))
|
||||
|| (_item_single_select_down(sd))))
|
||||
if (!sd->h_mode && !focused)
|
||||
{
|
||||
if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
|
||||
_item_multi_select_down(sd);
|
||||
else
|
||||
_item_single_select_down(sd);
|
||||
}
|
||||
if (_item_focused_next(obj, ELM_FOCUS_DOWN))
|
||||
{
|
||||
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
return;
|
||||
}
|
||||
else
|
||||
y += step_y;
|
||||
{
|
||||
if (ret) *ret = EINA_FALSE;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if ((!strcmp(ev->key, "Home")) ||
|
||||
((!strcmp(ev->key, "KP_Home")) && !ev->string))
|
||||
|
@ -919,6 +1006,52 @@ _elm_list_smart_theme(Eo *obj, void *_pd, va_list *list)
|
|||
if (ret) *ret = EINA_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_list_item_focused(Elm_List_Item *it)
|
||||
{
|
||||
ELM_LIST_DATA_GET(WIDGET(it), sd);
|
||||
Evas_Coord x, y, w, h, sx, sy, sw, sh;
|
||||
const char *focus_raise;
|
||||
|
||||
if ((sd->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY) ||
|
||||
(it == (Elm_List_Item *)sd->focused_item))
|
||||
return;
|
||||
evas_object_geometry_get(VIEW(it), &x, &y, &w, &h);
|
||||
evas_object_geometry_get(sd->hit_rect, &sx, &sy, &sw, &sh);
|
||||
if ((x < sx) || (y < sy)|| ((x + w) > (sx + sw)) || ((y + h) > (sy + sh)))
|
||||
elm_list_item_bring_in((Elm_Object_Item *)it);
|
||||
sd->focused_item = (Elm_Object_Item *)it;
|
||||
((Elm_Widget_Item *)it)->focused = EINA_TRUE;
|
||||
if (elm_widget_focus_highlight_enabled_get(WIDGET(it)))
|
||||
{
|
||||
edje_object_signal_emit
|
||||
(VIEW(it), "elm,state,focused", "elm");
|
||||
}
|
||||
focus_raise = edje_object_data_get(VIEW(it), "focusraise");
|
||||
if ((focus_raise) && (!strcmp(focus_raise, "on")))
|
||||
evas_object_raise(VIEW(it));
|
||||
evas_object_smart_callback_call
|
||||
(WIDGET(it), SIG_ITEM_FOCUSED, it);
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_list_item_unfocused(Elm_List_Item *it)
|
||||
{
|
||||
ELM_LIST_DATA_GET(WIDGET(it), sd);
|
||||
|
||||
if (!sd->focused_item) return;
|
||||
sd->prev_focused_item = (Elm_Object_Item *)it;
|
||||
if (sd->select_mode == ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)
|
||||
return;
|
||||
if (elm_widget_focus_highlight_enabled_get(WIDGET(sd->focused_item)))
|
||||
edje_object_signal_emit
|
||||
(VIEW(sd->focused_item), "elm,state,unfocused", "elm");
|
||||
if (it == (Elm_List_Item *)sd->focused_item)
|
||||
sd->focused_item = NULL;
|
||||
evas_object_smart_callback_call
|
||||
(WIDGET(it), SIG_ITEM_UNFOCUSED, it);
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_list_smart_on_focus(Eo *obj, void *_pd, va_list *list)
|
||||
{
|
||||
|
@ -933,6 +1066,22 @@ _elm_list_smart_on_focus(Eo *obj, void *_pd, va_list *list)
|
|||
if (elm_widget_focus_get(obj) && sd->selected && !sd->last_selected_item)
|
||||
sd->last_selected_item = eina_list_data_get(sd->selected);
|
||||
|
||||
if (elm_widget_focus_get(obj))
|
||||
{
|
||||
if (sd->last_focused_item)
|
||||
_elm_list_item_focused((Elm_List_Item *)sd->last_focused_item);
|
||||
else if (sd->last_selected_item)
|
||||
_elm_list_item_focused((Elm_List_Item *)sd->last_selected_item);
|
||||
else
|
||||
_elm_list_item_focused((Elm_List_Item *)elm_list_first_item_get(obj));
|
||||
_elm_widget_focus_highlight_start(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
sd->prev_focused_item = sd->focused_item;
|
||||
sd->last_focused_item = sd->focused_item;
|
||||
_elm_list_item_unfocused((Elm_List_Item *)sd->focused_item);
|
||||
}
|
||||
if (ret) *ret = EINA_TRUE;
|
||||
}
|
||||
|
||||
|
@ -1033,7 +1182,7 @@ call:
|
|||
|
||||
if (it->func) it->func((void *)it->base.data, WIDGET(it), it);
|
||||
evas_object_smart_callback_call(obj, SIG_SELECTED, it);
|
||||
it->sd->last_selected_item = (Elm_Object_Item *)it;
|
||||
sd->last_selected_item = (Elm_Object_Item *)it;
|
||||
|
||||
_elm_list_unwalk(obj, sd);
|
||||
evas_object_unref(obj);
|
||||
|
@ -1086,7 +1235,7 @@ _item_unselect(Elm_List_Item *it)
|
|||
evas_object_ref(obj);
|
||||
_elm_list_walk(sd);
|
||||
|
||||
if (it->sd->focus_on_selection_enabled)
|
||||
if (sd->focus_on_selection_enabled)
|
||||
{
|
||||
if (it->icon) elm_object_focus_set(it->icon, EINA_FALSE);
|
||||
if (it->end) elm_object_focus_set(it->end, EINA_FALSE);
|
||||
|
@ -1322,6 +1471,7 @@ _mouse_up_cb(void *data,
|
|||
evas_object_ref(obj);
|
||||
_elm_list_walk(sd);
|
||||
|
||||
elm_object_item_focus_set((Elm_Object_Item *)it, EINA_TRUE);
|
||||
if (sd->multi &&
|
||||
((sd->multi_select_mode != ELM_OBJECT_MULTI_SELECT_MODE_WITH_CONTROL) ||
|
||||
(evas_key_modifier_is_set(ev->modifiers, "Control"))))
|
||||
|
@ -1544,6 +1694,39 @@ _item_signal_emit_hook(Elm_Object_Item *it,
|
|||
edje_object_signal_emit(VIEW(it), emission, source);
|
||||
}
|
||||
|
||||
static void
|
||||
_item_focus_set_hook(Elm_Object_Item *it, Eina_Bool focused)
|
||||
{
|
||||
ELM_LIST_ITEM_CHECK_OR_RETURN(it);
|
||||
Evas_Object *obj = WIDGET(it);
|
||||
ELM_LIST_DATA_GET(obj, sd);
|
||||
|
||||
if (focused)
|
||||
{
|
||||
if (!elm_object_focus_get(obj))
|
||||
elm_object_focus_set(obj, EINA_TRUE);
|
||||
if (sd->focused_item)
|
||||
_elm_list_item_unfocused((Elm_List_Item *)sd->focused_item);
|
||||
if (it != sd->focused_item) _elm_list_item_focused((Elm_List_Item *)it);
|
||||
}
|
||||
else
|
||||
_elm_list_item_unfocused((Elm_List_Item *)it);
|
||||
_elm_widget_focus_highlight_start(obj);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_item_focus_get_hook(Elm_Object_Item *it)
|
||||
{
|
||||
ELM_LIST_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
|
||||
Evas_Object *obj = WIDGET(it);
|
||||
ELM_LIST_CHECK(obj) EINA_FALSE;
|
||||
ELM_LIST_DATA_GET(obj, sd);
|
||||
|
||||
if (it == sd->focused_item)
|
||||
return EINA_TRUE;
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
static char *
|
||||
_access_info_cb(void *data, Evas_Object *obj EINA_UNUSED)
|
||||
{
|
||||
|
@ -1669,10 +1852,7 @@ _item_new(Evas_Object *obj,
|
|||
{
|
||||
Elm_List_Item *it;
|
||||
|
||||
ELM_LIST_DATA_GET(obj, sd);
|
||||
|
||||
it = elm_widget_item_new(obj, Elm_List_Item);
|
||||
it->sd = sd;
|
||||
it->label = eina_stringshare_add(label);
|
||||
it->icon = icon;
|
||||
it->end = end;
|
||||
|
@ -1720,6 +1900,8 @@ _item_new(Evas_Object *obj,
|
|||
elm_widget_item_text_get_hook_set(it, _item_text_get_hook);
|
||||
elm_widget_item_del_pre_hook_set(it, _item_del_pre_hook);
|
||||
elm_widget_item_signal_emit_hook_set(it, _item_signal_emit_hook);
|
||||
elm_widget_item_focus_set_hook_set(it, _item_focus_set_hook);
|
||||
elm_widget_item_focus_get_hook_set(it, _item_focus_get_hook);
|
||||
|
||||
return it;
|
||||
}
|
||||
|
@ -2806,6 +2988,81 @@ _focus_on_selection_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
|||
*ret = sd->focus_on_selection_enabled;
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_list_item_coordinates_adjust(Elm_List_Item *it,
|
||||
Evas_Coord *x,
|
||||
Evas_Coord *y,
|
||||
Evas_Coord *w,
|
||||
Evas_Coord *h)
|
||||
{
|
||||
ELM_LIST_DATA_GET(WIDGET(it), sd);
|
||||
|
||||
Evas_Coord ix, iy, iw, ih, vx, vy, vw, vh;
|
||||
|
||||
evas_object_geometry_get(sd->hit_rect, &vx, &vy, &vw, &vh);
|
||||
evas_object_geometry_get(VIEW(it), &ix, &iy, &iw, &ih);
|
||||
*x = ix;
|
||||
*y = iy;
|
||||
*w = iw;
|
||||
*h = ih;
|
||||
if (!sd->h_mode)
|
||||
{
|
||||
//TODO: Enhance it later. declare a macro in elm_macros.h
|
||||
if ((ix < vx) || (ix + iw) > (vx + vw) || (iy + ih) > (vy + vh))
|
||||
*y = iy - ih;
|
||||
else if (iy < vy)
|
||||
*y = iy + ih;
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO: Enhance it later. declare a macro in elm_macros.h
|
||||
if ((iy < vy) || (ix + iw) > (vx + vw) || (iy + ih) > (vy + vh))
|
||||
*x = ix - iw;
|
||||
else if (ix < vx)
|
||||
*x = ix + iw;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_list_focus_highlight_geometry_get(Eo *obj EINA_UNUSED, 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 *);
|
||||
Eina_Bool *is_next = va_arg(*list, Eina_Bool *);
|
||||
|
||||
Elm_List_Smart_Data *sd = _pd;
|
||||
|
||||
if (is_next && *is_next)
|
||||
{
|
||||
if (sd->focused_item)
|
||||
{
|
||||
_elm_list_item_coordinates_adjust((Elm_List_Item *)sd->focused_item, x, y, w, h);
|
||||
elm_widget_focus_highlight_focus_part_geometry_get(VIEW(sd->focused_item), x, y, w, h);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sd->prev_focused_item)
|
||||
{
|
||||
_elm_list_item_coordinates_adjust((Elm_List_Item *)sd->prev_focused_item, x, y, w, h);
|
||||
elm_widget_focus_highlight_focus_part_geometry_get(VIEW(sd->prev_focused_item), x, y, w, h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_list_focused_item_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
||||
{
|
||||
Elm_Object_Item **ret = va_arg(*list, Elm_Object_Item **);
|
||||
Elm_List_Smart_Data *sd = _pd;
|
||||
if (ret) *ret = NULL;
|
||||
|
||||
if (!elm_object_focus_get(obj)) return;
|
||||
if (ret) *ret = sd->focused_item;
|
||||
}
|
||||
|
||||
static void
|
||||
_class_constructor(Eo_Class *klass)
|
||||
{
|
||||
|
@ -2828,6 +3085,8 @@ _class_constructor(Eo_Class *klass)
|
|||
EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_SUB_OBJECT_DEL), _elm_list_smart_sub_object_del),
|
||||
EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_DIRECTION_MANAGER_IS), _elm_list_smart_focus_direction_manager_is),
|
||||
EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_ACCESS), _elm_list_smart_access),
|
||||
EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_HIGHLIGHT_GEOMETRY_GET), _elm_list_focus_highlight_geometry_get),
|
||||
EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUSED_ITEM_GET), _elm_list_focused_item_get),
|
||||
|
||||
EO_OP_FUNC(ELM_OBJ_LAYOUT_ID(ELM_OBJ_LAYOUT_SUB_ID_SIZING_EVAL), _elm_list_smart_sizing_eval),
|
||||
|
||||
|
|
|
@ -1720,6 +1720,13 @@ elm_object_orientation_mode_disabled_get(const Evas_Object *obj)
|
|||
return elm_widget_orientation_mode_disabled_get(obj);
|
||||
}
|
||||
|
||||
EAPI Elm_Object_Item *
|
||||
elm_object_focused_item_get(const Evas_Object *obj)
|
||||
{
|
||||
EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
|
||||
return elm_widget_focused_item_get(obj);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_object_item_access_info_set(Elm_Object_Item *it, const char *txt)
|
||||
{
|
||||
|
@ -1934,3 +1941,15 @@ elm_object_item_track_get(const Elm_Object_Item *it)
|
|||
{
|
||||
return elm_widget_item_track_get((Elm_Widget_Item *)it);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_object_item_focus_set(Elm_Object_Item *item, Eina_Bool focused)
|
||||
{
|
||||
elm_widget_item_focus_set(item, focused);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_object_item_focus_get(const Elm_Object_Item *item)
|
||||
{
|
||||
return elm_widget_item_focus_get(item);
|
||||
}
|
||||
|
|
|
@ -83,6 +83,25 @@ _elm_scrollable_is(const Evas_Object *obj)
|
|||
eo_isa(obj, ELM_SCROLLABLE_INTERFACE);
|
||||
}
|
||||
|
||||
void
|
||||
_elm_widget_focus_highlight_start(const Evas_Object *obj)
|
||||
{
|
||||
Evas_Object *top = elm_widget_top_get(obj);
|
||||
|
||||
if (top && eo_isa(top, ELM_OBJ_WIN_CLASS))
|
||||
_elm_win_focus_highlight_start(top);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
elm_widget_focus_highlight_enabled_get(const Evas_Object *obj)
|
||||
{
|
||||
const Evas_Object *win = elm_widget_top_get(obj);
|
||||
|
||||
if (win && eo_isa(win, ELM_OBJ_WIN_CLASS))
|
||||
return elm_win_focus_highlight_enabled_get(win);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
|
@ -4861,10 +4880,44 @@ _elm_widget_newest_focus_order_get(Eo *obj, void *_pd, va_list *list)
|
|||
}
|
||||
|
||||
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_focus_highlight_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h, Eina_Bool is_next)
|
||||
{
|
||||
ELM_WIDGET_CHECK(obj);
|
||||
eo_do(obj, elm_wdg_focus_highlight_geometry_get(x, y, w, h));
|
||||
eo_do(obj, elm_wdg_focus_highlight_geometry_get(x, y, w, h, &is_next));
|
||||
}
|
||||
|
||||
EAPI void
|
||||
elm_widget_focus_highlight_focus_part_geometry_get(const Evas_Object *obj,
|
||||
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;
|
||||
const Evas_Object *edje_obj = NULL;
|
||||
|
||||
if (obj && eo_isa(obj, EDJE_OBJ_CLASS))
|
||||
{
|
||||
edje_obj = obj;
|
||||
if (!(target_hl_part = edje_object_data_get(edje_obj, "focus_part")))
|
||||
return;
|
||||
}
|
||||
else if (obj && eo_isa(obj, ELM_OBJ_LAYOUT_CLASS))
|
||||
{
|
||||
edje_obj = elm_layout_edje_get(obj);
|
||||
if (!(target_hl_part = elm_layout_data_get(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
|
||||
|
@ -4874,33 +4927,31 @@ _elm_widget_focus_highlight_geometry_get(Eo *obj, void *_pd, va_list *list)
|
|||
Evas_Coord *y = va_arg(*list, Evas_Coord *);
|
||||
Evas_Coord *w = va_arg(*list, Evas_Coord *);
|
||||
Evas_Coord *h = va_arg(*list, Evas_Coord *);
|
||||
Eina_Bool *is_next = va_arg(*list, Eina_Bool *);
|
||||
(void)is_next;
|
||||
|
||||
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;
|
||||
elm_widget_focus_highlight_focus_part_geometry_get(sd->resize_obj, x, y, w, h);
|
||||
}
|
||||
|
||||
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 Elm_Object_Item *
|
||||
elm_widget_focused_item_get(const Evas_Object *obj)
|
||||
{
|
||||
ELM_WIDGET_CHECK(obj) NULL;
|
||||
Elm_Object_Item *ret = NULL;
|
||||
eo_do(obj, elm_wdg_focused_item_get(&ret));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_widget_focused_item_get(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
|
||||
{
|
||||
Elm_Object_Item **ret = va_arg(*list, Elm_Object_Item **);
|
||||
|
||||
if (ret) *ret = NULL;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -5297,6 +5348,42 @@ _elm_widget_item_style_get_hook_set(Elm_Widget_Item *item,
|
|||
ELM_WIDGET_ITEM_RETURN_IF_ONDEL(item);
|
||||
item->style_get_func = func;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* Set the function to set the focus on widget item.
|
||||
*
|
||||
* @param item a valid #Elm_Widget_Item to be notified
|
||||
* @see elm_widget_item_focus_set_hook_set() convenience macro.
|
||||
* @ingroup Widget
|
||||
*/
|
||||
EAPI void
|
||||
_elm_widget_item_focus_set_hook_set(Elm_Widget_Item *item, Elm_Widget_Focus_Set_Cb func)
|
||||
{
|
||||
ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
|
||||
ELM_WIDGET_ITEM_RETURN_IF_ONDEL(item);
|
||||
item->focus_set_func = func;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* Set the function to set the focus on widget item.
|
||||
*
|
||||
* @param item a valid #Elm_Widget_Item to be notified
|
||||
* @see elm_widget_item_focus_get_hook_set() convenience macro.
|
||||
* @ingroup Widget
|
||||
*/
|
||||
EAPI void
|
||||
_elm_widget_item_focus_get_hook_set(Elm_Widget_Item *item,
|
||||
Elm_Widget_Focus_Get_Cb func)
|
||||
{
|
||||
ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
|
||||
ELM_WIDGET_ITEM_RETURN_IF_ONDEL(item);
|
||||
item->focus_get_func = func;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
|
@ -5454,6 +5541,20 @@ _elm_widget_item_disable_hook_set(Elm_Widget_Item *item,
|
|||
item->disable_func = func;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
_elm_widget_item_focus_set(Elm_Widget_Item *item, Eina_Bool focused)
|
||||
{
|
||||
ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
|
||||
item->focus_set_func(item, focused);
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
_elm_widget_item_focus_get(const Elm_Widget_Item *item)
|
||||
{
|
||||
ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, EINA_FALSE);
|
||||
return item->focus_get_func(item);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
_elm_widget_item_domain_translatable_part_text_set(Elm_Widget_Item *item,
|
||||
const char *part,
|
||||
|
@ -6658,6 +6759,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(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUSED_ITEM_GET), _elm_widget_focused_item_get),
|
||||
|
||||
EO_OP_FUNC_SENTINEL
|
||||
};
|
||||
|
@ -6811,6 +6913,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(ELM_WIDGET_SUB_ID_FOCUSED_ITEM_GET, "Get the focused widget item."),
|
||||
|
||||
EO_OP_DESCRIPTION_SENTINEL
|
||||
};
|
||||
|
|
|
@ -467,6 +467,8 @@ typedef Eina_Bool (*Elm_Widget_Del_Pre_Cb)(void *data);
|
|||
typedef void (*Elm_Widget_Item_Signal_Cb)(void *data, Elm_Widget_Item *item, const char *emission, const char *source);
|
||||
typedef void (*Elm_Widget_Style_Set_Cb)(void *data, const char *style);
|
||||
typedef const char *(*Elm_Widget_Style_Get_Cb)(const void *data);
|
||||
typedef void (*Elm_Widget_Focus_Set_Cb)(void *data, Eina_Bool focused);
|
||||
typedef Eina_Bool (*Elm_Widget_Focus_Get_Cb)(const void *data);
|
||||
|
||||
#define ELM_ACCESS_DONE -1 /* sentence done - send done event here */
|
||||
#define ELM_ACCESS_CANCEL -2 /* stop reading immediately */
|
||||
|
@ -510,6 +512,8 @@ Eina_Bool _elm_access_auto_highlight_get(void);
|
|||
void _elm_access_widget_item_access_order_set(Elm_Widget_Item *item, Eina_List *objs);
|
||||
const Eina_List *_elm_access_widget_item_access_order_get(const Elm_Widget_Item *item);
|
||||
void _elm_access_widget_item_access_order_unset(Elm_Widget_Item *item);
|
||||
void _elm_widget_focus_highlight_start(const Evas_Object *obj);
|
||||
void _elm_win_focus_highlight_start(Evas_Object *obj);
|
||||
|
||||
EAPI void _elm_access_clear(Elm_Access_Info *ac);
|
||||
EAPI void _elm_access_text_set(Elm_Access_Info *ac, int type, const char *text);
|
||||
|
@ -578,6 +582,8 @@ struct _Elm_Widget_Item
|
|||
Elm_Widget_Disable_Cb disable_func;
|
||||
Elm_Widget_Style_Set_Cb style_set_func;
|
||||
Elm_Widget_Style_Get_Cb style_get_func;
|
||||
Elm_Widget_Focus_Set_Cb focus_set_func;
|
||||
Elm_Widget_Focus_Get_Cb focus_get_func;
|
||||
Evas_Object *access_obj;
|
||||
const char *access_info;
|
||||
Eina_List *access_order;
|
||||
|
@ -589,6 +595,7 @@ struct _Elm_Widget_Item
|
|||
Eina_Bool disabled : 1;
|
||||
Eina_Bool on_deletion : 1;
|
||||
Eina_Bool on_translate : 1;
|
||||
Eina_Bool focused : 1;
|
||||
};
|
||||
|
||||
struct _Elm_Object_Item
|
||||
|
@ -659,6 +666,8 @@ EAPI void elm_widget_parent2_set(Evas_Object *obj, Evas_Object *pare
|
|||
EAPI void elm_widget_focus_steal(Evas_Object *obj);
|
||||
EAPI Evas_Object *elm_widget_newest_focus_order_get(const Evas_Object *obj, unsigned int *newest_focus_order, Eina_Bool can_focus_only);
|
||||
EAPI void elm_widget_display_mode_set(Evas_Object *obj, Evas_Display_Mode dispmode);
|
||||
EAPI Eina_Bool elm_widget_focus_highlight_enabled_get(const Evas_Object *obj);
|
||||
EAPI void elm_widget_focus_highlight_focus_part_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h);
|
||||
EAPI const Elm_Widget_Smart_Class *elm_widget_smart_class_get(void);
|
||||
|
||||
/**
|
||||
|
@ -734,9 +743,10 @@ EAPI Evas_Object *elm_widget_content_part_unset(Evas_Object *obj, const char
|
|||
EAPI void elm_widget_access_info_set(Evas_Object *obj, const char *txt);
|
||||
EAPI const char *elm_widget_access_info_get(const Evas_Object *obj);
|
||||
EAPI void elm_widget_orientation_set(Evas_Object *obj, int rotation);
|
||||
EAPI Elm_Object_Item *elm_widget_focused_item_get(const Evas_Object *obj);
|
||||
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 void elm_widget_focus_highlight_geometry_get(const Evas_Object *obj, Evas_Coord *x, Evas_Coord *y, Evas_Coord *w, Evas_Coord *h, Eina_Bool is_next);
|
||||
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);
|
||||
|
@ -768,7 +778,8 @@ EAPI const char *_elm_widget_item_part_text_get(const Elm_Widget_Item *item
|
|||
EAPI void _elm_widget_item_part_text_custom_set(Elm_Widget_Item *item, const char *part, const char *label);
|
||||
EAPI const char *_elm_widget_item_part_text_custom_get(Elm_Widget_Item *item, const char *part);
|
||||
EAPI void _elm_widget_item_part_text_custom_update(Elm_Widget_Item *item);
|
||||
|
||||
EAPI void _elm_widget_item_focus_set(Elm_Widget_Item *item, Eina_Bool focused);
|
||||
EAPI Eina_Bool _elm_widget_item_focus_get(const Elm_Widget_Item *item);
|
||||
EAPI void _elm_widget_item_style_set(Elm_Widget_Item *item, const char *style);
|
||||
EAPI const char *_elm_widget_item_style_get(Elm_Widget_Item *item);
|
||||
|
||||
|
@ -788,6 +799,8 @@ EAPI void _elm_widget_item_disable_hook_set(Elm_Widget_Item *item, E
|
|||
EAPI void _elm_widget_item_del_pre_hook_set(Elm_Widget_Item *item, Elm_Widget_Del_Pre_Cb func);
|
||||
EAPI void _elm_widget_item_style_set_hook_set(Elm_Widget_Item *item, Elm_Widget_Style_Set_Cb func);
|
||||
EAPI void _elm_widget_item_style_get_hook_set(Elm_Widget_Item *item, Elm_Widget_Style_Get_Cb func);
|
||||
EAPI void _elm_widget_item_focus_get_hook_set(Elm_Widget_Item *item, Elm_Widget_Focus_Get_Cb func);
|
||||
EAPI void _elm_widget_item_focus_set_hook_set(Elm_Widget_Item *item, Elm_Widget_Focus_Set_Cb func);
|
||||
EAPI void _elm_widget_item_domain_translatable_part_text_set(Elm_Widget_Item *item, const char *part, const char *domain, const char *label);
|
||||
EAPI const char * _elm_widget_item_translatable_part_text_get(const Elm_Widget_Item *item, const char *part);
|
||||
EAPI void _elm_widget_item_translate(Elm_Widget_Item *item);
|
||||
|
@ -1042,6 +1055,21 @@ EAPI void elm_widget_tree_dot_dump(const Evas_Object *top, FILE *out
|
|||
*/
|
||||
#define elm_widget_item_style_get(item) \
|
||||
_elm_widget_item_style_get((Elm_Widget_Item *)item)
|
||||
|
||||
/**
|
||||
* Convenience function to query focus set hook.
|
||||
* @see _elm_widget_item_focus_set_hook_set()
|
||||
*/
|
||||
#define elm_widget_item_focus_set_hook_set(item, func) \
|
||||
_elm_widget_item_focus_set_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Focus_Set_Cb)func)
|
||||
|
||||
/**
|
||||
* Convenience function to query focus get hook.
|
||||
* @see _elm_widget_item_focus_get_hook_set()
|
||||
*/
|
||||
#define elm_widget_item_focus_get_hook_set(item, func) \
|
||||
_elm_widget_item_focus_get_hook_set((Elm_Widget_Item *)item, (Elm_Widget_Focus_Get_Cb)func)
|
||||
|
||||
/**
|
||||
* Convenience function to query track_cancel.
|
||||
* @see _elm_widget_item_del_pre_hook_set()
|
||||
|
@ -1077,6 +1105,20 @@ EAPI void elm_widget_tree_dot_dump(const Evas_Object *top, FILE *out
|
|||
#define elm_widget_item_part_text_custom_update(item) \
|
||||
_elm_widget_item_part_text_custom_update((Elm_Widget_Item *)item)
|
||||
|
||||
/**
|
||||
* Convenience function to set the focus on widget item.
|
||||
* @see _elm_widget_item_focus_set()
|
||||
*/
|
||||
#define elm_widget_item_focus_set(item, focused) \
|
||||
_elm_widget_item_focus_set((Elm_Widget_Item *)item, focused)
|
||||
|
||||
/**
|
||||
* Convenience function to query focus set hook.
|
||||
* @see _elm_widget_item_focus_get()
|
||||
*/
|
||||
#define elm_widget_item_focus_get(item) \
|
||||
_elm_widget_item_focus_get((const Elm_Widget_Item *)item)
|
||||
|
||||
#define ELM_WIDGET_CHECK_OR_RETURN(obj, ...) \
|
||||
do { \
|
||||
if (!obj || !evas_object_smart_data_get(obj)) \
|
||||
|
@ -1275,6 +1317,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,
|
||||
ELM_WIDGET_SUB_ID_FOCUSED_ITEM_GET,
|
||||
#if 0
|
||||
ELM_WIDGET_SUB_ID_THEME_APPLY, /* API + virtual*/
|
||||
ELM_WIDGET_SUB_ID_THEME_SPECIFIC,
|
||||
|
@ -2681,9 +2724,19 @@ typedef void * (*list_data_get_func_type)(const Eina_List * l);
|
|||
* @param[in] x
|
||||
* @param[in] y
|
||||
* @param[in] w
|
||||
* @param[in] z
|
||||
* @param[in] h
|
||||
* @param[in] is_next
|
||||
*
|
||||
*/
|
||||
#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)
|
||||
|
||||
#define elm_wdg_focus_highlight_geometry_get(x, y, w, h, is_next) 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), EO_TYPECHECK(Eina_Bool *, is_next)
|
||||
/**
|
||||
* @def elm_wdg_focused_item_get
|
||||
* @since 1.10
|
||||
*
|
||||
* Get the focused widget item.
|
||||
*
|
||||
* @param[out] ret
|
||||
*
|
||||
*/
|
||||
#define elm_wdg_focused_item_get(ret) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUSED_ITEM_GET), EO_TYPECHECK(Elm_Object_Item **, ret)
|
||||
#endif
|
||||
|
|
|
@ -27,6 +27,9 @@ struct _Elm_List_Smart_Data
|
|||
|
||||
Eina_List *items, *selected, *to_delete;
|
||||
Elm_Object_Item *last_selected_item;
|
||||
Elm_Object_Item *focused_item; /**< a focused item by keypad arrow or mouse. This is set to NULL if widget looses focus. */
|
||||
Elm_Object_Item *prev_focused_item; /**< a previous focused item by keypad arrow or mouse. */
|
||||
Elm_Object_Item *last_focused_item; /**< This records the last focused item when widget looses focus. This is required to set the focus on last focused item when widgets gets focus. */
|
||||
Evas_Coord minw[2], minh[2];
|
||||
Elm_Object_Select_Mode select_mode;
|
||||
Elm_Object_Multi_Select_Mode multi_select_mode; /**< select mode for multiple selection */
|
||||
|
@ -57,8 +60,6 @@ struct _Elm_List_Item
|
|||
{
|
||||
ELM_WIDGET_ITEM;
|
||||
|
||||
Elm_List_Smart_Data *sd;
|
||||
|
||||
Ecore_Timer *swipe_timer;
|
||||
Ecore_Timer *long_timer;
|
||||
Evas_Object *icon, *end;
|
||||
|
|
|
@ -711,8 +711,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_widget_focus_highlight_geometry_get(target, &tx, &ty, &tw, &th);
|
||||
elm_widget_focus_highlight_geometry_get(previous, &px, &py, &pw, &ph);
|
||||
elm_widget_focus_highlight_geometry_get(target, &tx, &ty, &tw, &th, EINA_TRUE);
|
||||
elm_widget_focus_highlight_geometry_get(previous, &px, &py, &pw, &ph, EINA_FALSE);
|
||||
evas_object_move(obj, tx, ty);
|
||||
evas_object_resize(obj, tw, th);
|
||||
evas_object_clip_unset(obj);
|
||||
|
@ -738,7 +738,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_widget_focus_highlight_geometry_get(target, &x, &y, &w, &h);
|
||||
elm_widget_focus_highlight_geometry_get(target, &x, &y, &w, &h, EINA_TRUE);
|
||||
|
||||
evas_object_move(obj, x, y);
|
||||
evas_object_resize(obj, w, h);
|
||||
|
@ -5823,6 +5823,18 @@ _window_id_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
|
|||
*ret = 0;
|
||||
}
|
||||
|
||||
void
|
||||
_elm_win_focus_highlight_start(Evas_Object *obj)
|
||||
{
|
||||
ELM_WIN_DATA_GET(obj, sd);
|
||||
|
||||
if (!elm_win_focus_highlight_enabled_get(obj)) return;
|
||||
sd->focus_highlight.cur.visible = EINA_TRUE;
|
||||
sd->focus_highlight.cur.in_theme = EINA_FALSE;
|
||||
sd->focus_highlight.geometry_changed = EINA_TRUE;
|
||||
_elm_win_focus_highlight_reconfigure(sd);
|
||||
}
|
||||
|
||||
EAPI Ecore_Window
|
||||
elm_win_window_id_get(const Evas_Object *obj)
|
||||
{
|
||||
|
@ -5963,7 +5975,6 @@ _class_constructor(Eo_Class *klass)
|
|||
EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WM_MANUAL_ROTATION_DONE_SET), _wm_manual_rotation_done_set),
|
||||
EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WM_MANUAL_ROTATION_DONE_GET), _wm_manual_rotation_done_get),
|
||||
EO_OP_FUNC(ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WM_MANUAL_ROTATION_DONE), _wm_manual_rotation_done),
|
||||
|
||||
EO_OP_FUNC_SENTINEL
|
||||
};
|
||||
|
||||
|
|
|
@ -1372,3 +1372,7 @@ enum
|
|||
* @see elm_win_wm_rotation_manual_rotation_done
|
||||
*/
|
||||
#define elm_obj_win_wm_manual_rotation_done() ELM_OBJ_WIN_ID(ELM_OBJ_WIN_SUB_ID_WM_MANUAL_ROTATION_DONE)
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue