From: JinYong Park Date: Thu, 11 Jan 2018 02:41:44 +0000 (+0900) Subject: ctxpopup: fix unintentional item style change X-Git-Tag: submit/tizen_4.0/20180124.101838~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6f6af81f9a4a0950f7ea0fb38cbd736121123741;p=platform%2Fupstream%2Felementary.git ctxpopup: fix unintentional item style change 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 --- diff --git a/src/mobile_lib/elc_ctxpopup.c b/src/mobile_lib/elc_ctxpopup.c index ee53485ce..1b5554aea 100644 --- a/src/mobile_lib/elc_ctxpopup.c +++ b/src/mobile_lib/elc_ctxpopup.c @@ -1346,6 +1346,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); @@ -1375,38 +1376,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) @@ -1548,16 +1551,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) { @@ -1566,22 +1573,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); } } @@ -1617,6 +1624,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); @@ -1627,22 +1638,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); } } @@ -1678,6 +1689,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); @@ -1686,11 +1701,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; @@ -1787,6 +1802,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); @@ -1809,38 +1825,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) @@ -2198,6 +2216,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; @@ -2219,38 +2238,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");