ephysics: toggle theme

SVN revision: 79054
This commit is contained in:
Bruno Dilly 2012-11-09 18:58:32 +00:00
parent b25a7d2816
commit 620a0a1ac7
9 changed files with 408 additions and 3 deletions

View File

@ -24,6 +24,7 @@ TEST_FILES = \
shadows.edc \
shapes.edc \
spinner.edc \
toggle.edc \
images/arrows.png \
images/background.jpg \
images/ball-blue.png \
@ -69,7 +70,11 @@ TEST_FILES = \
images/spinner_bt_left_pressed.png \
images/spinner_bt_right.png \
images/spinner_bt_right_pressed.png \
images/star.png
images/star.png \
images/tog_base_off.png \
images/tog_base_on.png \
images/tog_bt_off.png \
images/tog_bt_on.png
SANDBOX_FILES = \
ephysics_sandbox.edc \

View File

@ -13,5 +13,6 @@ collections {
#include "shadows.edc"
#include "shapes.edc"
#include "spinner.edc"
#include "toggle.edc"
#include "others.edc"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,399 @@
group {
name: "elm/check/base/ephysics-test";
images {
image: "tog_base_on.png" COMP;
image: "tog_base_off.png" COMP;
image: "tog_bt_on.png" COMP;
image: "tog_bt_off.png" COMP;
}
script {
public is_rtl;
public is_drag;
public was_drag;
}
parts {
part { name: "bg";
type: RECT;
mouse_events: 0;
scale: 1;
description { state: "default" 0.0;
fixed: 1 0;
rel1.relative: 1.0 0.0;
rel1.offset: -4 3;
rel2.offset: -4 -4;
align: 1.0 0.5;
min: 100 26;
max: 100 26;
visible: 0;
}
}
part {
name: "clipper";
type: RECT;
mouse_events: 0;
description {
state: "default" 0.0;
rel1.to: "bg";
rel2.to: "bg";
color: 255 255 255 255;
}
}
part {
name: "button";
type: RECT;
scale: 1;
clip_to: "clipper";
mouse_events: 1;
dragable {
x: 1 1 0;
y: 0 0 0;
confine: "bg";
}
description {
state: "default" 0.0;
fixed: 1 1;
rel1.to: "bg";
rel2.to: "bg";
min: 28 24;
max: 28 24;
aspect: 1.0 1.0;
aspect_preference: VERTICAL;
color: 0 0 0 0;
}
}
part {
name: "button_events";
type: RECT;
dragable {
events: "button";
}
description {
state: "default" 0.0;
color: 0 0 0 0;
}
}
part {
name: "onrect";
type: IMAGE;
scale: 1;
clip_to: "clipper";
mouse_events: 0;
description {
state: "default" 0.0;
rel1.to: "button";
rel1.relative: 1.0 0.0;
rel2.to: "button";
rel2.relative: 1.0 1.0;
fixed: 1 1;
align: 1 0.5;
min: 100 26;
max: 100 26;
image.normal: "tog_base_on.png";
}
}
part {
name: "offrect";
type: IMAGE;
scale: 1;
clip_to: "clipper";
mouse_events: 0;
description {
state: "default" 0.0;
rel1.to: "button";
rel1.relative: 0 0.0;
rel2.to: "button";
rel2.relative: 0 1.0;
fixed: 1 1;
align: 0 0.5;
min: 100 26;
max: 100 26;
image.normal: "tog_base_off.png";
}
}
part {
name: "button0";
type: IMAGE;
clip_to: "clipper";
mouse_events: 0;
description {
state: "default" 0.0;
rel1.to: "button";
rel2.to: "button";
image.normal: "tog_bt_on.png";
}
description {
state: "on" 0.0;
inherit: "default" 0.0;
}
description {
state: "off" 0.0;
inherit: "default" 0.0;
image.normal: "tog_bt_off.png";
}
}
part {
name: "elm.offtext";
type: TEXT;
mouse_events: 0;
scale: 1;
clip_to: "clipper";
description {
state: "default" 0.0;
fixed: 1 1;
rel1.to_x: "button";
rel1.relative: 1.0 0.0;
rel2.to_x: "offrect";
color: 0 0 0 255;
text {
font: "Sans,Edje-Vera";
size: 10;
min: 0 1;
align: 0.5 0.5;
}
}
}
part {
name: "elm.ontext";
type: TEXT;
effect: SOFT_SHADOW;
mouse_events: 0;
scale: 1;
clip_to: "clipper";
description {
state: "default" 0.0;
fixed: 1 1;
rel1.to_x: "onrect";
rel1.offset: 1 1;
rel2.to_x: "button";
rel2.offset: 0 0;
rel2.relative: 0.0 1.0;
color: 224 224 224 255;
color3: 0 0 0 64;
text {
font: "Sans,Edje-Vera";
size: 10;
min: 0 1;
align: 0.5 0.5;
}
}
}
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.relative: 0.0 1.0;
rel2.offset: 3 -5;
}
description {
state: "visible" 0.0;
inherit: "default" 0.0;
visible: 1;
aspect: 1.0 1.0;
rel2.offset: 4 -5;
}
}
part {
name: "elm.text";
type: TEXT;
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.to_x: "bg";
rel2.relative: 0.0 1.0;
rel2.offset: -7 -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;
}
}
}
programs {
program {
signal: "mouse,clicked,1";
source: "button";
script {
new Float:dx, Float:dy;
get_drag(PART:"button", dx, dy);
if (!get_int(was_drag)) {
if (dx > 0.5)
set_drag(PART:"button", 0.0, 0.0);
else
set_drag(PART:"button", 1.0, 0.0);
if (((get_int(is_rtl) == 1) && (dx <= 0.5)) ||
(get_int(is_rtl) == 0) && (dx > 0.5))
emit("elm,action,check,off", "");
else
emit("elm,action,check,on", "");
}
}
}
program {
signal: "drag";
source: "button";
script {
set_int(is_drag, 1);
}
}
program {
signal: "mouse,down,1";
source: "button";
script {
set_int(was_drag, 0);
set_int(is_drag, 0);
}
}
program {
name: "drag_end";
signal: "mouse,up,1";
source: "button";
script {
new Float:dx, Float:dy;
get_drag(PART:"button", dx, dy);
if (dx > 0.5)
{
set_drag(PART:"button", 1.0, 0.0);
}
else
{
set_drag(PART:"button", 0.0, 0.0);
}
if (((get_int(is_rtl) == 1) && (dx <= 0.5)) ||
(get_int(is_rtl) == 0) && (dx > 0.5)) {
emit("elm,action,check,on", "");
}
else {
emit("elm,action,check,off", "");
}
set_int(was_drag, get_int(is_drag));
set_int(is_drag, 0);
}
}
program {
name: "check_on";
signal: "elm,state,check,on";
source: "elm";
script {
new Float:drag;
if (get_int(is_rtl) == 0) {
drag = 100.0;
}
else {
drag = 0.0;
}
set_drag(PART:"button", drag, 0.0);
set_state(PART:"button0", "on", 0.0);
}
}
program {
name: "check_off";
signal: "elm,state,check,off";
source: "elm";
script {
new Float:drag;
if (get_int(is_rtl) == 0) {
drag = 0.0;
}
else {
drag = 100.0;
}
set_drag(PART:"button", drag, 0.0);
set_state(PART:"button0", "off", 0.0);
}
}
program {
name: "text_show";
signal: "elm,state,text,visible";
source: "elm";
action: STATE_SET "visible" 0.0;
target: "elm.text";
}
program {
name: "text_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: "to_rtl";
signal: "edje,state,rtl";
source: "edje";
script {
set_int(is_rtl, 1);
}
}
program {
name: "to_ltr";
signal: "edje,state,ltr";
source: "edje";
script {
set_int(is_rtl, 0);
}
}
}
}

View File

@ -162,7 +162,7 @@ test_flag(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info _
elm_object_signal_emit(test_data->layout, "borders,show", "ephysics_test");
tg = elm_check_add(test_data->win);
elm_object_style_set(tg, "toggle");
elm_object_style_set(tg, "ephysics-test");
evas_object_size_hint_weight_set(tg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(tg, EVAS_HINT_FILL, 0.5);
elm_check_state_set(tg, EINA_TRUE);

View File

@ -75,7 +75,7 @@ test_light(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
elm_object_signal_emit(test_data->layout, "borders,show", "ephysics_test");
tg = elm_check_add(test_data->win);
elm_object_style_set(tg, "toggle");
elm_object_style_set(tg, "ephysics-test");
evas_object_size_hint_weight_set(tg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(tg, EVAS_HINT_FILL, 0.5);
elm_check_state_set(tg, EINA_TRUE);