[access] The read next/prev message does not move focus but move highlight only,...
authorShinwoo Kim <kimcinoo.efl@gmail.com>
Mon, 28 Jan 2013 11:13:18 +0000 (11:13 +0000)
committerShinwoo Kim <kimcinoo.efl@gmail.com>
Mon, 28 Jan 2013 11:13:18 +0000 (11:13 +0000)
SVN revision: 83379

legacy/elementary/ChangeLog
legacy/elementary/src/lib/elm_access.c
legacy/elementary/src/lib/elm_widget.c
legacy/elementary/src/lib/elm_widget.h

index 6562210..1a8a905 100644 (file)
 2013-01-26  Daniel Juyung Seo (SeoZ)
 
         * Add elm_index_delay_change_time_set/get for changing delay change time in index.
+
+2013-01-28  Shinwoo Kim
+
+        * [access] The read next/prev message does not move focus but move highlight only. the focus moves when the activate message is detected.
index 87e221b..468555a 100644 (file)
@@ -6,6 +6,7 @@
 #define MY_CLASS_NAME "elm_access"
 
 static Eina_Bool mouse_event_enable = EINA_TRUE;
+static Eina_Bool read_mode = EINA_FALSE;
 
 static Evas_Object * _elm_access_add(Evas_Object *parent);
 
@@ -256,6 +257,17 @@ void _elm_access_mouse_event_enabled_set(Eina_Bool enabled)
    mouse_event_enable = enabled;
 }
 
+void _elm_access_read_mode_set(Eina_Bool enabled)
+{
+   enabled = !!enabled;
+   if (read_mode == enabled) return;
+   read_mode = enabled;
+}
+
+Eina_Bool _elm_access_read_mode_get()
+{
+   return read_mode;
+}
 //-------------------------------------------------------------------------//
 EAPI void
 _elm_access_highlight_set(Evas_Object* obj)
@@ -332,6 +344,11 @@ _elm_access_highlight_object_activate(Evas_Object *obj, Elm_Activate act)
 
    if (elm_widget_is(highlight))
      {
+        _elm_access_read_mode_set(EINA_FALSE);
+
+        if (!elm_object_focus_get(highlight))
+          elm_object_focus_set(highlight, EINA_TRUE);
+
         elm_widget_activate(highlight, act);
         return;
      }
@@ -347,15 +364,7 @@ _elm_access_highlight_object_activate(Evas_Object *obj, Elm_Activate act)
 EAPI void
 _elm_access_highlight_cycle(Evas_Object *obj, Elm_Focus_Direction dir)
 {
-   Evas_Object *highlight, *focused;
-
-   highlight = _access_highlight_object_get(obj);
-   focused = elm_widget_focused_object_get(obj);
-
-   if (highlight && (highlight != focused))
-     elm_object_focus_set(highlight, EINA_TRUE);
-
-   /* use focus cycle to read next, previous object */
+   _elm_access_read_mode_set(EINA_TRUE);
    elm_widget_focus_cycle(obj, dir);
 }
 
@@ -451,6 +460,8 @@ _elm_access_object_hilight(Evas_Object *obj)
         if (ptarget)
           {
              evas_object_data_del(o, "_elm_access_target");
+             elm_widget_parent_highlight_set(ptarget, EINA_FALSE);
+
              evas_object_event_callback_del_full(ptarget, EVAS_CALLBACK_DEL,
                                                  _access_obj_hilight_del_cb, NULL);
              evas_object_event_callback_del_full(ptarget, EVAS_CALLBACK_HIDE,
@@ -462,6 +473,7 @@ _elm_access_object_hilight(Evas_Object *obj)
           }
      }
    evas_object_data_set(o, "_elm_access_target", obj);
+   elm_widget_parent_highlight_set(obj, EINA_TRUE);
 
    elm_widget_theme_object_set(obj, o, "access", "base", "default");
 
@@ -499,6 +511,7 @@ _elm_access_object_unhilight(Evas_Object *obj)
         evas_object_event_callback_del_full(ptarget, EVAS_CALLBACK_RESIZE,
                                             _access_obj_hilight_resize_cb, NULL);
         evas_object_del(o);
+        elm_widget_parent_highlight_set(ptarget, EINA_FALSE);
      }
 }
 
@@ -644,6 +657,7 @@ _elm_access_object_hilight_disable(Evas *e)
                                             _access_obj_hilight_resize_cb, NULL);
      }
    evas_object_del(o);
+   elm_widget_parent_highlight_set(ptarget, EINA_FALSE);
 }
 
 EAPI void
index 7530229..8e18a28 100644 (file)
@@ -20,6 +20,9 @@ EAPI Eo_Op ELM_WIDGET_BASE_ID = EO_NOOP;
   ELM_WIDGET_DATA_GET(obj, sd);                      \
   if (!sd) return
 
+#define ELM_WIDGET_FOCUS_GET(obj)                                    \
+  ((_elm_access_read_mode_get()) ? (elm_widget_highlight_get(obj)) : \
+                                  (elm_widget_focus_get(obj)))
 
 typedef struct _Elm_Event_Cb_Data         Elm_Event_Cb_Data;
 typedef struct _Elm_Translate_String_Data Elm_Translate_String_Data;
@@ -1557,6 +1560,23 @@ _elm_widget_focus_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
    *ret = sd->focused;
 }
 
+EAPI Eina_Bool
+elm_widget_highlight_get(const Evas_Object *obj)
+{
+   ELM_WIDGET_CHECK(obj) EINA_FALSE;
+   Eina_Bool ret = EINA_FALSE;
+   eo_do((Eo *) obj, elm_wdg_highlight_get(&ret));
+   return ret;
+}
+
+static void
+_elm_widget_highlight_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
+{
+   Eina_Bool *ret = va_arg(*list, Eina_Bool *);
+   Elm_Widget_Smart_Data *sd = _pd;
+   *ret = sd->highlighted;
+}
+
 EAPI Evas_Object *
 elm_widget_focused_object_get(const Evas_Object *obj)
 {
@@ -2017,7 +2037,12 @@ _elm_widget_focus_cycle(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
      return;
    elm_widget_focus_next_get(obj, dir, &target);
    if (target)
-     elm_widget_focus_steal(target);
+     {
+        /* access */
+        if (_elm_config->access_mode && _elm_access_read_mode_get())
+          _elm_access_highlight_set(target);
+        else elm_widget_focus_steal(target);
+     }
 }
 
 /**
@@ -2616,7 +2641,7 @@ _elm_widget_focus_next_get(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
 
    /* Return */
    *next = (Evas_Object *)obj;
-   *ret = !elm_widget_focus_get(obj);
+   *ret = !ELM_WIDGET_FOCUS_GET(obj);
 }
 
 /**
@@ -2687,12 +2712,12 @@ _elm_widget_focus_list_next_get(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
    const Eina_List *l = items;
 
    /* Recovery last focused sub item */
-   if (elm_widget_focus_get(obj))
+   if (ELM_WIDGET_FOCUS_GET(obj))
      {
         for (; l; l = list_next(l))
           {
              Evas_Object *cur = list_data_get(l);
-             if (elm_widget_focus_get(cur)) break;
+             if (ELM_WIDGET_FOCUS_GET(cur)) break;
           }
 
          /* Focused object, but no focused sub item */
@@ -2748,6 +2773,29 @@ _elm_widget_focus_list_next_get(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
 }
 
 EAPI void
+elm_widget_parent_highlight_set(Evas_Object *obj,
+                                Eina_Bool highlighted)
+{
+   ELM_WIDGET_CHECK(obj);
+   eo_do(obj, elm_wdg_parent_highlight_set(highlighted));
+}
+
+
+static void
+_elm_widget_parent_highlight_set(Eo *obj, void *_pd, va_list *list)
+{
+   Eina_Bool highlighted = va_arg(*list, int);
+   Elm_Widget_Smart_Data *sd = _pd;
+   highlighted = !!highlighted;
+
+   Evas_Object *o = elm_widget_parent_get(obj);
+
+   if (o) elm_widget_parent_highlight_set(o, highlighted);
+
+   sd->highlighted = highlighted;
+}
+
+EAPI void
 elm_widget_signal_emit(Evas_Object *obj,
                        const char *emission,
                        const char *source)
@@ -5326,6 +5374,7 @@ _class_constructor(Eo_Class *klass)
         EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_CAN_FOCUS_GET), _elm_widget_can_focus_get),
         EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_CHILD_CAN_FOCUS_GET), _elm_widget_child_can_focus_get),
         EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_GET), _elm_widget_focus_get),
+        EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_HIGHLIGHT_GET), _elm_widget_highlight_get),
         EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUSED_OBJECT_GET), _elm_widget_focused_object_get),
         EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_TOP_GET), _elm_widget_top_get),
 
@@ -5396,7 +5445,7 @@ _class_constructor(Eo_Class *klass)
         EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_LIST_DIRECTION_GET), _elm_widget_focus_list_direction_get),
         EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_NEXT_GET), _elm_widget_focus_next_get),
         EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_LIST_NEXT_GET), _elm_widget_focus_list_next_get),
-
+        EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_PARENT_HIGHLIGHT_SET), _elm_widget_parent_highlight_set),
         EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_DISPLAY_MODE_SET), _elm_widget_display_mode_set),
         EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_DISPLAY_MODE_GET), _elm_widget_display_mode_get),
 
@@ -5458,6 +5507,7 @@ static const Eo_Op_Description op_desc[] = {
      EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_CHILD_CAN_FOCUS_GET, "description here"),
 
      EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_FOCUS_GET, "description here"),
+     EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_HIGHLIGHT_GET, "description here"),
      EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_FOCUSED_OBJECT_GET, "description here"),
      EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_TOP_GET, "description here"),
      EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_PARENT_WIDGET_GET, "description here"),
@@ -5530,6 +5580,7 @@ static const Eo_Op_Description op_desc[] = {
      EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_FOCUS_LIST_DIRECTION_GET, "Get near object in one direction of base object in list."),
      EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_FOCUS_NEXT_GET, "Get next object in focus chain of object tree."),
      EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_FOCUS_LIST_NEXT_GET, "Get next object in focus chain of object tree in list."),
+     EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_PARENT_HIGHLIGHT_SET, "Set highlighted value from itself to top parent object."),
 
      EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_DISPLAY_MODE_SET, "Sets the widget and child widget's Evas_Display_Mode."),
      EO_OP_DESCRIPTION(ELM_WIDGET_SUB_ID_DISPLAY_MODE_GET, "Returns the widget's Evas_Display_Mode"),
index 6fb9981..e31bb89 100644 (file)
@@ -429,6 +429,7 @@ typedef struct _Elm_Widget_Smart_Data
                                                           * default */
    Eina_Bool                     still_in : 1;
    Eina_Bool                     can_access : 1;
+   Eina_Bool                     highlighted : 1;
 } Elm_Widget_Smart_Data;
 
 /**
@@ -487,6 +488,11 @@ struct _Elm_Access_Info
 };
 
 void                  _elm_access_mouse_event_enabled_set(Eina_Bool enabled);
+/* elm_widget_focus_list_next_get();, elm_widget_focus_next_get();
+   and elm_widget_focus_cycle(); use _elm_access_read_mode to use
+   focus chain */
+void                  _elm_access_read_mode_set(Eina_Bool enabled);
+Eina_Bool             _elm_access_read_mode_get();
 EAPI void             _elm_access_clear(Elm_Access_Info *ac);
 EAPI void             _elm_access_text_set(Elm_Access_Info *ac, int type, const char *text);
 EAPI void             _elm_access_callback_set(Elm_Access_Info *ac, int type, Elm_Access_Info_Cb func, const void *data);
@@ -580,6 +586,7 @@ EAPI Eina_Bool        elm_widget_highlight_ignore_get(const Evas_Object *obj);
 EAPI void             elm_widget_highlight_in_theme_set(Evas_Object *obj, Eina_Bool highlight);
 EAPI Eina_Bool        elm_widget_highlight_in_theme_get(const Evas_Object *obj);
 EAPI Eina_Bool        elm_widget_focus_get(const Evas_Object *obj);
+EAPI Eina_Bool        elm_widget_highlight_get(const Evas_Object *obj);
 EAPI Evas_Object     *elm_widget_focused_object_get(const Evas_Object *obj);
 EAPI Evas_Object     *elm_widget_top_get(const Evas_Object *obj);
 EAPI Eina_Bool        elm_widget_is(const Evas_Object *obj);
@@ -598,6 +605,7 @@ EAPI Eina_Bool        elm_widget_focus_direction_get(const Evas_Object *obj, con
 EAPI Eina_Bool        elm_widget_focus_next_get(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next);
 EAPI Eina_Bool        elm_widget_focus_list_direction_get(const Evas_Object  *obj, const Evas_Object *base, const Eina_List *items, void *(*list_data_get)(const Eina_List *list), double degree, Evas_Object **direction, double *weight);
 EAPI Eina_Bool        elm_widget_focus_list_next_get(const Evas_Object *obj, const Eina_List *items, void *(*list_data_get)(const Eina_List *list), Elm_Focus_Direction dir, Evas_Object **next);
+EAPI void             elm_widget_parent_highlight_set(Evas_Object *obj, Eina_Bool highlighted);
 EAPI void             elm_widget_focus_set(Evas_Object *obj, int first);
 EAPI void             elm_widget_focused_object_clear(Evas_Object *obj);
 EAPI Evas_Object     *elm_widget_parent_get(const Evas_Object *obj);
@@ -1034,6 +1042,7 @@ enum
    ELM_WIDGET_SUB_ID_CAN_FOCUS_GET,
    ELM_WIDGET_SUB_ID_CHILD_CAN_FOCUS_GET,
    ELM_WIDGET_SUB_ID_FOCUS_GET,
+   ELM_WIDGET_SUB_ID_HIGHLIGHT_GET,
    ELM_WIDGET_SUB_ID_FOCUSED_OBJECT_GET,
    ELM_WIDGET_SUB_ID_TOP_GET,
 
@@ -1107,6 +1116,7 @@ enum
    ELM_WIDGET_SUB_ID_FOCUS_LIST_DIRECTION_GET,
    ELM_WIDGET_SUB_ID_FOCUS_NEXT_GET,
    ELM_WIDGET_SUB_ID_FOCUS_LIST_NEXT_GET,
+   ELM_WIDGET_SUB_ID_PARENT_HIGHLIGHT_SET,
 
    ELM_WIDGET_SUB_ID_DISPLAY_MODE_SET,
    ELM_WIDGET_SUB_ID_DISPLAY_MODE_GET,
@@ -1577,6 +1587,17 @@ typedef void * (*list_data_get_func_type)(const Eina_List * l);
 #define elm_wdg_focus_get(ret) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_GET), EO_TYPECHECK(Eina_Bool *, ret)
 
 /**
+ * @def elm_wdg_highlight_get
+ * @since 1.8
+ *
+ * No description supplied by the EAPI.
+ *
+ * @param[out] ret
+ *
+ */
+#define elm_wdg_highlight_get(ret) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_HIGHLIGHT_GET), EO_TYPECHECK(Eina_Bool *, ret)
+
+/**
  * @def elm_wdg_focused_object_get
  * @since 1.8
  *
@@ -2281,6 +2302,16 @@ typedef void * (*list_data_get_func_type)(const Eina_List * l);
  */
 #define elm_wdg_focus_list_next_get(items, list_data_get, dir, next, ret) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_LIST_NEXT_GET), EO_TYPECHECK(const Eina_List *, items), EO_TYPECHECK(list_data_get_func_type, list_data_get), EO_TYPECHECK(Elm_Focus_Direction, dir), EO_TYPECHECK(Evas_Object **, next), EO_TYPECHECK(Eina_Bool *, ret)
 
+/**
+ * @def elm_wdg_parent_highlight_set
+ * @since 1.8
+ *
+ * No description supplied by the EAPI.
+ *
+ * @param[in] highlighted
+ *
+ */
+#define elm_wdg_parent_highlight_set(highlighted) ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_PARENT_HIGHLIGHT_SET), EO_TYPECHECK(Eina_Bool, highlighted)
 
 /**
  * @def elm_wdg_display_mode_set