forked from enlightenment/efl
Elementary menu item: handling hidden icon
Summary: Added noicon menu item state to default menu theme. Now you can hide icon by setting it to "" (empty string) Removed check for resetting the same icon name. This allows setting an icon after it was hidden. Reviewers: cedric, seoz, raster Reviewed By: raster CC: reutskiy.v.v Differential Revision: https://phab.enlightenment.org/D522
This commit is contained in:
parent
a31944daa4
commit
3771a6d473
|
@ -40,7 +40,6 @@ group { name: "elm/menu/item/default";
|
||||||
inherit: "default" 0.0;
|
inherit: "default" 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// XXX: need to handle no icon mode
|
|
||||||
part { name: "elm.swallow.content"; type: SWALLOW; mouse_events: 0;
|
part { name: "elm.swallow.content"; type: SWALLOW; mouse_events: 0;
|
||||||
clip_to: "disabler";
|
clip_to: "disabler";
|
||||||
scale: 1;
|
scale: 1;
|
||||||
|
@ -52,6 +51,10 @@ group { name: "elm/menu/item/default";
|
||||||
rel2.offset: 3 -5;
|
rel2.offset: 3 -5;
|
||||||
rel2.relative: 0.0 1.0;
|
rel2.relative: 0.0 1.0;
|
||||||
}
|
}
|
||||||
|
description { state: "noicon" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
visible: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// XXX: check/radio goes next (right of) content, no radio/check handle
|
// XXX: check/radio goes next (right of) content, no radio/check handle
|
||||||
// XXX: need to handle no text?
|
// XXX: need to handle no text?
|
||||||
|
@ -237,6 +240,16 @@ group { name: "elm/menu/item/default";
|
||||||
// set_state(PART:"elm.text2", "default", 0.0);
|
// set_state(PART:"elm.text2", "default", 0.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
program { name: "icon_show";
|
||||||
|
signal: "elm,state,icon,visible"; source: "elm";
|
||||||
|
action: STATE_SET "default" 0.0;
|
||||||
|
target: "elm.swallow.content";
|
||||||
|
}
|
||||||
|
program { name: "icon_hide";
|
||||||
|
signal: "elm,state,icon,hidden"; source: "elm";
|
||||||
|
action: STATE_SET "noicon" 0.0;
|
||||||
|
target: "elm.swallow.content";
|
||||||
|
}
|
||||||
program { name: "selected";
|
program { name: "selected";
|
||||||
signal: "elm,state,selected"; source: "elm";
|
signal: "elm,state,selected"; source: "elm";
|
||||||
action: STATE_SET "active" 0.0;
|
action: STATE_SET "active" 0.0;
|
||||||
|
@ -408,7 +421,6 @@ group { name: "elm/menu/main_menu_submenu/default";
|
||||||
inherit: "default" 0.0;
|
inherit: "default" 0.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// XXX: need to handle no icon mode
|
|
||||||
part { name: "elm.swallow.content"; type: SWALLOW; mouse_events: 0;
|
part { name: "elm.swallow.content"; type: SWALLOW; mouse_events: 0;
|
||||||
clip_to: "disabler";
|
clip_to: "disabler";
|
||||||
scale: 1;
|
scale: 1;
|
||||||
|
@ -420,6 +432,10 @@ group { name: "elm/menu/main_menu_submenu/default";
|
||||||
rel2.offset: 3 -5;
|
rel2.offset: 3 -5;
|
||||||
rel2.relative: 0.0 1.0;
|
rel2.relative: 0.0 1.0;
|
||||||
}
|
}
|
||||||
|
description { state: "noicon" 0.0;
|
||||||
|
inherit: "default" 0.0;
|
||||||
|
visible: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// XXX: check/radio goes next (right of) content, no radio/check handle
|
// XXX: check/radio goes next (right of) content, no radio/check handle
|
||||||
// XXX: need to handle no text?
|
// XXX: need to handle no text?
|
||||||
|
@ -634,6 +650,16 @@ group { name: "elm/menu/main_menu_submenu/default";
|
||||||
// set_state(PART:"elm.text2", "default", 0.0);
|
// set_state(PART:"elm.text2", "default", 0.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
program { name: "icon_show";
|
||||||
|
signal: "elm,state,icon,visible"; source: "elm";
|
||||||
|
action: STATE_SET "default" 0.0;
|
||||||
|
target: "elm.swallow.content";
|
||||||
|
}
|
||||||
|
program { name: "icon_hide";
|
||||||
|
signal: "elm,state,icon,hidden"; source: "elm";
|
||||||
|
action: STATE_SET "noicon" 0.0;
|
||||||
|
target: "elm.swallow.content";
|
||||||
|
}
|
||||||
program { name: "selected";
|
program { name: "selected";
|
||||||
signal: "elm,state,selected"; source: "elm";
|
signal: "elm,state,selected"; source: "elm";
|
||||||
action: STATE_SET "active" 0.0;
|
action: STATE_SET "active" 0.0;
|
||||||
|
|
|
@ -1029,9 +1029,8 @@ elm_menu_item_icon_name_set(Elm_Object_Item *it,
|
||||||
ELM_MENU_ITEM_CHECK_OR_RETURN(it);
|
ELM_MENU_ITEM_CHECK_OR_RETURN(it);
|
||||||
EINA_SAFETY_ON_NULL_RETURN(icon);
|
EINA_SAFETY_ON_NULL_RETURN(icon);
|
||||||
|
|
||||||
if (!*icon) return;
|
if ((icon[0] != '\0') &&
|
||||||
if ((item->icon_str) && (!strcmp(item->icon_str, icon))) return;
|
(snprintf(icon_tmp, sizeof(icon_tmp), "menu/%s", icon) > 0) &&
|
||||||
if ((snprintf(icon_tmp, sizeof(icon_tmp), "menu/%s", icon) > 0) &&
|
|
||||||
(elm_icon_standard_set(item->content, icon_tmp) ||
|
(elm_icon_standard_set(item->content, icon_tmp) ||
|
||||||
elm_icon_standard_set(item->content, icon)))
|
elm_icon_standard_set(item->content, icon)))
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,6 +19,7 @@ EAPI Evas_Object *elm_menu_item_object_get(const Elm_Object_Item
|
||||||
* @param icon The name of icon object to set for the content of @p item
|
* @param icon The name of icon object to set for the content of @p item
|
||||||
*
|
*
|
||||||
* Once this icon is set, any previously set icon will be deleted.
|
* Once this icon is set, any previously set icon will be deleted.
|
||||||
|
* To hide icon set it to "".
|
||||||
*
|
*
|
||||||
* @ingroup Menu
|
* @ingroup Menu
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue