static void _on_move(void *data EINA_UNUSED, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED);
static void _item_sizing_eval(Elm_Ctxpopup_Item_Data *item);
static Eina_Bool _key_action_escape(Evas_Object *obj, const char *params EINA_UNUSED);
+//TIZEN ONLY(20161014) : Accessibility: scroll the content when highlight frame goes out of view port
+static void _content_move_down_cb(void *data, Evas_Object *obj, void *ev EINA_UNUSED);
+static void _content_move_up_cb(void *data, Evas_Object *obj, void *ev EINA_UNUSED);
+//
EOLIAN static Eina_Bool
_elm_ctxpopup_elm_widget_translate(Eo *obj, Elm_Ctxpopup_Data *sd)
elm_scroller_policy_set(sd->scr, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
edje_object_part_swallow(wd->resize_obj, "elm.swallow.content", sd->scr);
-
+ //TIZEN ONLY(20161014) : Accessibility: scroll the content when highlight frame goes out of view port
+ evas_object_smart_callback_add(sd->scr, "scroll,down", _content_move_down_cb, (void*)obj);
+ evas_object_smart_callback_add(sd->scr, "scroll,up", _content_move_up_cb, (void*)obj);
+ //
elm_object_content_set(sd->scr, sd->box);
elm_ctxpopup_horizontal_set(obj, sd->horizontal);
}
return &atspi_actions[0];
}
+//TIZEN ONLY(20161014) : Accessibility: scroll the content when highlight frame goes out of view port
+static int
+_is_item_in_viewport(int viewport_y, int viewport_h, int obj_y, int obj_h)
+{
+ if ((obj_y + obj_h/2) < viewport_y)
+ return 1;
+ else if ((obj_y + obj_h/2) > viewport_y + viewport_h)
+ return -1;
+ return 0;
+}
+
+EOLIAN static Eina_Bool
+_elm_ctxpopup_item_elm_interface_atspi_component_highlight_grab(Eo *eo_it, Elm_Ctxpopup_Item_Data *it)
+{
+ Evas_Coord wy, wh, x, y, w, h, bx, by;
+ ELM_CTXPOPUP_DATA_GET_OR_RETURN_VAL(WIDGET(it), sd, EINA_FALSE);
+ Eina_Bool ret;
+
+ evas_object_geometry_get(VIEW(it), &x, &y, &w, &h);
+ eo_do(sd->scr, elm_interface_scrollable_content_viewport_geometry_get(NULL, &wy, NULL, &wh));
+ int res = _is_item_in_viewport(wy, wh, y, h);
+
+ if (res != 0)
+ {
+ evas_object_geometry_get(sd->box, &bx, &by, NULL, NULL);
+ evas_smart_objects_calculate(evas_object_evas_get(sd->box));
+ x -= bx;
+ y -= by;
+ if (res > 0)
+ {
+ y -= wh - h;
+ eo_do(sd->scr, elm_interface_scrollable_content_region_show(x, y, w, h));
+ }
+ else if (res < 0)
+ {
+ y += wh - h;
+ eo_do(sd->scr, elm_interface_scrollable_content_region_show(x, y, w, h));
+ }
+ }
+
+ elm_interface_atspi_accessible_state_changed_signal_emit(eo_it, ELM_ATSPI_STATE_HIGHLIGHTED, EINA_TRUE);
+ eo_do_super(eo_it, ELM_CTXPOPUP_ITEM_CLASS, ret = elm_interface_atspi_component_highlight_grab());
+ return ret;
+}
+
+EOLIAN static Eina_Bool
+_elm_ctxpopup_item_elm_interface_atspi_component_highlight_clear(Eo *eo_it, Elm_Ctxpopup_Item_Data *it)
+{
+ elm_object_accessibility_highlight_set(VIEW(it), EINA_FALSE);
+ elm_interface_atspi_accessible_state_changed_signal_emit(eo_it, ELM_ATSPI_STATE_HIGHLIGHTED, EINA_FALSE);
+
+ return EINA_TRUE;
+}
+
+static void
+_content_move_down_cb(void *data, Evas_Object *obj, void *ev EINA_UNUSED)
+{
+ if (!_elm_atspi_enabled())
+ return ;
+ ELM_CTXPOPUP_DATA_GET(data, pd);
+ Elm_Ctxpopup_Item_Data *it_data;
+ Evas_Object * highlighted_obj = _elm_object_accessibility_currently_highlighted_get();
+ Evas_Object * parent = highlighted_obj;
+
+ if (eo_isa(highlighted_obj, ELM_WIDGET_CLASS))
+ {
+ while ((parent = elm_widget_parent_get(parent)))
+ if (parent == obj)
+ break;
+ }
+ else if (eo_isa(highlighted_obj, EDJE_OBJECT_CLASS))
+ {
+ while ((parent = evas_object_smart_parent_get(parent)))
+ if (parent == obj)
+ break;
+ }
+ // TIZEN_ONLY(20160805): set _accessibility_currently_highlighted_obj to NULL in object delete callback
+ else
+ {
+ WRN("Improper highlighted object: %p", highlighted_obj);
+ return;
+ }
+ //
+
+ if (parent)
+ {
+ int obj_x, obj_y, w, h, hx, hy, hw, hh;
+ eo_do(pd->scr, elm_interface_scrollable_content_viewport_geometry_get(&obj_x, &obj_y, &w, &h));
+ evas_object_geometry_get(highlighted_obj, &hx, &hy, &hw, &hh);
+
+ Elm_Ctxpopup_Item_Data *next_previous_item = NULL;
+ int viewport_position_result = _is_item_in_viewport(obj_y, h, hy, hh);
+ if (viewport_position_result > 0)
+ {
+ Eina_List *l = pd->items;
+ while(l)
+ {
+ it_data = eina_list_data_get(l);
+ next_previous_item = it_data;
+ evas_object_geometry_get(VIEW(next_previous_item), &hx, &hy, &hw, &hh);
+
+ if (_is_item_in_viewport(obj_y, h, hy, hh) == 0)
+ break;
+ next_previous_item = NULL;
+
+ l = eina_list_next(l);
+ }
+ }
+ if (next_previous_item)
+ eo_do(EO_OBJ(next_previous_item), elm_interface_atspi_component_highlight_grab());
+ }
+
+}
+
+static void
+_content_move_up_cb(void *data, Evas_Object *obj, void *ev EINA_UNUSED)
+{
+ if (!_elm_atspi_enabled())
+ return ;
+ ELM_CTXPOPUP_DATA_GET(data, pd);
+ Elm_Ctxpopup_Item_Data *it_data;
+ Evas_Object * highlighted_obj = _elm_object_accessibility_currently_highlighted_get();
+ Evas_Object * parent = highlighted_obj;
+
+ if (eo_isa(highlighted_obj, ELM_WIDGET_CLASS))
+ {
+ while ((parent = elm_widget_parent_get(parent)))
+ if (parent == obj)
+ break;
+ }
+ else if (eo_isa(highlighted_obj, EDJE_OBJECT_CLASS))
+ {
+ while ((parent = evas_object_smart_parent_get(parent)))
+ if (parent == obj)
+ break;
+ }
+ // TIZEN_ONLY(20160805): set _accessibility_currently_highlighted_obj to NULL in object delete callback
+ else
+ {
+ WRN("Improper highlighted object: %p", highlighted_obj);
+ return;
+ }
+ //
+
+ if (parent)
+ {
+ int obj_x, obj_y, w, h, hx, hy, hw, hh;
+ eo_do(pd->scr, elm_interface_scrollable_content_viewport_geometry_get(&obj_x, &obj_y, &w, &h));
+ evas_object_geometry_get(highlighted_obj, &hx, &hy, &hw, &hh);
+
+ Elm_Ctxpopup_Item_Data *next_previous_item = NULL;
+ int viewport_position_result = _is_item_in_viewport(obj_y, h, hy, hh);
+ if (viewport_position_result < 0)
+ {
+ Eina_List *l = eina_list_last(pd->items);
+ while(l)
+ {
+ it_data = eina_list_data_get(l);
+ next_previous_item = it_data;
+ evas_object_geometry_get(VIEW(next_previous_item), &hx, &hy, &hw, &hh);
+
+ if (_is_item_in_viewport(obj_y, h, hy, hh) == 0)
+ break;
+ next_previous_item = NULL;
+
+ l = eina_list_prev(l);
+ }
+ }
+ if (next_previous_item)
+ eo_do(EO_OBJ(next_previous_item), elm_interface_atspi_component_highlight_grab());
+ }
+
+}
+//
#include "elm_ctxpopup_item.eo.c"
#include "elm_ctxpopup.eo.c"