and now i have a simple check and radio liust infrastructure to use to build


			
			
				devs/princeamd/enlightenment-0.17-elive
			
			
		
Carsten Haitzler 18 years ago
parent 9a6d41e4bd
commit aa1529d411
  1. 3
      data/themes/default_check.edc
  2. 1
      data/themes/default_frame.edc
  3. 32
      data/themes/default_radio.edc
  4. 6
      src/bin/Makefile.am
  5. 2
      src/bin/e_includes.h
  6. 24
      src/bin/e_test.c
  7. 2
      src/bin/e_widget_check.c
  8. 2
      src/bin/e_widget_check.h
  9. 85
      src/bin/e_widget_framelist.c
  10. 14
      src/bin/e_widget_framelist.h
  11. 116
      src/bin/e_widget_radio.c
  12. 15
      src/bin/e_widget_radio.h

@ -60,10 +60,11 @@ group {
mouse_events: 0;
description {
state: "default" 0.0;
min: 16 16;
rel1 {
to_x: "outline";
relative: 1.0 0.0;
offset: 2 4;
offset: 4 4;
}
rel2 {
relative: 1.0 1.0;

@ -81,6 +81,7 @@ group {
description {
state: "default" 0.0;
align: 0.0 0.0;
fixed: 1 1;
rel1 {
relative: 0.0 0.0;
offset: 16 6;

@ -16,11 +16,11 @@ group {
fixed: 1 1;
rel1 {
relative: 0.0 0.0;
offset: 1 1;
offset: 4 4;
}
rel2 {
relative: 1.0 1.0;
offset: -2 -2;
relative: 0.0 1.0;
offset: 4 -5;
}
image {
normal: "e17_menu_radio1.png";
@ -60,14 +60,15 @@ group {
mouse_events: 0;
description {
state: "default" 0.0;
min: 16 16;
rel1 {
to_x: "outline";
relative: 1.0 0.0;
offset: 1 1;
offset: 4 4;
}
rel2 {
relative: 1.0 1.0;
offset: -1 -2;
offset: -5 -5;
}
color: 0 0 0 255;
color3: 255 255 255 128;
@ -108,20 +109,13 @@ group {
name: "click";
signal: "mouse,down,1";
source: "event";
script {
new buf[100];
new Float:val;
get_state(PART:"item1", buf, sizeof(buf), val);
if (!strcmp(buf, "default")) {
set_state(PART:"item1", "active", 0.0);
emit("toggled", "on");
}
else {
set_state(PART:"item1", "default", 0.0);
emit("toggled", "off");
}
}
action: STATE_SET "active" 0.0;
target: "item1";
after: "click2";
}
program {
name: "click2";
action: SIGNAL_EMIT "toggled" "on";
}
}
}

@ -84,7 +84,9 @@ e_fileman.h \
e_scrollbar.h \
e_fileman_smart.h \
e_widget.h \
e_widget_check.h
e_widget_check.h \
e_widget_radio.h \
e_widget_framelist.h
enlightenment_src = \
e_user.c \
@ -151,6 +153,8 @@ e_scrollbar.c \
e_fileman_smart.c \
e_widget.c \
e_widget_check.c \
e_widget_radio.c \
e_widget_framelist.c \
$(ENLIGHTENMENTHEADERS)
enlightenment_SOURCES = \

@ -66,3 +66,5 @@
#include "e_fileman_smart.h"
#include "e_widget.h"
#include "e_widget_check.h"
#include "e_widget_radio.h"
#include "e_widget_framelist.h"

@ -309,6 +309,7 @@ _e_test_internal(E_Container *con)
}
#elif 0
static int my_val = 0;
static int my_rval = 1;
static void
_e_test_internal(E_Container *con)
@ -320,12 +321,29 @@ _e_test_internal(E_Container *con)
{
Evas_Object *o;
Evas_Coord mw, mh;
E_Radio_Group *rg;
Evas *e;
e = e_win_evas_get(dia->win);
o = e_widget_framelist_add(e, "My Checklist", 0);
e_widget_framelist_object_append(o, e_widget_check_add(e, "Checkbox 1", &my_val));
e_widget_framelist_object_append(o, e_widget_check_add(e, "Checkbox 2", &my_val));
e_widget_framelist_object_append(o, e_widget_check_add(e, "Checkbox 3", &my_val));
e_widget_framelist_object_append(o, e_widget_check_add(e, "Checkbox and some long text", &my_val));
e_widget_framelist_object_append(o, e_widget_check_add(e, "Checkbox 7", &my_val));
e_widget_framelist_object_append(o, e_widget_check_add(e, "Koneko", &my_val));
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));
o = e_widget_checkbox_add(e_win_evas_get(dia->win),
"My checkbox widget which on toggles is modifying my_val",
&my_val);
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");
}

@ -15,7 +15,7 @@ static void _e_wid_signal_cb1(void *data, Evas_Object *obj, const char *emission
/* externally accessible functions */
Evas_Object *
e_widget_checkbox_add(Evas *evas, char *label, int *val)
e_widget_check_add(Evas *evas, char *label, int *val)
{
Evas_Object *obj, *o;
E_Widget_Data *wd;

@ -6,7 +6,7 @@
#ifndef E_WIDGET_CHECK_H
#define E_WIDGET_CHECK_H
EAPI Evas_Object *e_widget_checkbox_add(Evas *evas, char *label, int *val);
EAPI Evas_Object *e_widget_check_add(Evas *evas, char *label, int *val);
#endif
#endif

@ -0,0 +1,85 @@
/*
* 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_frame, *o_box;
};
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_framelist_add(Evas *evas, char *label, int horiz)
{
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));
e_widget_data_set(obj, wd);
o = edje_object_add(evas);
wd->o_frame = o;
e_theme_edje_object_set(o, "base/theme/widgets",
"widgets/frame");
edje_object_part_text_set(o, "label", label);
e_widget_sub_object_add(obj, o);
e_widget_resize_object_set(obj, o);
o = e_box_add(evas);
wd->o_box = o;
e_box_orientation_set(o, horiz);
e_box_homogenous_set(o, 0);
edje_object_part_swallow(o, "items", wd->o_box);
e_widget_sub_object_add(obj, o);
evas_object_show(o);
edje_object_size_min_calc(wd->o_frame, &mw, &mh);
e_widget_min_size_set(obj, mw, mh);
return obj;
}
void
e_widget_framelist_object_append(Evas_Object *obj, Evas_Object *sobj)
{
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);
e_box_pack_options_set(sobj,
1, 1, /* fill */
1, 0, /* expand */
0.5, 0.5, /* align */
mw, mh, /* min */
99999, 99999 /* max */
);
e_box_min_size_get(wd->o_box, &mw, &mh);
edje_extern_object_min_size_set(wd->o_box, mw, mh);
edje_object_part_swallow(wd->o_frame, "items", wd->o_box);
edje_object_size_min_calc(wd->o_frame, &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_FRAMELIST_H
#define E_WIDGET_FRAMELIST_H
EAPI Evas_Object *e_widget_framelist_add(Evas *evas, char *label, int horiz);
EAPI void e_widget_framelist_object_append(Evas_Object *obj, Evas_Object *sobj);
#endif
#endif

@ -0,0 +1,116 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "e.h"
struct _E_Radio_Group
{
int *valptr;
Evas_List *radios;
};
typedef struct _E_Widget_Data E_Widget_Data;
struct _E_Widget_Data
{
E_Radio_Group *group;
Evas_Object *o_radio;
int valnum;
};
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 */
E_Radio_Group *
e_widget_radio_group_new(int *val)
{
E_Radio_Group *group;
group = calloc(1, sizeof(E_Radio_Group));
group->valptr = val;
return group;
}
Evas_Object *
e_widget_radio_add(Evas *evas, char *label, int valnum, E_Radio_Group *group)
{
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->group = group;
wd->valnum = valnum;
e_widget_data_set(obj, wd);
o = edje_object_add(evas);
wd->o_radio = o;
e_theme_edje_object_set(o, "base/theme/widgets",
"widgets/radio");
edje_object_signal_callback_add(o, "toggled", "*", _e_wid_signal_cb1, obj);
edje_object_part_text_set(o, "label", label);
edje_object_size_min_calc(o, &mw, &mh);
e_widget_min_size_set(obj, mw, mh);
if ((wd->group) && (wd->group->valptr))
{
if (*(wd->group->valptr) == valnum) edje_object_signal_emit(o, "toggle_on", "");
}
if (wd->group)
{
wd->group->radios = evas_list_append(wd->group->radios, obj);
}
e_widget_sub_object_add(obj, o);
e_widget_resize_object_set(obj, o);
return obj;
}
static void
_e_wid_del_hook(Evas_Object *obj)
{
E_Widget_Data *wd;
wd = e_widget_data_get(obj);
if (wd->group)
{
wd->group->radios = evas_list_remove(wd->group->radios, obj);
if (!wd->group->radios) free(wd->group);
}
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->group) && (wd->group->valptr))
{
Evas_List *l;
int toggled = 0;
for (l = wd->group->radios; l; l = l->next)
{
wd = e_widget_data_get(l->data);
if (l->data != data)
{
wd = e_widget_data_get(l->data);
if (wd->valnum == *(wd->group->valptr))
{
edje_object_signal_emit(wd->o_radio, "toggle_off", "");
toggled = 1;
break;
}
}
}
if (!toggled) return;
wd = e_widget_data_get(data);
if (!strcmp(source, "on")) *(wd->group->valptr) = wd->valnum;
}
}

@ -0,0 +1,15 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef E_TYPEDEFS
#else
#ifndef E_WIDGET_RADIO_H
#define E_WIDGET_RADIO_H
typedef struct _E_Radio_Group E_Radio_Group;
EAPI E_Radio_Group *e_widget_radio_group_new(int *val);
EAPI Evas_Object *e_widget_radio_add(Evas *evas, char *label, int valnum, E_Radio_Group *group);
#endif
#endif
Loading…
Cancel
Save