ctxpopup: fix unintentional item style change 89/166589/3
authorJinYong Park <j4939.park@samsung.com>
Thu, 11 Jan 2018 02:41:44 +0000 (11:41 +0900)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Thu, 11 Jan 2018 08:22:03 +0000 (08:22 +0000)
When ctxpopup set style, show, set horizontal, change item's text,
item change style to smae with ctxpopup although it has its own style.

Change-Id: If2a7b897ee156015af078db7eee4b10fd1f9d56d
Signed-off-by: JinYong Park <j4939.park@samsung.com>
src/mobile_lib/elc_ctxpopup.c

index 7d1aad1..56ef2a2 100644 (file)
@@ -1381,6 +1381,7 @@ _elm_ctxpopup_elm_widget_theme_apply(Eo *obj, Elm_Ctxpopup_Data *sd)
    Eina_Bool rtl;
    Eina_Bool tmp;
    Elm_Theme_Apply int_ret = ELM_THEME_APPLY_FAILED;
+   char* style;
 
    ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd, ELM_THEME_APPLY_FAILED);
 
@@ -1410,38 +1411,40 @@ _elm_ctxpopup_elm_widget_theme_apply(Eo *obj, Elm_Ctxpopup_Data *sd)
      {
         edje_object_mirrored_set(VIEW(item), rtl);
 
+        style = (item->style ? item->style : elm_widget_style_get(obj));
+
         if (item->label && item->icon)
           {
              if (!sd->horizontal)
                _elm_theme_object_set(obj, VIEW(item), "ctxpopup",
                                      "icon_text_style_item",
-                                     elm_widget_style_get(obj));
+                                     style);
              else
                _elm_theme_object_set(obj, VIEW(item), "ctxpopup",
                                      "icon_text_style_item_horizontal",
-                                     elm_widget_style_get(obj));
+                                     style);
           }
         else if (item->label)
           {
              if (!sd->horizontal)
                _elm_theme_object_set(obj, VIEW(item), "ctxpopup",
                                      "text_style_item",
-                                     elm_widget_style_get(obj));
+                                     style);
              else
                _elm_theme_object_set(obj, VIEW(item), "ctxpopup",
                                      "text_style_item_horizontal",
-                                     elm_widget_style_get(obj));
+                                     style);
           }
         else
           {
              if (!sd->horizontal)
                _elm_theme_object_set(obj, VIEW(item), "ctxpopup",
                                      "icon_style_item",
-                                     elm_widget_style_get(obj));
+                                     style);
              else
                _elm_theme_object_set(obj, VIEW(item), "ctxpopup",
                                      "icon_style_item_horizontal",
-                                     elm_widget_style_get(obj));
+                                     style);
           }
 
         if (item->label)
@@ -1586,16 +1589,20 @@ _elm_ctxpopup_item_elm_widget_item_part_text_set(Eo *eo_ctxpopup_it EINA_UNUSED,
 
    ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd);
 
+   char *style = (ctxpopup_it->style ?
+                  ctxpopup_it->style :
+                  elm_widget_style_get(WIDGET(ctxpopup_it)));
+
    if (ctxpopup_it->label && !label)
      {
         if (!sd->horizontal)
           _elm_theme_object_set(WIDGET(ctxpopup_it), VIEW(ctxpopup_it), "ctxpopup",
                                 "icon_style_item",
-                                elm_widget_style_get(WIDGET(ctxpopup_it)));
+                                style);
         else
           _elm_theme_object_set(WIDGET(ctxpopup_it), VIEW(ctxpopup_it), "ctxpopup",
                                 "icon_style_item_horizontal",
-                                elm_widget_style_get(WIDGET(ctxpopup_it)));
+                                style);
      }
    else if (!ctxpopup_it->label && label)
      {
@@ -1604,22 +1611,22 @@ _elm_ctxpopup_item_elm_widget_item_part_text_set(Eo *eo_ctxpopup_it EINA_UNUSED,
              if (!sd->horizontal)
                _elm_theme_object_set(WIDGET(ctxpopup_it), VIEW(ctxpopup_it), "ctxpopup",
                                      "text_style_item",
-                                     elm_widget_style_get(WIDGET(ctxpopup_it)));
+                                     style);
              else
                _elm_theme_object_set(WIDGET(ctxpopup_it), VIEW(ctxpopup_it), "ctxpopup",
                                      "text_style_item_horizontal",
-                                     elm_widget_style_get(WIDGET(ctxpopup_it)));
+                                     style);
           }
         else
           {
              if (!sd->horizontal)
                _elm_theme_object_set(WIDGET(ctxpopup_it), VIEW(ctxpopup_it), "ctxpopup",
                                     "icon_text_style_item",
-                                    elm_widget_style_get(WIDGET(ctxpopup_it)));
+                                     style);
              else
                _elm_theme_object_set(WIDGET(ctxpopup_it), VIEW(ctxpopup_it), "ctxpopup",
                                      "icon_text_style_item_horizontal",
-                                     elm_widget_style_get(WIDGET(ctxpopup_it)));
+                                     style);
           }
      }
 
@@ -1655,6 +1662,10 @@ _elm_ctxpopup_item_elm_widget_item_part_content_set(Eo *eo_ctxpopup_it EINA_UNUS
 
    ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd);
 
+   char *style = (ctxpopup_it->style ?
+                  ctxpopup_it->style :
+                  elm_widget_style_get(WIDGET(ctxpopup_it)));
+
    if (ctxpopup_it->icon)
      evas_object_del(ctxpopup_it->icon);
 
@@ -1665,22 +1676,22 @@ _elm_ctxpopup_item_elm_widget_item_part_content_set(Eo *eo_ctxpopup_it EINA_UNUS
              if (!sd->horizontal)
                _elm_theme_object_set(WIDGET(ctxpopup_it), VIEW(ctxpopup_it), "ctxpopup",
                                      "icon_text_style_item",
-                                     elm_widget_style_get(WIDGET(ctxpopup_it)));
+                                     style);
              else
                _elm_theme_object_set(WIDGET(ctxpopup_it), VIEW(ctxpopup_it), "ctxpopup",
                                      "icon_text_style_item_horizontal",
-                                     elm_widget_style_get(WIDGET(ctxpopup_it)));
+                                     style);
           }
         else if (ctxpopup_it->icon && !content)
           {
              if (!sd->horizontal)
                _elm_theme_object_set(WIDGET(ctxpopup_it), VIEW(ctxpopup_it), "ctxpopup",
                                      "text_style_item",
-                                     elm_widget_style_get(WIDGET(ctxpopup_it)));
+                                     style);
              else
                _elm_theme_object_set(WIDGET(ctxpopup_it), VIEW(ctxpopup_it), "ctxpopup",
                                      "text_style_item_horizontal",
-                                     elm_widget_style_get(WIDGET(ctxpopup_it)));
+                                     style);
           }
      }
 
@@ -1716,6 +1727,10 @@ _elm_ctxpopup_item_elm_widget_item_part_content_unset(Eo *eo_ctxpopup_it EINA_UN
 
    ELM_CTXPOPUP_DATA_GET(WIDGET(ctxpopup_it), sd);
 
+   char *style = (ctxpopup_it->style ?
+                  ctxpopup_it->style :
+                  elm_widget_style_get(WIDGET(ctxpopup_it)));
+
    edje_object_part_unswallow(VIEW(ctxpopup_it), ctxpopup_it->icon);
    evas_object_hide(ctxpopup_it->icon);
 
@@ -1724,11 +1739,11 @@ _elm_ctxpopup_item_elm_widget_item_part_content_unset(Eo *eo_ctxpopup_it EINA_UN
         if (!sd->horizontal)
           _elm_theme_object_set(WIDGET(ctxpopup_it), VIEW(ctxpopup_it), "ctxpopup",
                                 "text_style_item",
-                                elm_widget_style_get(WIDGET(ctxpopup_it)));
+                                style);
         else
           _elm_theme_object_set(WIDGET(ctxpopup_it), VIEW(ctxpopup_it), "ctxpopup",
                                 "text_style_item_horizontal",
-                                elm_widget_style_get(WIDGET(ctxpopup_it)));
+                                style);
      }
 
    content = ctxpopup_it->icon;
@@ -1825,6 +1840,7 @@ _on_show(void *data EINA_UNUSED,
    Eina_List *elist;
    Elm_Ctxpopup_Item_Data *item;
    int idx = 0;
+   char *style;
 
    ELM_CTXPOPUP_DATA_GET(obj, sd);
    ELM_WIDGET_DATA_GET_OR_RETURN(obj, wd);
@@ -1846,38 +1862,40 @@ _on_show(void *data EINA_UNUSED,
 
    EINA_LIST_FOREACH(sd->items, elist, item)
      {
+        style = (item->style ? item->style : elm_widget_style_get(obj));
+
         if (item->label && item->icon)
           {
              if (!sd->horizontal)
                _elm_theme_object_set(obj, VIEW(item), "ctxpopup",
                                      "icon_text_style_item",
-                                     elm_widget_style_get(obj));
+                                     style);
              else
                _elm_theme_object_set(obj, VIEW(item), "ctxpopup",
                                      "icon_text_style_item_horizontal",
-                                     elm_widget_style_get(obj));
+                                     style);
           }
         else if (item->label)
           {
              if (!sd->horizontal)
                _elm_theme_object_set(obj, VIEW(item), "ctxpopup",
                                      "text_style_item",
-                                     elm_widget_style_get(obj));
+                                     style);
              else
                _elm_theme_object_set(obj, VIEW(item), "ctxpopup",
                                      "text_style_item_horizontal",
-                                     elm_widget_style_get(obj));
+                                     style);
           }
         else
           {
              if (!sd->horizontal)
                _elm_theme_object_set(obj, VIEW(item), "ctxpopup",
                                      "icon_style_item",
-                                     elm_widget_style_get(obj));
+                                     style);
              else
                _elm_theme_object_set(obj, VIEW(item), "ctxpopup",
                                      "icon_style_item_horizontal",
-                                     elm_widget_style_get(obj));
+                                     style);
           }
 
         if (idx++ == 0)
@@ -2246,6 +2264,7 @@ _elm_ctxpopup_horizontal_set(Eo *obj, Elm_Ctxpopup_Data *sd, Eina_Bool horizonta
    Eina_List *elist;
    Elm_Ctxpopup_Item_Data *item;
    int idx = 0;
+   char *style;
 
    sd->horizontal = !!horizontal;
 
@@ -2267,38 +2286,40 @@ _elm_ctxpopup_horizontal_set(Eo *obj, Elm_Ctxpopup_Data *sd, Eina_Bool horizonta
 
    EINA_LIST_FOREACH(sd->items, elist, item)
      {
+        style = (item->style ? item->style : elm_widget_style_get(obj));
+
         if (item->label && item->icon)
           {
              if (!sd->horizontal)
                _elm_theme_object_set(obj, VIEW(item), "ctxpopup",
                                      "icon_text_style_item",
-                                     elm_widget_style_get(obj));
+                                     style);
              else
                _elm_theme_object_set(obj, VIEW(item), "ctxpopup",
                                      "icon_text_style_item_horizontal",
-                                     elm_widget_style_get(obj));
+                                     style);
           }
         else if (item->label)
           {
              if (!sd->horizontal)
                _elm_theme_object_set(obj, VIEW(item), "ctxpopup",
                                      "text_style_item",
-                                     elm_widget_style_get(obj));
+                                     style);
              else
                _elm_theme_object_set(obj, VIEW(item), "ctxpopup",
                                      "text_style_item_horizontal",
-                                     elm_widget_style_get(obj));
+                                     style);
           }
         else
           {
              if (!sd->horizontal)
                _elm_theme_object_set(obj, VIEW(item), "ctxpopup",
                                      "icon_style_item",
-                                     elm_widget_style_get(obj));
+                                     style);
              else
                _elm_theme_object_set(obj, VIEW(item), "ctxpopup",
                                      "icon_style_item_horizontal",
-                                     elm_widget_style_get(obj));
+                                     style);
           }
         if (idx++ == 0)
           edje_object_signal_emit(VIEW(item), "elm,state,default", "elm");