forked from enlightenment/efl
List: Focus highlight when loop is enable
Summary: Implemented focus highlight feature in list for vertical and horizontal looping @feature Test Plan: elementary_test->"List Focus" & "List Focus Horizontal" Reviewers: singh.amitesh, nirajkr, seoz, eagleeye, raster Subscribers: sachin.dev Differential Revision: https://phab.enlightenment.org/D1216 Conflicts: src/lib/elm_list.c
This commit is contained in:
parent
e8084e322c
commit
efe737b3b8
|
@ -73,6 +73,16 @@ group { name: "elm/focus_highlight/top/default";
|
|||
rel1.relative: 0 -1;
|
||||
rel2.relative: 1 0;
|
||||
}
|
||||
description { state: "move_left" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
rel1.relative: -1 0;
|
||||
rel2.relative: 0 1;
|
||||
}
|
||||
description { state: "move_right" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
rel1.relative: 1 0;
|
||||
rel2.relative: 2 1;
|
||||
}
|
||||
}
|
||||
part { name: "clip"; type: RECT;
|
||||
scale: 1;
|
||||
|
@ -84,11 +94,19 @@ group { name: "elm/focus_highlight/top/default";
|
|||
}
|
||||
description { state: "move_down" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
color: 0 0 0 0;
|
||||
color: 255 255 255 0;
|
||||
}
|
||||
description { state: "move_up" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
color: 0 0 0 0 ;
|
||||
color: 255 255 255 0 ;
|
||||
}
|
||||
description { state: "move_left" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
color: 255 255 255 0;
|
||||
}
|
||||
description { state: "move_right" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
color: 255 255 255 0 ;
|
||||
}
|
||||
description { state: "visible" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
|
@ -230,5 +248,57 @@ group { name: "elm/focus_highlight/top/default";
|
|||
target: "base";
|
||||
target: "clip";
|
||||
}
|
||||
program { name: "move_left";
|
||||
signal: "elm,action,focus,move,left";
|
||||
source: "elm";
|
||||
transition: LIN 0.3;
|
||||
action: STATE_SET "move_left" 0.0;
|
||||
target: "base";
|
||||
target: "clip";
|
||||
after: "move_left_end";
|
||||
}
|
||||
program { name: "move_left_end";
|
||||
action: SIGNAL_EMIT "elm,focus,move,left,end" "elm";
|
||||
}
|
||||
program { name: "move_right";
|
||||
signal: "elm,action,focus,move,right";
|
||||
source: "elm";
|
||||
transition: LIN 0.3;
|
||||
action: STATE_SET "move_right" 0.0;
|
||||
target: "base";
|
||||
target: "clip";
|
||||
after: "move_right_end";
|
||||
}
|
||||
program { name: "move_right_end";
|
||||
action: SIGNAL_EMIT "elm,focus,move,right,end" "elm";
|
||||
}
|
||||
program { name: "move_home_from_right";
|
||||
signal: "elm,action,focus,move,home,right";
|
||||
source: "elm";
|
||||
action: STATE_SET "move_right" 0.0;
|
||||
target: "base";
|
||||
target: "clip";
|
||||
after: "move_home_from_right2";
|
||||
}
|
||||
program { name: "move_home_from_right2";
|
||||
action: STATE_SET "default" 0.0;
|
||||
transition: LIN 0.3;
|
||||
target: "base";
|
||||
target: "clip";
|
||||
}
|
||||
program { name: "move_home_from_left";
|
||||
signal: "elm,action,focus,move,home,left";
|
||||
source: "elm";
|
||||
action: STATE_SET "move_left" 0.0;
|
||||
target: "base";
|
||||
target: "clip";
|
||||
after: "move_home_from_left2";
|
||||
}
|
||||
program { name: "move_home_from_left2";
|
||||
action: STATE_SET "default" 0.0;
|
||||
transition: LIN 0.3;
|
||||
target: "base";
|
||||
target: "clip";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1775,15 +1775,16 @@ _elm_list_looping_left_cb(void *data,
|
|||
elm_list_item_selected_set(it, EINA_TRUE);
|
||||
else
|
||||
elm_object_item_focus_set(it, EINA_TRUE);
|
||||
_elm_widget_focus_highlight_signal_emit(list, "elm,action,focus,move,left", "elm");
|
||||
elm_layout_signal_emit(list, "elm,action,looping,left,end", "elm");
|
||||
sd->item_looping_on = EINA_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_list_looping_right_cb(void *data,
|
||||
Evas_Object *obj EINA_UNUSED,
|
||||
const char *emission EINA_UNUSED,
|
||||
const char *source EINA_UNUSED)
|
||||
Evas_Object *obj EINA_UNUSED,
|
||||
const char *emission EINA_UNUSED,
|
||||
const char *source EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *list = data;
|
||||
|
||||
|
@ -1794,15 +1795,16 @@ _elm_list_looping_right_cb(void *data,
|
|||
elm_list_item_selected_set(it, EINA_TRUE);
|
||||
else
|
||||
elm_object_item_focus_set(it, EINA_TRUE);
|
||||
_elm_widget_focus_highlight_signal_emit(list, "elm,action,focus,move,right", "elm");
|
||||
elm_layout_signal_emit(list, "elm,action,looping,right,end", "elm");
|
||||
sd->item_looping_on = EINA_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_list_looping_up_cb(void *data,
|
||||
Evas_Object *obj EINA_UNUSED,
|
||||
const char *emission EINA_UNUSED,
|
||||
const char *source EINA_UNUSED)
|
||||
Evas_Object *obj EINA_UNUSED,
|
||||
const char *emission EINA_UNUSED,
|
||||
const char *source EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *list = data;
|
||||
|
||||
|
@ -1813,6 +1815,7 @@ _elm_list_looping_up_cb(void *data,
|
|||
elm_list_item_selected_set(it, EINA_TRUE);
|
||||
else
|
||||
elm_object_item_focus_set(it, EINA_TRUE);
|
||||
_elm_widget_focus_highlight_signal_emit(list, "elm,action,focus,move,up", "elm");
|
||||
elm_layout_signal_emit(list, "elm,action,looping,up,end", "elm");
|
||||
sd->item_looping_on = EINA_FALSE;
|
||||
}
|
||||
|
@ -1832,10 +1835,82 @@ _elm_list_looping_down_cb(void *data,
|
|||
elm_list_item_selected_set(it, EINA_TRUE);
|
||||
else
|
||||
elm_object_item_focus_set(it, EINA_TRUE);
|
||||
_elm_widget_focus_highlight_signal_emit(list, "elm,action,focus,move,down", "elm");
|
||||
elm_layout_signal_emit(list, "elm,action,looping,down,end", "elm");
|
||||
sd->item_looping_on = EINA_FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_list_focus_highlight_move_down_end_cb(void *data,
|
||||
Evas_Object *obj EINA_UNUSED,
|
||||
const char *emission EINA_UNUSED,
|
||||
const char *source EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *list = data;
|
||||
Elm_List_Item *it = (Elm_List_Item *)elm_list_first_item_get(list);
|
||||
ELM_LIST_DATA_GET(list, sd);
|
||||
|
||||
if (!_elm_config->item_select_on_focus_disable)
|
||||
elm_list_item_selected_set(it, EINA_TRUE);
|
||||
else
|
||||
elm_object_item_focus_set(it, EINA_TRUE);
|
||||
elm_layout_signal_emit(list, "elm,action,looping,down,end", "elm");
|
||||
sd->item_looping_on = EINA_FALSE;
|
||||
|
||||
_elm_widget_focus_highlight_signal_emit(list, "elm,action,focus,move,home,up", "elm");
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_list_focus_highlight_move_up_end_cb(void *data,
|
||||
Evas_Object *obj EINA_UNUSED,
|
||||
const char *emission EINA_UNUSED,
|
||||
const char *source EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *li = data;
|
||||
Elm_List_Item *it = (Elm_List_Item *)elm_list_last_item_get(li);
|
||||
|
||||
if (!_elm_config->item_select_on_focus_disable)
|
||||
elm_list_item_selected_set((Elm_Object_Item *)it, EINA_TRUE);
|
||||
else
|
||||
elm_object_item_focus_set((Elm_Object_Item *)it, EINA_TRUE);
|
||||
|
||||
_elm_widget_focus_highlight_signal_emit(li, "elm,action,focus,move,home,down", "elm");
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_list_focus_highlight_move_right_end_cb(void *data,
|
||||
Evas_Object *obj EINA_UNUSED,
|
||||
const char *emission EINA_UNUSED,
|
||||
const char *source EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *li = data;
|
||||
Elm_List_Item *it = (Elm_List_Item *)elm_list_first_item_get(li);
|
||||
|
||||
if (!_elm_config->item_select_on_focus_disable)
|
||||
elm_list_item_selected_set((Elm_Object_Item *)it, EINA_TRUE);
|
||||
else
|
||||
elm_object_item_focus_set((Elm_Object_Item *)it, EINA_TRUE);
|
||||
|
||||
_elm_widget_focus_highlight_signal_emit(li, "elm,action,focus,move,home,left", "elm");
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_list_focus_highlight_move_left_end_cb(void *data,
|
||||
Evas_Object *obj EINA_UNUSED,
|
||||
const char *emission EINA_UNUSED,
|
||||
const char *source EINA_UNUSED)
|
||||
{
|
||||
Evas_Object *li = data;
|
||||
Elm_List_Item *it = (Elm_List_Item *)elm_list_last_item_get(li);
|
||||
|
||||
if (!_elm_config->item_select_on_focus_disable)
|
||||
elm_list_item_selected_set((Elm_Object_Item *)it, EINA_TRUE);
|
||||
else
|
||||
elm_object_item_focus_set((Elm_Object_Item *)it, EINA_TRUE);
|
||||
|
||||
_elm_widget_focus_highlight_signal_emit(li, "elm,action,focus,move,home,right", "elm");
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_elm_list_item_elm_widget_item_disable(Eo *eo_item EINA_UNUSED, Elm_List_Item_Data *item)
|
||||
{
|
||||
|
@ -2999,6 +3074,17 @@ _elm_list_elm_widget_focused_item_get(Eo *obj EINA_UNUSED, Elm_List_Data *sd)
|
|||
EOLIAN static void
|
||||
_elm_list_elm_widget_item_loop_enabled_set(Eo *obj EINA_UNUSED, Elm_List_Data *sd, Eina_Bool enable)
|
||||
{
|
||||
if (enable == EINA_TRUE)
|
||||
{
|
||||
_elm_widget_focus_highlight_signal_callback_add(obj, "elm,focus,move,down,end",
|
||||
"elm", _elm_list_focus_highlight_move_down_end_cb, obj);
|
||||
_elm_widget_focus_highlight_signal_callback_add(obj, "elm,focus,move,up,end",
|
||||
"elm", _elm_list_focus_highlight_move_up_end_cb, obj);
|
||||
_elm_widget_focus_highlight_signal_callback_add(obj, "elm,focus,move,left,end",
|
||||
"elm", _elm_list_focus_highlight_move_left_end_cb, obj);
|
||||
_elm_widget_focus_highlight_signal_callback_add(obj, "elm,focus,move,right,end",
|
||||
"elm", _elm_list_focus_highlight_move_right_end_cb, obj);
|
||||
}
|
||||
sd->item_loop_enable = !!enable;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue