and now add custom access info for items too and clean up nicely.
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 24 Aug 2011 06:39:29 +0000 (06:39 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 24 Aug 2011 06:39:29 +0000 (06:39 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@62734 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/Elementary.h.in
src/lib/elm_main.c
src/lib/elm_toolbar.c
src/lib/elm_widget.c
src/lib/elm_widget.h

index cc6c894..c7e5959 100644 (file)
@@ -1066,13 +1066,24 @@ extern "C" {
    /**
     * Set the text to read out when in accessibility mode
     *
-    * @param obj The object which is described
+    * @param obj The object which is to be described
     * @param txt The text that describes the widget to people with poor or no vision
     *
     * @ingroup General
     */
    EAPI void elm_object_access_info_set(Evas_Object *obj, const char *txt);
 
+   /**
+    * Set the text to read out when in accessibility mode
+    *
+    * @param it The object item which is to be described
+    * @param txt The text that describes the widget to people with poor or no vision
+    *
+    * @ingroup General
+    */
+   EAPI void elm_object_item_access_info_set(Elm_Object_Item *it, const char *txt);
+         
+
 #define elm_object_item_text_get(it) elm_object_item_text_part_get((it), NULL)
 
    /**
index 037b3b8..cf0ae1d 100644 (file)
@@ -2080,3 +2080,10 @@ elm_object_access_info_set(Evas_Object *obj, const char *txt)
 {
    elm_widget_access_info_set(obj, txt);
 }
+
+EAPI void
+elm_object_item_access_info_set(Elm_Object_Item *it, const char *txt)
+{
+   _elm_widget_item_access_info_set((Elm_Widget_Item *)it, txt);
+}
+
index 7f64e09..28c6635 100644 (file)
@@ -637,7 +637,7 @@ static char *
 _access_info_cb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Elm_Widget_Item *item __UNUSED__)
 {
    Elm_Toolbar_Item *it = (Elm_Toolbar_Item *)item;
-   char *txt = NULL; // FIXME set access info on items - prefer that
+   char *txt = item->access_info;
    if (!txt) txt = (char *)it->label;
    if (txt) return strdup(txt);
    return txt;
index 0b9253e..4f5fe20 100644 (file)
@@ -2572,6 +2572,18 @@ _elm_widget_item_del(Elm_Widget_Item *item)
 
    if (item->view)
      evas_object_del(item->view);
+   
+   if (item->access)
+     {
+        _elm_access_clear(item->access);
+        free(item->access);
+        item->access = NULL;
+     }
+   if (item->access_info)
+     {
+        eina_stringshare_del(item->access_info);
+        item->access_info = NULL;
+     }
 
    EINA_MAGIC_SET(item, EINA_MAGIC_NONE);
    free(item);
@@ -3088,6 +3100,16 @@ _elm_widget_item_text_get_hook_set(Elm_Widget_Item *item,
    item->on_text_get_func = func;
 }
 
+EAPI void
+_elm_widget_item_access_info_set(Elm_Widget_Item *item, const char *txt)
+{
+   ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+   if (item->access_info) eina_stringshare_del(item->access_info);
+   if (!txt) item->access_info = NULL;
+   else item->access_info = eina_stringshare_add(txt);
+}
+
+
 static void
 _smart_add(Evas_Object *obj)
 {
index 51d5031..8feeb83 100644 (file)
@@ -255,6 +255,7 @@ struct _Elm_Widget_Item
    Elm_Widget_On_Text_Set_Cb on_text_set_func;
    Elm_Widget_On_Text_Get_Cb on_text_get_func;
    Elm_Access_Info *access;
+   const char *access_info;
    /* widget variations should have data from here and on */
    /* @todo: TODO check if this is enough for 1.0 release, maybe add padding! */
 };
@@ -443,6 +444,7 @@ EAPI void             _elm_widget_item_content_get_hook_set(Elm_Widget_Item *ite
 EAPI void             _elm_widget_item_content_unset_hook_set(Elm_Widget_Item *item, Elm_Widget_On_Content_Unset_Cb func);
 EAPI void             _elm_widget_item_text_set_hook_set(Elm_Widget_Item *item, Elm_Widget_On_Text_Set_Cb func);
 EAPI void             _elm_widget_item_text_get_hook_set(Elm_Widget_Item *item, Elm_Widget_On_Text_Get_Cb func);
+EAPI void             _elm_widget_item_access_info_set(Elm_Widget_Item *item, const char *txt);
 
 
 /* debug function. don't use it unless you are tracking parenting issues */