Elementary: replace eo_data_get for objects data referencing.
[platform/upstream/elementary.git] / src / lib / elc_ctxpopup.c
index 9733cbc..a8bea71 100644 (file)
 #include <Elementary.h>
 #include "elm_priv.h"
+#include "elm_widget_ctxpopup.h"
 
-typedef struct _Widget_Data Widget_Data;
-typedef struct _Elm_Ctxpopup_Item Elm_Ctxpopup_Item;
+EAPI Eo_Op ELM_OBJ_CTXPOPUP_BASE_ID = EO_NOOP;
 
-struct _Elm_Ctxpopup_Item
-{
-   ELM_WIDGET_ITEM;
-   const char *label;
-   Evas_Object *icon;
-   Evas_Smart_Cb func;
-   Eina_Bool disabled:1;
-};
+#define MY_CLASS ELM_OBJ_CTXPOPUP_CLASS
 
-struct _Widget_Data
-{
-   Evas_Object *parent;
-   Evas_Object *base;
-   Evas_Object *content;
-   Evas_Object *box;
-   Evas_Object *arrow;
-   Evas_Object *scr;
-   Evas_Object *bg;
-   Eina_List *items;
-   Elm_Ctxpopup_Direction dir;
-   Elm_Ctxpopup_Direction dir_priority[4];
-   Evas_Coord max_sc_w, max_sc_h;
-   Eina_Bool horizontal:1;
-   Eina_Bool visible:1;
-   Eina_Bool finished:1;
-};
+#define MY_CLASS_NAME "elm_ctxpopup"
 
-static const char *widtype = NULL;
-
-static void _freeze_on(void *data, Evas_Object *obj, void *event_info);
-static void _freeze_off(void *data, Evas_Object *obj, void *event_info);
-static void _hold_on(void *data, Evas_Object *obj, void *event_info);
-static void _hold_off(void *data, Evas_Object *obj, void *event_info);
-static void _scroller_size_reset(Widget_Data *wd);
-static void _on_focus_hook(void *data, Evas_Object *obj);
-static Eina_Bool _event_hook(Evas_Object *obj,
-                             Evas_Object *src,
-                             Evas_Callback_Type type,
-                             void *event_info);
-static void _parent_cut_off(Evas_Object *obj);
-static void _parent_resize(void *data,
-                           Evas *e,
-                           Evas_Object *obj,
-                           void *event_info);
-static void _parent_move(void *data,
-                         Evas *e,
-                         Evas_Object *obj,
-                         void *event_info);
-static void _parent_del(void *data,
-                        Evas *e,
-                        Evas_Object *obj,
-                        void *event_info);
-static void _item_sizing_eval(Elm_Ctxpopup_Item *item);
-static void _adjust_pos_x(Evas_Coord_Point *pos,
-                          Evas_Coord_Point *base_size,
-                          Evas_Coord_Rectangle *hover_area);
-static void _adjust_pos_y(Evas_Coord_Point *pos,
-                          Evas_Coord_Point *base_size,
-                          Evas_Coord_Rectangle *hover_area);
-static Elm_Ctxpopup_Direction _calc_base_geometry(Evas_Object *obj,
-                                                  Evas_Coord_Rectangle *rect);
-static void _update_arrow(Evas_Object *obj, Elm_Ctxpopup_Direction dir);
-static void _sizing_eval(Evas_Object *obj);
-static void _shift_base_by_arrow(Evas_Object *arrow,
-                                 Elm_Ctxpopup_Direction dir,
-                                 Evas_Coord_Rectangle *rect);
-static void _del_pre_hook(Evas_Object *obj);
-static void _del_hook(Evas_Object *obj);
-static void _theme_hook(Evas_Object *obj);
-static void _content_set_hook(Evas_Object *obj,
-                              const char *part,
-                              Evas_Object *content);
-static Evas_Object * _content_unset_hook(Evas_Object *obj,
-                                         const char *part__);
-static Evas_Object * _content_get_hook(const Evas_Object *obj,
-                                       const char *part);
-static void _bg_clicked_cb(void *data, Evas_Object *obj,
-                           const char *emission,
-                           const char *source);
-static void _ctxpopup_show(void *data,
-                           Evas *e,
-                           Evas_Object *obj,
-                           void *event_info);
-static void _hide(Evas_Object *obj);
-static void _ctxpopup_hide(void *data,
-                           Evas *e,
-                           Evas_Object *obj,
-                           void *event_info);
-static void _scroller_resize(void *data,
-                             Evas *e,
-                             Evas_Object *obj,
-                             void *event_info);
-static void _ctxpopup_move(void *data,
-                           Evas *e,
-                           Evas_Object *obj,
-                           void *event_info);
-static void _item_select_cb(void *data, Evas_Object *obj,
-                            const char *emission,
-                            const char *source);
-static void _item_icon_set(Elm_Ctxpopup_Item *item, Evas_Object *icon);
-static void _item_label_set(Elm_Ctxpopup_Item *item, const char *label);
-static void _item_new(Elm_Ctxpopup_Item *item, char *group_name);
-static void _content_del(void *data,
-                         Evas *e,
-                         Evas_Object *obj,
-                         void *event_info);
-static void _list_del(Widget_Data *wd);
-static void _list_new(Evas_Object *obj);
-static void _remove_items(Widget_Data * wd);
+EAPI const char ELM_CTXPOPUP_SMART_NAME[] = "elm_ctxpopup";
 
 static const char SIG_DISMISSED[] = "dismissed";
+static const char SIG_LANG_CHANGED[] = "language,changed";
 
-static const Evas_Smart_Cb_Description _signals[] = {
+static const Evas_Smart_Cb_Description _smart_callbacks[] = {
    {SIG_DISMISSED, ""},
+   {SIG_LANG_CHANGED, ""},
    {NULL, NULL}
 };
 
 static void
-_freeze_on(void *data __UNUSED__, Evas_Object *obj,
-           void *event_info __UNUSED__)
+_elm_ctxpopup_smart_translate(Eo *obj, void *_pd, va_list *list)
 {
-   Widget_Data *wd = elm_widget_data_get(obj);
+   Eina_Bool *ret = va_arg(*list, Eina_Bool *);
+   Elm_Ctxpopup_Smart_Data *sd = _pd;
+   Eina_List *l;
+   Elm_Ctxpopup_Item *it;
 
-   if ((!wd) || (!wd->scr)) return;
-   elm_object_scroll_freeze_push(wd->scr);
-}
+   evas_object_hide(obj);
 
-static void
-_freeze_off(void *data __UNUSED__, Evas_Object *obj,
-            void *event_info __UNUSED__)
-{
-   Widget_Data *wd = elm_widget_data_get(obj);
+   EINA_LIST_FOREACH(sd->items, l, it)
+     elm_widget_item_translate(it);
 
-   if ((!wd) || (!wd->scr)) return;
-   elm_object_scroll_freeze_pop(wd->scr);
+   if (ret) *ret = EINA_TRUE;
 }
 
 static void
-_hold_on(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
+_elm_ctxpopup_smart_focus_next_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
 {
-   Widget_Data *wd = elm_widget_data_get(obj);
-
-   if ((!wd) || (!wd->scr)) return;
-   elm_object_scroll_hold_push(wd->scr);
+   Eina_Bool *ret = va_arg(*list, Eina_Bool *);
+   *ret = EINA_TRUE;
 }
 
 static void
-_hold_off(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
+_elm_ctxpopup_smart_focus_direction_manager_is(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
 {
-   Widget_Data *wd = elm_widget_data_get(obj);
-
-   if ((!wd) || (!wd->scr)) return;
-   elm_object_scroll_hold_pop(wd->scr);
+   Eina_Bool *ret = va_arg(*list, Eina_Bool *);
+   *ret = EINA_TRUE;
 }
 
 static void
-_scroller_size_reset(Widget_Data *wd)
+_elm_ctxpopup_smart_focus_next(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
 {
-   wd->finished = EINA_FALSE;
-   wd->max_sc_h = -1;
-   wd->max_sc_w = -1;
-}
+   Elm_Ctxpopup_Smart_Data *sd = _pd;
 
-static void
-_on_focus_hook(void *data __UNUSED__, Evas_Object *obj)
-{
-   Widget_Data *wd = elm_widget_data_get(obj);
-   if (!wd) return;
+   Elm_Focus_Direction dir = va_arg(*list, Elm_Focus_Direction);
+   Evas_Object **next = va_arg(*list, Evas_Object **);
+   Eina_Bool *ret = va_arg(*list, Eina_Bool *);
+   if (ret) *ret = EINA_FALSE;
 
-   if (elm_widget_focus_get(obj))
-     {
-        //FIXME:
-     }
-   else
+   if (!sd)
+     return;
+
+   if (!elm_widget_focus_next_get(sd->box, dir, next))
      {
-        //FIXME:
+        elm_widget_focused_object_clear(sd->box);
+        elm_widget_focus_next_get(sd->box, dir, next);
      }
-}
 
-static Eina_Bool
-_event_hook(Evas_Object *obj, Evas_Object *src __UNUSED__, Evas_Callback_Type type, void *event_info)
-{
-   Evas_Event_Key_Down *ev;
-   Widget_Data *wd;
-
-   if (type != EVAS_CALLBACK_KEY_DOWN)
-     return EINA_FALSE;
-   wd = elm_widget_data_get(obj);
-   if (!wd) return EINA_FALSE;
-
-   ev = event_info;
-   if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return EINA_FALSE;
-   if (strcmp(ev->keyname, "Escape")) return EINA_FALSE;
-
-   evas_object_hide(obj);
-   ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
-   return EINA_TRUE;
+   if (ret) *ret = EINA_TRUE;
 }
 
 static void
-_parent_cut_off(Evas_Object *obj)
+_elm_ctxpopup_smart_focus_direction(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
 {
-   Widget_Data *wd = elm_widget_data_get(obj);
+   Elm_Ctxpopup_Smart_Data *sd = _pd;
 
-   if (!wd) return;
+   Evas_Object *base = va_arg(*list, Evas_Object *);
+   double degree = va_arg(*list, double);
+   Evas_Object **direction = va_arg(*list, Evas_Object **);
+   double *weight = va_arg(*list, double *);
+   Eina_Bool *ret = va_arg(*list, Eina_Bool *);
+   if (ret) *ret = EINA_FALSE;
+   Eina_Bool int_ret;
 
-   evas_object_event_callback_del_full(wd->parent,
-                                       EVAS_CALLBACK_DEL,
-                                       _parent_del,
-                                       obj);
-   evas_object_event_callback_del_full(wd->parent,
-                                       EVAS_CALLBACK_MOVE,
-                                       _parent_move,
-                                       obj);
-   evas_object_event_callback_del_full(wd->parent,
-                                       EVAS_CALLBACK_RESIZE,
-                                       _parent_resize,
-                                       obj);
+   Eina_List *l = NULL;
+   void *(*list_data_get)(const Eina_List *list);
 
-   elm_widget_sub_object_del(wd->parent, obj);
-}
+   if (!sd)
+     return;
 
-static void
-_parent_resize(void *data,
-               Evas *e __UNUSED__,
-               Evas_Object *obj __UNUSED__,
-               void *event_info __UNUSED__)
-{
-   Widget_Data *wd = elm_widget_data_get(data);
-   if (!wd) return;
+   list_data_get = eina_list_data_get;
 
-   wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
+   l = eina_list_append(l, sd->box);
 
-   _hide(data);
+   int_ret = elm_widget_focus_list_direction_get
+            (obj, base, l, list_data_get, degree, direction, weight);
+   if (ret) *ret = int_ret;
+   eina_list_free(l);
 }
 
+
 static void
-_parent_move(void *data,
-             Evas *e __UNUSED__,
-             Evas_Object *obj __UNUSED__,
-             void *event_info __UNUSED__)
+_elm_ctxpopup_smart_event(Eo *obj, void *_pd, va_list *list)
 {
-   Widget_Data *wd = elm_widget_data_get(data);
+   Evas_Object *src = va_arg(*list, Evas_Object *);
+   (void)src;
+   Evas_Callback_Type type = va_arg(*list, Evas_Callback_Type);
+   void *event_info = va_arg(*list, void *);
+   Eina_Bool *ret = va_arg(*list, Eina_Bool *);
+   if (ret) *ret = EINA_FALSE;
 
-   if (!wd) return;
+   Evas_Event_Key_Down *ev = event_info;
 
-   wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
+   Elm_Ctxpopup_Smart_Data *sd = _pd;
 
-   if (wd->visible)
+   if (elm_widget_disabled_get(obj)) return;
+   if (type != EVAS_CALLBACK_KEY_DOWN) return;
+   if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return;
+
+   if (!strcmp(ev->keyname, "Tab"))
      {
-        _scroller_size_reset(wd);
-        _sizing_eval(obj);
+        if (evas_key_modifier_is_set(ev->modifiers, "Shift"))
+          elm_widget_focus_cycle(sd->box, ELM_FOCUS_PREVIOUS);
+        else
+          elm_widget_focus_cycle(sd->box, ELM_FOCUS_NEXT);
+        if (ret) *ret = EINA_TRUE;
+        return;
      }
-}
 
-static void
-_parent_del(void *data,
-            Evas *e __UNUSED__,
-            Evas_Object *obj __UNUSED__,
-            void *event_info __UNUSED__)
-{
-   evas_object_del(data);
-}
+   if (strcmp(ev->keyname, "Escape")) return;
 
-static void
-_item_sizing_eval(Elm_Ctxpopup_Item *item)
-{
-   Evas_Coord min_w = -1, min_h = -1, max_w = -1, max_h = -1;
-
-   if (!item) return;
-
-   edje_object_size_min_restricted_calc(VIEW(item), &min_w, &min_h, min_w,
-                                        min_h);
-   evas_object_size_hint_min_set(VIEW(item), min_w, min_h);
-   evas_object_size_hint_max_set(VIEW(item), max_w, max_h);
+   evas_object_hide(obj);
+   ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
+   if (ret) *ret = EINA_TRUE;
 }
 
 static void
-_adjust_pos_x(Evas_Coord_Point *pos, Evas_Coord_Point *base_size,
+_x_pos_adjust(Evas_Coord_Point *pos,
+              Evas_Coord_Point *base_size,
               Evas_Coord_Rectangle *hover_area)
 {
    pos->x -= (base_size->x / 2);
@@ -300,7 +156,8 @@ _adjust_pos_x(Evas_Coord_Point *pos, Evas_Coord_Point *base_size,
 }
 
 static void
-_adjust_pos_y(Evas_Coord_Point *pos, Evas_Coord_Point *base_size,
+_y_pos_adjust(Evas_Coord_Point *pos,
+              Evas_Coord_Point *base_size,
               Evas_Coord_Rectangle *hover_area)
 {
    pos->y -= (base_size->y / 2);
@@ -318,40 +175,41 @@ _adjust_pos_y(Evas_Coord_Point *pos, Evas_Coord_Point *base_size,
 }
 
 static Elm_Ctxpopup_Direction
-_calc_base_geometry(Evas_Object *obj, Evas_Coord_Rectangle *rect)
+_base_geometry_calc(Evas_Object *obj,
+                    Evas_Coord_Rectangle *rect)
 {
-   Widget_Data *wd;
+   Elm_Ctxpopup_Direction dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
+   Evas_Coord_Rectangle hover_area;
    Evas_Coord_Point pos = {0, 0};
+   Evas_Coord_Point arrow_size;
    Evas_Coord_Point base_size;
    Evas_Coord_Point max_size;
    Evas_Coord_Point min_size;
-   Evas_Coord_Rectangle hover_area;
-   Evas_Coord_Point arrow_size;
-   Elm_Ctxpopup_Direction dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
    Evas_Coord_Point temp;
    int idx;
 
-   wd = elm_widget_data_get(obj);
+   ELM_CTXPOPUP_DATA_GET(obj, sd);
+   Elm_Widget_Smart_Data *wd = eo_data_scope_get(obj, ELM_OBJ_WIDGET_CLASS);
 
-   if ((!wd) || (!rect))
-     return ELM_CTXPOPUP_DIRECTION_DOWN;
+   if (!rect || !sd->parent) return ELM_CTXPOPUP_DIRECTION_DOWN;
 
-   edje_object_part_geometry_get(wd->arrow, "ctxpopup_arrow", NULL, NULL,
-                                 &arrow_size.x, &arrow_size.y);
-   evas_object_resize(wd->arrow, arrow_size.x, arrow_size.y);
+   edje_object_part_geometry_get
+     (sd->arrow, "ctxpopup_arrow", NULL, NULL, &arrow_size.x, &arrow_size.y);
+   evas_object_resize(sd->arrow, arrow_size.x, arrow_size.y);
 
    //Initialize Area Rectangle.
-   evas_object_geometry_get(wd->parent,
-                            &hover_area.x,
-                            &hover_area.y,
-                            &hover_area.w,
-                            &hover_area.h);
+   evas_object_geometry_get
+     (sd->parent, &hover_area.x, &hover_area.y, &hover_area.w,
+     &hover_area.h);
+   if (!strcmp(evas_object_type_get(sd->parent), "elm_win"))
+     hover_area.x = hover_area.y = 0;
 
    evas_object_geometry_get(obj, &pos.x, &pos.y, NULL, NULL);
 
    //recalc the edje
-   edje_object_size_min_calc(wd->base, &base_size.x, &base_size.y);
-   evas_object_smart_calculate(wd->base);
+   edje_object_size_min_calc
+     (wd->resize_obj, &base_size.x, &base_size.y);
+   evas_object_smart_calculate(wd->resize_obj);
 
    //Limit to Max Size
    evas_object_size_hint_max_get(obj, &max_size.x, &max_size.y);
@@ -375,43 +233,50 @@ _calc_base_geometry(Evas_Object *obj, Evas_Coord_Rectangle *rect)
    //If find a avaialble direction, it adjusts position and size.
    for (idx = 0; idx < 4; idx++)
      {
-        switch (wd->dir_priority[idx])
+        switch (sd->dir_priority[idx])
           {
-           case ELM_CTXPOPUP_DIRECTION_UNKNOWN:
            case ELM_CTXPOPUP_DIRECTION_UP:
-              temp.y = (pos.y - base_size.y);
-              if ((temp.y - arrow_size.y) < hover_area.y)
-                continue;
-              _adjust_pos_x(&pos, &base_size, &hover_area);
-              pos.y -= base_size.y;
-              dir = ELM_CTXPOPUP_DIRECTION_UP;
-              break;
+             temp.y = (pos.y - base_size.y);
+             if ((temp.y - arrow_size.y) < hover_area.y)
+               continue;
+
+             _x_pos_adjust(&pos, &base_size, &hover_area);
+             pos.y -= base_size.y;
+             dir = ELM_CTXPOPUP_DIRECTION_UP;
+             break;
+
            case ELM_CTXPOPUP_DIRECTION_LEFT:
-              temp.x = (pos.x - base_size.x);
-              if ((temp.x - arrow_size.x) < hover_area.x)
-                continue;
-              _adjust_pos_y(&pos, &base_size, &hover_area);
-              pos.x -= base_size.x;
-              dir = ELM_CTXPOPUP_DIRECTION_LEFT;
-              break;
+             temp.x = (pos.x - base_size.x);
+             if ((temp.x - arrow_size.x) < hover_area.x)
+               continue;
+
+             _y_pos_adjust(&pos, &base_size, &hover_area);
+             pos.x -= base_size.x;
+             dir = ELM_CTXPOPUP_DIRECTION_LEFT;
+             break;
+
            case ELM_CTXPOPUP_DIRECTION_RIGHT:
-              temp.x = (pos.x + base_size.x);
-              if ((temp.x + arrow_size.x) >
-                  (hover_area.x + hover_area.w))
-                continue;
-              _adjust_pos_y(&pos, &base_size, &hover_area);
-              dir = ELM_CTXPOPUP_DIRECTION_RIGHT;
-              break;
+             temp.x = (pos.x + base_size.x);
+             if ((temp.x + arrow_size.x) >
+                 (hover_area.x + hover_area.w))
+               continue;
+
+             _y_pos_adjust(&pos, &base_size, &hover_area);
+             dir = ELM_CTXPOPUP_DIRECTION_RIGHT;
+             break;
+
            case ELM_CTXPOPUP_DIRECTION_DOWN:
-              temp.y = (pos.y + base_size.y);
-              if ((temp.y + arrow_size.y) >
-                  (hover_area.y + hover_area.h))
-                continue;
-              _adjust_pos_x(&pos, &base_size, &hover_area);
-              dir = ELM_CTXPOPUP_DIRECTION_DOWN;
-              break;
+             temp.y = (pos.y + base_size.y);
+             if ((temp.y + arrow_size.y) >
+                 (hover_area.y + hover_area.h))
+               continue;
+
+             _x_pos_adjust(&pos, &base_size, &hover_area);
+             dir = ELM_CTXPOPUP_DIRECTION_DOWN;
+             break;
+
            default:
-              break;
+             continue;
           }
         break;
      }
@@ -421,7 +286,7 @@ _calc_base_geometry(Evas_Object *obj, Evas_Coord_Rectangle *rect)
      {
         Evas_Coord length[2];
 
-        if(!wd->horizontal)
+        if (!sd->horizontal)
           {
              length[0] = pos.y - hover_area.y;
              length[1] = (hover_area.y + hover_area.h) - pos.y;
@@ -429,7 +294,7 @@ _calc_base_geometry(Evas_Object *obj, Evas_Coord_Rectangle *rect)
              // ELM_CTXPOPUP_DIRECTION_UP
              if (length[0] > length[1])
                {
-                  _adjust_pos_x(&pos, &base_size, &hover_area);
+                  _x_pos_adjust(&pos, &base_size, &hover_area);
                   pos.y -= base_size.y;
                   dir = ELM_CTXPOPUP_DIRECTION_UP;
                   if (pos.y < (hover_area.y + arrow_size.y))
@@ -441,13 +306,13 @@ _calc_base_geometry(Evas_Object *obj, Evas_Coord_Rectangle *rect)
              //ELM_CTXPOPUP_DIRECTION_DOWN
              else
                {
-                  _adjust_pos_x(&pos, &base_size, &hover_area);
+                  _x_pos_adjust(&pos, &base_size, &hover_area);
                   dir = ELM_CTXPOPUP_DIRECTION_DOWN;
                   if ((pos.y + arrow_size.y + base_size.y) >
                       (hover_area.y + hover_area.h))
-                     base_size.y -=
-                        ((pos.y + arrow_size.y + base_size.y) -
-                         (hover_area.y + hover_area.h));
+                    base_size.y -=
+                      ((pos.y + arrow_size.y + base_size.y) -
+                       (hover_area.y + hover_area.h));
                }
           }
         else
@@ -458,7 +323,7 @@ _calc_base_geometry(Evas_Object *obj, Evas_Coord_Rectangle *rect)
              //ELM_CTXPOPUP_DIRECTION_LEFT
              if (length[0] > length[1])
                {
-                  _adjust_pos_y(&pos, &base_size, &hover_area);
+                  _y_pos_adjust(&pos, &base_size, &hover_area);
                   pos.x -= base_size.x;
                   dir = ELM_CTXPOPUP_DIRECTION_LEFT;
                   if (pos.x < (hover_area.x + arrow_size.x))
@@ -470,13 +335,13 @@ _calc_base_geometry(Evas_Object *obj, Evas_Coord_Rectangle *rect)
              //ELM_CTXPOPUP_DIRECTION_RIGHT
              else
                {
-                  _adjust_pos_y(&pos, &base_size, &hover_area);
+                  _y_pos_adjust(&pos, &base_size, &hover_area);
                   dir = ELM_CTXPOPUP_DIRECTION_RIGHT;
                   if (pos.x + (arrow_size.x + base_size.x) >
                       hover_area.x + hover_area.w)
-                     base_size.x -=
-                        ((pos.x + arrow_size.x + base_size.x) -
-                         (hover_area.x + hover_area.w));
+                    base_size.x -=
+                      ((pos.x + arrow_size.x + base_size.x) -
+                       (hover_area.x + hover_area.w));
                }
           }
      }
@@ -491,950 +356,1028 @@ _calc_base_geometry(Evas_Object *obj, Evas_Coord_Rectangle *rect)
 }
 
 static void
-_update_arrow(Evas_Object *obj, Elm_Ctxpopup_Direction dir)
+_arrow_update(Evas_Object *obj,
+              Elm_Ctxpopup_Direction dir,
+              Evas_Coord_Rectangle base_size)
 {
-   Evas_Coord x, y;
    Evas_Coord_Rectangle arrow_size;
-   Evas_Coord_Rectangle base_size;
-   Widget_Data *wd;
+   Evas_Coord x, y;
    double drag;
 
-   wd = elm_widget_data_get(obj);
-   if (!wd) return;
+   ELM_CTXPOPUP_DATA_GET(obj, sd);
+   Elm_Widget_Smart_Data *wd = eo_data_scope_get(obj, ELM_OBJ_WIDGET_CLASS);
 
    evas_object_geometry_get(obj, &x, &y, NULL, NULL);
-   evas_object_geometry_get(wd->arrow, NULL, NULL, &arrow_size.w,
-                            &arrow_size.h);
-   evas_object_geometry_get(wd->base, &base_size.x, &base_size.y,
-                            &base_size.w, &base_size.h);
+   evas_object_geometry_get
+     (sd->arrow, NULL, NULL, &arrow_size.w, &arrow_size.h);
 
-   edje_object_part_unswallow(wd->base, wd->arrow);
+   /* arrow is not being kept as sub-object on purpose, here. the
+    * design of the widget does not help with the contrary */
 
    switch (dir)
      {
       case ELM_CTXPOPUP_DIRECTION_RIGHT:
-         edje_object_signal_emit(wd->arrow, "elm,state,left", "elm");
-         edje_object_part_swallow(wd->base,
-                                  "elm.swallow.arrow_left",
-                                  wd->arrow);
-         if (base_size.h > 0)
-           {
-              if (y < ((arrow_size.h * 0.5) + base_size.y))
-                y = 0;
-              else if (y > base_size.y + base_size.h - (arrow_size.h * 0.5))
-                y = base_size.h - arrow_size.h;
-              else
-                y = y - base_size.y - (arrow_size.h * 0.5);
-              drag = (double) (y) / (double) (base_size.h - arrow_size.h);
-              edje_object_part_drag_value_set(wd->base,
-                                              "elm.swallow.arrow_left",
-                                              1,
-                                              drag);
-           }
-         break;
+        edje_object_signal_emit(sd->arrow, "elm,state,left", "elm");
+        edje_object_part_swallow
+           (wd->resize_obj,
+            (elm_widget_mirrored_get(obj) ? "elm.swallow.arrow_right" :
+             "elm.swallow.arrow_left"), sd->arrow);
+
+        if (base_size.h > 0)
+          {
+             if (y < ((arrow_size.h * 0.5) + base_size.y))
+               y = 0;
+             else if (y > base_size.y + base_size.h - (arrow_size.h * 0.5))
+               y = base_size.h - arrow_size.h;
+             else
+               y = y - base_size.y - (arrow_size.h * 0.5);
+             drag = (double)(y) / (double)(base_size.h - arrow_size.h);
+             edje_object_part_drag_value_set
+                (wd->resize_obj,
+                 (elm_widget_mirrored_get(obj) ? "elm.swallow.arrow_right" :
+                  "elm.swallow.arrow_left"), 1, drag);
+          }
+        break;
+
       case ELM_CTXPOPUP_DIRECTION_LEFT:
-         edje_object_signal_emit(wd->arrow, "elm,state,right", "elm");
-         edje_object_part_swallow(wd->base,
-                                  "elm.swallow.arrow_right",
-                                  wd->arrow);
-         if (base_size.h > 0)
-           {
-              if (y < ((arrow_size.h * 0.5) + base_size.y))
-                y = 0;
-              else if (y > (base_size.y + base_size.h - (arrow_size.h * 0.5)))
-                y = base_size.h - arrow_size.h;
-              else
-                y = y - base_size.y - (arrow_size.h * 0.5);
-              drag = (double) (y) / (double) (base_size.h - arrow_size.h);
-              edje_object_part_drag_value_set(wd->base,
-                                              "elm.swallow.arrow_right",
-                                              0,
-                                              drag);
-           }
-         break;
+        edje_object_signal_emit(sd->arrow, "elm,state,right", "elm");
+        edje_object_part_swallow
+           (wd->resize_obj,
+            (elm_widget_mirrored_get(obj) ? "elm.swallow.arrow_left" :
+             "elm.swallow.arrow_right"), sd->arrow);
+
+        if (base_size.h > 0)
+          {
+             if (y < ((arrow_size.h * 0.5) + base_size.y))
+               y = 0;
+             else if (y > (base_size.y + base_size.h - (arrow_size.h * 0.5)))
+               y = base_size.h - arrow_size.h;
+             else
+               y = y - base_size.y - (arrow_size.h * 0.5);
+             drag = (double)(y) / (double)(base_size.h - arrow_size.h);
+             edje_object_part_drag_value_set
+                (wd->resize_obj,
+                 (elm_widget_mirrored_get(obj) ? "elm.swallow.arrow_left" :
+                  "elm.swallow.arrow_right"), 0, drag);
+          }
+        break;
+
       case ELM_CTXPOPUP_DIRECTION_DOWN:
-         edje_object_signal_emit(wd->arrow, "elm,state,top", "elm");
-         edje_object_part_swallow(wd->base, "elm.swallow.arrow_up", wd->arrow);
-         if (base_size.w > 0)
-           {
-              if (x < ((arrow_size.w * 0.5) + base_size.x))
-                x = 0;
-              else if (x > (base_size.x + base_size.w - (arrow_size.w * 0.5)))
-                x = base_size.w - arrow_size.w;
-              else
-                x = x - base_size.x - (arrow_size.w * 0.5);
-              drag = (double) (x) / (double) (base_size.w - arrow_size.w);
-              edje_object_part_drag_value_set(wd->base,
-                                              "elm.swallow.arrow_up",
-                                              drag,
-                                              1);
-           }
-         break;
+        edje_object_signal_emit(sd->arrow, "elm,state,top", "elm");
+        edje_object_part_swallow
+          (wd->resize_obj, "elm.swallow.arrow_up",
+          sd->arrow);
+
+        if (base_size.w > 0)
+          {
+             if (x < ((arrow_size.w * 0.5) + base_size.x))
+               x = 0;
+             else if (x > (base_size.x + base_size.w - (arrow_size.w * 0.5)))
+               x = base_size.w - arrow_size.w;
+             else
+               x = x - base_size.x - (arrow_size.w * 0.5);
+             drag = (double)(x) / (double)(base_size.w - arrow_size.w);
+             edje_object_part_drag_value_set
+               (wd->resize_obj, "elm.swallow.arrow_up", drag,
+               1);
+          }
+        break;
+
       case ELM_CTXPOPUP_DIRECTION_UP:
-         edje_object_signal_emit(wd->arrow, "elm,state,bottom", "elm");
-         edje_object_part_swallow(wd->base,
-                                  "elm.swallow.arrow_down",
-                                  wd->arrow);
-         if (base_size.w > 0)
-           {
-              if (x < ((arrow_size.w * 0.5) + base_size.x))
-                x = 0;
-              else if (x > (base_size.x + base_size.w - (arrow_size.w * 0.5)))
-                x = base_size.w - arrow_size.w;
-              else x = x - base_size.x - (arrow_size.w * 0.5);
-              drag = (double) (x) / (double) (base_size.w - arrow_size.w);
-              edje_object_part_drag_value_set(wd->base,
-                                              "elm.swallow.arrow_down",
-                                              drag,
-                                              0);
-           }
-         break;
+        edje_object_signal_emit(sd->arrow, "elm,state,bottom", "elm");
+        edje_object_part_swallow
+          (wd->resize_obj, "elm.swallow.arrow_down",
+          sd->arrow);
+
+        if (base_size.w > 0)
+          {
+             if (x < ((arrow_size.w * 0.5) + base_size.x))
+               x = 0;
+             else if (x > (base_size.x + base_size.w - (arrow_size.w * 0.5)))
+               x = base_size.w - arrow_size.w;
+             else x = x - base_size.x - (arrow_size.w * 0.5);
+             drag = (double)(x) / (double)(base_size.w - arrow_size.w);
+             edje_object_part_drag_value_set
+               (wd->resize_obj, "elm.swallow.arrow_down",
+               drag, 0);
+          }
+        break;
+
       default:
-         break;
+        break;
      }
+
+   //should be here for getting accurate geometry value
+   evas_object_smart_calculate(wd->resize_obj);
 }
 
 static void
-_show_signal_emit(Evas_Object *obj, Elm_Ctxpopup_Direction dir)
+_show_signals_emit(Evas_Object *obj,
+                   Elm_Ctxpopup_Direction dir)
 {
-   Widget_Data *wd;
+   ELM_CTXPOPUP_DATA_GET(obj, sd);
 
-   wd = elm_widget_data_get(obj);
-   if (!wd || wd->visible) return;
+   if (!sd->visible) return;
+   if ((sd->list) && (!sd->list_visible)) return;
 
    switch (dir)
      {
-        case ELM_CTXPOPUP_DIRECTION_UP:
-           edje_object_signal_emit(wd->base, "elm,state,show,up", "elm");
-           break;
-        case ELM_CTXPOPUP_DIRECTION_LEFT:
-           edje_object_signal_emit(wd->base, "elm,state,show,left", "elm");
-           break;
-        case ELM_CTXPOPUP_DIRECTION_RIGHT:
-           edje_object_signal_emit(wd->base, "elm,state,show,right", "elm");
-           break;
-        case ELM_CTXPOPUP_DIRECTION_DOWN:
-           edje_object_signal_emit(wd->base, "elm,state,show,down", "elm");
-           break;
-        default:
-           break;
+      case ELM_CTXPOPUP_DIRECTION_UP:
+        elm_layout_signal_emit(obj, "elm,state,show,up", "elm");
+        break;
+
+      case ELM_CTXPOPUP_DIRECTION_LEFT:
+        elm_layout_signal_emit(obj,
+              (elm_widget_mirrored_get(obj) ? "elm,state,show,right" :
+               "elm,state,show,left"), "elm");
+        break;
+
+      case ELM_CTXPOPUP_DIRECTION_RIGHT:
+        elm_layout_signal_emit(obj,
+              (elm_widget_mirrored_get(obj) ? "elm,state,show,left" :
+               "elm,state,show,right"), "elm");
+        break;
+
+      case ELM_CTXPOPUP_DIRECTION_DOWN:
+        elm_layout_signal_emit(obj, "elm,state,show,down", "elm");
+        break;
+
+      default:
+        break;
      }
+
+   edje_object_signal_emit(sd->bg, "elm,state,show", "elm");
+   elm_layout_signal_emit(obj, "elm,state,show", "elm");
 }
 
 static void
-_sizing_eval(Evas_Object *obj)
+_hide_signals_emit(Evas_Object *obj,
+                   Elm_Ctxpopup_Direction dir)
 {
-   Widget_Data *wd;
-   Eina_List *elist;
-   Elm_Ctxpopup_Item *item;
-   Evas_Coord_Rectangle rect = { 0, 0, 1, 1 };
-   Evas_Coord_Point box_size = { 0, 0 };
-   Evas_Coord_Point _box_size = { 0, 0 };
+   ELM_CTXPOPUP_DATA_GET(obj, sd);
 
-   wd = elm_widget_data_get(obj);
-   if (!wd) return;
+   if (!sd->visible) return;
 
-   //Box, Scroller
-   EINA_LIST_FOREACH(wd->items, elist, item)
+   switch (dir)
      {
-        _item_sizing_eval(item);
-        evas_object_size_hint_min_get(VIEW(item), &_box_size.x, &_box_size.y);
-        if (!wd->horizontal)
-          {
-             if (_box_size.x > box_size.x)
-               box_size.x = _box_size.x;
-             if (_box_size.y != -1)
-               box_size.y += _box_size.y;
-          }
-        else
-          {
-             if (_box_size.x != -1)
-               box_size.x += _box_size.x;
-             if (_box_size.y > box_size.y)
-               box_size.y = _box_size.y;
-          }
-     }
+      case ELM_CTXPOPUP_DIRECTION_UP:
+        elm_layout_signal_emit(obj, "elm,state,hide,up", "elm");
+        break;
 
-   if (!wd->content)
-     {
-        evas_object_size_hint_min_set(wd->box, box_size.x, box_size.y);
-        evas_object_size_hint_min_set(wd->scr, box_size.x, box_size.y);
-     }
+      case ELM_CTXPOPUP_DIRECTION_LEFT:
+        elm_layout_signal_emit(obj,
+              (elm_widget_mirrored_get(obj) ? "elm,state,hide,right" :
+               "elm,state,hide,left"), "elm");
+        break;
 
-   //Base
-   wd->dir = _calc_base_geometry(obj, &rect);
-   _show_signal_emit(obj, wd->dir);
-   _update_arrow(obj, wd->dir);
-   _shift_base_by_arrow(wd->arrow, wd->dir, &rect);
+      case ELM_CTXPOPUP_DIRECTION_RIGHT:
+        elm_layout_signal_emit(obj,
+              (elm_widget_mirrored_get(obj) ? "elm,state,hide,left" :
+               "elm,state,hide,right"), "elm");
+        break;
+
+      case ELM_CTXPOPUP_DIRECTION_DOWN:
+        elm_layout_signal_emit(obj, "elm,state,hide,down", "elm");
+        break;
 
-   //resize scroller according to final size.
-   if (!wd->content)
-     evas_object_smart_calculate(wd->scr);
+      default:
+        break;
+     }
 
-   evas_object_move(wd->base, rect.x, rect.y);
-   evas_object_resize(wd->base, rect.w, rect.h);
+   edje_object_signal_emit(sd->bg, "elm,state,hide", "elm");
 }
 
 static void
-_shift_base_by_arrow(Evas_Object *arrow, Elm_Ctxpopup_Direction dir,
+_base_shift_by_arrow(Evas_Object *arrow,
+                     Elm_Ctxpopup_Direction dir,
                      Evas_Coord_Rectangle *rect)
 {
    Evas_Coord arrow_w, arrow_h;
 
    evas_object_geometry_get(arrow, NULL, NULL, &arrow_w, &arrow_h);
-
    switch (dir)
      {
       case ELM_CTXPOPUP_DIRECTION_RIGHT:
-         rect->x += arrow_w;
-         break;
+        rect->x += arrow_w;
+        break;
+
       case ELM_CTXPOPUP_DIRECTION_LEFT:
-         rect->x -= arrow_w;
-         break;
+        rect->x -= arrow_w;
+        break;
+
       case ELM_CTXPOPUP_DIRECTION_DOWN:
-         rect->y += arrow_h;
-         break;
+        rect->y += arrow_h;
+        break;
+
       case ELM_CTXPOPUP_DIRECTION_UP:
-         rect->y -= arrow_h;
-         break;
+        rect->y -= arrow_h;
+        break;
+
       default:
-         break;
+        break;
      }
 }
 
 static void
-_del_pre_hook(Evas_Object *obj)
+_elm_ctxpopup_smart_layout_sub_object_add_enable(Eo *obj EINA_UNUSED, void *_pd EINA_UNUSED, va_list *list)
 {
-   Widget_Data *wd;
-
-   wd = elm_widget_data_get(obj);
-   if (!wd) return;
-
-   _parent_cut_off(obj);
+   Eina_Bool *enable = va_arg(*list, Eina_Bool *);
+   *enable = EINA_FALSE;
 }
 
 static void
-_del_hook(Evas_Object *obj)
+_elm_ctxpopup_smart_sub_object_add(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
 {
-   Widget_Data *wd;
+   Evas_Object *sobj = va_arg(*list, Evas_Object *);
+   Eina_Bool *ret = va_arg(*list, Eina_Bool *);
+   Eina_Bool int_ret;
 
-   wd = elm_widget_data_get(obj);
-   if (!wd) return;
+   eo_do_super(obj, MY_CLASS, elm_wdg_sub_object_add(sobj, &int_ret));
 
-   elm_ctxpopup_clear(obj);
-   evas_object_del(wd->arrow);
-   evas_object_del(wd->base);
-   free(wd);
+   if (ret) *ret = int_ret;
 }
 
-//FIXME: lost the content size when theme hook is called. 
 static void
-_theme_hook(Evas_Object *obj)
+_elm_ctxpopup_smart_sizing_eval(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
 {
-   Widget_Data *wd;
-   Eina_List *elist;
-   Elm_Ctxpopup_Item *item;
-   Eina_Bool rtl;
+   Evas_Coord_Rectangle rect = { 0, 0, 1, 1 };
+   Evas_Coord_Point list_size = { 0, 0 };
 
-   wd = elm_widget_data_get(obj);
-   if (!wd) return;
+   Elm_Ctxpopup_Smart_Data *sd = _pd;
+   Elm_Widget_Smart_Data *wd = eo_data_scope_get(obj, ELM_OBJ_WIDGET_CLASS);
+
+   if (!sd->arrow) return;  /* simple way to flag "under deletion" */
+   if (!sd->parent) return; /* do not calculate sizes unless parent is set */
+
+   //Base
+   sd->dir = _base_geometry_calc(obj, &rect);
 
-   _elm_widget_mirrored_reload(obj);
-   rtl = elm_widget_mirrored_get(obj);
+   _arrow_update(obj, sd->dir, rect);
 
-   _elm_theme_object_set(obj, wd->bg, "ctxpopup", "bg",
-                         elm_widget_style_get(obj));
-   _elm_theme_object_set(obj, wd->base, "ctxpopup", "base",
-                         elm_widget_style_get(obj));
-   _elm_theme_object_set(obj, wd->arrow, "ctxpopup", "arrow",
-                         elm_widget_style_get(obj));
+   _base_shift_by_arrow(sd->arrow, sd->dir, &rect);
 
-   //Items
-   EINA_LIST_FOREACH(wd->items, elist, item)
+   if ((sd->list) && (sd->list_visible))
      {
-        edje_object_mirrored_set(VIEW(item), rtl);
-
-        if (item->label && item->icon)
-          _elm_theme_object_set(obj, VIEW(item), "ctxpopup",
-                                "icon_text_style_item",
-                                elm_widget_style_get(obj));
-        else if (item->label)
-          _elm_theme_object_set(obj, VIEW(item), "ctxpopup", "text_style_item",
-                                elm_widget_style_get(obj));
-        else if (item->icon)
-          _elm_theme_object_set(obj, VIEW(item), "ctxpopup", "icon_style_item",
-                                elm_widget_style_get(obj));
-        if (item->label)
-          edje_object_part_text_set(VIEW(item), "elm.text", item->label);
-
-        if (item->disabled)
-          edje_object_signal_emit(VIEW(item), "elm,state,disabled", "elm");
-
-        edje_object_message_signal_process(VIEW(item));
+        evas_object_geometry_get(sd->list, 0, 0, &list_size.x, &list_size.y);
+        if ((list_size.x >= rect.w) || (list_size.y >= rect.h))
+          {
+             elm_list_mode_set(sd->list, ELM_LIST_COMPRESS);
+             evas_object_size_hint_min_set(sd->box, rect.w, rect.h);
+             evas_object_size_hint_min_set(obj, rect.w, rect.h);
+          }
      }
 
-   if (wd->scr)
+   evas_object_move(wd->resize_obj, rect.x, rect.y);
+   evas_object_resize(wd->resize_obj, rect.w, rect.h);
+
+   _show_signals_emit(obj, sd->dir);
+}
+
+static void
+_on_parent_del(void *data,
+               Evas *e __UNUSED__,
+               Evas_Object *obj __UNUSED__,
+               void *event_info __UNUSED__)
+{
+   evas_object_del(data);
+}
+
+static void
+_on_parent_move(void *data,
+                Evas *e __UNUSED__,
+                Evas_Object *obj __UNUSED__,
+                void *event_info __UNUSED__)
+{
+   ELM_CTXPOPUP_DATA_GET(data, sd);
+
+   sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
+
+   if (sd->visible) elm_layout_sizing_eval(data);
+}
+
+static void
+_on_parent_resize(void *data,
+                  Evas *e __UNUSED__,
+                  Evas_Object *obj __UNUSED__,
+                  void *event_info __UNUSED__)
+{
+   ELM_CTXPOPUP_DATA_GET(data, sd);
+
+   sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
+
+   evas_object_hide(data);
+   evas_object_smart_callback_call(data, SIG_DISMISSED, NULL);
+}
+
+static void
+_parent_detach(Evas_Object *obj)
+{
+   ELM_CTXPOPUP_DATA_GET(obj, sd);
+
+   if (!sd->parent) return;
+
+   evas_object_event_callback_del_full
+     (sd->parent, EVAS_CALLBACK_DEL, _on_parent_del, obj);
+   evas_object_event_callback_del_full
+     (sd->parent, EVAS_CALLBACK_MOVE, _on_parent_move, obj);
+   evas_object_event_callback_del_full
+     (sd->parent, EVAS_CALLBACK_RESIZE, _on_parent_resize, obj);
+}
+
+static void
+_on_content_resized(void *data,
+                    Evas *e __UNUSED__,
+                    Evas_Object *obj __UNUSED__,
+                    void *event_info __UNUSED__)
+{
+   ELM_CTXPOPUP_DATA_GET(data, sd);
+
+   elm_box_recalculate(sd->box);
+   elm_layout_sizing_eval(data);
+}
+
+//FIXME: lost the content size when theme hook is called.
+static void
+_elm_ctxpopup_smart_theme(Eo *obj, void *_pd, va_list *list)
+{
+   Elm_Ctxpopup_Smart_Data *sd = _pd;
+
+   Eina_Bool int_ret;
+   Eina_Bool *ret = va_arg(*list, Eina_Bool *);
+   if (ret) *ret = EINA_FALSE;
+
+   eo_do_super(obj, MY_CLASS, elm_wdg_theme(&int_ret));
+   if (!int_ret) return;
+
+   elm_widget_theme_object_set
+     (obj, sd->bg, "ctxpopup", "bg", elm_widget_style_get(obj));
+   elm_widget_theme_object_set
+     (obj, sd->arrow, "ctxpopup", "arrow", elm_widget_style_get(obj));
+
+   if (sd->list)
      {
         if (!strncmp(elm_object_style_get(obj), "default", strlen("default")))
-           elm_object_style_set(wd->scr, "ctxpopup");
+          elm_object_style_set(sd->list, "ctxpopup");
         else
-           elm_object_style_set(wd->scr, elm_object_style_get(obj));
+          elm_object_style_set(sd->list, elm_object_style_get(obj));
      }
 
-   wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
+   sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
 
-   if (wd->visible)
-     {
-        _scroller_size_reset(wd);
-        _sizing_eval(obj);
-     }
+   if (sd->visible) elm_layout_sizing_eval(obj);
+
+   if (ret) *ret = EINA_TRUE;
 }
 
+/* kind of a big and tricky override here: an internal box will hold
+ * the actual content. content aliases won't be of much help here */
 static void
-_content_set_hook(Evas_Object *obj, const char *part __UNUSED__,
-                  Evas_Object *content)
+_elm_ctxpopup_smart_content_set(Eo *obj, void *_pd, va_list *list)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype);
+   Evas_Coord min_w = -1, min_h = -1;
+
+   Elm_Ctxpopup_Smart_Data *sd = _pd;
+   const char *part = va_arg(*list, const char *);
+   Evas_Object *content = va_arg(*list, Evas_Object *);
+   Eina_Bool *ret = va_arg(*list, Eina_Bool *);
+   Eina_Bool int_ret = EINA_TRUE;
+
+   if ((part) && (strcmp(part, "default")))
+     {
+        eo_do_super(obj, MY_CLASS, elm_obj_container_content_set(part, content, &int_ret));
+        goto end;
+     }
+
+   if (!content)
+     {
+        int_ret = EINA_FALSE;
+        goto end;
+     }
 
-   Widget_Data *wd;
+   if (content == sd->content) goto end;
 
-   wd = elm_widget_data_get(obj);
-   if ((!wd) || (!content)) return;
+   if (sd->content) evas_object_del(sd->content);
+   if (sd->content == sd->list) sd->list = NULL;
 
-   if (wd->items) elm_ctxpopup_clear(obj);
-   if (wd->content) evas_object_del(wd->content);
+   evas_object_size_hint_weight_set
+     (content, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+   evas_object_size_hint_fill_set
+     (content, EVAS_HINT_FILL, EVAS_HINT_FILL);
 
-   evas_object_event_callback_add(content, EVAS_CALLBACK_DEL, _content_del,
-                                  obj);
+   /* since it's going to be a box content, not a layout's... */
+   evas_object_show(content);
 
-   elm_widget_sub_object_add(obj, content);
-   edje_object_part_swallow(wd->base, "elm.swallow.content", content);
+   evas_object_size_hint_min_get(content, &min_w, &min_h);
+   evas_object_size_hint_min_set(sd->box, min_w, min_h);
+   elm_box_pack_end(sd->box, content);
 
-   wd->content = content;
+   sd->content = content;
+   sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
 
-   wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
+   if (sd->visible) elm_layout_sizing_eval(obj);
 
-   if (wd->visible)
-     _sizing_eval(obj);
+end:
+   if (ret) *ret = int_ret;
 }
 
-static Evas_Object *
-_content_unset_hook(Evas_Object *obj, const char *part __UNUSED__)
+static void
+_elm_ctxpopup_smart_content_get(Eo *obj, void *_pd, va_list *list)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+   const char *part = va_arg(*list, const char *);
+   Evas_Object **ret = va_arg(*list, Evas_Object **);
+   *ret = NULL;
+
+   if ((part) && (strcmp(part, "default")))
+     {
+        eo_do_super(obj, MY_CLASS, elm_obj_container_content_get(part, ret));
+        return;
+     }
 
-   Widget_Data *wd;
+   Elm_Ctxpopup_Smart_Data *sd = _pd;
+
+   *ret = sd->content;
+}
+
+static void
+_elm_ctxpopup_smart_content_unset(Eo *obj, void *_pd, va_list *list)
+{
    Evas_Object *content;
 
-   wd = elm_widget_data_get(obj);
-   if (!wd) return NULL;
+   const char *part = va_arg(*list, const char *);
+   Evas_Object **ret = va_arg(*list, Evas_Object **);
 
-   content = wd->content;
-   if (!content) return NULL;
+   if ((part) && (strcmp(part, "default")))
+     {
+        eo_do_super(obj, MY_CLASS, elm_obj_container_content_unset(part, &content));
+        goto end;
+     }
 
-   edje_object_part_unswallow(wd->base, content);
-   elm_widget_sub_object_del(obj, content);
-   evas_object_event_callback_del(content, EVAS_CALLBACK_DEL, _content_del);
-   edje_object_signal_emit(wd->base, "elm,state,content,disable", "elm");
+   Elm_Ctxpopup_Smart_Data *sd = _pd;
+   content = sd->content;
+   if (!content) goto end;
 
-   wd->content = NULL;
-   wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
+   sd->content = NULL;
+   sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
 
-   return content;
+   if (sd->visible) elm_layout_sizing_eval(obj);
 
+end:
+   if (ret) *ret = content;
 }
 
-static Evas_Object *
-_content_get_hook(const Evas_Object *obj, const char *part __UNUSED__)
+static void
+_item_text_set_hook(Elm_Object_Item *it,
+                    const char *part,
+                    const char *label)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
+   Elm_Ctxpopup_Item *ctxpopup_it;
+
+   if ((part) && (strcmp(part, "default"))) return;
+
+   ctxpopup_it = (Elm_Ctxpopup_Item *)it;
 
-   Widget_Data *wd = elm_widget_data_get(obj);
-   if (!wd) return NULL;
-   return wd->content;
+   ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd);
+
+   elm_object_item_part_text_set(ctxpopup_it->list_item, "default", label);
+   sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
+
+   if (sd->visible) elm_layout_sizing_eval(WIDGET(ctxpopup_it));
 }
 
-static void
-_bg_clicked_cb(void *data, Evas_Object *obj __UNUSED__,
-               const char *emission __UNUSED__, const char *source __UNUSED__)
+static const char *
+_item_text_get_hook(const Elm_Object_Item *it,
+                    const char *part)
 {
-   evas_object_hide(data);
+   Elm_Ctxpopup_Item *ctxpopup_it;
+
+   if (part && strcmp(part, "default")) return NULL;
+
+   ctxpopup_it = (Elm_Ctxpopup_Item *)it;
+   return elm_object_item_part_text_get(ctxpopup_it->list_item, "default");
 }
 
 static void
-_ctxpopup_show(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
-               void *event_info __UNUSED__)
+_item_content_set_hook(Elm_Object_Item *it,
+                       const char *part,
+                       Evas_Object *content)
 {
-   Widget_Data *wd;
+   Elm_Ctxpopup_Item *ctxpopup_it;
 
-   wd = elm_widget_data_get(obj);
-   if (!wd) return;
+   if ((part) && (strcmp(part, "icon"))
+       && (strcmp(part, "start"))
+       && (strcmp(part, "end"))) return;
 
-   if ((!wd->items) && (!wd->content)) return;
+   ctxpopup_it = (Elm_Ctxpopup_Item *)it;
 
-   wd->visible = EINA_TRUE;
+   ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd);
 
-   evas_object_show(wd->bg);
-   evas_object_show(wd->base);
-   evas_object_show(wd->arrow);
-
-   edje_object_signal_emit(wd->bg, "elm,state,show", "elm");
-   edje_object_signal_emit(wd->base, "elm,state,show", "elm");
+   if ((part) && (!strcmp(part, "end")))
+     elm_object_item_part_content_set(ctxpopup_it->list_item, "end", content);
+   else
+     elm_object_item_part_content_set
+       (ctxpopup_it->list_item, "start", content);
 
-   _sizing_eval(obj);
+   sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
 
-   elm_object_focus_set(obj, EINA_TRUE);
+   if (sd->visible) elm_layout_sizing_eval(WIDGET(ctxpopup_it));
 }
 
-static void
-_hide(Evas_Object *obj)
+static Evas_Object *
+_item_content_get_hook(const Elm_Object_Item *it,
+                       const char *part)
 {
-   Widget_Data *wd = elm_widget_data_get(obj);
+   Elm_Ctxpopup_Item *ctxpopup_it;
+
+   if (part && strcmp(part, "icon") && strcmp(part, "start")
+       && strcmp(part, "end")) return NULL;
 
-   if ((!wd) || (!wd->visible)) return;
+   ctxpopup_it = (Elm_Ctxpopup_Item *)it;
 
-   evas_object_hide(wd->bg);
-   evas_object_hide(wd->arrow);
-   evas_object_hide(wd->base);
+   if (part && !strcmp(part, "end"))
+     return elm_object_item_part_content_get(ctxpopup_it->list_item, "end");
+   else
+     return elm_object_item_part_content_get(ctxpopup_it->list_item, "start");
+}
 
-   _scroller_size_reset(wd);
+static void
+_item_disable_hook(Elm_Object_Item *it)
+{
+   Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *)it;
 
-   evas_object_smart_callback_call(obj, SIG_DISMISSED, NULL);
-   wd->visible = EINA_FALSE;
+   elm_object_item_disabled_set
+     (ctxpopup_it->list_item, elm_widget_item_disabled_get(ctxpopup_it));
 }
 
 static void
-_ctxpopup_hide(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
-               void *event_info __UNUSED__)
+_item_signal_emit_hook(Elm_Object_Item *it,
+                       const char *emission,
+                       const char *source)
 {
-   _hide(obj);
+   Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *)it;
+
+   elm_object_item_signal_emit(ctxpopup_it->list_item, emission, source);
 }
 
 static void
-_scroller_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj,
-                 void *event_info __UNUSED__)
+_bg_clicked_cb(void *data,
+               Evas_Object *obj __UNUSED__,
+               const char *emission __UNUSED__,
+               const char *source __UNUSED__)
 {
-   Widget_Data *wd;
-   Evas_Coord w, h;
+   ELM_CTXPOPUP_DATA_GET(data, sd);
 
-   wd = elm_widget_data_get(data);
-   if (!wd) return;
-   if (!wd->visible) return;
-   if (wd->finished) return;
+   _hide_signals_emit(data, sd->dir);
+}
 
-   evas_object_geometry_get(obj, 0, 0, &w, &h);
+static void
+_on_show(void *data __UNUSED__,
+         Evas *e __UNUSED__,
+         Evas_Object *obj,
+         void *event_info __UNUSED__)
+{
+   ELM_CTXPOPUP_DATA_GET(obj, sd);
 
-   if (w != 0 && h != 0)
+   if (sd->list)
      {
-        if ((w <= wd->max_sc_w) && (h <= wd->max_sc_h))
-          {
-             _sizing_eval(data);
-             wd->finished = EINA_TRUE;
-             return;
-          }
+        elm_list_go(sd->list);
+        sd->visible = EINA_TRUE;
+        elm_object_focus_set(sd->list, EINA_TRUE);
+        return;
      }
 
-   if (wd->max_sc_w < w)
-     wd->max_sc_w = w;
-   if (wd->max_sc_h < h)
-     wd->max_sc_h = h;
+   if (!sd->content) return;
 
-   _sizing_eval(data);
-}
+   sd->visible = EINA_TRUE;
 
-static void
-_ctxpopup_move(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj,
-               void *event_info __UNUSED__)
-{
-   Widget_Data *wd;
+   evas_object_show(sd->bg);
+   evas_object_show(sd->arrow);
 
-   wd = elm_widget_data_get(obj);
+   edje_object_signal_emit(sd->bg, "elm,state,show", "elm");
+   elm_layout_signal_emit(obj, "elm,state,show", "elm");
 
-   if (!wd) return;
+   elm_layout_sizing_eval(obj);
 
-   if (wd->visible)
-     evas_object_show(wd->arrow);
-
-   _scroller_size_reset(wd);
-   _sizing_eval(obj);
+   elm_object_focus_set(obj, EINA_TRUE);
 }
 
 static void
-_item_select_cb(void *data, Evas_Object *obj __UNUSED__,
-                const char *emission __UNUSED__, const char *source __UNUSED__)
+_on_hide(void *data __UNUSED__,
+         Evas *e __UNUSED__,
+         Evas_Object *obj,
+         void *event_info __UNUSED__)
 {
-   Elm_Ctxpopup_Item *item = data;
+   ELM_CTXPOPUP_DATA_GET(obj, sd);
 
-   if (!item) return;
-   if (item->disabled) return;
+   if (!sd->visible) return;
+
+   evas_object_hide(sd->bg);
+   evas_object_hide(sd->arrow);
 
-   if (item->func)
-     item->func((void*) item->base.data, WIDGET(item), data);
+   sd->visible = EINA_FALSE;
+   sd->list_visible = EINA_FALSE;
 }
 
 static void
-_item_icon_set(Elm_Ctxpopup_Item *item, Evas_Object *icon)
+_on_move(void *data __UNUSED__,
+         Evas *e __UNUSED__,
+         Evas_Object *obj,
+         void *event_info __UNUSED__)
 {
-   if (item->icon)
-     evas_object_del(item->icon);
+   ELM_CTXPOPUP_DATA_GET(obj, sd);
 
-   item->icon = icon;
-   if (!icon) return;
+   if (sd->visible) evas_object_show(sd->arrow);
 
-   edje_object_part_swallow(VIEW(item), "elm.swallow.icon", item->icon);
-   edje_object_message_signal_process(VIEW(item));
+   elm_layout_sizing_eval(obj);
 }
 
 static void
-_item_label_set(Elm_Ctxpopup_Item *item, const char *label)
+_hide_finished_cb(void *data,
+                  Evas_Object *obj __UNUSED__,
+                  const char *emission __UNUSED__,
+                  const char *source __UNUSED__)
 {
-   if (!eina_stringshare_replace(&item->label, label))
-     return;
-
-   edje_object_part_text_set(VIEW(item), "elm.text", label);
-   edje_object_message_signal_process(VIEW(item));
+   evas_object_hide(data);
+   evas_object_smart_callback_call(data, SIG_DISMISSED, NULL);
 }
 
 static void
-_item_new(Elm_Ctxpopup_Item *item, char *group_name)
+_list_resize_cb(void *data,
+                Evas *e __UNUSED__,
+                Evas_Object *obj __UNUSED__,
+                void *event_info __UNUSED__)
 {
-   Widget_Data *wd;
+   ELM_CTXPOPUP_DATA_GET(data, sd);
+
+   if (!sd->visible) return;
+   if (sd->list_visible) return;
 
-   wd = elm_widget_data_get(WIDGET(item));
-   if (!wd) return;
+   sd->list_visible = EINA_TRUE;
 
-   VIEW(item) = edje_object_add(evas_object_evas_get(wd->base));
-   edje_object_mirrored_set(VIEW(item), elm_widget_mirrored_get(WIDGET(item)));
-   _elm_theme_object_set(WIDGET(item), VIEW(item), "ctxpopup", group_name,
-                         elm_widget_style_get(WIDGET(item)));
-   edje_object_signal_callback_add(VIEW(item), "elm,action,click", "",
-                                   _item_select_cb, item);
-   evas_object_size_hint_align_set(VIEW(item), EVAS_HINT_FILL, EVAS_HINT_FILL);
-   evas_object_show(VIEW(item));
+   evas_object_show(sd->bg);
+   evas_object_show(sd->arrow);
+
+   elm_layout_sizing_eval(data);
 }
 
 static void
-_content_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__,
-             void *event_info __UNUSED__)
+_ctxpopup_restack_cb(void *data __UNUSED__,
+                     Evas *e __UNUSED__,
+                     Evas_Object *obj,
+                     void *event_info __UNUSED__)
 {
-   elm_object_content_unset(data);
+   ELM_CTXPOPUP_DATA_GET(obj, sd);
+   evas_object_stack_below(sd->bg, obj);
 }
 
 static void
-_list_del(Widget_Data *wd)
+_list_del(Elm_Ctxpopup_Smart_Data *sd)
 {
-   if (!wd->scr) return;
+   if (!sd->list) return;
 
-   edje_object_part_unswallow(wd->base, wd->scr);
-   evas_object_del(wd->scr);
-   wd->scr = NULL;
-   wd->box = NULL;
+   evas_object_del(sd->list);
+   sd->list = NULL;
 }
 
-static void
-_list_new(Evas_Object *obj)
+static Eina_Bool
+_item_del_pre_hook(Elm_Object_Item *it)
 {
-   Widget_Data *wd;
-   wd = elm_widget_data_get(obj);
-   if (!wd) return;
+   Evas_Object *list;
+   Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *)it;
+
+   ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd);
 
-   //scroller
-   wd->scr = elm_scroller_add(obj);
-   elm_object_style_set(wd->scr, "ctxpopup");
-   evas_object_size_hint_align_set(wd->scr, EVAS_HINT_FILL, EVAS_HINT_FILL);
-   evas_object_event_callback_add(wd->scr, EVAS_CALLBACK_RESIZE,
-                                  _scroller_resize, obj);
-   edje_object_part_swallow(wd->base, "elm.swallow.content", wd->scr);
+   sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
 
-   //box
-   wd->box = elm_box_add(obj);
-   evas_object_size_hint_weight_set(wd->box, EVAS_HINT_EXPAND,
-                                    EVAS_HINT_EXPAND);
+   list = elm_object_item_widget_get(ctxpopup_it->list_item);
+
+   if (eina_list_count(elm_list_items_get(list)) < 2)
+     {
+        elm_object_item_del(ctxpopup_it->list_item);
+        sd->items = eina_list_remove(sd->items, ctxpopup_it);
+        evas_object_hide(WIDGET(ctxpopup_it));
 
-   elm_scroller_content_set(wd->scr, wd->box);
-   elm_ctxpopup_horizontal_set(obj, wd->horizontal);
+        return EINA_TRUE;
+     }
+
+   elm_object_item_del(ctxpopup_it->list_item);
+   sd->items = eina_list_remove(sd->items, ctxpopup_it);
+   if (sd->list_visible) elm_layout_sizing_eval(WIDGET(ctxpopup_it));
+
+   return EINA_TRUE;
 }
 
 static void
-_remove_items(Widget_Data *wd)
+_elm_ctxpopup_smart_disable(Eo *obj, void *_pd, va_list *list)
 {
-   Eina_List *elist;
-   Elm_Ctxpopup_Item *item;
+   Elm_Ctxpopup_Smart_Data *sd = _pd;
 
-   if (!wd->items) return;
+   Eina_Bool *ret = va_arg(*list, Eina_Bool *);
+   if (ret) *ret = EINA_FALSE;
+   Eina_Bool int_ret;
 
-   EINA_LIST_FOREACH(wd->items, elist, item)
-     {
-        if (item->label)
-          eina_stringshare_del(item->label);
-        if (item->icon)
-          evas_object_del(item->icon);
-        wd->items = eina_list_remove(wd->items, item);
-        free(item);
-     }
+   eo_do_super(obj, MY_CLASS, elm_wdg_disable(&int_ret));
+   if (!int_ret) return;
+
+   elm_object_disabled_set(sd->list, elm_widget_disabled_get(obj));
 
-   wd->items = NULL;
+   if (ret) *ret = EINA_TRUE;
 }
 
-EAPI Evas_Object *
-elm_ctxpopup_add(Evas_Object *parent)
+static void
+_elm_ctxpopup_smart_add(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
 {
-   Evas_Object *obj;
-   Evas *e;
-   Widget_Data *wd;
+   Elm_Ctxpopup_Smart_Data *priv = _pd;
 
-   ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
+   eo_do_super(obj, MY_CLASS, evas_obj_smart_add());
 
-   ELM_SET_WIDTYPE(widtype, "ctxpopup");
-   elm_widget_type_set(obj, "ctxpopup");
-   elm_widget_data_set(obj, wd);
-   elm_widget_del_pre_hook_set(obj, _del_pre_hook);
-   elm_widget_del_hook_set(obj, _del_hook);
-   elm_widget_theme_hook_set(obj, _theme_hook);
-   elm_widget_on_focus_hook_set(obj, _on_focus_hook, NULL);
-   elm_widget_can_focus_set(obj, EINA_TRUE);
-   elm_widget_event_hook_set(obj, _event_hook);
-   elm_widget_content_set_hook_set(obj, _content_set_hook);
-   elm_widget_content_unset_hook_set(obj, _content_unset_hook);
-   elm_widget_content_get_hook_set(obj, _content_get_hook);
+   if (!elm_layout_theme_set
+       (obj, "ctxpopup", "base", elm_widget_style_get(obj)))
+     CRITICAL("Failed to set layout!");
+
+   elm_layout_signal_callback_add
+     (obj, "elm,action,hide,finished", "", _hide_finished_cb, obj);
 
    //Background
-   wd->bg = edje_object_add(e);
-   elm_widget_sub_object_add(obj, wd->bg);
-   _elm_theme_object_set(obj, wd->bg, "ctxpopup", "bg", "default");
-   edje_object_signal_callback_add(wd->bg,
-                                   "elm,action,click",
-                                   "",
-                                   _bg_clicked_cb,
-                                    obj);
-   //Base
-   wd->base = edje_object_add(e);
-   elm_widget_sub_object_add(obj, wd->base);
-   _elm_theme_object_set(obj, wd->base, "ctxpopup", "base", "default");
+   priv->bg = edje_object_add(evas_object_evas_get(obj));
+   elm_widget_theme_object_set(obj, priv->bg, "ctxpopup", "bg", "default");
+   edje_object_signal_callback_add
+     (priv->bg, "elm,action,click", "", _bg_clicked_cb, obj);
+
+   evas_object_stack_below(priv->bg, obj);
 
    //Arrow
-   wd->arrow = edje_object_add(e);
-   elm_widget_sub_object_add(obj, wd->arrow);
-   _elm_theme_object_set(obj, wd->arrow, "ctxpopup", "arrow", "default");
-
-   wd->dir_priority[0] = ELM_CTXPOPUP_DIRECTION_UP;
-   wd->dir_priority[1] = ELM_CTXPOPUP_DIRECTION_LEFT;
-   wd->dir_priority[2] = ELM_CTXPOPUP_DIRECTION_RIGHT;
-   wd->dir_priority[3] = ELM_CTXPOPUP_DIRECTION_DOWN;
-   wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
-
-   evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _ctxpopup_show,
-                                  NULL);
-   evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _ctxpopup_hide,
-                                  NULL);
-   evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _ctxpopup_move,
-                                  NULL);
-   evas_object_smart_callback_add(obj, "scroll-freeze-on", _freeze_on, obj);
-   evas_object_smart_callback_add(obj, "scroll-freeze-off", _freeze_off, obj);
-   evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
-   evas_object_smart_callback_add(obj, "scroll-hold-off", _hold_off, obj);
-
-   evas_object_smart_callbacks_descriptions_set(obj, _signals);
+   priv->arrow = edje_object_add(evas_object_evas_get(obj));
+   elm_widget_theme_object_set
+     (obj, priv->arrow, "ctxpopup", "arrow", "default");
 
-   //default parent is to be hover parent
-   elm_ctxpopup_hover_parent_set(obj, parent);
+   priv->dir_priority[0] = ELM_CTXPOPUP_DIRECTION_UP;
+   priv->dir_priority[1] = ELM_CTXPOPUP_DIRECTION_LEFT;
+   priv->dir_priority[2] = ELM_CTXPOPUP_DIRECTION_RIGHT;
+   priv->dir_priority[3] = ELM_CTXPOPUP_DIRECTION_DOWN;
+   priv->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
 
-   return obj;
-}
+   evas_object_event_callback_add
+     (obj, EVAS_CALLBACK_RESTACK, _ctxpopup_restack_cb, obj);
 
-EAPI Evas_Object *
-elm_ctxpopup_item_icon_get(const Elm_Object_Item *it)
-{
-   ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
-   Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *) it;
-   return ctxpopup_it->icon;
+   priv->box = elm_box_add(obj);
+   evas_object_size_hint_weight_set
+     (priv->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+   evas_object_event_callback_add
+     (priv->box, EVAS_CALLBACK_RESIZE, _on_content_resized, obj);
+
+   /* box will be our content placeholder, thus the parent's version call */
+   Eina_Bool ret;
+   eo_do_super(obj, MY_CLASS, elm_obj_container_content_set("elm.swallow.content", priv->box, &ret));
+
+   evas_object_event_callback_add(obj, EVAS_CALLBACK_SHOW, _on_show, NULL);
+   evas_object_event_callback_add(obj, EVAS_CALLBACK_HIDE, _on_hide, NULL);
+   evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _on_move, NULL);
+
+   elm_widget_can_focus_set(obj, EINA_TRUE);
 }
 
-EAPI void
-elm_ctxpopup_item_icon_set(Elm_Object_Item *it, Evas_Object *icon)
+static void
+_elm_ctxpopup_smart_del(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
 {
-   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+   Elm_Ctxpopup_Smart_Data *sd = _pd;
+   Elm_Ctxpopup_Item *it;
+
+   evas_object_event_callback_del_full
+     (sd->box, EVAS_CALLBACK_RESIZE, _on_content_resized, obj);
+   _parent_detach(obj);
 
-   Widget_Data *wd;
-   Elm_Ctxpopup_Item *ctxpopup_it  = (Elm_Ctxpopup_Item *) it;
+   elm_ctxpopup_clear(obj);
+   evas_object_del(sd->arrow);
+   sd->arrow = NULL; /* stops _sizing_eval() from going on on deletion */
 
-   wd = elm_widget_data_get(WIDGET(ctxpopup_it));
-   if (!wd) return;
+   evas_object_del(sd->bg);
+   sd->bg = NULL;
 
-   _item_icon_set(ctxpopup_it, icon);
-   wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
+   EINA_LIST_FREE(sd->items, it)
+     elm_widget_item_free(it);
 
-   if (wd->visible)
-     {
-        _scroller_size_reset(wd);
-        _sizing_eval(WIDGET(ctxpopup_it));
-     }
+   eo_do_super(obj, MY_CLASS, evas_obj_smart_del());
 }
 
-EAPI const char *
-elm_ctxpopup_item_label_get(const Elm_Object_Item *it)
+static void
+_elm_ctxpopup_smart_parent_set(Eo *obj, void *_pd EINA_UNUSED, va_list *list)
 {
-   ELM_OBJ_ITEM_CHECK_OR_RETURN(it, NULL);
-   Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *) it;
-   return ctxpopup_it->label;
+   Evas_Object *parent = va_arg(*list, Evas_Object *);
+   //default parent is to be hover parent
+   elm_ctxpopup_hover_parent_set(obj, parent);
 }
 
-EAPI void
-elm_ctxpopup_item_label_set(Elm_Object_Item *it, const char *label)
+EAPI Evas_Object *
+elm_ctxpopup_add(Evas_Object *parent)
 {
-   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
+   EINA_SAFETY_ON_NULL_RETURN_VAL(parent, NULL);
+   Evas_Object *obj = eo_add(MY_CLASS, parent);
+   eo_unref(obj);
 
-   Widget_Data *wd;
-   Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *) it;
+   /* access: parent could be any object such as elm_list which does
+      not know elc_ctxpopup as its child object in the focus_next(); */
+   Elm_Widget_Smart_Data *wd = eo_data_scope_get(obj, ELM_OBJ_WIDGET_CLASS);
+   wd->highlight_root = EINA_TRUE;
 
-   wd = elm_widget_data_get(WIDGET(ctxpopup_it));
-   if (!wd) return;
+   return obj;
+}
 
-   _item_label_set(ctxpopup_it, label);
-   wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
+static void
+_constructor(Eo *obj, void *_pd EINA_UNUSED, va_list *list EINA_UNUSED)
+{
+   eo_do_super(obj, MY_CLASS, eo_constructor());
+   eo_do(obj,
+         evas_obj_type_set(MY_CLASS_NAME),
+         evas_obj_smart_callbacks_descriptions_set(_smart_callbacks, NULL));
 
-   if (wd->visible)
-     {
-        _scroller_size_reset(wd);
-        _sizing_eval(WIDGET(ctxpopup_it));
-     }
+   elm_widget_sub_object_add(eo_parent_get(obj), obj);
 }
 
 EAPI void
-elm_ctxpopup_hover_parent_set(Evas_Object *obj, Evas_Object *parent)
+elm_ctxpopup_hover_parent_set(Evas_Object *obj,
+                              Evas_Object *parent)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype);
+   ELM_CTXPOPUP_CHECK(obj);
+   eo_do(obj, elm_obj_ctxpopup_hover_parent_set(parent));
+}
 
-   Widget_Data *wd;
+static void
+_hover_parent_set(Eo *obj, void *_pd, va_list *list)
+{
    Evas_Coord x, y, w, h;
+   Evas_Object *parent = va_arg(*list, Evas_Object *);
 
-   wd = elm_widget_data_get(obj);
-   if ((!wd) || (!parent)) return;
+   Elm_Ctxpopup_Smart_Data *sd = _pd;
 
-   _parent_cut_off(obj);
+   if (!parent) return;
 
-   if (parent)
-     {
-        evas_object_event_callback_add(parent,
-                                       EVAS_CALLBACK_DEL,
-                                       _parent_del,
-                                       obj);
-        evas_object_event_callback_add(parent,
-                                       EVAS_CALLBACK_MOVE,
-                                       _parent_move,
-                                       obj);
-        evas_object_event_callback_add(parent,
-                                       EVAS_CALLBACK_RESIZE,
-                                       _parent_resize,
-                                       obj);
-     }
+   _parent_detach(obj);
+
+   evas_object_event_callback_add
+     (parent, EVAS_CALLBACK_DEL, _on_parent_del, obj);
+   evas_object_event_callback_add
+     (parent, EVAS_CALLBACK_MOVE, _on_parent_move, obj);
+   evas_object_event_callback_add
+     (parent, EVAS_CALLBACK_RESIZE, _on_parent_resize, obj);
 
-   elm_widget_sub_object_add(parent, obj);
-   wd->parent = parent;
+   sd->parent = parent;
 
    //Update Background
    evas_object_geometry_get(parent, &x, &y, &w, &h);
-   evas_object_move(wd->bg, x, y);
-   evas_object_resize(wd->bg, w, h);
+   if (!strcmp(evas_object_type_get(parent), "elm_win"))
+     x = y = 0;
+   evas_object_move(sd->bg, x, y);
+   evas_object_resize(sd->bg, w, h);
 
-   if (wd->visible) _sizing_eval(obj);
+   if (sd->visible) elm_layout_sizing_eval(obj);
 }
 
 EAPI Evas_Object *
 elm_ctxpopup_hover_parent_get(const Evas_Object *obj)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
-
-   Widget_Data *wd;
-
-   wd = elm_widget_data_get(obj);
-   if (!wd) return NULL;
+   ELM_CTXPOPUP_CHECK(obj) NULL;
+   Evas_Object *ret = NULL;
+   eo_do((Eo *) obj, elm_obj_ctxpopup_hover_parent_get(&ret));
+   return ret;
+}
 
-   return wd->parent;
+static void
+_hover_parent_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
+{
+   Evas_Object **ret = va_arg(*list, Evas_Object **);
+   Elm_Ctxpopup_Smart_Data *sd = _pd;
+   *ret = sd->parent;
 }
 
 EAPI void
-elm_ctxpopup_clear(Evas_Object * obj)
+elm_ctxpopup_clear(Evas_Object *obj)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype);
+   ELM_CTXPOPUP_CHECK(obj);
+   eo_do(obj, elm_obj_ctxpopup_clear());
+}
 
-   Widget_Data *wd = elm_widget_data_get(obj);
-   if (!wd) return;
+static void
+_clear(Eo *obj EINA_UNUSED, void *_pd, va_list *list EINA_UNUSED)
+{
+   Elm_Ctxpopup_Smart_Data *sd = _pd;
 
-   _remove_items(wd);
-   _list_del(wd);
-   wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
+   _list_del(sd);
+   sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
 }
 
 EAPI void
-elm_ctxpopup_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
+elm_ctxpopup_horizontal_set(Evas_Object *obj,
+                            Eina_Bool horizontal)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype);
+   ELM_CTXPOPUP_CHECK(obj);
+   eo_do(obj, elm_obj_ctxpopup_horizontal_set(horizontal));
+}
 
-   Widget_Data *wd;
+static void
+_horizontal_set(Eo *obj, void *_pd, va_list *list)
+{
+   Eina_Bool horizontal = va_arg(*list, int);
+   Elm_Ctxpopup_Smart_Data *sd = _pd;
 
-   wd = elm_widget_data_get(obj);
-   if (!wd) return;
+   sd->horizontal = !!horizontal;
 
-   wd->horizontal = !!horizontal;
+   if (!sd->list) return;
 
-   if ((!wd->scr) && (!wd->box))
-      return;
+   elm_list_horizontal_set(sd->list, sd->horizontal);
 
-   if (!horizontal)
-     {
-        elm_box_horizontal_set(wd->box, EINA_FALSE);
-        elm_scroller_bounce_set(wd->scr, EINA_FALSE, EINA_TRUE);
-     }
-   else
-     {
-        elm_box_horizontal_set(wd->box, EINA_TRUE);
-        elm_scroller_bounce_set(wd->scr, EINA_TRUE, EINA_FALSE);
-     }
-
-   wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
+   sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
 
-   if (wd->visible)
-      _sizing_eval(obj);
+   if (sd->visible) elm_layout_sizing_eval(obj);
 }
 
 EAPI Eina_Bool
 elm_ctxpopup_horizontal_get(const Evas_Object *obj)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
-
-   Widget_Data *wd;
+   ELM_CTXPOPUP_CHECK(obj) EINA_FALSE;
+   Eina_Bool ret = EINA_FALSE;
+   eo_do((Eo *) obj, elm_obj_ctxpopup_horizontal_get(&ret));
+   return ret;
+}
 
-   wd = elm_widget_data_get(obj);
-   if (!wd) return EINA_FALSE;
+static void
+_horizontal_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
+{
+   Eina_Bool *ret = va_arg(*list, Eina_Bool *);
+   Elm_Ctxpopup_Smart_Data *sd = _pd;
 
-   return wd->horizontal;
+   *ret = sd->horizontal;
 }
 
 EAPI Elm_Object_Item *
-elm_ctxpopup_item_append(Evas_Object *obj, const char *label,
-                         Evas_Object *icon, Evas_Smart_Cb func,
+elm_ctxpopup_item_append(Evas_Object *obj,
+                         const char *label,
+                         Evas_Object *icon,
+                         Evas_Smart_Cb func,
                          const void *data)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype) NULL;
-
-   Widget_Data *wd;
-   Evas_Object *content;
-   Elm_Ctxpopup_Item *item;
-
-   wd = elm_widget_data_get(obj);
-   if (!wd) return NULL;
-
-   item = elm_widget_item_new(obj, Elm_Ctxpopup_Item);
-   if (!item) return NULL;
-
-   //The first item is appended.
-   content = elm_object_content_unset(obj);
-   if (content) evas_object_del(content);
-
-   if (!wd->items)
-     _list_new(obj);
-
-   item->func = func;
-   item->base.data = data;
-
-   if (icon && label)
-     _item_new(item, "icon_text_style_item");
-   else if (label)
-     _item_new(item, "text_style_item");
-   else
-     _item_new(item, "icon_style_item");
-
-   _item_icon_set(item, icon);
-   _item_label_set(item, label);
-   elm_box_pack_end(wd->box, VIEW(item));
-   wd->items = eina_list_append(wd->items, item);
-   wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
 
-   if (wd->visible)
-     {
-        _scroller_size_reset(wd);
-        _sizing_eval(obj);
-     }
-
-   return (Elm_Object_Item *) item;
+   ELM_CTXPOPUP_CHECK(obj) NULL;
+   Elm_Object_Item *ret = NULL;
+   eo_do(obj, elm_obj_ctxpopup_item_append(label, icon, func, data, &ret));
+   return ret;
 }
 
-EAPI void
-elm_ctxpopup_item_del(Elm_Object_Item *it)
+static void
+_item_wrap_cb(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-
-   Widget_Data *wd;
-   Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *) it;
-
-   wd = elm_widget_data_get(WIDGET(ctxpopup_it));
-   if (!wd) return;
+   Elm_Ctxpopup_Item *item = data;
+   item->wcb.org_func_cb((void *)item->wcb.org_data, item->wcb.cobj, item);
+}
 
-   if (ctxpopup_it->icon)
-     evas_object_del(ctxpopup_it->icon);
-   if (VIEW(ctxpopup_it))
-     evas_object_del(VIEW(ctxpopup_it));
+static void
+_item_append(Eo *obj, void *_pd, va_list *list)
+{
+   const char *label = va_arg(*list, const char *);
+   Evas_Object *icon = va_arg(*list, Evas_Object *);
+   Evas_Smart_Cb func = va_arg(*list, Evas_Smart_Cb);
+   const void *data = va_arg(*list, const void *);
+   Elm_Object_Item **ret = va_arg(*list, Elm_Object_Item **);
+   *ret = NULL;
 
-   eina_stringshare_del(ctxpopup_it->label);
+   Elm_Ctxpopup_Item *item;
 
-   wd->items = eina_list_remove(wd->items, ctxpopup_it);
+   Elm_Ctxpopup_Smart_Data *sd = _pd;
 
-   wd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
+   item = elm_widget_item_new(obj, Elm_Ctxpopup_Item);
+   if (!item) return;
 
-   elm_widget_item_del(ctxpopup_it);
+   elm_widget_item_del_pre_hook_set(item, _item_del_pre_hook);
+   elm_widget_item_disable_hook_set(item, _item_disable_hook);
+   elm_widget_item_text_set_hook_set(item, _item_text_set_hook);
+   elm_widget_item_text_get_hook_set(item, _item_text_get_hook);
+   elm_widget_item_content_set_hook_set(item, _item_content_set_hook);
+   elm_widget_item_content_get_hook_set(item, _item_content_get_hook);
+   elm_widget_item_signal_emit_hook_set(item, _item_signal_emit_hook);
 
-   if (eina_list_count(wd->items) < 1)
+   if (!sd->list)
      {
-        evas_object_hide(WIDGET(ctxpopup_it));
-        return;
+        //The first item is appended.
+        sd->list = elm_list_add(obj);
+        elm_list_mode_set(sd->list, ELM_LIST_EXPAND);
+        elm_list_horizontal_set(sd->list, sd->horizontal);
+        evas_object_event_callback_add
+          (sd->list, EVAS_CALLBACK_RESIZE, _list_resize_cb, obj);
+        elm_layout_content_set(obj, "default", sd->list);
      }
 
-   if (wd->visible)
-     _sizing_eval(WIDGET(ctxpopup_it));
-
-}
-
-EAPI void
-elm_ctxpopup_item_disabled_set(Elm_Object_Item *it, Eina_Bool disabled)
-{
-   ELM_OBJ_ITEM_CHECK_OR_RETURN(it);
-
-   Widget_Data *wd;
-   Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *) it;
-
-   wd = elm_widget_data_get(WIDGET(ctxpopup_it));
-   if (!wd) return;
-
-   if (disabled == ctxpopup_it->disabled)
-     return;
-
-   if (disabled)
-     edje_object_signal_emit(VIEW(ctxpopup_it), "elm,state,disabled", "elm");
-   else
-     edje_object_signal_emit(VIEW(ctxpopup_it), "elm,state,enabled", "elm");
+   item->wcb.org_func_cb = func;
+   item->wcb.org_data = data;
+   item->wcb.cobj = obj;
+   item->list_item =
+     elm_list_item_append(sd->list, label, icon, NULL, _item_wrap_cb, item);
+   sd->items = eina_list_append(sd->items, item);
 
-   ctxpopup_it->disabled = !!disabled;
-}
+   sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
 
-EAPI Eina_Bool
-elm_ctxpopup_item_disabled_get(const Elm_Object_Item *it)
-{
-   ELM_OBJ_ITEM_CHECK_OR_RETURN(it, EINA_FALSE);
-   Elm_Ctxpopup_Item *ctxpopup_it = (Elm_Ctxpopup_Item *) it;
-   return ctxpopup_it->disabled;
-}
+   if (sd->visible) elm_layout_sizing_eval(obj);
 
-EAPI void
-elm_ctxpopup_content_set(Evas_Object *obj, Evas_Object *content)
-{
-   elm_object_content_set(obj, content);
-}
-
-EAPI Evas_Object *
-elm_ctxpopup_content_unset(Evas_Object *obj)
-{
-   return elm_object_content_unset(obj);
+   *ret = (Elm_Object_Item *)item;
 }
 
 EAPI void
@@ -1444,19 +1387,26 @@ elm_ctxpopup_direction_priority_set(Evas_Object *obj,
                                     Elm_Ctxpopup_Direction third,
                                     Elm_Ctxpopup_Direction fourth)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype);
-   Widget_Data *wd;
+   ELM_CTXPOPUP_CHECK(obj);
+   eo_do(obj, elm_obj_ctxpopup_direction_priority_set(first, second, third, fourth));
+}
 
-   wd = elm_widget_data_get(obj);
-   if (!wd) return;
+static void
+_direction_priority_set(Eo *obj, void *_pd, va_list *list)
+{
+   Elm_Ctxpopup_Direction first = va_arg(*list, Elm_Ctxpopup_Direction);
+   Elm_Ctxpopup_Direction second = va_arg(*list, Elm_Ctxpopup_Direction);
+   Elm_Ctxpopup_Direction third = va_arg(*list, Elm_Ctxpopup_Direction);
+   Elm_Ctxpopup_Direction fourth = va_arg(*list, Elm_Ctxpopup_Direction);
+
+   Elm_Ctxpopup_Smart_Data *sd = _pd;
 
-   wd->dir_priority[0] = first;
-   wd->dir_priority[1] = second;
-   wd->dir_priority[2] = third;
-   wd->dir_priority[3] = fourth;
+   sd->dir_priority[0] = first;
+   sd->dir_priority[1] = second;
+   sd->dir_priority[2] = third;
+   sd->dir_priority[3] = fourth;
 
-   if (wd->visible)
-     _sizing_eval(obj);
+   if (sd->visible) elm_layout_sizing_eval(obj);
 }
 
 EAPI void
@@ -1466,25 +1416,123 @@ elm_ctxpopup_direction_priority_get(Evas_Object *obj,
                                     Elm_Ctxpopup_Direction *third,
                                     Elm_Ctxpopup_Direction *fourth)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype);
-   Widget_Data *wd;
+   ELM_CTXPOPUP_CHECK(obj);
+   eo_do(obj, elm_obj_ctxpopup_direction_priority_get(first, second, third, fourth));
+}
 
-   wd = elm_widget_data_get(obj);
-   if (!wd) return;
+static void
+_direction_priority_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
+{
+   Elm_Ctxpopup_Direction *first = va_arg(*list, Elm_Ctxpopup_Direction *);
+   Elm_Ctxpopup_Direction *second = va_arg(*list, Elm_Ctxpopup_Direction *);
+   Elm_Ctxpopup_Direction *third = va_arg(*list, Elm_Ctxpopup_Direction *);
+   Elm_Ctxpopup_Direction *fourth = va_arg(*list, Elm_Ctxpopup_Direction *);
+
+   Elm_Ctxpopup_Smart_Data *sd = _pd;
 
-   if (first) *first = wd->dir_priority[0];
-   if (second) *second = wd->dir_priority[1];
-   if (third) *third = wd->dir_priority[2];
-   if (fourth) *fourth = wd->dir_priority[3];
+   if (first) *first = sd->dir_priority[0];
+   if (second) *second = sd->dir_priority[1];
+   if (third) *third = sd->dir_priority[2];
+   if (fourth) *fourth = sd->dir_priority[3];
 }
 
 EAPI Elm_Ctxpopup_Direction
 elm_ctxpopup_direction_get(const Evas_Object *obj)
 {
-   ELM_CHECK_WIDTYPE(obj, widtype) ELM_CTXPOPUP_DIRECTION_UNKNOWN;
-   Widget_Data *wd;
+   ELM_CTXPOPUP_CHECK(obj) ELM_CTXPOPUP_DIRECTION_UNKNOWN;
+   Elm_Ctxpopup_Direction ret = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
+   eo_do((Eo *) obj, elm_obj_ctxpopup_direction_get(&ret));
+   return ret;
+}
 
-   wd = elm_widget_data_get(obj);
-   if (!wd) return ELM_CTXPOPUP_DIRECTION_UNKNOWN;
-   return wd->dir;
+static void
+_direction_get(Eo *obj EINA_UNUSED, void *_pd, va_list *list)
+{
+   Elm_Ctxpopup_Direction *ret = va_arg(*list, Elm_Ctxpopup_Direction *);
+   Elm_Ctxpopup_Smart_Data *sd = _pd;
+
+   *ret = sd->dir;
 }
+
+EAPI void
+elm_ctxpopup_dismiss(Evas_Object *obj)
+{
+   ELM_CTXPOPUP_CHECK(obj);
+   eo_do(obj, elm_obj_ctxpopup_dismiss());
+}
+
+static void
+_dismiss(Eo *obj, void *_pd, va_list *list EINA_UNUSED)
+{
+   Elm_Ctxpopup_Smart_Data *sd = _pd;
+
+   _hide_signals_emit(obj, sd->dir);
+}
+
+static void
+_class_constructor(Eo_Class *klass)
+{
+   const Eo_Op_Func_Description func_desc[] = {
+        EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
+
+        EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_ADD), _elm_ctxpopup_smart_add),
+        EO_OP_FUNC(EVAS_OBJ_SMART_ID(EVAS_OBJ_SMART_SUB_ID_DEL), _elm_ctxpopup_smart_del),
+
+        EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_PARENT_SET), _elm_ctxpopup_smart_parent_set),
+        EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_DISABLE), _elm_ctxpopup_smart_disable),
+        EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_EVENT), _elm_ctxpopup_smart_event),
+        EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_THEME), _elm_ctxpopup_smart_theme),
+        EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_SUB_OBJECT_ADD), _elm_ctxpopup_smart_sub_object_add),
+        EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_NEXT_MANAGER_IS), _elm_ctxpopup_smart_focus_next_manager_is),
+        EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_NEXT),  _elm_ctxpopup_smart_focus_next),
+        EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_DIRECTION_MANAGER_IS), _elm_ctxpopup_smart_focus_direction_manager_is),
+        EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_FOCUS_DIRECTION),  _elm_ctxpopup_smart_focus_direction),
+        EO_OP_FUNC(ELM_WIDGET_ID(ELM_WIDGET_SUB_ID_TRANSLATE), _elm_ctxpopup_smart_translate),
+
+        EO_OP_FUNC(ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_SET), _elm_ctxpopup_smart_content_set),
+        EO_OP_FUNC(ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_GET), _elm_ctxpopup_smart_content_get),
+        EO_OP_FUNC(ELM_OBJ_CONTAINER_ID(ELM_OBJ_CONTAINER_SUB_ID_CONTENT_UNSET), _elm_ctxpopup_smart_content_unset),
+
+        EO_OP_FUNC(ELM_OBJ_LAYOUT_ID(ELM_OBJ_LAYOUT_SUB_ID_SIZING_EVAL), _elm_ctxpopup_smart_sizing_eval),
+        EO_OP_FUNC(ELM_OBJ_LAYOUT_ID(ELM_OBJ_LAYOUT_SUB_ID_SUB_OBJECT_ADD_ENABLE), _elm_ctxpopup_smart_layout_sub_object_add_enable),
+
+        EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_HOVER_PARENT_SET), _hover_parent_set),
+        EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_HOVER_PARENT_GET), _hover_parent_get),
+        EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_CLEAR), _clear),
+        EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_HORIZONTAL_SET), _horizontal_set),
+        EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_HORIZONTAL_GET), _horizontal_get),
+        EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_ITEM_APPEND), _item_append),
+        EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_DIRECTION_PRIORITY_SET), _direction_priority_set),
+        EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_DIRECTION_PRIORITY_GET), _direction_priority_get),
+        EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_DIRECTION_GET), _direction_get),
+        EO_OP_FUNC(ELM_OBJ_CTXPOPUP_ID(ELM_OBJ_CTXPOPUP_SUB_ID_DISMISS), _dismiss),
+        EO_OP_FUNC_SENTINEL
+   };
+   eo_class_funcs_set(klass, func_desc);
+
+   evas_smart_legacy_type_register(MY_CLASS_NAME, klass);
+}
+static const Eo_Op_Description op_desc[] = {
+     EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_HOVER_PARENT_SET, "Set the Ctxpopup's parent."),
+     EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_HOVER_PARENT_GET, "Get the Ctxpopup's parent."),
+     EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_CLEAR, "Clear all items in the given ctxpopup object."),
+     EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_HORIZONTAL_SET, "Change the ctxpopup's orientation to horizontal or vertical."),
+     EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_HORIZONTAL_GET, "Get the value of current ctxpopup object's orientation."),
+     EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_ITEM_APPEND, "Add a new item to a ctxpopup object."),
+     EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_DIRECTION_PRIORITY_SET, "Set the direction priority of a ctxpopup."),
+     EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_DIRECTION_PRIORITY_GET, "Get the direction priority of a ctxpopup."),
+     EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_DIRECTION_GET, "Get the current direction of a ctxpopup."),
+     EO_OP_DESCRIPTION(ELM_OBJ_CTXPOPUP_SUB_ID_DISMISS, "Dismiss a ctxpopup object."),
+     EO_OP_DESCRIPTION_SENTINEL
+};
+static const Eo_Class_Description class_desc = {
+     EO_VERSION,
+     MY_CLASS_NAME,
+     EO_CLASS_TYPE_REGULAR,
+     EO_CLASS_DESCRIPTION_OPS(&ELM_OBJ_CTXPOPUP_BASE_ID, op_desc, ELM_OBJ_CTXPOPUP_SUB_ID_LAST),
+     NULL,
+     sizeof(Elm_Ctxpopup_Smart_Data),
+     _class_constructor,
+     NULL
+};
+EO_DEFINE_CLASS(elm_obj_ctxpopup_class_get, &class_desc, ELM_OBJ_LAYOUT_CLASS, NULL);