and now add custom access info for items too and clean up nicely.
[framework/uifw/elementary.git] / src / lib / elm_widget.c
index 97d71aa..d56b469 100644 (file)
@@ -10,9 +10,16 @@ static const char SMART_NAME[] = "elm_widget";
   Smart_Data * sd = evas_object_smart_data_get(obj); \
   if (!sd) return;
 
+#undef elm_widget_text_set_hook_set
+#undef elm_widget_text_get_hook_set
+#undef elm_widget_content_set_hook_set
+#undef elm_widget_content_get_hook_set
+#undef elm_widget_content_unset_hook_set
+
 typedef struct _Smart_Data        Smart_Data;
 typedef struct _Edje_Signal_Data  Edje_Signal_Data;
 typedef struct _Elm_Event_Cb_Data Elm_Event_Cb_Data;
+typedef struct _Elm_Translate_String_Data Elm_Translate_String_Data;
 
 struct _Smart_Data
 {
@@ -30,6 +37,7 @@ struct _Smart_Data
    void       (*activate_func)(Evas_Object *obj);
    void       (*disable_func)(Evas_Object *obj);
    void       (*theme_func)(Evas_Object *obj);
+   void       (*translate_func)(Evas_Object *obj);
    Eina_Bool  (*event_func)(Evas_Object       *obj,
                             Evas_Object       *source,
                             Evas_Callback_Type type,
@@ -70,6 +78,11 @@ struct _Smart_Data
                                       Evas_Coord        *y,
                                       Evas_Coord        *w,
                                       Evas_Coord        *h);
+   Elm_Widget_On_Text_Set_Cb on_text_set_func;
+   Elm_Widget_On_Text_Get_Cb on_text_get_func;
+   Elm_Widget_On_Content_Set_Cb on_content_set_func;
+   Elm_Widget_On_Content_Get_Cb on_content_get_func;
+   Elm_Widget_On_Content_Unset_Cb on_content_unset_func;
    void        *data;
    Evas_Coord   rx, ry, rw, rh;
    int          scroll_hold;
@@ -77,6 +90,7 @@ struct _Smart_Data
    double       scale;
    Elm_Theme   *theme;
    const char  *style;
+   const char  *access_info;
    unsigned int focus_order;
    Eina_Bool    focus_order_on_calc;
 
@@ -84,6 +98,7 @@ struct _Smart_Data
    int          child_drag_y_locked;
 
    Eina_List   *edje_signals;
+   Eina_List   *translate_strings;
 
    Eina_Bool    drag_x_locked : 1;
    Eina_Bool    drag_y_locked : 1;
@@ -91,11 +106,14 @@ struct _Smart_Data
    Eina_Bool    can_focus : 1;
    Eina_Bool    child_can_focus : 1;
    Eina_Bool    focused : 1;
+   Eina_Bool    top_win_focused : 1;
+   Eina_Bool    tree_unfocusable : 1;
    Eina_Bool    highlight_ignore : 1;
    Eina_Bool    highlight_in_theme : 1;
    Eina_Bool    disabled : 1;
    Eina_Bool    is_mirrored : 1;
    Eina_Bool    mirrored_auto_mode : 1;   /* This is TRUE by default */
+   Eina_Bool    still_in : 1;
 
    Eina_List   *focus_chain;
    Eina_List   *event_cb;
@@ -116,6 +134,13 @@ struct _Elm_Event_Cb_Data
    const void  *data;
 };
 
+struct _Elm_Translate_String_Data
+{
+   const char *id;
+   const char *domain;
+   const char *string;
+};
+
 /* local subsystem functions */
 static void _smart_reconfigure(Smart_Data *sd);
 static void _smart_add(Evas_Object *obj);
@@ -215,25 +240,54 @@ _sub_obj_hide(void        *data __UNUSED__,
               Evas_Object *obj,
               void        *event_info __UNUSED__)
 {
-   _if_focused_revert(obj, EINA_TRUE);
+   elm_widget_focus_hide_handle(obj);
+}
+
+static void
+_sub_obj_mouse_down(void        *data,
+                    Evas        *e __UNUSED__,
+                    Evas_Object *obj __UNUSED__,
+                    void        *event_info)
+{
+   Smart_Data *sd = data;
+   Evas_Event_Mouse_Down *ev = event_info;
+   if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
+     sd->still_in = EINA_TRUE;
 }
 
 static void
-_sub_obj_mouse_down(void        *data __UNUSED__,
+_sub_obj_mouse_move(void        *data,
                     Evas        *e __UNUSED__,
                     Evas_Object *obj,
-                    void        *event_info __UNUSED__)
+                    void        *event_info)
 {
-   Evas_Object *o = obj;
-   do
+   Smart_Data *sd = data;
+   Evas_Event_Mouse_Move *ev = event_info;
+   if (sd->still_in)
      {
-        if (_elm_widget_is(o)) break;
-        o = evas_object_smart_parent_get(o);
+        if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD)
+          sd->still_in = EINA_FALSE;
+        else
+          {
+             Evas_Coord x, y, w, h;
+             evas_object_geometry_get(obj, &x, &y, &w, &h);
+             if ((ev->cur.canvas.x < x) || (ev->cur.canvas.y < y) ||
+                 (ev->cur.canvas.x >= (x + w)) || (ev->cur.canvas.y >= (y + h)))
+               sd->still_in = EINA_FALSE;
+          }
      }
-   while (o);
-   if (!o) return;
-   if (!_is_focusable(o)) return;
-   elm_widget_focus_steal(o);
+}
+
+static void
+_sub_obj_mouse_up(void        *data,
+                  Evas        *e __UNUSED__,
+                  Evas_Object *obj,
+                  void        *event_info __UNUSED__)
+{
+   Smart_Data *sd = data;
+   if (sd->still_in)
+     elm_widget_focus_mouse_up_handle(obj);
+   sd->still_in = EINA_FALSE;
 }
 
 static void
@@ -312,23 +366,12 @@ static void
 _parent_focus(Evas_Object *obj)
 {
    API_ENTRY return;
+   if (sd->focused) return;
 
    Evas_Object *o = elm_widget_parent_get(obj);
    sd->focus_order_on_calc = EINA_TRUE;
 
-   if (sd->focused) return;
-   if (o)
-     {
-        unsigned int i = 0;
-        Evas_Object *ret;
-
-        ret = _newest_focus_order_get(o, &i, EINA_TRUE);
-
-        /* we don't want to bump a common widget ancestor's
-           focus_order *twice* while parent focusing */
-        if (!ret || (!i) || (i != focus_order))
-          _parent_focus(o);
-     }
+   if (o) _parent_focus(o);
 
    if (!sd->focus_order_on_calc)
      return; /* we don't want to override it if by means of any of the
@@ -337,12 +380,13 @@ _parent_focus(Evas_Object *obj)
 
    focus_order++;
    sd->focus_order = focus_order;
-   sd->focused = EINA_TRUE;
-   if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
-   if (sd->focus_func) sd->focus_func(obj);
-
-   _elm_widget_focus_region_show(obj);
-
+   if (sd->top_win_focused)
+     {
+        sd->focused = EINA_TRUE;
+        if (sd->on_focus_func) sd->on_focus_func(sd->on_focus_data, obj);
+        if (sd->focus_func) sd->focus_func(obj);
+        _elm_widget_focus_region_show(obj);
+     }
    sd->focus_order_on_calc = EINA_FALSE;
 }
 
@@ -417,6 +461,18 @@ elm_widget_type_register(const char **ptr)
    widtypes = eina_list_append(widtypes, (void *)ptr);
 }
 
+/**
+ * @defgroup Widget Widget
+ *
+ * @internal
+ * Disposed api for making widgets
+ */
+EAPI void
+elm_widget_type_unregister(const char **ptr)
+{
+   widtypes = eina_list_remove(widtypes, (void *)ptr);
+}
+
 EAPI Eina_Bool
 elm_widget_api_check(int ver)
 {
@@ -487,6 +543,14 @@ elm_widget_theme_hook_set(Evas_Object *obj,
 }
 
 EAPI void
+elm_widget_translate_hook_set(Evas_Object *obj,
+                              void       (*func)(Evas_Object *obj))
+{
+   API_ENTRY return;
+   sd->translate_func = func;
+}
+
+EAPI void
 elm_widget_event_hook_set(Evas_Object *obj,
                           Eina_Bool  (*func)(Evas_Object       *obj,
                                              Evas_Object       *source,
@@ -498,6 +562,46 @@ elm_widget_event_hook_set(Evas_Object *obj,
 }
 
 EAPI void
+elm_widget_text_set_hook_set(Evas_Object *obj,
+                             Elm_Widget_On_Text_Set_Cb func)
+{
+   API_ENTRY return;
+   sd->on_text_set_func = func;
+}
+
+EAPI void
+elm_widget_text_get_hook_set(Evas_Object *obj,
+                             Elm_Widget_On_Text_Get_Cb func)
+{
+   API_ENTRY return;
+   sd->on_text_get_func = func;
+}
+
+EAPI void
+elm_widget_content_set_hook_set(Evas_Object *obj,
+                                Elm_Widget_On_Content_Set_Cb func)
+{
+   API_ENTRY return;
+   sd->on_content_set_func = func;
+}
+
+EAPI void
+elm_widget_content_get_hook_set(Evas_Object *obj,
+                                Elm_Widget_On_Content_Get_Cb func)
+{
+   API_ENTRY return;
+   sd->on_content_get_func = func;
+}
+
+EAPI void
+elm_widget_content_unset_hook_set(Evas_Object *obj,
+                                  Elm_Widget_On_Content_Unset_Cb func)
+{
+   API_ENTRY return;
+   sd->on_content_unset_func = func;
+}
+
+EAPI void
 elm_widget_changed_hook_set(Evas_Object *obj,
                             void       (*func)(Evas_Object *obj))
 {
@@ -825,6 +929,7 @@ elm_widget_sub_object_add(Evas_Object *obj,
              if (sd2->parent_obj)
                elm_widget_sub_object_del(sd2->parent_obj, sobj);
              sd2->parent_obj = obj;
+             sd2->top_win_focused = sd->top_win_focused;
              if (!sd->child_can_focus && (_is_focusable(sobj)))
                sd->child_can_focus = EINA_TRUE;
           }
@@ -875,10 +980,6 @@ elm_widget_sub_object_del(Evas_Object *obj,
           }
         if (abort_on_warn == 1) abort();
      }
-   if (!sd->child_can_focus)
-     {
-        if (_is_focusable(sobj)) sd->child_can_focus = 0;
-     }
    if (_elm_widget_is(sobj))
      {
         Smart_Data *sd2 = evas_object_smart_data_get(sobj);
@@ -893,6 +994,20 @@ elm_widget_sub_object_del(Evas_Object *obj,
         else
           sd->subobjs = eina_list_remove(sd->subobjs, sobj);
         if (elm_widget_focus_get(sobj)) _unfocus_parents(obj);
+        if ((sd->child_can_focus) && (_is_focusable(sobj)))
+          {
+             Evas_Object *subobj;
+             const Eina_List *l;
+             sd->child_can_focus = EINA_FALSE;
+             EINA_LIST_FOREACH(sd->subobjs, l, subobj)
+               {
+                  if (_is_focusable(subobj))
+                    {
+                       sd->child_can_focus = EINA_TRUE;
+                       break;
+                    }
+               }
+          }
      }
    else
      sd->subobjs = eina_list_remove(sd->subobjs, sobj);
@@ -925,6 +1040,10 @@ elm_widget_resize_object_set(Evas_Object *obj,
                                             _sub_obj_del, sd);
         evas_object_event_callback_del_full(sd->resize_obj, EVAS_CALLBACK_MOUSE_DOWN,
                                             _sub_obj_mouse_down, sd);
+        evas_object_event_callback_del_full(sd->resize_obj, EVAS_CALLBACK_MOUSE_MOVE,
+                                            _sub_obj_mouse_move, sd);
+        evas_object_event_callback_del_full(sd->resize_obj, EVAS_CALLBACK_MOUSE_UP,
+                                            _sub_obj_mouse_up, sd);
         evas_object_smart_member_del(sd->resize_obj);
         if (_elm_widget_is(sd->resize_obj))
           {
@@ -946,6 +1065,10 @@ elm_widget_resize_object_set(Evas_Object *obj,
                                             _sub_obj_del, sd);
         evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_MOUSE_DOWN,
                                             _sub_obj_mouse_down, sd);
+        evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_MOUSE_MOVE,
+                                            _sub_obj_mouse_move, sd);
+        evas_object_event_callback_del_full(sobj, EVAS_CALLBACK_MOUSE_UP,
+                                            _sub_obj_mouse_up, sd);
         evas_object_smart_member_del(sobj);
         if (_elm_widget_is(sobj))
           {
@@ -959,7 +1082,11 @@ elm_widget_resize_object_set(Evas_Object *obj,
         if (_elm_widget_is(sd->resize_obj))
           {
              Smart_Data *sd2 = evas_object_smart_data_get(sd->resize_obj);
-             if (sd2) sd2->parent_obj = obj;
+             if (sd2)
+               {
+                  sd2->parent_obj = obj;
+                  sd2->top_win_focused = sd->top_win_focused;
+               }
              evas_object_event_callback_add(sobj, EVAS_CALLBACK_HIDE,
                                             _sub_obj_hide, sd);
           }
@@ -969,6 +1096,10 @@ elm_widget_resize_object_set(Evas_Object *obj,
                                        _sub_obj_del, sd);
         evas_object_event_callback_add(sobj, EVAS_CALLBACK_MOUSE_DOWN,
                                        _sub_obj_mouse_down, sd);
+        evas_object_event_callback_add(sobj, EVAS_CALLBACK_MOUSE_MOVE,
+                                       _sub_obj_mouse_move, sd);
+        evas_object_event_callback_add(sobj, EVAS_CALLBACK_MOUSE_UP,
+                                       _sub_obj_mouse_up, sd);
         _smart_reconfigure(sd);
         evas_object_data_set(sobj, "elm-parent", obj);
         evas_object_smart_callback_call(obj, "sub-object-add", sobj);
@@ -1041,6 +1172,49 @@ elm_widget_child_can_focus_get(const Evas_Object *obj)
    return sd->child_can_focus;
 }
 
+/**
+ * @internal
+ *
+ * This API makes the widget object and its children to be unfocusable.
+ *
+ * This API can be helpful for an object to be deleted.
+ * When an object will be deleted soon, it and its children may not
+ * want to get focus (by focus reverting or by other focus controls).
+ * Then, just use this API before deleting.
+ *
+ * @param obj The widget root of sub-tree
+ * @param tree_unfocusable If true, set the object sub-tree as unfocusable
+ *
+ * @ingroup Widget
+ */
+EAPI void
+elm_widget_tree_unfocusable_set(Evas_Object *obj,
+                                Eina_Bool    tree_unfocusable)
+{
+   API_ENTRY return;
+
+   if (sd->tree_unfocusable == tree_unfocusable) return;
+   sd->tree_unfocusable = !!tree_unfocusable;
+   elm_widget_focus_tree_unfocusable_handle(obj);
+}
+
+/**
+ * @internal
+ *
+ * This returns true, if the object sub-tree is unfocusable.
+ *
+ * @param obj The widget root of sub-tree
+ * @return EINA_TRUE if the object sub-tree is unfocusable
+ *
+ * @ingroup Widget
+ */
+EAPI Eina_Bool
+elm_widget_tree_unfocusable_get(const Evas_Object *obj)
+{
+   API_ENTRY return EINA_FALSE;
+   return sd->tree_unfocusable;
+}
+
 EAPI void
 elm_widget_highlight_ignore_set(Evas_Object *obj,
                                 Eina_Bool    ignore)
@@ -1431,7 +1605,9 @@ elm_widget_focus_next_get(const Evas_Object  *obj,
    API_ENTRY return EINA_FALSE;
 
    /* Ignore if disabled */
-   if ((!evas_object_visible_get(obj)) || (elm_widget_disabled_get(obj)))
+   if ((!evas_object_visible_get(obj))
+       || (elm_widget_disabled_get(obj))
+       || (elm_widget_tree_unfocusable_get(obj)))
      return EINA_FALSE;
 
    /* Try use hook */
@@ -1621,7 +1797,7 @@ elm_widget_signal_callback_del(Evas_Object   *obj,
              break;
           }
      }
-   sd->callback_del_func(obj, emission, source, _edje_signal_callback, esd);
+   sd->callback_del_func(obj, emission, source, _edje_signal_callback, data);
    return data;
 }
 
@@ -1731,12 +1907,15 @@ elm_widget_focus_steal(Evas_Object *obj)
 
    if (sd->focused) return;
    if (sd->disabled) return;
+   if (!sd->can_focus) return;
+   if (sd->tree_unfocusable) return;
    parent = obj;
    for (;;)
      {
         o = elm_widget_parent_get(parent);
         if (!o) break;
         sd = evas_object_smart_data_get(o);
+        if (sd->disabled || sd->tree_unfocusable) return;
         if (sd->focused) break;
         parent = o;
      }
@@ -1767,6 +1946,45 @@ elm_widget_focus_steal(Evas_Object *obj)
 }
 
 EAPI void
+elm_widget_focus_restore(Evas_Object *obj)
+{
+   Evas_Object *newest = NULL;
+   unsigned int newest_focus_order = 0;
+   API_ENTRY return;
+
+   newest = _newest_focus_order_get(obj, &newest_focus_order, EINA_TRUE);
+   if (newest)
+     {
+        elm_object_unfocus(newest);
+        elm_object_focus(newest);
+     }
+}
+
+void
+_elm_widget_top_win_focused_set(Evas_Object *obj, Eina_Bool top_win_focused)
+{
+   const Eina_List *l;
+   Evas_Object *child;
+   API_ENTRY return;
+
+   if (sd->top_win_focused == top_win_focused) return;
+   if (sd->resize_obj)
+     _elm_widget_top_win_focused_set(sd->resize_obj, top_win_focused);
+   EINA_LIST_FOREACH(sd->subobjs, l, child)
+     {
+        _elm_widget_top_win_focused_set(child, top_win_focused);
+     }
+   sd->top_win_focused = top_win_focused;
+}
+
+Eina_Bool
+_elm_widget_top_win_focused_get(const Evas_Object *obj)
+{
+   API_ENTRY return EINA_FALSE;
+   return sd->top_win_focused;
+}
+
+EAPI void
 elm_widget_activate(Evas_Object *obj)
 {
    API_ENTRY return;
@@ -1784,30 +2002,17 @@ elm_widget_change(Evas_Object *obj)
 
 EAPI void
 elm_widget_disabled_set(Evas_Object *obj,
-                        int          disabled)
+                        Eina_Bool    disabled)
 {
    API_ENTRY return;
 
    if (sd->disabled == disabled) return;
-   sd->disabled = disabled;
-   if (sd->focused)
-     {
-        Evas_Object *o, *parent;
-
-        parent = obj;
-        for (;;)
-          {
-             o = elm_widget_parent_get(parent);
-             if (!o) break;
-             parent = o;
-          }
-        if (elm_widget_focus_get(obj))
-          elm_widget_focus_cycle(parent, ELM_FOCUS_NEXT);
-     }
+   sd->disabled = !!disabled;
+   elm_widget_focus_disabled_handle(obj);
    if (sd->disable_func) sd->disable_func(obj);
 }
 
-EAPI int
+EAPI Eina_Bool
 elm_widget_disabled_get(const Evas_Object *obj)
 {
    API_ENTRY return 0;
@@ -1819,13 +2024,15 @@ elm_widget_show_region_set(Evas_Object *obj,
                            Evas_Coord   x,
                            Evas_Coord   y,
                            Evas_Coord   w,
-                           Evas_Coord   h)
+                           Evas_Coord   h,
+                           Eina_Bool    forceshow)
 {
    Evas_Object *parent_obj, *child_obj;
    Evas_Coord px, py, cx, cy;
 
    API_ENTRY return;
-   if ((x == sd->rx) && (y == sd->ry) && (w == sd->rw) && (h == sd->rh)) return;
+   if (!forceshow && (x == sd->rx) && (y == sd->ry)
+            && (w == sd->rw) && (h == sd->rh)) return;
    sd->rx = x;
    sd->ry = y;
    sd->rw = w;
@@ -2015,6 +2222,166 @@ elm_widget_theme_set(Evas_Object *obj,
      }
 }
 
+EAPI void
+elm_widget_text_part_set(Evas_Object *obj, const char *item, const char *label)
+{
+   API_ENTRY return;
+
+   if (!sd->on_text_set_func)
+     return;
+
+   sd->on_text_set_func(obj, item, label);
+}
+
+EAPI const char *
+elm_widget_text_part_get(const Evas_Object *obj, const char *item)
+{
+   API_ENTRY return NULL;
+
+   if (!sd->on_text_get_func)
+     return NULL;
+
+   return sd->on_text_get_func(obj, item);
+}
+
+EAPI void
+elm_widget_domain_translatable_text_part_set(Evas_Object *obj, const char *part, const char *domain, const char *label)
+{
+   const char *str;
+   Eina_List *l;
+   Elm_Translate_String_Data *ts = NULL;
+   API_ENTRY return;
+
+   str = eina_stringshare_add(part);
+   EINA_LIST_FOREACH(sd->translate_strings, l, ts)
+      if (ts->id == str)
+        break;
+      else
+        ts = NULL;
+
+   if (!ts && !label)
+     eina_stringshare_del(str);
+   else if (!ts)
+     {
+        ts = malloc(sizeof(Elm_Translate_String_Data));
+        if (!ts) return;
+
+        ts->id = str;
+        ts->domain = eina_stringshare_add(domain);
+        ts->string = eina_stringshare_add(label);
+        sd->translate_strings = eina_list_append(sd->translate_strings, ts);
+     }
+   else
+     {
+        if (label)
+          {
+             eina_stringshare_replace(&ts->domain, domain);
+             eina_stringshare_replace(&ts->string, label);
+          }
+        else
+          {
+             sd->translate_strings = eina_list_remove_list(
+                                                sd->translate_strings, l);
+             eina_stringshare_del(ts->id);
+             eina_stringshare_del(ts->domain);
+             eina_stringshare_del(ts->string);
+             free(ts);
+          }
+        eina_stringshare_del(str);
+     }
+
+#ifdef HAVE_GETTEXT
+   if (label && label[0])
+     label = dgettext(domain, label);
+#endif
+   elm_widget_text_part_set(obj, part, label);
+}
+
+EAPI const char *
+elm_widget_translatable_text_part_get(const Evas_Object *obj, const char *part)
+{
+   const char *str, *ret = NULL;
+   Eina_List *l;
+   Elm_Translate_String_Data *ts;
+   API_ENTRY return NULL;
+
+   str = eina_stringshare_add(part);
+   EINA_LIST_FOREACH(sd->translate_strings, l, ts)
+      if (ts->id == str)
+        {
+           ret = ts->string;
+           break;
+        }
+   eina_stringshare_del(str);
+   return ret;
+}
+
+EAPI void
+elm_widget_translate(Evas_Object *obj)
+{
+   const Eina_List *l;
+   Evas_Object *child;
+   Elm_Translate_String_Data *ts;
+
+   API_ENTRY return;
+   EINA_LIST_FOREACH(sd->subobjs, l, child) elm_widget_translate(child);
+   if (sd->resize_obj) elm_widget_translate(sd->resize_obj);
+   if (sd->hover_obj) elm_widget_translate(sd->hover_obj);
+   if (sd->translate_func) sd->translate_func(obj);
+
+#ifdef HAVE_GETTEXT
+   EINA_LIST_FOREACH(sd->translate_strings, l, ts)
+     {
+        const char *s = dgettext(ts->domain, ts->string);
+        elm_widget_text_part_set(obj, ts->id, s);
+     }
+#endif
+}
+
+EAPI void
+elm_widget_content_part_set(Evas_Object *obj, const char *part, Evas_Object *content)
+{
+   API_ENTRY return;
+
+   if (!sd->on_content_set_func)  return;
+   sd->on_content_set_func(obj, part, content);
+}
+
+EAPI Evas_Object *
+elm_widget_content_part_get(const Evas_Object *obj, const char *part)
+{
+   API_ENTRY return NULL;
+
+   if (!sd->on_content_get_func) return NULL;
+   return sd->on_content_get_func(obj, part);
+}
+
+EAPI Evas_Object *
+elm_widget_content_part_unset(Evas_Object *obj, const char *part)
+{
+   API_ENTRY return NULL;
+
+   if (!sd->on_content_unset_func) return NULL;
+   return sd->on_content_unset_func(obj, part);
+}
+
+EAPI void
+elm_widget_access_info_set(Evas_Object *obj, const char *txt)
+{
+   API_ENTRY return;
+   if (sd->access_info) eina_stringshare_del(sd->access_info);
+   if (!txt) sd->access_info = NULL;
+   else sd->access_info = eina_stringshare_add(txt);
+}
+
+EAPI const char *
+elm_widget_access_info_get(Evas_Object *obj)
+{
+   API_ENTRY return NULL;
+   return sd->access_info;
+}
+
+
 EAPI Elm_Theme *
 elm_widget_theme_get(const Evas_Object *obj)
 {
@@ -2224,6 +2591,46 @@ elm_widget_stringlist_free(Eina_List *list)
    EINA_LIST_FREE(list, s) eina_stringshare_del(s);
 }
 
+EAPI void
+elm_widget_focus_hide_handle(Evas_Object *obj)
+{
+   _if_focused_revert(obj, EINA_TRUE);
+}
+
+EAPI void
+elm_widget_focus_mouse_up_handle(Evas_Object *obj)
+{
+   Evas_Object *o = obj;
+   do
+     {
+        if (_elm_widget_is(o)) break;
+        o = evas_object_smart_parent_get(o);
+     }
+   while (o);
+   if (!o) return;
+   if (!_is_focusable(o)) return;
+   elm_widget_focus_steal(o);
+}
+
+EAPI void
+elm_widget_focus_tree_unfocusable_handle(Evas_Object *obj)
+{
+   API_ENTRY return;
+
+   if (!elm_widget_parent_get(obj))
+     elm_widget_focused_object_clear(obj);
+   else
+     _if_focused_revert(obj, EINA_TRUE);
+}
+
+EAPI void
+elm_widget_focus_disabled_handle(Evas_Object *obj)
+{
+   API_ENTRY return;
+
+   elm_widget_focus_tree_unfocusable_handle(obj);
+}
+
 /**
  * @internal
  *
@@ -2291,6 +2698,30 @@ _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;
+     }
+
+   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);
@@ -2408,7 +2839,20 @@ _elm_widget_item_tooltip_label_create(void        *data,
    if (!label)
      return NULL;
    elm_object_style_set(label, "tooltip");
-   elm_label_label_set(label, data);
+   elm_object_text_set(label, data);
+   return label;
+}
+
+static Evas_Object *
+_elm_widget_item_tooltip_trans_label_create(void        *data,
+                                            Evas_Object *obj __UNUSED__,
+                                            void        *item __UNUSED__)
+{
+   Evas_Object *label = elm_label_add(obj);
+   if (!label)
+     return NULL;
+   elm_object_style_set(label, "tooltip");
+   elm_object_translatable_text_set(label, data);
    return label;
 }
 
@@ -2446,6 +2890,19 @@ _elm_widget_item_tooltip_text_set(Elm_Widget_Item *item,
      _elm_widget_item_tooltip_label_del_cb);
 }
 
+EAPI void
+_elm_widget_item_tooltip_translatable_text_set(Elm_Widget_Item *item,
+                                               const char      *text)
+{
+   ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+   EINA_SAFETY_ON_NULL_RETURN(text);
+
+   text = eina_stringshare_add(text);
+   _elm_widget_item_tooltip_content_cb_set
+     (item, _elm_widget_item_tooltip_trans_label_create, text,
+     _elm_widget_item_tooltip_label_del_cb);
+}
+
 static Evas_Object *
 _elm_widget_item_tooltip_create(void        *data,
                                 Evas_Object *obj)
@@ -2704,6 +3161,121 @@ _smart_reconfigure(Smart_Data *sd)
      }
 }
 
+EAPI void
+_elm_widget_item_content_part_set(Elm_Widget_Item *item,
+                                 const char *part,
+                                 Evas_Object *content)
+{
+   ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+   if (!item->on_content_set_func) return;
+   item->on_content_set_func((Elm_Object_Item *) item, part, content);
+}
+
+EAPI Evas_Object *
+_elm_widget_item_content_part_get(const Elm_Widget_Item *item,
+                                  const char *part)
+{
+   ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL);
+   if (!item->on_content_get_func) return NULL;
+   return item->on_content_get_func((Elm_Object_Item *) item, part);
+}
+
+EAPI Evas_Object *
+_elm_widget_item_content_part_unset(Elm_Widget_Item *item,
+                                    const char *part)
+{
+   ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL);
+   if (!item->on_content_unset_func) return NULL;
+   return item->on_content_unset_func((Elm_Object_Item *) item, part);
+}
+
+EAPI void
+_elm_widget_item_text_part_set(Elm_Widget_Item *item,
+                              const char *part,
+                              const char *label)
+{
+   ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+   if (!item->on_text_set_func) return;
+   item->on_text_set_func((Elm_Object_Item *) item, part, label);
+}
+
+EAPI void
+_elm_widget_item_signal_emit(Elm_Widget_Item *item,
+                             const char *emission,
+                             const char *source)
+{
+   ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+   if (item->on_signal_emit_func)
+     item->on_signal_emit_func((Elm_Object_Item *) item, emission, source);
+}
+
+EAPI const char *
+_elm_widget_item_text_part_get(const Elm_Widget_Item *item,
+                               const char *part)
+{
+   ELM_WIDGET_ITEM_CHECK_OR_RETURN(item, NULL);
+   if (!item->on_text_get_func) return NULL;
+   return item->on_text_get_func((Elm_Object_Item *) item, part);
+}
+
+EAPI void
+_elm_widget_item_content_set_hook_set(Elm_Widget_Item *item,
+                                      Elm_Widget_On_Content_Set_Cb func)
+{
+   ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+   item->on_content_set_func = func;
+}
+
+EAPI void
+_elm_widget_item_content_get_hook_set(Elm_Widget_Item *item,
+                                      Elm_Widget_On_Content_Get_Cb func)
+{
+   ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+   item->on_content_get_func = func;
+}
+
+EAPI void
+_elm_widget_item_content_unset_hook_set(Elm_Widget_Item *item,
+                                        Elm_Widget_On_Content_Unset_Cb func)
+{
+   ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+   item->on_content_unset_func = func;
+}
+
+EAPI void
+_elm_widget_item_text_set_hook_set(Elm_Widget_Item *item,
+                                   Elm_Widget_On_Text_Set_Cb func)
+{
+   ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+   item->on_text_set_func = func;
+}
+
+EAPI void
+_elm_widget_item_text_get_hook_set(Elm_Widget_Item *item,
+                                   Elm_Widget_On_Text_Get_Cb func)
+{
+   ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+   item->on_text_get_func = func;
+}
+
+EAPI void
+_elm_widget_item_signal_emit_hook_set(Elm_Widget_Item *item,
+                                      Elm_Widget_On_Signal_Emit_Cb func)
+{
+   ELM_WIDGET_ITEM_CHECK_OR_RETURN(item);
+   item->on_signal_emit_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)
 {
@@ -2727,7 +3299,12 @@ _newest_focus_order_get(Evas_Object  *obj,
    Evas_Object *child, *ret, *best;
 
    API_ENTRY return NULL;
-   if (!evas_object_visible_get(obj)) return NULL;
+
+   if (!evas_object_visible_get(obj)
+       || (elm_widget_disabled_get(obj))
+       || (elm_widget_tree_unfocusable_get(obj)))
+     return NULL;
+
    best = NULL;
    if (*newest_focus_order < sd->focus_order)
      {
@@ -2767,8 +3344,8 @@ _if_focused_revert(Evas_Object *obj,
         newest = _newest_focus_order_get(top, &newest_focus_order, can_focus_only);
         if (newest)
           {
-             elm_object_unfocus(newest);
-             elm_object_focus(newest);
+             elm_object_focus_set(newest, EINA_FALSE);
+             elm_object_focus_set(newest, EINA_TRUE);
           }
      }
 }
@@ -2778,6 +3355,7 @@ _smart_del(Evas_Object *obj)
 {
    Evas_Object *sobj;
    Edje_Signal_Data *esd;
+   Elm_Translate_String_Data *ts;
 
    INTERNAL_ENTRY
 
@@ -2812,12 +3390,20 @@ _smart_del(Evas_Object *obj)
         eina_stringshare_del(esd->source);
         free(esd);
      }
+   EINA_LIST_FREE(sd->translate_strings, ts)
+     {
+        eina_stringshare_del(ts->id);
+        eina_stringshare_del(ts->domain);
+        eina_stringshare_del(ts->string);
+        free(ts);
+     }
    eina_list_free(sd->event_cb); /* should be empty anyway */
    if (sd->del_func) sd->del_func(obj);
    if (sd->style) eina_stringshare_del(sd->style);
    if (sd->type) eina_stringshare_del(sd->type);
    if (sd->theme) elm_theme_free(sd->theme);
    _if_focused_revert(obj, EINA_TRUE);
+   if (sd->access_info) eina_stringshare_del(sd->access_info);
    free(sd);
 }
 
@@ -2865,7 +3451,8 @@ _smart_hide(Evas_Object *obj)
    Eina_List *list;
    Evas_Object *o;
    INTERNAL_ENTRY
-     list = evas_object_smart_members_get(obj);
+
+   list = evas_object_smart_members_get(obj);
    EINA_LIST_FREE(list, o)
      {
         if (evas_object_data_get(o, "_elm_leaveme")) continue;
@@ -2938,30 +3525,30 @@ static void
 _smart_init(void)
 {
    if (_e_smart) return;
-   {
-      static const Evas_Smart_Class sc =
-      {
-         SMART_NAME,
-         EVAS_SMART_CLASS_VERSION,
-         _smart_add,
-         _smart_del,
-         _smart_move,
-         _smart_resize,
-         _smart_show,
-         _smart_hide,
-         _smart_color_set,
-         _smart_clip_set,
-         _smart_clip_unset,
-         _smart_calculate,
-         NULL,
-         NULL,
-         NULL,
-         NULL,
-         NULL,
-         NULL
-      };
-      _e_smart = evas_smart_class_new(&sc);
-   }
+     {
+        static const Evas_Smart_Class sc =
+          {
+             SMART_NAME,
+             EVAS_SMART_CLASS_VERSION,
+             _smart_add,
+             _smart_del,
+             _smart_move,
+             _smart_resize,
+             _smart_show,
+             _smart_hide,
+             _smart_color_set,
+             _smart_clip_set,
+             _smart_clip_unset,
+             _smart_calculate,
+             NULL,
+             NULL,
+             NULL,
+             NULL,
+             NULL,
+             NULL
+          };
+        _e_smart = evas_smart_class_new(&sc);
+     }
 }
 
 /* happy debug functions */
@@ -3069,4 +3656,4 @@ elm_widget_tree_dot_dump(const Evas_Object *top,
    (void)top;
    (void)output;
 #endif
-}
\ No newline at end of file
+}