parent
cdf027962e
commit
a0c8487fc5
15 changed files with 722 additions and 172 deletions
@ -0,0 +1,335 @@ |
||||
images { |
||||
image: "e17_button2.png" COMP; |
||||
image: "e17_button.png" COMP; |
||||
image: "e17_titlebar_glint1.png" COMP; |
||||
image: "e17_titlebar_glint2.png" COMP; |
||||
image: "e17_titlebar_glint3.png" COMP; |
||||
} |
||||
|
||||
group { |
||||
name: "widgets/button"; |
||||
parts { |
||||
part { |
||||
name: "button_image"; |
||||
type: IMAGE; |
||||
mouse_events: 1; |
||||
description { |
||||
state: "default" 0.0; |
||||
image { |
||||
normal: "e17_button.png"; |
||||
border: 8 8 8 8; |
||||
} |
||||
} |
||||
description { |
||||
state: "clicked" 0.0; |
||||
inherit: "default" 0.0; |
||||
image { |
||||
normal: "e17_button2.png"; |
||||
} |
||||
} |
||||
} |
||||
part { |
||||
name: "icon_swallow"; |
||||
type: SWALLOW; |
||||
description { |
||||
state: "default" 0.0; |
||||
align: 0.0 0.5; |
||||
color: 0 0 0 0; |
||||
rel1 { |
||||
relative: 0.0 0.0; |
||||
offset: 0 11; |
||||
to: "button_image"; |
||||
} |
||||
rel2 { |
||||
relative: 0.0 1.0; |
||||
offset: 0 -12; |
||||
to: "button_image"; |
||||
} |
||||
} |
||||
description { |
||||
state: "visible" 0.0; |
||||
inherit: "default" 0.0; |
||||
aspect: 1.0 1.0; |
||||
aspect_preference: VERTICAL; |
||||
align: 0.0 0.5; |
||||
color: 0 0 0 0; |
||||
rel1 { |
||||
relative: 0.0 0.0; |
||||
offset: 11 11; |
||||
to: "button_image"; |
||||
} |
||||
rel2 { |
||||
relative: 0.0 1.0; |
||||
offset: 10 -12; |
||||
to: "button_image"; |
||||
} |
||||
} |
||||
} |
||||
part { |
||||
name: "label"; |
||||
type: TEXT; |
||||
effect: SHADOW; |
||||
mouse_events: 0; |
||||
description { |
||||
state: "default" 0.0; |
||||
rel1 { |
||||
relative: 1.0 0.0; |
||||
offset: 5 11; |
||||
to_x: "icon_swallow"; |
||||
to_y: "button_image"; |
||||
} |
||||
rel2 { |
||||
relative: 1.0 1.0; |
||||
offset: -12 -12; |
||||
to: "button_image"; |
||||
} |
||||
color: 0 0 0 255; |
||||
color3: 255 255 255 128; |
||||
text { |
||||
text: "OK"; |
||||
font: "Edje-Vera"; |
||||
size: 10; |
||||
min: 1 1; |
||||
align: 0.5 0.5; |
||||
} |
||||
} |
||||
} |
||||
part { |
||||
name: "glint_clip"; |
||||
type: RECT; |
||||
mouse_events: 0; |
||||
description { |
||||
state: "default" 0.0; |
||||
color: 255 255 255 255; |
||||
rel1 { |
||||
relative: 0.0 0.0; |
||||
offset: 3 3; |
||||
} |
||||
rel2 { |
||||
relative: 1.0 1.0; |
||||
offset: -4 -4; |
||||
} |
||||
} |
||||
} |
||||
part { |
||||
name: "glint1"; |
||||
mouse_events: 0; |
||||
description { |
||||
state: "default" 0.0; |
||||
visible: 0; |
||||
color: 255 255 255 0; |
||||
align: 0.0 0.0; |
||||
max: 34 13; |
||||
rel1 { |
||||
relative: 0.0 0.0; |
||||
offset: 2 2; |
||||
} |
||||
rel2 { |
||||
relative: 1.0 1.0; |
||||
offset: -3 -3; |
||||
} |
||||
image { |
||||
normal: "e17_titlebar_glint1.png"; |
||||
border: 5 0 5 0; |
||||
} |
||||
fill { |
||||
smooth: 0; |
||||
} |
||||
} |
||||
description { |
||||
state: "active" 0.0; |
||||
inherit: "default" 0.0; |
||||
visible: 1; |
||||
color: 255 255 255 255; |
||||
} |
||||
} |
||||
part { |
||||
name: "glint2"; |
||||
mouse_events: 0; |
||||
clip_to: "glint_clip"; |
||||
description { |
||||
state: "default" 0.0; |
||||
visible: 0; |
||||
color: 255 255 255 0; |
||||
align: 1.0 0.5; |
||||
max: 0 0; |
||||
rel1 { |
||||
relative: 0.0 0.0; |
||||
offset: 3 3; |
||||
} |
||||
rel2 { |
||||
relative: 0.0 1.0; |
||||
offset: 3 -4; |
||||
} |
||||
image { |
||||
normal: "e17_titlebar_glint2.png"; |
||||
border: 0 0 5 5; |
||||
} |
||||
fill { |
||||
smooth: 0; |
||||
} |
||||
} |
||||
description { |
||||
state: "active" 0.0; |
||||
inherit: "default" 0.0; |
||||
visible: 1; |
||||
color: 255 255 255 255; |
||||
max: 169 9999; |
||||
min: 169 8; |
||||
align: 0.5 0.5; |
||||
} |
||||
description { |
||||
state: "active2" 0.0; |
||||
inherit: "default" 0.0; |
||||
visible: 1; |
||||
color: 255 255 255 128; |
||||
max: 169 9999; |
||||
min: 169 8; |
||||
align: 0.5 0.5; |
||||
rel1 { |
||||
relative: 1.0 0.0; |
||||
offset: -4 3; |
||||
} |
||||
rel2 { |
||||
relative: 1.0 1.0; |
||||
offset: -4 -4; |
||||
} |
||||
} |
||||
description { |
||||
state: "active3" 0.0; |
||||
inherit: "default" 0.0; |
||||
visible: 0; |
||||
color: 255 255 255 0; |
||||
max: 169 9999; |
||||
min: 169 8; |
||||
align: 0.0 0.5; |
||||
rel1 { |
||||
relative: 1.0 0.0; |
||||
offset: -4 3; |
||||
} |
||||
rel2 { |
||||
relative: 1.0 1.0; |
||||
offset: -4 -4; |
||||
} |
||||
} |
||||
} |
||||
part { |
||||
name: "glint3"; |
||||
mouse_events: 0; |
||||
description { |
||||
state: "default" 0.0; |
||||
visible: 0; |
||||
color: 255 255 255 0; |
||||
align: 1.0 1.0; |
||||
max: 34 13; |
||||
rel1 { |
||||
relative: 0.0 0.0; |
||||
offset: 2 2; |
||||
} |
||||
rel2 { |
||||
relative: 1.0 1.0; |
||||
offset: -3 -3; |
||||
} |
||||
image { |
||||
normal: "e17_titlebar_glint3.png"; |
||||
border: 0 5 0 5; |
||||
} |
||||
fill { |
||||
smooth: 0; |
||||
} |
||||
} |
||||
description { |
||||
state: "active" 0.0; |
||||
inherit: "default" 0.0; |
||||
visible: 1; |
||||
color: 255 255 255 255; |
||||
} |
||||
} |
||||
} |
||||
programs { |
||||
program { |
||||
name: "button_click"; |
||||
signal: "mouse,down,1"; |
||||
source: "button_image"; |
||||
action: STATE_SET "clicked" 0.0; |
||||
target: "button_image"; |
||||
} |
||||
program { |
||||
name: "button_unclick"; |
||||
signal: "mouse,up,1"; |
||||
source: "button_image"; |
||||
action: STATE_SET "default" 0.0; |
||||
target: "button_image"; |
||||
} |
||||
program { |
||||
name: "button_unclick2"; |
||||
signal: "mouse,clicked,1"; |
||||
source: "button_image"; |
||||
action: SIGNAL_EMIT "click" ""; |
||||
} |
||||
program { |
||||
name: "icon_visible"; |
||||
signal: "icon_visible"; |
||||
source: ""; |
||||
action: STATE_SET "visible" 0.0; |
||||
target: "icon_swallow"; |
||||
} |
||||
program { |
||||
name: "button_in"; |
||||
signal: "mouse,in"; |
||||
source: "button_image"; |
||||
action: SIGNAL_EMIT "enter" ""; |
||||
} |
||||
program { |
||||
name: "button_enter"; |
||||
signal: "enter"; |
||||
source: ""; |
||||
script { |
||||
run_program(PROGRAM:"go_active"); |
||||
} |
||||
} |
||||
program { |
||||
name: "go_active"; |
||||
action: STATE_SET "active" 0.0; |
||||
target: "glint1"; |
||||
target: "glint2"; |
||||
transition: LINEAR 0.05; |
||||
after: "go_active2"; |
||||
after: "go_active2b"; |
||||
} |
||||
program { |
||||
name: "go_active2"; |
||||
action: STATE_SET "active2" 0.0; |
||||
target: "glint2"; |
||||
transition: LINEAR 0.2; |
||||
after: "go_active3"; |
||||
after: "go_active3b"; |
||||
} |
||||
program { |
||||
name: "go_active2b"; |
||||
action: STATE_SET "active" 0.0; |
||||
target: "glint3"; |
||||
transition: LINEAR 0.2; |
||||
} |
||||
program { |
||||
name: "go_active3"; |
||||
action: STATE_SET "active3" 0.0; |
||||
target: "glint2"; |
||||
transition: LINEAR 0.05; |
||||
} |
||||
program { |
||||
name: "go_active3b"; |
||||
action: STATE_SET "default" 0.0; |
||||
target: "glint3"; |
||||
transition: LINEAR 0.1; |
||||
after: "go_active4"; |
||||
} |
||||
program { |
||||
name: "go_active4"; |
||||
action: STATE_SET "default" 0.0; |
||||
target: "glint1"; |
||||
target: "glint2"; |
||||
target: "glint3"; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,82 @@ |
||||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 |
||||
*/ |
||||
#include "e.h" |
||||
|
||||
typedef struct _E_Widget_Data E_Widget_Data; |
||||
struct _E_Widget_Data |
||||
{ |
||||
Evas_Object *o_button; |
||||
Evas_Object *o_icon; |
||||
void (*func) (void *data, void *data2); |
||||
void *data; |
||||
void *data2;
|
||||
}; |
||||
|
||||
static void _e_wid_del_hook(Evas_Object *obj); |
||||
static void _e_wid_signal_cb1(void *data, Evas_Object *obj, const char *emission, const char *source); |
||||
/* local subsystem functions */ |
||||
|
||||
/* externally accessible functions */ |
||||
Evas_Object * |
||||
e_widget_button_add(Evas *evas, char *label, char *icon, void (*func) (void *data, void *data2), void *data, void *data2) |
||||
{ |
||||
Evas_Object *obj, *o; |
||||
E_Widget_Data *wd; |
||||
Evas_Coord mw, mh; |
||||
|
||||
obj = e_widget_add(evas); |
||||
|
||||
e_widget_del_hook_set(obj, _e_wid_del_hook); |
||||
wd = calloc(1, sizeof(E_Widget_Data)); |
||||
wd->func = func; |
||||
wd->data = data; |
||||
wd->data2 = data2; |
||||
e_widget_data_set(obj, wd); |
||||
|
||||
o = edje_object_add(evas); |
||||
wd->o_button = o; |
||||
e_theme_edje_object_set(o, "base/theme/widgets", |
||||
"widgets/button"); |
||||
edje_object_signal_callback_add(o, "click", "", _e_wid_signal_cb1, obj); |
||||
edje_object_part_text_set(o, "label", label); |
||||
evas_object_show(o); |
||||
|
||||
e_widget_sub_object_add(obj, o); |
||||
e_widget_resize_object_set(obj, o); |
||||
|
||||
if (icon) |
||||
{ |
||||
o = edje_object_add(evas); |
||||
wd->o_icon = o; |
||||
e_util_edje_icon_set(o, icon); |
||||
edje_object_part_swallow(wd->o_button, "icon_swallow", o); |
||||
edje_object_signal_emit(wd->o_button, "icon_visible", ""); |
||||
edje_object_message_signal_process(wd->o_button); |
||||
evas_object_show(o); |
||||
e_widget_sub_object_add(obj, o); |
||||
} |
||||
|
||||
edje_object_size_min_calc(wd->o_button, &mw, &mh); |
||||
e_widget_min_size_set(obj, mw, mh); |
||||
|
||||
return obj; |
||||
} |
||||
|
||||
static void |
||||
_e_wid_del_hook(Evas_Object *obj) |
||||
{ |
||||
E_Widget_Data *wd; |
||||
|
||||
wd = e_widget_data_get(obj); |
||||
free(wd); |
||||
} |
||||
|
||||
static void |
||||
_e_wid_signal_cb1(void *data, Evas_Object *obj, const char *emission, const char *source) |
||||
{ |
||||
E_Widget_Data *wd; |
||||
|
||||
wd = e_widget_data_get(data); |
||||
if (wd->func) wd->func(wd->data, wd->data2); |
||||
} |
@ -0,0 +1,12 @@ |
||||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 |
||||
*/ |
||||
#ifdef E_TYPEDEFS |
||||
#else |
||||
#ifndef E_WIDGET_BUTTON_H |
||||
#define E_WIDGET_BUTTON_H |
||||
|
||||
EAPI Evas_Object *e_widget_button_add(Evas *evas, char *label, char *icon, void (*func) (void *data, void *data2), void *data, void *data2); |
||||
|
||||
#endif |
||||
#endif |
@ -0,0 +1,79 @@ |
||||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 |
||||
*/ |
||||
#include "e.h" |
||||
|
||||
typedef struct _E_Widget_Data E_Widget_Data; |
||||
struct _E_Widget_Data |
||||
{ |
||||
Evas_Object *o_box; |
||||
}; |
||||
|
||||
static void _e_wid_del_hook(Evas_Object *obj); |
||||
|
||||
/* local subsystem functions */ |
||||
|
||||
/* externally accessible functions */ |
||||
Evas_Object * |
||||
e_widget_list_add(Evas *evas, int horiz) |
||||
{ |
||||
Evas_Object *obj, *o; |
||||
E_Widget_Data *wd; |
||||
|
||||
obj = e_widget_add(evas); |
||||
|
||||
e_widget_del_hook_set(obj, _e_wid_del_hook); |
||||
wd = calloc(1, sizeof(E_Widget_Data)); |
||||
e_widget_data_set(obj, wd); |
||||
|
||||
o = e_box_add(evas); |
||||
wd->o_box = o; |
||||
e_box_orientation_set(o, horiz); |
||||
e_box_homogenous_set(o, 0); |
||||
evas_object_show(o); |
||||
e_widget_sub_object_add(obj, o); |
||||
e_widget_resize_object_set(obj, o); |
||||
|
||||
return obj; |
||||
} |
||||
|
||||
void |
||||
e_widget_list_object_append(Evas_Object *obj, Evas_Object *sobj, int fill, int expand, double align) |
||||
{ |
||||
E_Widget_Data *wd; |
||||
Evas_Coord mw, mh; |
||||
|
||||
wd = e_widget_data_get(obj); |
||||
|
||||
e_box_pack_end(wd->o_box, sobj); |
||||
e_widget_min_size_get(sobj, &mw, &mh); |
||||
if (e_box_orientation_get(wd->o_box) == 1) |
||||
e_box_pack_options_set(sobj, |
||||
1, fill, /* fill */ |
||||
0, expand, /* expand */ |
||||
0.5, align, /* align */ |
||||
mw, mh, /* min */ |
||||
99999, 99999 /* max */ |
||||
); |
||||
else |
||||
e_box_pack_options_set(sobj, |
||||
fill, 1, /* fill */ |
||||
expand, 0, /* expand */ |
||||
align, 0.5, /* align */ |
||||
mw, mh, /* min */ |
||||
99999, 99999 /* max */ |
||||
); |
||||
e_box_min_size_get(wd->o_box, &mw, &mh); |
||||
e_widget_min_size_set(obj, mw, mh); |
||||
e_widget_sub_object_add(obj, sobj); |
||||
evas_object_show(sobj); |
||||
} |
||||
|
||||
static void |
||||
_e_wid_del_hook(Evas_Object *obj) |
||||
{ |
||||
E_Widget_Data *wd; |
||||
|
||||
wd = e_widget_data_get(obj); |
||||
free(wd); |
||||
} |
@ -0,0 +1,14 @@ |
||||
/*
|
||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 |
||||
*/ |
||||
#ifdef E_TYPEDEFS |
||||
#else |
||||
#ifndef E_WIDGET_LIST_H |
||||
#define E_WIDGET_LIST_H |
||||
|
||||
EAPI Evas_Object *e_widget_list_add(Evas *evas, int horiz); |
||||
EAPI void e_widget_list_object_append(Evas_Object *obj, Evas_Object *sobj, int fill, int expand, double align); |
||||
|
||||
|
||||
#endif |
||||
#endif |
Loading…
Reference in new issue