[Access] Add new APIs
authorTae-Hwan Kim <the81.kim@samsung.com>
Tue, 4 Jun 2013 13:45:49 +0000 (22:45 +0900)
committerSungho Kwak <sungho1.kwak@samsung.com>
Wed, 12 Jun 2013 05:35:56 +0000 (14:35 +0900)
External:
elm_access_highlight_next_set
elm_object_part_access_register

Internal:
elm_widget_focus_region_show

Change-Id: I9635c37e16712340e85ace918c175c4a98d1644b

src/lib/elm_access.c
src/lib/elm_access.h
src/lib/elm_main.c
src/lib/elm_object.h
src/lib/elm_widget.c
src/lib/elm_widget.h

index b066f0d..747ea21 100644 (file)
@@ -925,7 +925,27 @@ _elm_access_highlight_cycle(Evas_Object *obj, Elm_Focus_Direction dir)
 
    action_by = type;
 
-   if (!ho || !_access_action_callback_call(ho, type, NULL))
+   if (ho && !_access_action_callback_call(ho, type, NULL))
+     {
+        Elm_Access_Info *info = _elm_access_object_get(ho);
+        Evas_Object *comming = NULL;
+        if (type == ELM_ACCESS_ACTION_HIGHLIGHT_NEXT)
+          {
+             if (info->next) comming = info->next;
+          }
+        else
+          {
+             if (info->prev) comming = info->prev;
+          }
+        if (comming)
+          {
+             elm_access_highlight_set(comming);
+             elm_widget_focus_region_show(comming);
+          }
+        else
+          elm_widget_focus_cycle(obj, dir);
+     }
+   else if (!ho || !_access_action_callback_call(ho, type, NULL))
      elm_widget_focus_cycle(obj, dir);
 
    action_by = ELM_ACCESS_ACTION_FIRST;
@@ -1583,3 +1603,32 @@ elm_access_external_info_get(const Evas_Object *obj)
    ac = _elm_access_object_get(obj);
    return _elm_access_text_get(ac, ELM_ACCESS_CONTEXT_INFO, obj);
 }
+
+EAPI void
+elm_access_highlight_next_set(Evas_Object *obj, Elm_Highlight_Direction dir, Evas_Object *next)
+{
+   EINA_SAFETY_ON_FALSE_RETURN(obj);
+   EINA_SAFETY_ON_FALSE_RETURN(next);
+
+   Elm_Access_Info *info = _elm_access_object_get(obj);
+   Elm_Access_Info *info_next = _elm_access_object_get(next);
+
+   if (!info || !info_next)
+     {
+        ERR("There is no access information");
+        return;
+     }
+
+   if (dir == ELM_HIGHLIGHT_DIR_NEXT)
+     {
+        info_next->prev = obj;
+        info->next = next;
+     }
+   else if (dir == ELM_HIGHLIGHT_DIR_PREVIOUS)
+     {
+        info_next->next = obj;
+        info->prev = next;
+     }
+   else
+      ERR("Not supported focus direction for access highlight [%d]", dir);
+}
index 3593e28..4294556 100644 (file)
@@ -60,6 +60,17 @@ enum _Elm_Access_Action_Type
  */
 typedef enum _Elm_Access_Action_Type Elm_Access_Action_Type;
 
+enum _Elm_Highlight_Direction
+{
+       ELM_HIGHLIGHT_DIR_FIRST = -1,
+       ELM_HIGHLIGHT_DIR_NEXT,
+       ELM_HIGHLIGHT_DIR_PREVIOUS
+};
+/**
+ * @typedef Elm_Access_Action_Type
+ */
+typedef enum _Elm_Highlight_Direction Elm_Highlight_Direction;
+
 struct _Elm_Access_Action_Info
 {
    Evas_Coord   x;
@@ -201,6 +212,26 @@ EAPI void elm_access_say(const char *text);
  */
 EAPI void elm_access_highlight_set(Evas_Object* obj);
 
+/**
+ * @brief Set the next access object for highlight.
+ * @since 1.8
+ *
+ * @param obj  The object is previous access object of next for hilight.
+ * @param dir  Access direction same as Focus direction
+ * @param next The object is next access object of obj for hilight.
+ *
+ * Currently focus chain is used for access highlight direction. Use this API
+ * to customize focus chain. If focus chain is already established, you can
+ * change one object's highlight chain and do not break the other object's
+ * focus chain. If you use elm_object_focus_custom_chain_append(), it will
+ * reset other object's custom chain also.
+ *
+ * @see elm_object_focus_custom_chain_append
+ * @ingroup Access
+ */
+EAPI void
+elm_access_highlight_next_set(Evas_Object *obj, Elm_Highlight_Direction dir, Evas_Object *next);
+
 EAPI Eina_Bool elm_access_action(Evas_Object *obj, const Elm_Access_Action_Type type, void *action_info);
 
 EAPI void elm_access_action_cb_set(Evas_Object *obj, const Elm_Access_Action_Type type, const Elm_Access_Action_Cb cb, const void *data);
index 5040a8a..7d2e3f7 100644 (file)
@@ -1019,6 +1019,21 @@ elm_object_part_content_unset(Evas_Object *obj, const char *part)
    return elm_widget_content_part_unset(obj, part);
 }
 
+EAPI Evas_Object *
+elm_object_part_access_register(Evas_Object *obj, const char *part)
+{
+   EINA_SAFETY_ON_NULL_RETURN_VAL(obj, NULL);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(part, NULL);
+   if (!evas_object_smart_type_check(obj, "elm_layout"))
+     {
+        ERR("Only for parts of a layout, access object can be registered");
+        return NULL;
+     }
+
+   Evas_Object *edj = elm_layout_edje_get(obj);
+   return _elm_access_edje_object_part_object_register(obj, edj, part);
+}
+
 EAPI Eina_Bool
 elm_object_style_set(Evas_Object *obj,
                      const char  *style)
index 743c53c..2a031b1 100644 (file)
@@ -171,6 +171,17 @@ EAPI Evas_Object                 *elm_object_part_content_unset(Evas_Object *obj
 #define elm_object_content_unset(obj) elm_object_part_content_unset((obj), NULL)
 
 /**
+ * Register a part on an object as an access object.
+ * @since 1.8
+ *
+ * @param obj The Elementary object
+ * @param part The object's part name to register
+ *
+ * @ingroup General
+ */
+EAPI Evas_Object *                elm_object_part_access_register(Evas_Object *obj, const char *part);
+
+/**
  * Set the text to read out when in accessibility mode
  *
  * @param obj The object which is to be described
index 1d24988..6607138 100644 (file)
@@ -908,6 +908,12 @@ _elm_widget_focus_region_show(const Evas_Object *obj)
      }
 }
 
+EAPI void
+elm_widget_focus_region_show(const Evas_Object *obj)
+{
+   _elm_widget_focus_region_show(obj);
+}
+
 static void
 _parent_focus(Evas_Object *obj)
 {
index 83daa03..684b2a3 100644 (file)
@@ -582,6 +582,9 @@ struct _Elm_Access_Info
 
    /* the owner part object that owns this access info */
    Evas_Object               *part_object;
+
+   Evas_Object               *next;
+   Evas_Object               *prev;
 };
 
 void                  _elm_access_shutdown();
@@ -742,6 +745,8 @@ EAPI const Elm_Widget_Smart_Class *elm_widget_smart_class_get(void);
 
 EAPI Eina_Bool        elm_widget_highlight_get(const Evas_Object *obj);
 EAPI void             elm_widget_parent_highlight_set(Evas_Object *obj, Eina_Bool highlighted);
+EAPI void             elm_widget_focus_region_show(const Evas_Object *obj);
+
 /**
  * @internal
  *