Elm toolbar : If the icon is bigger than the text fit to the icon size

SVN revision: 43350
This commit is contained in:
Jonathan Atton 2009-10-30 13:13:21 +00:00
parent 5533c2a8f9
commit f7c963cad5
2 changed files with 194 additions and 195 deletions

View File

@ -6808,206 +6808,207 @@ collections {
}
group { name: "elm/toolbar/item/default";
images {
image: "toolbar_sel.png" COMP;
}
parts {
part { name: "label2";
type: TEXT;
mouse_events: 0;
scale: 1;
description { state: "default" 0.0;
align: 0.5 1.0;
fixed: 0 1;
rel1.to: "elm.text";
rel2.to: "elm.text";
color: 0 0 0 255;
text {
font: "Sans";
text_source: "elm.text";
size: 10;
min: 1 1;
align: 0.5 0.5;
images {
image: "toolbar_sel.png" COMP;
}
parts {
part { name: "label2";
type: TEXT;
mouse_events: 0;
scale: 1;
description { state: "default" 0.0;
align: 0.5 1.0;
fixed: 0 1;
rel1.to: "elm.text";
rel2.to: "elm.text";
color: 0 0 0 255;
text {
font: "Sans";
text_source: "elm.text";
size: 10;
min: 1 1;
align: 0.5 0.5;
}
}
}
description { state: "selected" 0.0;
inherit: "default" 0.0;
visible: 0;
}
description { state: "disabled" 0.0;
inherit: "default" 0.0;
color: 0 0 0 128;
color3: 0 0 0 0;
}
description { state: "disabled_visible" 0.0;
inherit: "default" 0.0;
color: 0 0 0 128;
color3: 0 0 0 0;
visible: 1;
text.min: 1 1;
}
}
part { name: "bg";
mouse_events: 0;
description { state: "default" 0.0;
visible: 0;
color: 255 255 255 0;
image {
normal: "toolbar_sel.png";
border: 3 3 0 0;
description { state: "selected" 0.0;
inherit: "default" 0.0;
visible: 0;
}
image.middle: SOLID;
fill.smooth: 0;
}
description { state: "selected" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
}
description { state: "disabled" 0.0;
inherit: "default" 0.0;
visible: 0;
color: 255 255 255 0;
}
}
part { name: "elm.swallow.icon";
type: SWALLOW;
description { state: "default" 0.0;
align: 0.5 0.5;
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
rel1 {
relative: 0.0 0.0;
offset: 2 2;
description { state: "disabled" 0.0;
inherit: "default" 0.0;
color: 0 0 0 128;
color3: 0 0 0 0;
}
rel2 {
to_y: "elm.text";
relative: 1.0 0.0;
offset: -3 -1;
description { state: "disabled_visible" 0.0;
inherit: "default" 0.0;
color: 0 0 0 128;
color3: 0 0 0 0;
visible: 1;
text.min: 1 1;
}
color: 0 0 0 0;
}
}
part { name: "elm.text";
type: TEXT;
effect: SOFT_SHADOW;
mouse_events: 0;
scale: 1;
description { state: "default" 0.0;
align: 0.5 1.0;
fixed: 0 1;
rel1 {
relative: 0.0 1.0;
offset: 0 -1;
}
part { name: "bg";
mouse_events: 0;
description { state: "default" 0.0;
visible: 0;
color: 255 255 255 0;
image {
normal: "toolbar_sel.png";
border: 3 3 0 0;
}
image.middle: SOLID;
fill.smooth: 0;
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
description { state: "selected" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
}
visible: 0;
color: 224 224 224 255;
color3: 0 0 0 32;
text {
font: "Sans:style=Bold";
size: 10;
min: 1 1;
align: 0.5 0.5;
description { state: "disabled" 0.0;
inherit: "default" 0.0;
visible: 0;
color: 255 255 255 0;
}
}
description { state: "selected" 0.0;
inherit: "default" 0.0;
visible: 1;
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
text.min: 1 1;
}
description { state: "disabled" 0.0;
inherit: "default" 0.0;
color: 0 0 0 128;
color3: 0 0 0 0;
}
description { state: "disabled_visible" 0.0;
inherit: "default" 0.0;
color: 0 0 0 128;
color3: 0 0 0 0;
visible: 1;
text.min: 1 1;
}
}
part { name: "event";
type: RECT;
mouse_events: 1;
ignore_flags: ON_HOLD;
description { state: "default" 0.0;
color: 0 0 0 0;
}
}
}
programs {
program { name: "go_active";
signal: "elm,state,selected";
source: "elm";
action: STATE_SET "selected" 0.0;
target: "bg";
target: "elm.text";
target: "label2";
transition: LINEAR 0.2;
}
program { name: "go_passive";
signal: "elm,state,unselected";
source: "elm";
action: STATE_SET "default" 0.0;
target: "bg";
target: "elm.text";
target: "label2";
transition: LINEAR 0.1;
}
program { name: "go";
signal: "mouse,up,1";
source: "event";
action: SIGNAL_EMIT "elm,action,click" "elm";
}
program { name: "disable";
signal: "elm,state,disabled";
source: "elm";
action: STATE_SET "disabled" 0.0;
target: "label2";
target: "bg";
after: "disable_text";
}
program { name: "disable_text";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.text", st, 30, vl);
if (!strcmp(st, "visible"))
set_state(PART:"elm.text", "disabled_visible", 0.0);
else
set_state(PART:"elm.text", "disabled", 0.0);
}
}
program { name: "enable";
signal: "elm,state,enabled";
source: "elm";
action: STATE_SET "default" 0.0;
target: "label2";
target: "bg";
after: "enable_text";
}
program { name: "enable_text";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.text", st, 30, vl);
if (!strcmp(st, "disabled_visible"))
set_state(PART:"elm.text", "visible", 0.0);
else
set_state(PART:"elm.text", "default", 0.0);
}
}
}
}
part { name: "elm.swallow.icon";
type: SWALLOW;
description { state: "default" 0.0;
align: 0.5 0.5;
fixed: 0 0;
//aspect: 1.0 1.0;
//aspect_preference: VERTICAL;
rel1 {
relative: 0.0 0.0;
offset: 2 2;
}
rel2 {
to_y: "elm.text";
relative: 1.0 0.0;
offset: -3 -1;
}
color: 0 0 0 0;
}
}
part { name: "elm.text";
type: TEXT;
effect: SOFT_SHADOW;
mouse_events: 0;
scale: 1;
description { state: "default" 0.0;
align: 0.5 1.0;
fixed: 0 1;
rel1 {
relative: 0.0 1.0;
offset: 0 -1;
}
rel2 {
relative: 1.0 1.0;
offset: -1 -1;
}
visible: 0;
color: 224 224 224 255;
color3: 0 0 0 32;
text {
font: "Sans:style=Bold";
size: 10;
min: 1 1;
align: 0.5 0.5;
}
}
description { state: "selected" 0.0;
inherit: "default" 0.0;
visible: 1;
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
text.min: 1 1;
}
description { state: "disabled" 0.0;
inherit: "default" 0.0;
color: 0 0 0 128;
color3: 0 0 0 0;
}
description { state: "disabled_visible" 0.0;
inherit: "default" 0.0;
color: 0 0 0 128;
color3: 0 0 0 0;
visible: 1;
text.min: 1 1;
}
}
part { name: "event";
type: RECT;
mouse_events: 1;
ignore_flags: ON_HOLD;
description { state: "default" 0.0;
color: 0 0 0 0;
}
}
}
programs {
program { name: "go_active";
signal: "elm,state,selected";
source: "elm";
action: STATE_SET "selected" 0.0;
target: "bg";
target: "elm.text";
target: "label2";
transition: LINEAR 0.2;
}
program { name: "go_passive";
signal: "elm,state,unselected";
source: "elm";
action: STATE_SET "default" 0.0;
target: "bg";
target: "elm.text";
target: "label2";
transition: LINEAR 0.1;
}
program { name: "go";
signal: "mouse,up,1";
source: "event";
action: SIGNAL_EMIT "elm,action,click" "elm";
}
program { name: "disable";
signal: "elm,state,disabled";
source: "elm";
action: STATE_SET "disabled" 0.0;
target: "label2";
target: "bg";
after: "disable_text";
}
program { name: "disable_text";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.text", st, 30, vl);
if (!strcmp(st, "visible"))
set_state(PART:"elm.text", "disabled_visible", 0.0);
else
set_state(PART:"elm.text", "disabled", 0.0);
}
}
program { name: "enable";
signal: "elm,state,enabled";
source: "elm";
action: STATE_SET "default" 0.0;
target: "label2";
target: "bg";
after: "enable_text";
}
program { name: "enable_text";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.text", st, 30, vl);
if (!strcmp(st, "disabled_visible"))
set_state(PART:"elm.text", "visible", 0.0);
else
set_state(PART:"elm.text", "default", 0.0);
}
}
}
}
group { name: "elm/toolbar/separator/default";

View File

@ -375,8 +375,6 @@ elm_toolbar_item_add(Evas_Object *obj, Evas_Object *icon, const char *label, voi
int ms = 0;
ms = ((double)wd->icon_size * _elm_config->scale);
//TODO uncomment the next line to get a big icon
//ms = 100;
evas_object_size_hint_min_set(it->icon, ms, ms);
evas_object_size_hint_max_set(it->icon, ms, ms);
edje_object_part_swallow(it->base, "elm.swallow.icon", it->icon);