theme: make spin button work better

this is now using the EFL_UI_CLICKABLE_PART_BIND macro, which makes
multiple clicks work correctly, which improves the overall usability of
the widget.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Differential Revision: https://phab.enlightenment.org/D11000
This commit is contained in:
Marcel Hollerbach 2020-01-01 14:13:46 +01:00
parent 914fa2fd7c
commit 7c0ea35097
1 changed files with 6 additions and 59 deletions

View File

@ -279,10 +279,6 @@ group { "efl/spin_button/horizontal/inc_button";
images.image: "sym_right_light_normal.png" COMP; images.image: "sym_right_light_normal.png" COMP;
images.image: "sym_right_glow_normal.png" COMP; images.image: "sym_right_glow_normal.png" COMP;
images.image: "sym_right_dark_normal.png" COMP; images.image: "sym_right_dark_normal.png" COMP;
script {
public mouse_down = 0;
public multi_down = 0;
}
parts { parts {
part { name: "arrow.image"; part { name: "arrow.image";
scale: 1; scale: 1;
@ -321,64 +317,31 @@ group { "efl/spin_button/horizontal/inc_button";
} }
} }
programs { programs {
EFL_UI_CLICKABLE_PART_BIND(over)
program { name: "button_press"; program { name: "button_press";
signal: "mouse,down,1"; signal: "mouse,down,1";
source: "over"; source: "over";
script {
if ((get_int(multi_down) == 0) &&
(get_int(mouse_down) == 0)) {
set_int(mouse_down, 1);
run_program(PROGRAM:"button_press2");
}
}
}
program { name: "button_press2";
action: SIGNAL_EMIT "efl,action,press" "";
after: "button_press_anim";
}
program { name: "button_press_anim";
action: STATE_SET "pressed" 0.0; action: STATE_SET "pressed" 0.0;
target: "arrow.image"; target: "arrow.image";
} }
program { name: "button_unpress"; program { name: "button_unpress";
signal: "mouse,up,1"; signal: "mouse,up,1";
source: "over"; source: "over";
script {
if (get_int(mouse_down) == 1) {
set_int(mouse_down, 0);
run_program(PROGRAM:"button_unpress2");
run_program(PROGRAM:"button_unpress_anim");
}
}
}
program { name: "button_unpress2";
action: SIGNAL_EMIT "efl,action,unpress" "";
}
program { name: "button_unpress_anim";
action: STATE_SET "default" 0.0; action: STATE_SET "default" 0.0;
target: "arrow.image"; target: "arrow.image";
} }
program { name: "button_click";
signal: "mouse,clicked,1";
source: "over";
script {
if (get_int(multi_down) == 0) {
run_program(PROGRAM:"button_click2");
}
}
}
program { name: "action_unpressed"; program { name: "action_unpressed";
signal: "efl,action,unpressed"; signal: "efl,action,unpressed";
source: "efl"; source: "efl";
after: "button_unpress_anim"; action: STATE_SET "default" 0.0;
target: "arrow.image";
} }
program { name: "action_pressed"; program { name: "action_pressed";
signal: "efl,action,pressed"; signal: "efl,action,pressed";
source: "efl"; source: "efl";
after: "button_press_anim"; action: STATE_SET "pressed" 0.0;
} target: "arrow.image";
program { name: "button_click2";
action: SIGNAL_EMIT "efl,action,click" "";
} }
program { name: "access_pressed"; program { name: "access_pressed";
signal: "efl,state,animation,activated"; signal: "efl,state,animation,activated";
@ -406,22 +369,6 @@ group { "efl/spin_button/horizontal/inc_button";
target: "arrow.image"; target: "arrow.image";
target: "disabler"; target: "disabler";
} }
program {
name: "multi_down";
signal: "efl,action,multi,down";
source: "efl";
script {
set_int(multi_down, 1);
}
}
program {
name: "multi_up";
signal: "efl,action,multi,up";
source: "efl";
script {
set_int(multi_down, 0);
}
}
} }
} }