elm button : new style "anchor", see elentary_test

SVN revision: 42820
This commit is contained in:
Jonathan Atton 2009-09-30 14:02:51 +00:00
parent 97a2d89bc5
commit 07eef230f6
2 changed files with 341 additions and 0 deletions

View File

@ -540,6 +540,7 @@ collections {
}
///////////////////////////////////////////////////////////////////////////////
group { name: "elm/button/base/default";
images {
image: "bt_base1.png" COMP;
@ -1302,6 +1303,315 @@ collections {
}
}
group { name: "elm/button/base/anchor";
images {
image: "bt_base1.png" COMP;
image: "bt_base2.png" COMP;
image: "bt_hilight.png" COMP;
image: "bt_shine.png" COMP;
image: "bt_glow.png" COMP;
image: "bt_dis_base.png" COMP;
image: "bt_dis_hilight.png" COMP;
}
parts {
part { name: "button_image";
mouse_events: 1;
description { state: "default" 0.0;
color: 255 255 255 0;
image {
normal: "bt_base2.png";
border: 7 7 7 7;
}
image.middle: SOLID;
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
color: 255 255 255 255;
}
description { state: "clicked" 0.0;
inherit: "default" 0.0;
inherit: "visible" 0.0;
image.normal: "bt_base1.png";
image.middle: SOLID;
}
description { state: "disabled" 0.0;
inherit: "default" 0.0;
inherit: "visible" 0.0;
image {
normal: "bt_dis_base.png";
border: 4 4 4 4;
}
}
}
part { name: "elm.swallow.content";
type: SWALLOW;
description { state: "default" 0.0;
fixed: 1 0;
visible: 0;
align: 0.0 0.5;
rel1.offset: 4 4;
rel2.offset: 3 -5;
rel2.relative: 0.0 1.0;
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
fixed: 1 0;
visible: 1;
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
rel2.offset: 4 -5;
}
description { state: "icononly" 0.0;
inherit: "default" 0.0;
fixed: 0 0;
visible: 1;
align: 0.5 0.5;
aspect: 1.0 1.0;
rel2.offset: -5 -5;
rel2.relative: 1.0 1.0;
aspect_preference: VERTICAL;
}
}
part {
name: "elm.text";
type: TEXT;
effect: SOFT_SHADOW;
mouse_events: 0;
scale: 1;
description { state: "default" 0.0;
visible: 0;
rel1.to_x: "elm.swallow.content";
rel1.relative: 1.0 0.0;
rel1.offset: 0 4;
rel2.offset: -5 -5;
color: 224 224 224 255;
color3: 0 0 0 64;
text {
font: "Sans,Edje-Vera";
size: 10;
min: 0 0;
align: 0.5 0.5;
}
}
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: "over1";
mouse_events: 0;
description { state: "default" 0.0;
color: 255 255 255 0;
rel2.relative: 1.0 0.5;
image {
normal: "bt_hilight.png";
border: 7 7 7 0;
}
}
description { state: "visible" 0.0;
inherit: "default" 0.0;
color: 255 255 255 255;
}
description { state: "disabled" 0.0;
inherit: "default" 0.0;
inherit: "visible" 0.0;
image {
normal: "bt_dis_hilight.png";
border: 4 4 4 0;
}
}
}
part { name: "over2";
mouse_events: 1;
repeat_events: 1;
ignore_flags: ON_HOLD;
description { state: "default" 0.0;
image {
normal: "bt_shine.png";
border: 7 7 7 7;
}
}
description { state: "disabled" 0.0;
inherit: "default" 0.0;
visible: 0;
}
}
part { name: "over3";
mouse_events: 1;
repeat_events: 1;
description { state: "default" 0.0;
color: 255 255 255 0;
image {
normal: "bt_glow.png";
border: 12 12 12 12;
}
fill.smooth : 0;
}
description { state: "clicked" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
}
}
part { name: "disabler";
type: RECT;
description { state: "default" 0.0;
color: 0 0 0 0;
visible: 0;
}
description { state: "disabled" 0.0;
inherit: "default" 0.0;
visible: 1;
}
}
}
programs {
program {
name: "button_mouse_in";
signal: "mouse,in";
source: "over2";
action: STATE_SET "visible" 0.0;
target: "button_image";
target: "over1";
transition: DECELERATE 0.5;
}
program {
name: "button_mouse_out";
signal: "mouse,out";
source: "over2";
action: STATE_SET "default" 0.0;
target: "button_image";
target: "over1";
transition: DECELERATE 0.5;
}
program {
name: "button_unclick";
signal: "mouse,up,1";
source: "over2";
action: STATE_SET "visible" 0.0;
target: "button_image";
}
program {
name: "button_click2";
signal: "mouse,down,1";
source: "over3";
action: STATE_SET "clicked" 0.0;
target: "over3";
}
program {
name: "button_unclick2";
signal: "mouse,up,1";
source: "over3";
action: STATE_SET "default" 0.0;
transition: DECELERATE 0.5;
target: "over3";
}
program {
name: "button_unclick3";
signal: "mouse,up,1";
source: "over2";
action: SIGNAL_EMIT "elm,action,click" "";
}
program { name: "text_show";
signal: "elm,state,text,visible";
source: "elm";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.swallow.content", st, 30, vl);
if (!strcmp(st, "icononly"))
set_state(PART:"elm.swallow.content", "visible", 0.0);
set_state(PART:"elm.text", "visible", 0.0);
}
}
program { name: "text_hide";
signal: "elm,state,text,hidden";
source: "elm";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.swallow.content", st, 30, vl);
if (!strcmp(st, "visible"))
set_state(PART:"elm.swallow.content", "icononly", 0.0);
set_state(PART:"elm.text", "default", 0.0);
}
}
program { name: "icon_show";
signal: "elm,state,icon,visible";
source: "elm";
script {
new st[31];
new Float:vl;
get_state(PART:"elm.text", st, 30, vl);
if (!strcmp(st, "visible"))
set_state(PART:"elm.swallow.content", "visible", 0.0);
else
set_state(PART:"elm.swallow.content", "icononly", 0.0);
}
}
program { name: "icon_hide";
signal: "elm,state,icon,hidden";
source: "elm";
action: STATE_SET "default" 0.0;
target: "elm.swallow.content";
}
program { name: "disable";
signal: "elm,state,disabled";
source: "elm";
action: STATE_SET "disabled" 0.0;
target: "button_image";
target: "over1";
target: "over2";
target: "disabler";
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: "button_image";
target: "over1";
target: "over2";
target: "disabler";
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/toggle/base/default";
images {

View File

@ -80,6 +80,37 @@ test_button(void *data, Evas_Object *obj, void *event_info)
evas_object_show(bt);
evas_object_show(ic);
bt = elm_button_add(win);
elm_object_style_set(bt, "anchor");
elm_button_label_set(bt, "Anchor style");
elm_box_pack_end(bx, bt);
evas_object_show(bt);
ic = elm_icon_add(win);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
elm_icon_file_set(ic, buf, NULL);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
bt = elm_button_add(win);
elm_object_style_set(bt, "anchor");
elm_button_icon_set(bt, ic);
elm_box_pack_end(bx, bt);
evas_object_show(bt);
evas_object_show(ic);
ic = elm_icon_add(win);
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
elm_icon_file_set(ic, buf, NULL);
evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
bt = elm_button_add(win);
elm_object_style_set(bt, "anchor");
elm_button_icon_set(bt, ic);
elm_object_disabled_set(bt, 1);
elm_box_pack_end(bx, bt);
evas_object_show(bt);
evas_object_show(ic);
evas_object_show(win);
}
#endif