elm: [claendar]Exposing calendar's month name in accessibility tree
authorPrasoon Singh <prasoon.16@samsung.com>
Mon, 27 Nov 2017 10:45:53 +0000 (16:15 +0530)
committerJiyoun Park <jy0703.park@samsung.com>
Thu, 21 Dec 2017 09:24:04 +0000 (18:24 +0900)
@tizen_feature

orignal_patch: ded48905e1e8dc435804496637f35e1b1175aaef

Change-Id: Icc51b06ac6f42236cc30c2c2f59d54ec7a05fa9b

src/lib/elementary/elm_calendar.c

index 8b22efc..ebbf536 100644 (file)
 
 static const char SIG_CHANGED[] = "changed";
 static const char SIG_DISPLAY_CHANGED[] = "display,changed";
+//TIZEN_ONLY(20160720): Exposing calendar's month name in accessibility tree.
+static const char MONTH_TEXT_PART[] = "month_text";
+static const char MONTH_ACCESS_PART[] = "month_text.access";
+//
 
 static const Evas_Smart_Cb_Description _smart_callbacks[] = {
    {SIG_CHANGED, ""},
@@ -467,6 +471,23 @@ _localized_access_info_cb(void *data, Evas_Object *obj EINA_UNUSED)
    return NULL;
 }
 
+//TIZEN_ONLY(20160720): Exposing calendar's month name in accessibility tree.
+static char *
+_month_access_info_cb(void *data, Evas_Object *obj EINA_UNUSED)
+{
+   char *ret;
+   Eina_Strbuf *buf;
+   Evas_Object *o = (Evas_Object*)data;
+   buf = eina_strbuf_new();
+
+   eina_strbuf_append_printf(buf, "%s", edje_object_part_text_get(elm_layout_edje_get(o), MONTH_TEXT_PART));
+
+   ret = eina_strbuf_string_steal(buf);
+   eina_strbuf_free(buf);
+   return ret;
+}
+//
+
 static void
 _calendar_atspi_bridge_on_connect_cb(void *data, const Efl_Event *event EINA_UNUSED)
 {
@@ -479,6 +500,18 @@ _calendar_atspi_bridge_on_connect_cb(void *data, const Efl_Event *event EINA_UNU
    Evas_Object *ao, *ac;
 
    ELM_CALENDAR_DATA_GET(obj, sd);
+   //TIZEN_ONLY(20160720): Exposing calendar's month name in accessibility tree.
+   Evas_Object *part, *access;
+   part = (Evas_Object*)edje_object_part_object_get(elm_layout_edje_get(obj), MONTH_ACCESS_PART);
+   elm_access_object_unregister(part);
+   if (part)
+     {
+        access = elm_access_object_register(part, obj);
+        _elm_access_callback_set(_elm_access_info_get(access),
+                                 ELM_ACCESS_INFO, _month_access_info_cb, obj);
+        efl_access_role_set(access, EFL_ACCESS_ROLE_HEADING);
+     }
+   //
    day = 0;
    maxdays = _maxdays_get(&sd->shown_time, 0);
    for (ii = 0; ii < 42; ii++)
@@ -507,6 +540,12 @@ _calendar_atspi_bridge_on_disconnect_cb(void *data, const Efl_Event *event EINA_
    char pname[14];
    Evas_Object *ac;
 
+   //TIZEN_ONLY(20160720): Exposing calendar's month name in accessibility tree.
+   Evas_Object *access;
+   access = (Evas_Object*)edje_object_part_object_get(elm_layout_edje_get(obj), MONTH_ACCESS_PART);
+   elm_access_object_unregister(access);
+   //
+
    for (ii = 0; ii < 42; ii++)
      {
         snprintf(pname, sizeof(pname), "cit_%i.access", ii);