[ctxpopup] fixed P130411-7458: fixed VI bug and add landscape mode
authorBora Hwang <bora1.hwang@samsung.com>
Thu, 25 Apr 2013 05:29:40 +0000 (14:29 +0900)
committerSungho Kwak <sungho1.kwak@samsung.com>
Wed, 12 Jun 2013 04:24:45 +0000 (13:24 +0900)
Change-Id: I6144dddfb7e71fbd9921d35246969a365d565f8b

src/lib/elc_ctxpopup.c
src/lib/elm_widget_ctxpopup.h

index 4584449..89ea8c2 100644 (file)
@@ -753,7 +753,6 @@ _show_signals_emit(Evas_Object *obj,
      }
 
    edje_object_signal_emit(sd->bg, "elm,state,show", "elm");
-//   elm_layout_signal_emit(obj, "elm,state,show", "elm");
 }
 
 static void
@@ -823,22 +822,6 @@ _base_shift_by_arrow(Evas_Object *arrow,
      }
 }
 
-//TODO: compress item - different from opensource
-static void
-_compress_item(Evas_Object *obj)
-{
-   Eina_List *elist;
-   Elm_Ctxpopup_Item *item;
-
-   ELM_CTXPOPUP_DATA_GET(obj, sd);
-   if (!sd) return;
-
-   EINA_LIST_FOREACH(sd->items, elist, item)
-     {
-        edje_object_signal_emit(item->base.view, "elm,state,compress", "elm");
-     }
-}
-
 static Eina_Bool
 _elm_ctxpopup_smart_sub_object_add(Evas_Object *obj,
                                    Evas_Object *sobj)
@@ -918,10 +901,6 @@ _elm_ctxpopup_smart_sizing_eval(Evas_Object *obj)
    //Base
    sd->dir = _base_geometry_calc(obj, &rect);
 
-   //TODO: compress item - different from opensource
-   if (!sd->horizontal && !sd->content)
-     _compress_item(obj);
-
    _arrow_update(obj, sd->dir, rect);
    _base_shift_by_arrow(sd->arrow, sd->dir, &rect);
 
@@ -976,6 +955,8 @@ _on_parent_resize(void *data,
 {
    ELM_CTXPOPUP_DATA_GET(data, sd);
 
+   _hide_signals_emit(data, sd->dir);
+
    sd->dir = ELM_CTXPOPUP_DIRECTION_UNKNOWN;
 
    evas_object_hide(data);
@@ -1015,7 +996,7 @@ _elm_ctxpopup_smart_theme(Evas_Object *obj)
 {
    Eina_List *elist;
    Elm_Ctxpopup_Item *item;
-   int idx = 0;
+   int idx = 0, orientation = -1;
    Eina_Bool rtl;
 
    ELM_CTXPOPUP_DATA_GET(obj, sd);
@@ -1029,8 +1010,14 @@ _elm_ctxpopup_smart_theme(Evas_Object *obj)
      (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));
-   elm_widget_theme_object_set
-     (obj, sd->layout, "ctxpopup", "layout", elm_widget_style_get(obj));
+
+   orientation = sd->orientation;
+   if (orientation == 90 || orientation == 270)
+     elm_widget_theme_object_set
+       (obj, sd->layout, "ctxpopup", "layout/landscape", elm_widget_style_get(obj));
+   else
+     elm_widget_theme_object_set
+       (obj, sd->layout, "ctxpopup", "layout", elm_widget_style_get(obj));
 
    //Items
    EINA_LIST_FOREACH(sd->items, elist, item)
@@ -1298,6 +1285,7 @@ _on_show(void *data __UNUSED__,
    int idx = 0;
 
    ELM_CTXPOPUP_DATA_GET(obj, sd);
+   ELM_WIDGET_DATA_GET(obj, wsd);
 
    if ((!sd->items) && (!sd->content)) return;
 
@@ -1310,6 +1298,13 @@ _on_show(void *data __UNUSED__,
    edje_object_signal_emit(sd->bg, "elm,state,show", "elm");
    elm_layout_signal_emit(obj, "elm,state,show", "elm");
 
+   if (wsd->orient_mode == 90 || wsd->orient_mode == 270)
+     elm_widget_theme_object_set
+       (obj, sd->layout, "ctxpopup", "layout/landscape", elm_widget_style_get(obj));
+   else
+     elm_widget_theme_object_set
+       (obj, sd->layout, "ctxpopup", "layout", elm_widget_style_get(obj));
+
    EINA_LIST_FOREACH(sd->items, elist, item)
      {
         if (item->label && !item->icon)
@@ -1692,7 +1687,19 @@ elm_ctxpopup_add(Evas_Object *parent)
    /* 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_DATA_GET(obj, sd);
+   ELM_CTXPOPUP_DATA_GET(obj, sd1);
+
    sd->highlight_root = EINA_TRUE;
+   sd1->orientation = sd->orient_mode;
+
+   _elm_widget_orient_signal_emit(obj);
+
+   if (sd1->orientation == 90 || sd1->orientation == 270)
+     elm_widget_theme_object_set
+       (obj, sd1->layout, "ctxpopup", "layout/landscape", elm_widget_style_get(obj));
+   else
+     elm_widget_theme_object_set
+       (obj, sd1->layout, "ctxpopup", "layout", elm_widget_style_get(obj));
 
    return obj;
 }
index c407dea..779588c 100644 (file)
@@ -152,6 +152,8 @@ struct _Elm_Ctxpopup_Smart_Data
    Eina_Bool              horizontal : 1;
    Eina_Bool              finished : 1;
    Eina_Bool              visible : 1;
+
+   int                    orientation;
 };
 
 /**