working on more widgety stuff

SVN revision: 17438
This commit is contained in:
Carsten Haitzler 2005-10-11 16:25:00 +00:00
parent cdf027962e
commit a0c8487fc5
15 changed files with 719 additions and 169 deletions

View File

@ -43,7 +43,8 @@ default_scrollbar.edc \
default_fileman.edc \
default_check.edc \
default_radio.edc \
default_frame.edc
default_frame.edc \
default_button.edc
default.edj: Makefile $(EXTRA_DIST)
$(EDJE_CC) $(EDJE_FLAGS) \

View File

@ -52,5 +52,6 @@ collections {
#include "default_check.edc"
#include "default_radio.edc"
#include "default_frame.edc"
#include "default_button.edc"
}

View File

@ -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";
}
}
}

View File

@ -635,6 +635,12 @@ group {
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";

View File

@ -86,7 +86,9 @@ e_fileman_smart.h \
e_widget.h \
e_widget_check.h \
e_widget_radio.h \
e_widget_framelist.h
e_widget_framelist.h \
e_widget_list.h \
e_widget_button.h
enlightenment_src = \
e_user.c \
@ -155,6 +157,8 @@ e_widget.c \
e_widget_check.c \
e_widget_radio.c \
e_widget_framelist.c \
e_widget_list.c \
e_widget_button.c \
$(ENLIGHTENMENTHEADERS)
enlightenment_SOURCES = \

View File

@ -16,7 +16,6 @@ struct _E_Dialog_Button
/* local subsystem functions */
static void _e_dialog_free(E_Dialog *dia);
static void _e_dialog_cb_button_clicked(void *data, Evas_Object *obj, const char *emission, const char *source);
static void _e_dialog_button_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event);
static void _e_dialog_button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event);
static void _e_dialog_cb_delete(E_Win *win);
static void _e_dialog_cb_key_down(void *data, Evas *e, Evas_Object *obj, void *event);
@ -108,7 +107,6 @@ e_dialog_button_add(E_Dialog *dia, char *label, char *icon, void (*func) (void *
_e_dialog_cb_button_clicked, db);
edje_object_part_text_set(db->obj, "button_text", db->label);
evas_object_event_callback_add(db->obj, EVAS_CALLBACK_MOUSE_IN, _e_dialog_button_cb_mouse_in, dia);
evas_object_event_callback_add(db->obj, EVAS_CALLBACK_MOUSE_DOWN, _e_dialog_button_cb_mouse_down, db);
if (icon)
@ -120,7 +118,6 @@ e_dialog_button_add(E_Dialog *dia, char *label, char *icon, void (*func) (void *
edje_object_message_signal_process(db->obj);
evas_object_show(db->obj_icon);
}
edje_object_calc_force(db->obj);
edje_object_size_min_calc(db->obj, &mw, &mh);
e_box_pack_end(dia->box_object, db->obj);
e_box_pack_options_set(db->obj,
@ -301,12 +298,6 @@ _e_dialog_cb_button_clicked(void *data, Evas_Object *obj, const char *emission,
e_object_del(E_OBJECT(db->dialog));
}
static void
_e_dialog_button_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event)
{
edje_object_signal_emit(obj, "enter", "");
}
static void
_e_dialog_button_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event)
{

View File

@ -68,3 +68,5 @@
#include "e_widget_check.h"
#include "e_widget_radio.h"
#include "e_widget_framelist.h"
#include "e_widget_list.h"
#include "e_widget_button.h"

View File

@ -319,12 +319,17 @@ _e_test_internal(E_Container *con)
dia = e_dialog_new(con);
e_dialog_title_set(dia, "A Test Dialog");
{
Evas_Object *o;
Evas_Object *o, *ol, *hb;
Evas_Coord mw, mh;
E_Radio_Group *rg;
Evas *e;
e = e_win_evas_get(dia->win);
ol = e_widget_list_add(e, 0);
hb = e_widget_list_add(e, 1);
o = e_widget_framelist_add(e, "My Checklist", 0);
e_widget_framelist_object_append(o, e_widget_check_add(e, "Checkbox 1", &my_val));
@ -341,11 +346,26 @@ _e_test_internal(E_Container *con)
e_widget_framelist_object_append(o, e_widget_radio_add(e, "Rad 3", 3, rg));
e_widget_framelist_object_append(o, e_widget_radio_add(e, "Rad 4", 4, rg));
e_widget_min_size_get(o, &mw, &mh);
e_dialog_content_set(dia, o, mw, mh);
evas_object_show(o);
// e_theme_edje_object_set(o, "base/theme/dialog",
// "widgets/frame");
e_widget_list_object_append(hb, o, 1, 1, 0.5);
o = e_widget_framelist_add(e, "My Checklist on the right", 0);
rg = e_widget_radio_group_new(&my_rval);
e_widget_framelist_object_append(o, e_widget_radio_add(e, "Rad 0", 0, rg));
e_widget_framelist_object_append(o, e_widget_radio_add(e, "Rad 1", 1, rg));
e_widget_framelist_object_append(o, e_widget_radio_add(e, "Rad 2", 2, rg));
e_widget_framelist_object_append(o, e_widget_radio_add(e, "Rad 3", 3, rg));
e_widget_framelist_object_append(o, e_widget_radio_add(e, "Rad 4", 4, rg));
e_widget_list_object_append(hb, o, 0, 0, 0.0);
e_widget_list_object_append(ol, hb, 1, 1, 0.5);
o = e_widget_button_add(e, "Button", "enlightenment/exit", NULL, NULL, NULL);
e_widget_list_object_append(ol, o, 0, 0, 1.0);
e_widget_min_size_get(ol, &mw, &mh);
e_dialog_content_set(dia, ol, mw, mh);
}
e_dialog_button_add(dia, "OK", NULL, NULL, NULL);
e_dialog_button_add(dia, "Apply", "enlightenment/reset", NULL, NULL);

82
src/bin/e_widget_button.c Normal file
View File

@ -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);
}

12
src/bin/e_widget_button.h Normal file
View File

@ -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

View File

@ -33,6 +33,7 @@ e_widget_check_add(Evas *evas, char *label, int *val)
"widgets/check");
edje_object_signal_callback_add(o, "toggled", "*", _e_wid_signal_cb1, obj);
edje_object_part_text_set(o, "label", label);
evas_object_show(o);
edje_object_size_min_calc(o, &mw, &mh);
e_widget_min_size_set(obj, mw, mh);
if (wd->valptr)

View File

@ -10,7 +10,7 @@ struct _E_Widget_Data
};
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 */
@ -32,6 +32,7 @@ e_widget_framelist_add(Evas *evas, char *label, int horiz)
e_theme_edje_object_set(o, "base/theme/widgets",
"widgets/frame");
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);

79
src/bin/e_widget_list.c Normal file
View File

@ -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);
}

14
src/bin/e_widget_list.h Normal file
View File

@ -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

View File

@ -53,6 +53,7 @@ e_widget_radio_add(Evas *evas, char *label, int valnum, E_Radio_Group *group)
"widgets/radio");
edje_object_signal_callback_add(o, "toggled", "*", _e_wid_signal_cb1, obj);
edje_object_part_text_set(o, "label", label);
evas_object_show(o);
edje_object_size_min_calc(o, &mw, &mh);
e_widget_min_size_set(obj, mw, mh);
if ((wd->group) && (wd->group->valptr))