summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWoochan Lee <wc0917.lee@samsung.com>2016-10-27 11:44:44 +0200
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2016-10-27 13:27:25 +0200
commit986264c55670da521ee960bea7adb7cfddf686cc (patch)
tree1e3bef7ea2c419ae6de02232997791644cb3e4c5
parent48fb9e72df77b11c76256eb640e55f6ed07679c6 (diff)
downloadefl-986264c55670da521ee960bea7adb7cfddf686cc.tar.gz
elm_multibuttonentry: Apply focus UI feature for the item.
Summary: It was not implemented. Add focus_direct to give the internal box for focus UI feature. - Item will be deleted when got a focus highlighted then user press delete button. - Focus UI will not work if MBE shrunk. @feature Test Plan: Run elementary_test. multibuttonentry sample. Reviewers: woohyun, Hermet, bu5hm4n Subscribers: bu5hm4n, cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4360
-rw-r--r--src/lib/elementary/elc_multibuttonentry.c43
-rw-r--r--src/lib/elementary/elm_multibuttonentry.eo1
2 files changed, 41 insertions, 3 deletions
diff --git a/src/lib/elementary/elc_multibuttonentry.c b/src/lib/elementary/elc_multibuttonentry.c
index 472b71e3a6..45773ab553 100644
--- a/src/lib/elementary/elc_multibuttonentry.c
+++ b/src/lib/elementary/elc_multibuttonentry.c
@@ -45,6 +45,9 @@ static const Evas_Smart_Cb_Description _smart_callbacks[] = {
{NULL, NULL}
};
+static Eina_Bool _elm_multibuttonentry_smart_focus_next_enable = EINA_FALSE;
+static Eina_Bool _elm_multibuttonentry_smart_focus_direction_enable = EINA_TRUE;
+
static void _entry_changed_cb(void *data, const Efl_Event *event);
static void _entry_focus_in_cb(void *data, const Efl_Event *event);
static void _entry_focus_out_cb(void *data, const Efl_Event *event);
@@ -301,6 +304,11 @@ _shrink_mode_set(Evas_Object *obj,
(obj, ELM_MULTIBUTTONENTRY_EVENT_EXPAND_STATE_CHANGED, (void *)(uintptr_t)sd->shrink);
}
+ if (sd->view_state == MULTIBUTTONENTRY_VIEW_SHRINK)
+ _elm_multibuttonentry_smart_focus_direction_enable = EINA_FALSE;
+ else
+ _elm_multibuttonentry_smart_focus_direction_enable = EINA_TRUE;
+
if (sd->view_state != MULTIBUTTONENTRY_VIEW_SHRINK)
_visual_guide_text_set(obj);
}
@@ -538,13 +546,27 @@ _on_item_deleted(void *data,
}
static void
+_on_item_focused(void *data,
+ Evas_Object *obj EINA_UNUSED,
+ void *event_info EINA_UNUSED)
+{
+ Elm_Multibuttonentry_Item_Data *it = data;
+ ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(WIDGET(it), sd);
+
+ if (!it) return;
+ sd->selected_it = it;
+}
+
+static void
_on_item_unfocused(void *data,
Evas_Object *obj EINA_UNUSED,
void *event_info EINA_UNUSED)
{
Elm_Multibuttonentry_Item_Data *it = data;
+ ELM_MULTIBUTTONENTRY_DATA_GET_OR_RETURN(WIDGET(it), sd);
if (!it) return;
+ sd->selected_it = NULL;
elm_layout_signal_emit(VIEW(it), "elm,state,unfocused", "elm");
}
@@ -768,6 +790,8 @@ _item_new(Elm_Multibuttonentry_Data *sd,
elm_layout_signal_callback_add
(VIEW(item), "elm,deleted", "elm", _on_item_deleted, EO_OBJ(item));
evas_object_smart_callback_add
+ (VIEW(item), "focused", _on_item_focused, item);
+ evas_object_smart_callback_add
(VIEW(item), "unfocused", _on_item_unfocused, item);
evas_object_event_callback_add
(VIEW(item),
@@ -1602,12 +1626,25 @@ _elm_multibuttonentry_efl_canvas_group_group_del(Eo *obj, Elm_Multibuttonentry_D
efl_canvas_group_del(efl_super(obj, MY_CLASS));
}
-static Eina_Bool _elm_multibuttonentry_smart_focus_next_enable = EINA_FALSE;
-
EOLIAN static Eina_Bool
_elm_multibuttonentry_elm_widget_focus_direction_manager_is(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd EINA_UNUSED)
{
- return EINA_FALSE;
+ return _elm_multibuttonentry_smart_focus_direction_enable;
+}
+
+EOLIAN static Eina_Bool
+_elm_multibuttonentry_elm_widget_focus_direction(Eo *obj EINA_UNUSED, Elm_Multibuttonentry_Data *sd, const Evas_Object *base, double degree, Evas_Object **direction, Elm_Object_Item **direction_item, double *weight)
+{
+ Eina_Bool ret;
+ Eina_List *items = NULL;
+
+ items = eina_list_append(items, sd->box);
+
+ ret = elm_widget_focus_list_direction_get
+ (obj, base, items, eina_list_data_get, degree, direction, direction_item, weight);
+ eina_list_free(items);
+
+ return ret;
}
EOLIAN static Eina_Bool
diff --git a/src/lib/elementary/elm_multibuttonentry.eo b/src/lib/elementary/elm_multibuttonentry.eo
index d99662b313..61492e9612 100644
--- a/src/lib/elementary/elm_multibuttonentry.eo
+++ b/src/lib/elementary/elm_multibuttonentry.eo
@@ -182,6 +182,7 @@ class Elm.Multibuttonentry (Elm.Layout)
Elm.Widget.focus_next_manager_is;
Elm.Widget.focus_direction_manager_is;
Elm.Widget.access;
+ Elm.Widget.focus_direction;
Elm.Widget.focus_next;
Elm.Widget.on_focus;
Elm.Widget.translate;