elm_panes : - add an animation with 2 arrows while the bar is dragged. - add getter/setter for the size of the left content. - in the test : double click -> open/close the left content

SVN revision: 49786
This commit is contained in:
Jonathan Atton 2010-06-21 20:15:57 +00:00
parent 1e173716de
commit 6ba054f636
6 changed files with 193 additions and 17 deletions

View File

@ -140,6 +140,7 @@ busy-7.png \
busy-8.png \
busy-9.png \
arrow_right.png \
arrow_left.png \
bt_spinner_up.png \
bt_spinner_down.png \
bt_spinner_hilight.png \

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -23106,6 +23106,8 @@ collections {
image: "bt_glow.png" COMP;
image: "bt_dis_base.png" COMP;
image: "bt_dis_hilight.png" COMP;
image: "arrow_right.png" COMP;
image: "arrow_left.png" COMP;
}
parts
{
@ -23120,7 +23122,7 @@ collections {
visible: 0;
}
}
//2 contents
part
{
@ -23130,7 +23132,7 @@ collections {
description
{
state: "default" 0.0;
rel2.to_x: "bar";
rel2.to_x: "elm.bar";
rel2.relative: 0.0 1.0;
visible: 1;
}
@ -23156,7 +23158,7 @@ collections {
description
{
state: "default" 0.0;
rel1.to_x: "bar";
rel1.to_x: "elm.bar";
rel1.relative: 1.0 0.0;
visible: 1;
}
@ -23174,7 +23176,7 @@ collections {
}
}
//BAR
part { name: "bar";
part { name: "elm.bar";
mouse_events: 1;
dragable {
confine: "whole";
@ -23182,8 +23184,8 @@ collections {
y: 0 0 0;
}
description { state: "default" 0.0;
max: 15 999;
min: 15 999;
max: 15 9999;
min: 15 100;
image {
normal: "bt_base2.png";
border: 7 7 7 7;
@ -23206,8 +23208,8 @@ collections {
part { name: "over1";
mouse_events: 0;
description { state: "default" 0.0;
rel1.to: "bar";
rel2.to: "bar";
rel1.to: "elm.bar";
rel2.to: "elm.bar";
rel2.relative: 1.0 0.5;
image {
normal: "bt_hilight.png";
@ -23227,8 +23229,8 @@ collections {
repeat_events: 1;
ignore_flags: ON_HOLD;
description { state: "default" 0.0;
rel1.to: "bar";
rel2.to: "bar";
rel1.to: "elm.bar";
rel2.to: "elm.bar";
image {
normal: "bt_shine.png";
border: 7 7 7 7;
@ -23244,8 +23246,8 @@ collections {
repeat_events: 1;
description { state: "default" 0.0;
color: 255 255 255 0;
rel1.to: "bar";
rel2.to: "bar";
rel1.to: "elm.bar";
rel2.to: "elm.bar";
image {
normal: "bt_glow.png";
border: 12 12 12 12;
@ -23259,6 +23261,68 @@ collections {
}
}
//Arrow
part {
name: "arrow_right";
description { state: "default" 0.0;
min: 45 45;
max: 45 45;
color: 255 255 255 0;
rel1.relative: 1.0 0.5;
rel1.to_x: "elm.bar";
rel1.offset: 45/2 -45/2;
rel2.relative: 1.0 0.5;
rel2.to_x: "elm.bar";
rel2.offset: 45/2 45/2;
image.normal: "arrow_right.png";
}
description { state: "anim_1" 0.0;
inherit: "default" 0.0;
color: 255 255 255 200;
rel1.offset: (45/2 + 10) -45/2;
rel2.offset: (45/2 +10) 45/2;
}
description { state: "anim_2" 0.0;
inherit: "default" 0.0;
color: 255 255 255 0;
rel1.offset: (45/2 + 20) -45/2;
rel2.offset: (45/2 + 20) 45/2;
}
}
part {
name: "arrow_left";
description { state: "default" 0.0;
min: 45 45;
max: 45 45;
color: 255 255 255 0;
rel1.relative: 0.0 0.5;
rel1.to_x: "elm.bar";
rel1.offset: -45/2 -45/2;
rel2.relative: 0.0 0.5;
rel2.to_x: "elm.bar";
rel2.offset: -45/2 45/2;
image.normal: "arrow_left.png";
}
description { state: "anim_1" 0.0;
inherit: "default" 0.0;
color: 255 255 255 200;
rel1.offset: (-45/2 - 10) -45/2;
rel2.offset: (-45/2 - 10) 45/2;
}
description { state: "anim_2" 0.0;
inherit: "default" 0.0;
color: 255 255 255 0;
rel1.offset: (-45/2 - 20) -45/2;
rel2.offset: (-45/2 - 20) 45/2;
}
}
}
programs {
program {
@ -23267,11 +23331,12 @@ collections {
source: "over2";
action: SIGNAL_EMIT "elm,action,press" "";
after: "button_click_anim";
after: "arrow_anim_start";
}
program {
name: "button_click_anim";
action: STATE_SET "clicked" 0.0;
target: "bar";
target: "elm.bar";
}
program {
name: "button_unclick";
@ -23279,11 +23344,12 @@ collections {
source: "over2";
action: SIGNAL_EMIT "elm,action,unpress" "";
after: "button_unclick_anim";
after: "arrow_anim_stop";
}
program {
name: "button_unclick_anim";
action: STATE_SET "default" 0.0;
target: "bar";
target: "elm.bar";
}
program {
name: "button_click2";
@ -23306,6 +23372,52 @@ collections {
source: "over2";
action: SIGNAL_EMIT "elm,action,click" "";
}
program {
name: "button_down_double";
signal: "mouse,down,1,double";
source: "over3";
action: SIGNAL_EMIT "elm,action,click,double" "";
}
//arrows animation
program {
name: "arrow_anim_start";
action: STATE_SET "anim_1" 0.0;
target: "arrow_right";
target: "arrow_left";
transition: LINEAR 0.6;
after: "arrow_anim_1";
}
program {
name: "arrow_anim_1";
action: STATE_SET "anim_2" 0.0;
target: "arrow_right";
target: "arrow_left";
transition: LINEAR 0.6;
after: "arrow_anim_2";
}
program {
name: "arrow_anim_2";
action: STATE_SET "default" 0.0;
target: "arrow_right";
target: "arrow_left";
after: "arrow_anim_start";
}
program {
name: "arrow_anim_stop";
action: ACTION_STOP;
target: "arrow_anim_start";
target: "arrow_anim_1";
target: "arrow_anim_2";
after: "arrow_anim_stop_1";
}
program {
name: "arrow_anim_stop_1";
action: STATE_SET "default" 0.0;
target: "arrow_right";
target: "arrow_left";
transition: DECELERATE 0.4;
}
}
}

View File

@ -1,7 +1,7 @@
#include <Elementary.h>
#ifndef ELM_LIB_QUICKLAUNCH
static Elm_Genlist_Item_Class itc;
static double size = 0.0;
static void
_press(void *data, Evas_Object *obj, void *event_info)
@ -12,7 +12,7 @@ _press(void *data, Evas_Object *obj, void *event_info)
static void
_unpress(void *data, Evas_Object *obj, void *event_info)
{
printf("unpress\n");
printf("unpress, size : %f\n", elm_panes_left_content_size_get(obj));
}
static void
@ -21,6 +21,21 @@ _clicked(void *data, Evas_Object *obj, void *event_info)
printf("clicked\n");
}
static void
_clicked_double(void *data, Evas_Object *obj, void *event_info)
{
printf("clicked double\n");
if(elm_panes_left_content_size_get(obj) > 0)
{
size = elm_panes_left_content_size_get(obj);
elm_panes_left_content_size_set(obj, 0.0);
}
else
elm_panes_left_content_size_set(obj, size);
}
void
test_panes(void *data, Evas_Object *obj, void *event_info)
{
@ -44,6 +59,8 @@ test_panes(void *data, Evas_Object *obj, void *event_info)
evas_object_show(panes);
evas_object_smart_callback_add(panes, "clicked", _clicked, panes);
evas_object_smart_callback_add(panes, "clicked,double", _clicked_double, panes);
evas_object_smart_callback_add(panes, "press", _press, panes);
evas_object_smart_callback_add(panes, "unpress", _unpress, panes);

View File

@ -1474,11 +1474,12 @@ extern "C" {
* Update the minimun height of the bar in the theme. No minimun should be set in the vertical theme
* Add horyzontal theme
* Add events (move, start ...)
* Add getter of the size of each content (30% - 70% ...)
*/
EAPI Evas_Object *elm_panes_add(Evas_Object *parent);
EAPI void elm_panes_content_left_set(Evas_Object *obj, Evas_Object *content);
EAPI void elm_panes_content_right_set(Evas_Object *obj, Evas_Object *content);
EAPI double elm_panes_left_content_size_get(Evas_Object *obj);
EAPI void elm_panes_left_content_size_set(Evas_Object *obj, double size);
typedef enum _Elm_Flip_Mode
{

View File

@ -20,6 +20,15 @@ struct _Widget_Data
Evas_Object *left;
Evas_Object *right;
} contents;
struct
{
int x_diff;
int y_diff;
Eina_Bool move;
} move;
Eina_Bool clicked_double;
};
static const char *widtype = NULL;
@ -92,6 +101,14 @@ _clicked(void *data, Evas_Object *obj __UNUSED__ , const char *emission __UNUSED
evas_object_smart_callback_call(data, "clicked", NULL);
}
static void
_clicked_double(void *data, Evas_Object *obj __UNUSED__ , const char *emission __UNUSED__, const char *source __UNUSED__)
{
Widget_Data *wd = elm_widget_data_get(data);
wd->clicked_double = EINA_TRUE;
}
static void
_press(void *data, Evas_Object *obj __UNUSED__ , const char *emission __UNUSED__, const char *source __UNUSED__)
{
@ -101,7 +118,14 @@ _press(void *data, Evas_Object *obj __UNUSED__ , const char *emission __UNUSED__
static void
_unpress(void *data, Evas_Object *obj __UNUSED__ , const char *emission __UNUSED__, const char *source __UNUSED__)
{
Widget_Data *wd = elm_widget_data_get(data);
evas_object_smart_callback_call(data, "unpress", NULL);
if(wd->clicked_double)
{
evas_object_smart_callback_call(data, "clicked,double", NULL);
wd->clicked_double = EINA_FALSE;
}
}
/**
@ -134,7 +158,10 @@ elm_panes_add(Evas_Object *parent)
elm_widget_resize_object_set(obj, wd->panes);
evas_object_show(wd->panes);
elm_panes_left_content_size_set(obj, 0.5);
edje_object_signal_callback_add(wd->panes, "elm,action,click", "", _clicked, obj);
edje_object_signal_callback_add(wd->panes, "elm,action,click,double", "", _clicked_double, obj);
edje_object_signal_callback_add(wd->panes, "elm,action,press", "", _press, obj);
edje_object_signal_callback_add(wd->panes, "elm,action,unpress", "", _unpress, obj);
@ -184,3 +211,21 @@ EAPI void elm_panes_content_right_set(Evas_Object *obj, Evas_Object *content)
}
}
EAPI double elm_panes_left_content_size_get(Evas_Object *obj)
{
Widget_Data *wd = elm_widget_data_get(obj);
double w, h;
edje_object_part_drag_value_get(wd->panes, "elm.bar", &w, &h);
return w;
}
EAPI void elm_panes_left_content_size_set(Evas_Object *obj, double size)
{
Widget_Data *wd = elm_widget_data_get(obj);
edje_object_part_drag_value_set(wd->panes, "elm.bar", size, 0.0);
}