From: michael bouchaud <michael.bouchaud@gmail.com>
progress bar patch - awesome. all there. excellent. a bit of formatting fixes, but in. thanks! SVN revision: 41710
This commit is contained in:
parent
59b39ea802
commit
eecdb5e668
|
@ -10072,4 +10072,691 @@ collections {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
group { name: "elm/progressbar/horizontal/default";
|
||||
images {
|
||||
image: "bt_basew.png" COMP;
|
||||
image: "bt_bases.png" COMP;
|
||||
image: "bt_base1.png" COMP;
|
||||
}
|
||||
parts {
|
||||
part { name: "elm.background.progressbar";
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
rel1 {
|
||||
relative: 0.0 0.0;
|
||||
offset: 0 0;
|
||||
}
|
||||
rel2 {
|
||||
relative: 1.0 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
part { name: "elm.swallow.bar";
|
||||
mouse_events: 0;
|
||||
type: SWALLOW;
|
||||
description {
|
||||
min: 48 28;
|
||||
max: 99999 28;
|
||||
state: "default" 0.0;
|
||||
rel1 {
|
||||
to_x: "elm.text";
|
||||
to_y: "elm.background.progressbar";
|
||||
relative: 1.0 0.0;
|
||||
}
|
||||
rel2 {
|
||||
to: "elm.background.progressbar";
|
||||
relative: 1.0 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
part { name: "elm.swallow.content";
|
||||
type: SWALLOW;
|
||||
description { state: "default" 0.0;
|
||||
visible: 0;
|
||||
align: 0.0 0.5;
|
||||
rel1 {
|
||||
offset: 4 0;
|
||||
to_y: "elm.background.progressbar";
|
||||
}
|
||||
rel2 {
|
||||
offset: 3 -1;
|
||||
relative: 0.0 1.0;
|
||||
to_y: "elm.background.progressbar";
|
||||
}
|
||||
}
|
||||
description { state: "visible" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
aspect: 1.0 1.0;
|
||||
aspect_preference: VERTICAL;
|
||||
rel2.offset: 4 -1;
|
||||
}
|
||||
}
|
||||
part { name: "elm.text";
|
||||
type: TEXT;
|
||||
mouse_events: 0;
|
||||
scale: 1;
|
||||
description { state: "default" 0.0;
|
||||
visible: 0;
|
||||
fixed: 1 1;
|
||||
align: 0.0 0.5;
|
||||
rel1.to_x: "elm.swallow.content";
|
||||
rel1.relative: 1.0 0.0;
|
||||
rel1.offset: -1 4;
|
||||
rel2.to_x: "elm.swallow.content";
|
||||
rel2.relative: 1.0 1.0;
|
||||
rel2.offset: -1 -5;
|
||||
color: 0 0 0 255;
|
||||
text {
|
||||
font: "Sans,Edje-Vera";
|
||||
size: 10;
|
||||
min: 0 0;
|
||||
align: 0.0 0.5;
|
||||
}
|
||||
}
|
||||
description { state: "visible" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
text.min: 1 1;
|
||||
rel1.offset: 0 4;
|
||||
rel2.offset: 0 -5;
|
||||
}
|
||||
}
|
||||
|
||||
part { name: "background";
|
||||
mouse_events: 0;
|
||||
clip_to: "elm.background.progressbar";
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
rel1 {
|
||||
to: "elm.swallow.bar";
|
||||
relative: 0.0 0.0;
|
||||
}
|
||||
rel2 {
|
||||
to: "elm.swallow.bar";
|
||||
relative: 1.0 1.0;
|
||||
offset: -1 -1;
|
||||
}
|
||||
image {
|
||||
normal: "bt_basew.png";
|
||||
border: 8 8 8 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
part { name: "elm.progress.progressbar";
|
||||
mouse_events: 0;
|
||||
clip_to: "elm.background.progressbar";
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
rel1 {
|
||||
to: "elm.swallow.bar";
|
||||
relative: 0.0 0.0;
|
||||
}
|
||||
rel2 {
|
||||
to_y: "elm.swallow.bar";
|
||||
to_x: "elm.cur.progressbar";
|
||||
offset: -1 -1;
|
||||
}
|
||||
image {
|
||||
normal: "bt_base1.png";
|
||||
border: 8 8 8 8;
|
||||
}
|
||||
}
|
||||
description {
|
||||
state: "invert" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
rel1 {
|
||||
to_y: "elm.swallow.bar";
|
||||
to_x: "elm.cur.progressbar";
|
||||
relative: 1.0 0.0;
|
||||
}
|
||||
rel2 {
|
||||
to: "elm.swallow.bar";
|
||||
relative: 1.0 1.0;
|
||||
}
|
||||
}
|
||||
description {
|
||||
state: "state_begin" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
rel1 {
|
||||
to: "elm.swallow.bar";
|
||||
relative: 0.0 0.0;
|
||||
}
|
||||
rel2 {
|
||||
to: "elm.swallow.bar";
|
||||
relative: 0.1 1.0;
|
||||
}
|
||||
}
|
||||
description {
|
||||
state: "state_end" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
rel1 {
|
||||
to: "elm.swallow.bar";
|
||||
relative: 0.9 0.0;
|
||||
}
|
||||
rel2 {
|
||||
to: "elm.swallow.bar";
|
||||
relative: 1.0 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
part { name: "elm.cur.progressbar";
|
||||
mouse_events: 0;
|
||||
dragable {
|
||||
confine: "background";
|
||||
x: 1 1 1;
|
||||
y: 0 0 0;
|
||||
}
|
||||
description { state: "default" 0.0;
|
||||
visible: 0;
|
||||
rel1 {
|
||||
to: "background";
|
||||
relative: 0 0;
|
||||
}
|
||||
rel2.to: "background";
|
||||
}
|
||||
}
|
||||
part { name: "elm.text.box";
|
||||
mouse_events: 0;
|
||||
description { state: "default" 0.0;
|
||||
visible: 1;
|
||||
rel1 {
|
||||
to: "elm.text.content";
|
||||
offset: -6 -4;
|
||||
}
|
||||
rel2 {
|
||||
to: "elm.text.content";
|
||||
offset: 6 4;
|
||||
}
|
||||
image {
|
||||
normal: "bt_basew.png";
|
||||
border: 8 8 8 8;
|
||||
}
|
||||
fill.smooth: 0;
|
||||
}
|
||||
description { state: "hidden" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 0;
|
||||
}
|
||||
}
|
||||
part { name: "elm.text.content";
|
||||
type: TEXT;
|
||||
mouse_events: 0;
|
||||
description { state: "default" 0.0;
|
||||
fixed: 1 1;
|
||||
visible: 1;
|
||||
rel1 {
|
||||
to: "background";
|
||||
relative: 0.5 0.5;
|
||||
offset: -3 -1;
|
||||
}
|
||||
rel2 {
|
||||
to: "background";
|
||||
relative: 0.5 0.5;
|
||||
offset: 3 -1;
|
||||
}
|
||||
text {
|
||||
font: "Sans,Edje-Vera";
|
||||
size: 10;
|
||||
min: 1 1;
|
||||
align: 0.5 0.0;
|
||||
}
|
||||
color: 0 0 0 255;
|
||||
}
|
||||
description { state: "hidden" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 0;
|
||||
text.min: 0 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
programs {
|
||||
program { name: "label_show";
|
||||
signal: "elm,state,text,visible";
|
||||
source: "elm";
|
||||
action: STATE_SET "visible" 0.0;
|
||||
target: "elm.text";
|
||||
}
|
||||
program { name: "label_hide";
|
||||
signal: "elm,state,text,hidden";
|
||||
source: "elm";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "elm.text";
|
||||
}
|
||||
program { name: "icon_show";
|
||||
signal: "elm,state,icon,visible";
|
||||
source: "elm";
|
||||
action: STATE_SET "visible" 0.0;
|
||||
target: "elm.swallow.content";
|
||||
}
|
||||
program { name: "icon_hide";
|
||||
signal: "elm,state,icon,hidden";
|
||||
source: "elm";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "elm.swallow.content";
|
||||
}
|
||||
program { name: "units_show";
|
||||
signal: "elm,state,units,visible";
|
||||
source: "elm";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "elm.text.content";
|
||||
target: "elm.text.box";
|
||||
}
|
||||
program { name: "units_hide";
|
||||
signal: "elm,state,units,hidden";
|
||||
source: "elm";
|
||||
action: STATE_SET "hidden" 0.0;
|
||||
target: "elm.text.content";
|
||||
target: "elm.text.box";
|
||||
}
|
||||
program { name: "slide_to_end";
|
||||
action: STATE_SET "state_end" 0.0;
|
||||
transition: LINEAR 0.5;
|
||||
target: "elm.progress.progressbar";
|
||||
after: "slide_to_begin";
|
||||
}
|
||||
program { name: "slide_to_begin";
|
||||
signal: "elm,state,slide,begin";
|
||||
action: STATE_SET "state_begin" 0.0;
|
||||
target: "elm.progress.progressbar";
|
||||
transition: LINEAR 0.5;
|
||||
after: "slide_to_end";
|
||||
}
|
||||
program { name: "start_pulse";
|
||||
signal: "elm,state,pulse,start";
|
||||
source: "elm";
|
||||
after: "slide_to_end";
|
||||
}
|
||||
program { name: "stop_pulse";
|
||||
signal: "elm,state,pulse,stop";
|
||||
source: "elm";
|
||||
action: ACTION_STOP;
|
||||
target: "slide_to_begin";
|
||||
target: "slide_to_end";
|
||||
target: "start_pulse";
|
||||
after: "state_pulse";
|
||||
}
|
||||
program { name: "state_pulse";
|
||||
signal: "elm,state,pulse";
|
||||
source: "elm";
|
||||
action: STATE_SET "state_begin" 0.0;
|
||||
target: "elm.progress.progressbar";
|
||||
after: "units_hide";
|
||||
}
|
||||
program { name: "state_fraction";
|
||||
signal: "elm,state,fraction";
|
||||
source: "elm";
|
||||
action: ACTION_STOP;
|
||||
target: "slide_to_begin";
|
||||
target: "slide_to_end";
|
||||
target: "start_pulse";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "elm.progress.progressbar";
|
||||
}
|
||||
program { name: "set_invert_on";
|
||||
signal: "elm,state,inverted,on";
|
||||
source: "elm";
|
||||
action: STATE_SET "invert" 0.0;
|
||||
target: "elm.progress.progressbar";
|
||||
}
|
||||
program { name: "set_invert_off";
|
||||
signal: "elm,state,inverted,off";
|
||||
source: "elm";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "elm.progress.progressbar";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
group { name: "elm/progressbar/vertical/default";
|
||||
images {
|
||||
image: "bt_basew.png" COMP;
|
||||
image: "bt_bases.png" COMP;
|
||||
image: "bt_base1.png" COMP;
|
||||
}
|
||||
parts {
|
||||
part { name: "elm.background.progressbar";
|
||||
type: RECT;
|
||||
mouse_events: 0;
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
rel1 {
|
||||
relative: 0.0 0.0;
|
||||
offset: 0 0;
|
||||
}
|
||||
rel2 {
|
||||
relative: 1.0 1.0;
|
||||
offset: -1 -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
part { name: "elm.swallow.bar";
|
||||
type: SWALLOW;
|
||||
scale: 1;
|
||||
description { state: "default" 0.0;
|
||||
min: 28 48;
|
||||
max: 28 9999;
|
||||
align: 0.5 1.0;
|
||||
rel1 {
|
||||
to_y: "elm.text";
|
||||
relative: 0.0 1.0;
|
||||
offset: 0 2;
|
||||
}
|
||||
rel2 {
|
||||
to_y: "elm.text.box";
|
||||
relative: 1.0 0.0;
|
||||
offset: -1 -3;
|
||||
}
|
||||
}
|
||||
}
|
||||
part { name: "elm.swallow.content";
|
||||
type: SWALLOW;
|
||||
description { state: "default" 0.0;
|
||||
visible: 0;
|
||||
align: 0.5 0.0;
|
||||
rel1 {
|
||||
offset: 0 4;
|
||||
to_x: "elm.swallow.bar";
|
||||
}
|
||||
rel2 {
|
||||
offset: -1 3;
|
||||
relative: 1.0 0.0;
|
||||
to_x: "elm.swallow.bar";
|
||||
}
|
||||
}
|
||||
description { state: "visible" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
aspect: 1.0 1.0;
|
||||
aspect_preference: HORIZONTAL;
|
||||
rel2.offset: -1 4;
|
||||
}
|
||||
}
|
||||
part { name: "elm.text";
|
||||
type: TEXT;
|
||||
mouse_events: 0;
|
||||
scale: 1;
|
||||
description { state: "default" 0.0;
|
||||
visible: 0;
|
||||
fixed: 1 1;
|
||||
align: 0.5 0.0;
|
||||
rel1.to_y: "elm.swallow.content";
|
||||
rel1.relative: 0.5 1.0;
|
||||
rel1.offset: 0 -1;
|
||||
rel2.to_y: "elm.swallow.content";
|
||||
rel2.relative: 0.5 1.0;
|
||||
rel2.offset: -1 -1;
|
||||
color: 0 0 0 255;
|
||||
text {
|
||||
font: "Sans,Edje-Vera";
|
||||
size: 10;
|
||||
min: 0 0;
|
||||
align: 0.5 0.0;
|
||||
}
|
||||
}
|
||||
description { state: "visible" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
text.min: 1 1;
|
||||
rel1.offset: 4 0;
|
||||
rel2.offset: -5 0;
|
||||
}
|
||||
}
|
||||
|
||||
part { name: "background";
|
||||
mouse_events: 0;
|
||||
clip_to: "elm.background.progressbar";
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
rel1 {
|
||||
to: "elm.swallow.bar";
|
||||
relative: 0.0 0.0;
|
||||
}
|
||||
rel2 {
|
||||
to: "elm.swallow.bar";
|
||||
relative: 1.0 1.0;
|
||||
offset: -1 -1;
|
||||
}
|
||||
image {
|
||||
normal: "bt_basew.png";
|
||||
border: 8 8 8 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
part { name: "elm.progress.progressbar";
|
||||
mouse_events: 0;
|
||||
clip_to: "elm.background.progressbar";
|
||||
description {
|
||||
state: "default" 0.0;
|
||||
rel1 {
|
||||
to: "elm.swallow.bar";
|
||||
relative: 0.0 0.0;
|
||||
}
|
||||
rel2 {
|
||||
to_x: "elm.swallow.bar";
|
||||
to_y: "elm.cur.progressbar";
|
||||
offset: -1 -1;
|
||||
}
|
||||
image {
|
||||
normal: "bt_base1.png";
|
||||
border: 8 8 8 8;
|
||||
}
|
||||
}
|
||||
description {
|
||||
state: "invert" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
rel1 {
|
||||
to_x: "elm.swallow.bar";
|
||||
to_y: "elm.cur.progressbar";
|
||||
relative: 0.0 1.0;
|
||||
}
|
||||
rel2 {
|
||||
to: "elm.swallow.bar";
|
||||
relative: 1.0 1.0;
|
||||
}
|
||||
}
|
||||
description {
|
||||
state: "state_begin" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
rel1 {
|
||||
to: "elm.swallow.bar";
|
||||
relative: 0.0 0.0;
|
||||
}
|
||||
rel2 {
|
||||
to: "elm.swallow.bar";
|
||||
relative: 1.0 0.1;
|
||||
}
|
||||
}
|
||||
description {
|
||||
state: "state_end" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
rel1 {
|
||||
to: "elm.swallow.bar";
|
||||
relative: 0.0 0.9;
|
||||
}
|
||||
rel2 {
|
||||
to: "elm.swallow.bar";
|
||||
relative: 1.0 1.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
part { name: "elm.cur.progressbar";
|
||||
mouse_events: 0;
|
||||
dragable {
|
||||
confine: "background";
|
||||
x: 0 0 0;
|
||||
y: 1 1 1;
|
||||
}
|
||||
description { state: "default" 0.0;
|
||||
visible: 0;
|
||||
rel1 {
|
||||
to: "background";
|
||||
relative: 0 0;
|
||||
}
|
||||
rel2.to: "background";
|
||||
}
|
||||
}
|
||||
|
||||
part { name: "elm.text.box";
|
||||
mouse_events: 0;
|
||||
description { state: "default" 0.0;
|
||||
visible: 0;
|
||||
rel1 {
|
||||
to: "elm.text.content";
|
||||
offset: -2 -2;
|
||||
}
|
||||
rel2 {
|
||||
to: "elm.text.content";
|
||||
offset: 2 2;
|
||||
}
|
||||
image {
|
||||
normal: "bt_basew.png";
|
||||
border: 8 8 8 8;
|
||||
}
|
||||
fill.smooth: 0;
|
||||
}
|
||||
description { state: "visible" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
visible: 1;
|
||||
}
|
||||
}
|
||||
part { name: "elm.text.content";
|
||||
type: TEXT;
|
||||
mouse_events: 0;
|
||||
scale: 1;
|
||||
description { state: "default" 0.0;
|
||||
visible: 0;
|
||||
fixed: 1 1;
|
||||
align: 0.5 1.0;
|
||||
rel1.relative: 0.0 1.0;
|
||||
rel1.offset: 2 0;
|
||||
rel2.relative: 1.0 1.0;
|
||||
rel2.offset: -2 0;
|
||||
color: 0 0 0 255;
|
||||
text {
|
||||
font: "Sans,Edje-Vera";
|
||||
size: 10;
|
||||
min: 0 0;
|
||||
align: 0.5 0.0;
|
||||
}
|
||||
}
|
||||
description { state: "visible" 0.0;
|
||||
inherit: "default" 0.0;
|
||||
fixed: 1 1;
|
||||
visible: 1;
|
||||
text.min: 1 1;
|
||||
rel1.offset: 8 -9;
|
||||
rel2.offset: -9 -9;
|
||||
}
|
||||
}
|
||||
}
|
||||
programs {
|
||||
program { name: "label_show";
|
||||
signal: "elm,state,text,visible";
|
||||
source: "elm";
|
||||
action: STATE_SET "visible" 0.0;
|
||||
target: "elm.text";
|
||||
}
|
||||
program { name: "label_hide";
|
||||
signal: "elm,state,text,hidden";
|
||||
source: "elm";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "elm.text";
|
||||
}
|
||||
program { name: "icon_show";
|
||||
signal: "elm,state,icon,visible";
|
||||
source: "elm";
|
||||
action: STATE_SET "visible" 0.0;
|
||||
target: "elm.swallow.content";
|
||||
}
|
||||
program { name: "icon_hide";
|
||||
signal: "elm,state,icon,hidden";
|
||||
source: "elm";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "elm.swallow.content";
|
||||
}
|
||||
program { name: "units_show";
|
||||
signal: "elm,state,units,visible";
|
||||
source: "elm";
|
||||
action: STATE_SET "visible" 0.0;
|
||||
target: "elm.text.content";
|
||||
target: "elm.text.box";
|
||||
}
|
||||
program { name: "units_hide";
|
||||
signal: "elm,state,units,hidden";
|
||||
source: "elm";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "elm.text.content";
|
||||
target: "elm.text.box";
|
||||
}
|
||||
program { name: "slide_to_end";
|
||||
action: STATE_SET "state_end" 0.0;
|
||||
transition: LINEAR 0.5;
|
||||
target: "elm.progress.progressbar";
|
||||
after: "slide_to_begin";
|
||||
}
|
||||
program { name: "slide_to_begin";
|
||||
action: STATE_SET "state_begin" 0.0;
|
||||
target: "elm.progress.progressbar";
|
||||
transition: LINEAR 0.5;
|
||||
after: "slide_to_end";
|
||||
}
|
||||
program { name: "start_pulse";
|
||||
signal: "elm,state,pulse,start";
|
||||
source: "elm";
|
||||
action: STATE_SET "state_begin" 0.0;
|
||||
target: "elm.progress.progressbar";
|
||||
after: "slide_to_end";
|
||||
}
|
||||
program { name: "stop_pulse";
|
||||
signal: "elm,state,pulse,stop";
|
||||
source: "elm";
|
||||
action: ACTION_STOP;
|
||||
target: "slide_to_begin";
|
||||
target: "slide_to_end";
|
||||
target: "start_pulse";
|
||||
after: "state_pulse";
|
||||
}
|
||||
program { name: "state_pulse";
|
||||
signal: "elm,state,pulse";
|
||||
source: "elm";
|
||||
action: STATE_SET "state_begin" 0.0;
|
||||
target: "elm.progress.progressbar";
|
||||
after: "units_hide";
|
||||
}
|
||||
program { name: "state_fraction";
|
||||
signal: "elm,state,fraction";
|
||||
source: "elm";
|
||||
action: ACTION_STOP;
|
||||
target: "slide_to_begin";
|
||||
target: "slide_to_end";
|
||||
target: "start_pulse";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "elm.progress.progressbar";
|
||||
}
|
||||
program { name: "set_invert_on";
|
||||
signal: "elm,state,inverted,on";
|
||||
source: "elm";
|
||||
action: STATE_SET "invert" 0.0;
|
||||
target: "elm.progress.progressbar";
|
||||
target: "elm.cur.progressbar";
|
||||
}
|
||||
program { name: "set_invert_off";
|
||||
signal: "elm,state,inverted,off";
|
||||
source: "elm";
|
||||
action: STATE_SET "default" 0.0;
|
||||
target: "elm.progress.progressbar";
|
||||
target: "elm.cur.progressbar";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3477,21 +3477,207 @@ my_bt_38(void *data, Evas_Object *obj, void *event_info)
|
|||
evas_object_show(win);
|
||||
}
|
||||
|
||||
typedef struct Progressbar
|
||||
{
|
||||
Evas_Object *pb1;
|
||||
Evas_Object *pb2;
|
||||
Evas_Object *pb3;
|
||||
Evas_Object *pb4;
|
||||
Evas_Object *pb5;
|
||||
Evas_Object *pb6;
|
||||
Eina_Bool run;
|
||||
Ecore_Timer *timer;
|
||||
} Progressbar;
|
||||
|
||||
static Progressbar _test_progressbar;
|
||||
|
||||
static int
|
||||
_my_bt_39_progressbar_value_set (void *data)
|
||||
{
|
||||
double progress;
|
||||
|
||||
progress = elm_progressbar_value_get (_test_progressbar.pb1);
|
||||
if (progress < 1.0) progress += 0.0123;
|
||||
else progress = 0.0;
|
||||
elm_progressbar_value_set(_test_progressbar.pb1, progress);
|
||||
elm_progressbar_value_set(_test_progressbar.pb4, progress);
|
||||
elm_progressbar_value_set(_test_progressbar.pb3, progress);
|
||||
elm_progressbar_value_set(_test_progressbar.pb6, progress);
|
||||
if (progress < 1.0) return ECORE_CALLBACK_RENEW;
|
||||
_test_progressbar.run = 0;
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
static void
|
||||
my_bt_39_done(void *data, Evas_Object *obj, void *event_info)
|
||||
my_bt_39_test_start(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
elm_progressbar_pulse(_test_progressbar.pb2, EINA_TRUE);
|
||||
elm_progressbar_pulse(_test_progressbar.pb5, EINA_TRUE);
|
||||
if (!_test_progressbar.run)
|
||||
{
|
||||
_test_progressbar.timer = ecore_timer_add(0.1, _my_bt_39_progressbar_value_set, NULL);
|
||||
_test_progressbar.run = EINA_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
my_bt_39_test_stop(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
elm_progressbar_pulse(_test_progressbar.pb2, EINA_FALSE);
|
||||
elm_progressbar_pulse(_test_progressbar.pb5, EINA_FALSE);
|
||||
if (_test_progressbar.run)
|
||||
{
|
||||
ecore_timer_del(_test_progressbar.timer);
|
||||
_test_progressbar.run = EINA_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
my_bt_39_destroy(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
my_bt_39_test_stop(NULL, NULL, NULL);
|
||||
evas_object_del(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
my_bt_39(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Object *win, *bg, *pb, *bx, *pbx, *hbx, *bt, *bt_bx, *ic1, *ic2;
|
||||
Progressbar *test;
|
||||
char buf[PATH_MAX];
|
||||
|
||||
win = elm_win_add(NULL, "progressbar", ELM_WIN_BASIC);
|
||||
elm_win_title_set(win, "Progressbar");
|
||||
evas_object_smart_callback_add(win, "delete-request", my_bt_39_destroy, test);
|
||||
|
||||
bg = elm_bg_add(win);
|
||||
elm_win_resize_object_add(win, bg);
|
||||
evas_object_size_hint_weight_set(bg, 1.0, 1.0);
|
||||
evas_object_show(bg);
|
||||
|
||||
bx = elm_box_add(win);
|
||||
elm_win_resize_object_add(win, bx);
|
||||
evas_object_size_hint_weight_set(bx, 1.0, 1.0);
|
||||
evas_object_show(bx);
|
||||
|
||||
pb = elm_progressbar_add(win);
|
||||
evas_object_size_hint_weight_set(pb, 1.0, 1.0);
|
||||
evas_object_size_hint_align_set(pb, -1.0, 0.5);
|
||||
elm_box_pack_end(bx, pb);
|
||||
// elm_progressbar_horizontal_set(pb, EINA_TRUE);
|
||||
// elm_progressbar_label_set(pb, "Progression %");
|
||||
// elm_progressbar_unit_format_set(pb, NULL);
|
||||
evas_object_show(pb);
|
||||
_test_progressbar.pb1 = pb;
|
||||
|
||||
pb = elm_progressbar_add(win);
|
||||
evas_object_size_hint_align_set(pb, -1.0, 0.5);
|
||||
evas_object_size_hint_weight_set(pb, 1.0, 1.0);
|
||||
elm_progressbar_label_set(pb, "Infinite bounce");
|
||||
elm_progressbar_pulse_set(pb, EINA_TRUE);
|
||||
elm_box_pack_end(bx, pb);
|
||||
evas_object_show(pb);
|
||||
_test_progressbar.pb2 = pb;
|
||||
|
||||
ic1 = elm_icon_add(win);
|
||||
snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
|
||||
elm_icon_file_set(ic1, buf, NULL);
|
||||
evas_object_size_hint_aspect_set(ic1, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
|
||||
pb = elm_progressbar_add(win);
|
||||
elm_progressbar_label_set(pb, "Label");
|
||||
elm_progressbar_icon_set(pb, ic1);
|
||||
elm_progressbar_inverted_set(pb, 1);
|
||||
elm_progressbar_unit_format_set(pb, "%1.1f units");
|
||||
elm_progressbar_span_size_set(pb, 200);
|
||||
evas_object_size_hint_align_set(pb, -1.0, 0.5);
|
||||
evas_object_size_hint_weight_set(pb, 1.0, 1.0);
|
||||
elm_box_pack_end(bx, pb);
|
||||
evas_object_show(ic1);
|
||||
evas_object_show(pb);
|
||||
_test_progressbar.pb3 = pb;
|
||||
|
||||
hbx = elm_box_add(win);
|
||||
elm_box_horizontal_set(hbx, EINA_TRUE);
|
||||
evas_object_size_hint_weight_set(hbx, 1.0, 1.0);
|
||||
evas_object_size_hint_align_set(hbx, -1.0, -1.0);
|
||||
elm_box_pack_end(bx, hbx);
|
||||
evas_object_show(hbx);
|
||||
|
||||
pb = elm_progressbar_add(win);
|
||||
elm_progressbar_horizontal_set(pb, EINA_FALSE);
|
||||
evas_object_size_hint_align_set(pb, -1.0, -1.0);
|
||||
evas_object_size_hint_weight_set(pb, 1.0, 1.0);
|
||||
elm_box_pack_end(hbx, pb);
|
||||
elm_progressbar_span_size_set(pb, 60);
|
||||
elm_progressbar_label_set(pb, "percent");
|
||||
evas_object_show(pb);
|
||||
_test_progressbar.pb4 = pb;
|
||||
|
||||
pb = elm_progressbar_add(win);
|
||||
elm_progressbar_horizontal_set(pb, EINA_FALSE);
|
||||
evas_object_size_hint_align_set(pb, -1.0, 0.5);
|
||||
evas_object_size_hint_weight_set(pb, 1.0, 1.0);
|
||||
elm_progressbar_span_size_set(pb, 80);
|
||||
elm_progressbar_pulse_set(pb, EINA_TRUE);
|
||||
elm_progressbar_unit_format_set(pb, NULL);
|
||||
elm_progressbar_label_set(pb, "Infinite bounce");
|
||||
elm_box_pack_end(hbx, pb);
|
||||
evas_object_show(pb);
|
||||
_test_progressbar.pb5 = pb;
|
||||
|
||||
ic2 = elm_icon_add(win);
|
||||
elm_icon_file_set(ic2, buf, NULL);
|
||||
evas_object_size_hint_aspect_set(ic2, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
|
||||
pb = elm_progressbar_add(win);
|
||||
elm_progressbar_horizontal_set(pb, EINA_FALSE);
|
||||
elm_progressbar_label_set(pb, "Label");
|
||||
elm_progressbar_icon_set(pb, ic2);
|
||||
elm_progressbar_inverted_set(pb, 1);
|
||||
elm_progressbar_unit_format_set(pb, "%1.2f%%");
|
||||
elm_progressbar_span_size_set(pb, 200);
|
||||
evas_object_size_hint_align_set(pb, -1.0, 0.5);
|
||||
evas_object_size_hint_weight_set(pb, 1.0, 1.0);
|
||||
elm_box_pack_end(hbx, pb);
|
||||
evas_object_show(ic2);
|
||||
evas_object_show(pb);
|
||||
_test_progressbar.pb6 = pb;
|
||||
|
||||
bt_bx = elm_box_add(win);
|
||||
elm_box_horizontal_set(bt_bx, 1);
|
||||
evas_object_size_hint_weight_set(bt_bx, 1.0, 1.0);
|
||||
elm_box_pack_end(bx, bt_bx);
|
||||
evas_object_show(bt_bx);
|
||||
|
||||
bt = elm_button_add(win);
|
||||
elm_button_label_set(bt, "Start");
|
||||
evas_object_smart_callback_add(bt, "clicked", my_bt_39_test_start, NULL);
|
||||
elm_box_pack_end(bt_bx, bt);
|
||||
evas_object_show(bt);
|
||||
|
||||
bt = elm_button_add(win);
|
||||
elm_button_label_set(bt, "Stop");
|
||||
evas_object_smart_callback_add(bt, "clicked", my_bt_39_test_stop, NULL);
|
||||
elm_box_pack_end(bt_bx, bt);
|
||||
evas_object_show(bt);
|
||||
|
||||
evas_object_show(win);
|
||||
}
|
||||
|
||||
static void
|
||||
my_bt_40_done(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
/* event_info conatin the full path of the selected file
|
||||
* or NULL if none is selected or cancel is pressed */
|
||||
const char *selected = event_info;
|
||||
|
||||
if (selected)
|
||||
printf("Selected file: %s\n", selected);
|
||||
printf("Selected file: %s\n", selected);
|
||||
else
|
||||
evas_object_del(data); /* delete the test window */
|
||||
evas_object_del(data); /* delete the test window */
|
||||
}
|
||||
|
||||
static void
|
||||
my_bt_39_selected(void *data, Evas_Object *obj, void *event_info)
|
||||
my_bt_40_selected(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
/* event_info conatin the full path of the selected file */
|
||||
const char *selected = event_info;
|
||||
|
@ -3502,7 +3688,7 @@ my_bt_39_selected(void *data, Evas_Object *obj, void *event_info)
|
|||
}
|
||||
|
||||
static void
|
||||
my_bt_39(void *data, Evas_Object *obj, void *event_info)
|
||||
my_bt_40(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Evas_Object *win, *fs, *bg;
|
||||
char buf[PATH_MAX];
|
||||
|
@ -3525,8 +3711,8 @@ my_bt_39(void *data, Evas_Object *obj, void *event_info)
|
|||
elm_win_resize_object_add(win, fs);
|
||||
evas_object_show(fs);
|
||||
/* the 'done' cb is called when the user press ok/cancel */
|
||||
evas_object_smart_callback_add(fs, "done", my_bt_39_done, win);
|
||||
evas_object_smart_callback_add(fs, "selected", my_bt_39_selected, win);
|
||||
evas_object_smart_callback_add(fs, "done", my_bt_40_done, win);
|
||||
evas_object_smart_callback_add(fs, "selected", my_bt_40_selected, win);
|
||||
|
||||
evas_object_resize(win, 240, 350);
|
||||
evas_object_show(win);
|
||||
|
@ -3647,7 +3833,8 @@ my_win_main(void)
|
|||
elm_list_item_append(li, "Genlist Tree", NULL, NULL, my_bt_36, NULL);
|
||||
elm_list_item_append(li, "Genlist 5", NULL, NULL, my_bt_37, NULL);
|
||||
elm_list_item_append(li, "Window States", NULL, NULL, my_bt_38, NULL);
|
||||
|
||||
elm_list_item_append(li, "Progressbar", NULL, NULL, my_bt_39, NULL);
|
||||
elm_list_item_append(li, "File Selector", NULL, NULL, my_bt_40, NULL);
|
||||
|
||||
elm_list_go(li);
|
||||
|
||||
|
|
|
@ -719,6 +719,18 @@ extern "C" {
|
|||
* "done" - the user click on the ok or cancel buttons
|
||||
*/
|
||||
|
||||
EAPI Evas_Object *elm_progressbar_add(Evas_Object *parent);
|
||||
EAPI void elm_progressbar_label_set(Evas_Object *obj, const char *label);
|
||||
EAPI void elm_progressbar_icon_set(Evas_Object *obj, Evas_Object *icon);
|
||||
EAPI void elm_progressbar_span_size_set(Evas_Object *obj, Evas_Coord size);
|
||||
EAPI void elm_progressbar_horizontal_set(Evas_Object *obj, Eina_Bool horizontal);
|
||||
EAPI void elm_progressbar_inverted_set(Evas_Object *obj, Eina_Bool inverted);
|
||||
EAPI void elm_progressbar_pulse_set(Evas_Object *obj, Eina_Bool pulse);
|
||||
EAPI void elm_progressbar_pulse(Evas_Object *obj, Eina_Bool state);
|
||||
EAPI void elm_progressbar_unit_format_set(Evas_Object *obj, const char *format);
|
||||
EAPI void elm_progressbar_value_set(Evas_Object *obj, double val);
|
||||
EAPI double elm_progressbar_value_get(const Evas_Object *obj);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -760,7 +772,6 @@ extern "C" {
|
|||
// * tiled image + zoom widget (tiled map viewer)
|
||||
// * dialpad widget - need one with a phone dialpad
|
||||
// * file selector widget
|
||||
// * progress bar widget
|
||||
// * generic "tacho" widget (set min/max labels - and up to 3 intermediate labels etc.)
|
||||
// * status widget (busy, stalled, running, etc.)
|
||||
// * full window in window widget (so move/resize of window object does as you'd expect a child window to do within the canvas)
|
||||
|
|
|
@ -55,6 +55,7 @@ elm_check.c \
|
|||
elm_radio.c \
|
||||
elm_pager.c \
|
||||
elm_fileselector.c \
|
||||
elm_progressbar.c \
|
||||
\
|
||||
elc_notepad.c \
|
||||
elc_anchorview.c \
|
||||
|
|
|
@ -0,0 +1,477 @@
|
|||
#include <Elementary.h>
|
||||
#include "elm_priv.h"
|
||||
|
||||
/**
|
||||
* @defgroup Progressbar Progressbar
|
||||
*
|
||||
* The progressbar adds a widget for representing current progress
|
||||
* of a job status
|
||||
*
|
||||
* A progressbar can be horizontal or vertical. It can contain an Icon and has a
|
||||
* primary label as well as a units label (that is formatted with floating
|
||||
* point values and thus accepts a printf-style format string, like
|
||||
* “%1.2f units”.
|
||||
*
|
||||
* Label, Icon and Unit strings/objects are optional.
|
||||
*
|
||||
* A progressbar may be inverted which means values invert, with high vales being
|
||||
* on the left or top and low values on the right or bottom (as opposed to
|
||||
* normally being low on the left or top and high on the bottom and right).
|
||||
*
|
||||
* The span of the progressbar is its length (horizontally or vertically).
|
||||
* This will be scaled by the object or applications scaling factor. At any point
|
||||
* code can query the progressbar for its value with elm_progressbar_value_get().
|
||||
*/
|
||||
|
||||
#define MIN_RATIO_LVL 0.0
|
||||
#define MAX_RATIO_LVL 1.0
|
||||
|
||||
typedef struct _Widget_Data Widget_Data;
|
||||
|
||||
struct _Widget_Data
|
||||
{
|
||||
Evas_Object *progressbar;
|
||||
Evas_Object *spacer;
|
||||
Evas_Object *icon;
|
||||
Evas_Coord size;
|
||||
Eina_Bool horizontal : 1;
|
||||
Eina_Bool inverted : 1;
|
||||
Eina_Bool pulse : 1;
|
||||
Eina_Bool pulse_state : 1;
|
||||
const char *units;
|
||||
const char *label;
|
||||
double val;
|
||||
};
|
||||
|
||||
static void _del_hook(Evas_Object *obj);
|
||||
static void _theme_hook(Evas_Object *obj);
|
||||
static void _sizing_eval(Evas_Object *obj);
|
||||
static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
static void _sub_del(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _units_set(Evas_Object *obj);
|
||||
|
||||
static void
|
||||
_del_hook(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (wd->label) eina_stringshare_del(wd->label);
|
||||
if (wd->units) eina_stringshare_del(wd->units);
|
||||
free(wd);
|
||||
}
|
||||
|
||||
static void
|
||||
_theme_hook(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (wd->horizontal)
|
||||
_elm_theme_set(wd->progressbar, "progressbar", "horizontal", elm_widget_style_get(obj));
|
||||
else
|
||||
_elm_theme_set(wd->progressbar, "progressbar", "vertical", elm_widget_style_get(obj));
|
||||
if (wd->inverted)
|
||||
edje_object_signal_emit(wd->progressbar, "elm,state,inverted,on", "elm");
|
||||
else
|
||||
edje_object_signal_emit(wd->progressbar, "elm,state,inverted,off", "elm");
|
||||
if (wd->icon)
|
||||
edje_object_signal_emit(wd->progressbar, "elm,state,icon,visible", "elm");
|
||||
else
|
||||
edje_object_signal_emit(wd->progressbar, "elm,state,icon,hidden", "elm");
|
||||
if (wd->label)
|
||||
edje_object_signal_emit(wd->progressbar, "elm,state,text,visible", "elm");
|
||||
else
|
||||
edje_object_signal_emit(wd->progressbar, "elm,state,text,hidden", "elm");
|
||||
edje_object_part_text_set(wd->progressbar, "elm.text", wd->label);
|
||||
if (wd->pulse)
|
||||
edje_object_signal_emit(wd->progressbar, "elm,state,pulse", "elm");
|
||||
else
|
||||
edje_object_signal_emit(wd->progressbar, "elm,state,fraction", "elm");
|
||||
if (wd->units && !wd->pulse)
|
||||
edje_object_signal_emit(wd->progressbar, "elm,state,units,visible", "elm");
|
||||
else
|
||||
edje_object_signal_emit(wd->progressbar, "elm,state,units,hidden", "elm");
|
||||
if (wd->horizontal)
|
||||
evas_object_size_hint_min_set(wd->spacer, (double)wd->size * elm_widget_scale_get(obj) * _elm_config->scale, 1);
|
||||
else
|
||||
evas_object_size_hint_min_set(wd->spacer, 1, (double)wd->size * elm_widget_scale_get(obj) * _elm_config->scale);
|
||||
|
||||
|
||||
edje_object_part_swallow(wd->progressbar, "elm.swallow.bar", wd->spacer);
|
||||
_units_set(obj);
|
||||
edje_object_message_signal_process(wd->progressbar);
|
||||
edje_object_scale_set(wd->progressbar, elm_widget_scale_get(obj) * _elm_config->scale);
|
||||
_sizing_eval(obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_sizing_eval(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
Evas_Coord minw = -1, minh = -1, maxw = -1, maxh = -1;
|
||||
|
||||
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
|
||||
edje_object_size_min_restricted_calc(wd->progressbar, &minw, &minh, minw, minh);
|
||||
elm_coords_finger_size_adjust(1, &minw, 1, &minh);
|
||||
evas_object_size_hint_min_set(obj, minw, minh);
|
||||
evas_object_size_hint_max_set(obj, maxw, maxh);
|
||||
}
|
||||
|
||||
static void
|
||||
_changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(data);
|
||||
if (obj != wd->icon) return;
|
||||
edje_object_part_swallow(wd->progressbar, "elm.swallow.content", obj);
|
||||
_sizing_eval(data);
|
||||
}
|
||||
|
||||
static void
|
||||
_sub_del(void *data, Evas_Object *obj, void *event_info)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
Evas_Object *sub = event_info;
|
||||
if (sub == wd->icon)
|
||||
{
|
||||
edje_object_signal_emit(wd->progressbar, "elm,state,icon,hidden", "elm");
|
||||
evas_object_event_callback_del
|
||||
(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS, _changed_size_hints);
|
||||
wd->icon = NULL;
|
||||
_sizing_eval(obj);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_val_fetch(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
double posx = MIN_RATIO_LVL, posy = MIN_RATIO_LVL, pos = MIN_RATIO_LVL;
|
||||
|
||||
edje_object_part_drag_value_get(wd->progressbar, "elm.cur.progressbar",
|
||||
&posx, &posy);
|
||||
if (wd->horizontal) pos = posx;
|
||||
else pos = posy;
|
||||
if (wd->inverted) pos = MAX_RATIO_LVL - pos;
|
||||
if (pos != wd->val)
|
||||
{
|
||||
wd->val = pos;
|
||||
evas_object_smart_callback_call(obj, "changed", NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_val_set(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
double pos;
|
||||
pos = wd->val;
|
||||
if (wd->inverted) pos = MAX_RATIO_LVL - pos;
|
||||
edje_object_part_drag_value_set(wd->progressbar, "elm.cur.progressbar", pos, pos);
|
||||
}
|
||||
|
||||
static void
|
||||
_units_set(Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (wd->units)
|
||||
{
|
||||
char buf[1024];
|
||||
|
||||
snprintf(buf, sizeof(buf), wd->units, 100 * wd->val);
|
||||
edje_object_part_text_set(wd->progressbar, "elm.text.content", buf);
|
||||
}
|
||||
else
|
||||
edje_object_part_text_set(wd->progressbar, "elm.text.content", NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new progressbar to the parent
|
||||
*
|
||||
* @param parent The parent object
|
||||
* @return The new object or NULL if it cannot be created
|
||||
*
|
||||
* @ingroup Progressbar
|
||||
*/
|
||||
EAPI Evas_Object *
|
||||
elm_progressbar_add(Evas_Object *parent)
|
||||
{
|
||||
Evas_Object *obj;
|
||||
Evas *e;
|
||||
Widget_Data *wd;
|
||||
|
||||
wd = ELM_NEW(Widget_Data);
|
||||
e = evas_object_evas_get(parent);
|
||||
obj = elm_widget_add(e);
|
||||
elm_widget_type_set(obj, "progressbar");
|
||||
elm_widget_sub_object_add(parent, obj);
|
||||
elm_widget_data_set(obj, wd);
|
||||
elm_widget_del_hook_set(obj, _del_hook);
|
||||
elm_widget_theme_hook_set(obj, _theme_hook);
|
||||
|
||||
wd->horizontal = EINA_TRUE;
|
||||
wd->inverted = EINA_FALSE;
|
||||
wd->pulse = EINA_FALSE;
|
||||
wd->pulse_state = EINA_FALSE;
|
||||
wd->units = eina_stringshare_add("%.0f %%");
|
||||
wd->val = MIN_RATIO_LVL;
|
||||
|
||||
wd->progressbar = edje_object_add(e);
|
||||
_elm_theme_set(wd->progressbar, "progressbar", "horizontal", "default");
|
||||
elm_widget_resize_object_set(obj, wd->progressbar);
|
||||
|
||||
wd->spacer = evas_object_rectangle_add(e);
|
||||
evas_object_color_set(wd->spacer, 0, 0, 0, 0);
|
||||
evas_object_pass_events_set(wd->spacer, 1);
|
||||
elm_widget_sub_object_add(obj, wd->spacer);
|
||||
edje_object_part_swallow(wd->progressbar, "elm.swallow.bar", wd->spacer);
|
||||
|
||||
evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
|
||||
_units_set(obj);
|
||||
_sizing_eval(obj);
|
||||
return obj;
|
||||
}
|
||||
|
||||
/*
|
||||
* Normally the progressbar will display and interpret values from low to high.
|
||||
* This display a progressbar for jobs with unknow state of progression,
|
||||
* (the cursor pulse right to left and left to right, and loop) if pulse is set to 1.
|
||||
*
|
||||
* @param obj The progressbar object
|
||||
* @param pulse The pulse flag. 1 == pulse, 0 == normal
|
||||
*
|
||||
* @ingroup Progressbar
|
||||
*/
|
||||
EAPI void
|
||||
elm_progressbar_pulse_set (Evas_Object *obj, Eina_Bool pulse)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
pulse = !!pulse;
|
||||
if (wd->pulse == pulse) return;
|
||||
wd->pulse = pulse;
|
||||
_theme_hook(obj);
|
||||
}
|
||||
|
||||
/*
|
||||
* Normally the progressbar will display and interpret values from low to high.
|
||||
* This display a progressbar for jobs with unknow state of progression,
|
||||
* (the cursor pulse right to left and left to right, and loop) if pulse is set to 1.
|
||||
*
|
||||
* @param obj The progressbar object
|
||||
* @param pulse The pulse flag. 1 == pulse, 0 == normal
|
||||
*
|
||||
* @ingroup Progressbar
|
||||
*/
|
||||
EAPI void
|
||||
elm_progressbar_pulse (Evas_Object *obj, Eina_Bool state)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
state = !!state;
|
||||
if (!wd->pulse && wd->pulse_state == state) return;
|
||||
wd->pulse_state = state;
|
||||
if (wd->pulse_state)
|
||||
edje_object_signal_emit(wd->progressbar, "elm,state,pulse,start", "elm");
|
||||
else
|
||||
edje_object_signal_emit(wd->progressbar, "elm,state,pulse,stop", "elm");
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the value the progressbar indicates
|
||||
*
|
||||
* @param obj The progressbar object
|
||||
* @param val The fraction value (must be beween 0.0 and 1.0)
|
||||
*
|
||||
* @ingroup Progressbar
|
||||
*/
|
||||
EAPI void
|
||||
elm_progressbar_value_set (Evas_Object *obj, double val)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (wd->val == val) return;
|
||||
wd->val = val;
|
||||
if (wd->val < MIN_RATIO_LVL) wd->val = MIN_RATIO_LVL;
|
||||
if (wd->val > MAX_RATIO_LVL) wd->val = MAX_RATIO_LVL;
|
||||
_val_set(obj);
|
||||
_units_set(obj);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the value the progressbar has
|
||||
*
|
||||
* @param obj The progressbar object
|
||||
* @return The value of the progressbar
|
||||
*
|
||||
* @ingroup Progressbar
|
||||
*/
|
||||
EAPI double
|
||||
elm_progressbar_value_get(const Evas_Object *obj)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
return wd->val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the label of the progressbar
|
||||
*
|
||||
* @param obj The progressbar object
|
||||
* @param label The text label string in UTF-8
|
||||
*
|
||||
* @ingroup Progressbar
|
||||
*/
|
||||
EAPI void
|
||||
elm_progressbar_label_set(Evas_Object *obj, const char *label)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
|
||||
if (wd->label) eina_stringshare_del(wd->label);
|
||||
if (label)
|
||||
{
|
||||
wd->label = eina_stringshare_add(label);
|
||||
edje_object_signal_emit(wd->progressbar, "elm,state,text,visible", "elm");
|
||||
edje_object_message_signal_process(wd->progressbar);
|
||||
}
|
||||
else
|
||||
{
|
||||
wd->label = NULL;
|
||||
edje_object_signal_emit(wd->progressbar, "elm,state,text,hidden", "elm");
|
||||
edje_object_message_signal_process(wd->progressbar);
|
||||
}
|
||||
edje_object_part_text_set(wd->progressbar, "elm.text", label);
|
||||
_sizing_eval(obj);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the icon object of the progressbar object
|
||||
*
|
||||
* Once the icon object is set, it will become a child of the progressbar object and
|
||||
* be deleted when the progressbar object is deleted. If another icon object is set
|
||||
* then the previous one becomes orophaned and will no longer be deleted along
|
||||
* with the progressbar.
|
||||
*
|
||||
* @param obj The progressbar object
|
||||
* @param icon The icon object
|
||||
*
|
||||
* @ingroup Progressbar
|
||||
*/
|
||||
EAPI void
|
||||
elm_progressbar_icon_set(Evas_Object *obj, Evas_Object *icon)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if ((wd->icon != icon) && (wd->icon))
|
||||
elm_widget_sub_object_del(obj, wd->icon);
|
||||
wd->icon = icon;
|
||||
if (icon)
|
||||
{
|
||||
elm_widget_sub_object_add(obj, icon);
|
||||
edje_object_part_swallow(wd->progressbar, "elm.swallow.content", icon);
|
||||
edje_object_signal_emit(wd->progressbar, "elm,state,icon,visible", "elm");
|
||||
evas_object_event_callback_add(icon, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
||||
_changed_size_hints, obj);
|
||||
_sizing_eval(obj);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the length of the progression region of the progressbar
|
||||
*
|
||||
* This sets the minimum width or height (depending on orientation) of the
|
||||
* area of the progressbar that allows the progressbar to be dragged around. This in
|
||||
* turn affects the objects minimum size (along with icon label and unit
|
||||
* text).
|
||||
*
|
||||
* @param obj The progressbar object
|
||||
* @param size The length of the progressbar area
|
||||
*
|
||||
* @ingroup Progressbar
|
||||
*/
|
||||
EAPI void
|
||||
elm_progressbar_span_size_set(Evas_Object *obj, Evas_Coord size)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (wd->size == size) return;
|
||||
wd->size = size;
|
||||
if (wd->horizontal)
|
||||
evas_object_size_hint_min_set(wd->spacer, (double)wd->size * elm_widget_scale_get(obj) * _elm_config->scale, 1);
|
||||
else
|
||||
evas_object_size_hint_min_set(wd->spacer, 1, (double)wd->size * elm_widget_scale_get(obj) * _elm_config->scale);
|
||||
edje_object_part_swallow(wd->progressbar, "elm.swallow.bar", wd->spacer);
|
||||
_sizing_eval(obj);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the format string of the unit area
|
||||
*
|
||||
* If NULL, this disabls the unit area display. If not it sets the format
|
||||
* string for the unit text. The unit text is provided a floating point
|
||||
* value, so the unit text can display up to 1 floating point falue. Note that
|
||||
* this is optional. Use a format string such as "%1.2f meters" for example.
|
||||
*
|
||||
* @param obj The progressbar object
|
||||
* @param units The format string for the units display
|
||||
*
|
||||
* @ingroup Progressbar
|
||||
*/
|
||||
EAPI void
|
||||
elm_progressbar_unit_format_set(Evas_Object *obj, const char *units)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
if (wd->units) eina_stringshare_del(wd->units);
|
||||
if (units)
|
||||
{
|
||||
wd->units = eina_stringshare_add(units);
|
||||
edje_object_signal_emit(wd->progressbar, "elm,state,units,visible", "elm");
|
||||
edje_object_message_signal_process(wd->progressbar);
|
||||
}
|
||||
else
|
||||
{
|
||||
wd->units = NULL;
|
||||
edje_object_signal_emit(wd->progressbar, "elm,state,units,hidden", "elm");
|
||||
edje_object_message_signal_process(wd->progressbar);
|
||||
}
|
||||
_units_set(obj);
|
||||
_sizing_eval(obj);
|
||||
}
|
||||
|
||||
/*
|
||||
* Set orientation of the progressbar
|
||||
*
|
||||
* @param obj The progressbar object
|
||||
* @param horizontal If set, the progressbar will be horizontal
|
||||
*
|
||||
* @ingroup Progressbar
|
||||
*/
|
||||
EAPI void
|
||||
elm_progressbar_horizontal_set(Evas_Object *obj, Eina_Bool horizontal)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
horizontal = !!horizontal;
|
||||
if (wd->horizontal == horizontal) return;
|
||||
wd->horizontal = horizontal;
|
||||
_theme_hook(obj);
|
||||
}
|
||||
|
||||
/*
|
||||
* Invert the progressbar display
|
||||
*
|
||||
* Normally the progressbar will display and interpret values from low to high
|
||||
* and when horizontal that is left to right. When vertical that is top
|
||||
* to bottom. This inverts this (so from right to left or bottom to top) if
|
||||
* inverted is set to 1.
|
||||
*
|
||||
* @param obj The progressbar object
|
||||
* @param inverted The inverted flag. 1 == inverted, 0 == normal
|
||||
*
|
||||
* @ingroup Progressbar
|
||||
*/
|
||||
EAPI void
|
||||
elm_progressbar_inverted_set(Evas_Object *obj, Eina_Bool inverted)
|
||||
{
|
||||
Widget_Data *wd = elm_widget_data_get(obj);
|
||||
inverted = !!inverted;
|
||||
if (wd->inverted == inverted) return;
|
||||
wd->inverted = inverted;
|
||||
if (wd->inverted)
|
||||
edje_object_signal_emit(wd->progressbar, "elm,state,inverted,on", "elm");
|
||||
else
|
||||
edje_object_signal_emit(wd->progressbar, "elm,state,inverted,off", "elm");
|
||||
edje_object_message_signal_process(wd->progressbar);
|
||||
_val_set(obj);
|
||||
_units_set(obj);
|
||||
}
|
Loading…
Reference in New Issue