new widgety stuff


			
			
				devs/princeamd/enlightenment-0.17-elive
			
			
		
Carsten Haitzler 15 years ago
parent 407167eceb
commit 05fc729bf8
  1. 3
      data/themes/Makefile.am
  2. 1
      data/themes/default.edc
  3. 387
      data/themes/default_slidesel.edc
  4. 6
      src/bin/Makefile.am
  5. 2
      src/bin/e_includes.h
  6. 344
      src/bin/e_slidecore.c
  7. 15
      src/bin/e_slidecore.h
  8. 347
      src/bin/e_slidesel.c
  9. 15
      src/bin/e_slidesel.h
  10. 70
      src/bin/e_test.c

@ -61,7 +61,8 @@ default_sys.edc \
default_deskpreview.edc \
default_fontpreview.edc \
default_wizard.edc \
default_toolbar.edc
default_toolbar.edc \
default_slidesel.edc
default.edj: Makefile $(EXTRA_DIST)
$(EDJE_CC) $(EDJE_FLAGS) \

@ -85,4 +85,5 @@ collections {
#include "default_fontpreview.edc"
#include "default_wizard.edc"
#include "default_toolbar.edc"
#include "default_slidesel.edc"
}

@ -0,0 +1,387 @@
images {
image: "focus.png" COMP;
}
group {
name: "e/widgets/slidesel";
parts {
part {
name: "clipper";
type: RECT;
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
offset: 4 4;
}
rel2 {
to_y: "e.text.label";
relative: 1.0 0.0;
offset: -5 -5;
}
}
}
part {
name: "e.swallow.content";
clip_to: "clipper";
type: SWALLOW;
description {
state: "default" 0.0;
rel1.to: "clipper";
rel2.to: "clipper";
}
}
part {
name: "e.text.label";
type: TEXT;
effect: SOFT_SHADOW;
mouse_events: 0;
description {
state: "default" 0.0;
rel1 {
relative: 0.0 1.0;
offset: 4 -5;
}
rel2 {
relative: 1.0 1.0;
offset: -5 -5;
}
align: 0.0 1.0;
color: 255 255 255 255;
color3: 0 0 0 16;
text {
font: "Sans:style=Bold,Edje-Vera-Bold";
size: 10;
min: 0 1;
align: 0.0 1.0;
text_class: "slidesel_label";
}
}
}
part {
name: "focus";
mouse_events: 0;
description {
state: "default" 0.0;
visible: 0;
color: 255 255 255 0;
image {
normal: "focus.png";
border: 7 7 7 7;
middle: 0;
}
fill {
smooth: 0;
}
}
description {
state: "focused" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
}
}
}
programs {
program {
name: "focus_in";
signal: "e,state,focused";
source: "e";
action: STATE_SET "focused" 0.0;
transition: DECELERATE 0.2;
target: "focus";
}
program {
name: "focus_out";
signal: "e,state,unfocused";
source: "e";
action: STATE_SET "default" 0.0;
transition: ACCELERATE 0.5;
target: "focus";
}
program {
name: "disable";
signal: "e,state,disabled";
source: "e";
// action: STATE_SET "disabled" 0.0;
// target: "outline";
// target: "event";
// target: "e.text.label";
}
program {
name: "enable";
signal: "e,state,enabled";
source: "e";
// action: STATE_SET "default" 0.0;
// target: "outline";
// target: "event";
// target: "e.text.label";
}
}
}
group {
name: "e/widgets/radio_icon";
parts {
part {
name: "outline";
mouse_events: 0;
description {
state: "default" 0.0;
min: 16 16;
max: 16 16;
align: 0.0 0.5;
fixed: 1 1;
rel1 {
relative: 0.0 0.0;
offset: 2 2;
}
rel2 {
relative: 0.0 1.0;
offset: 2 -3;
}
image {
normal: "e17_menu_radio1.png";
}
}
description {
state: "disabled" 0.0;
inherit: "default" 0.0;
image {
normal: "e17_menu_radio0.png";
}
}
}
part {
name: "item1";
mouse_events: 0;
description {
state: "default" 0.0;
visible: 0;
rel1 {
to: "outline";
relative: 0.0 0.0;
offset: 0 0;
}
rel2 {
to: "outline";
relative: 1.0 1.0;
offset: -1 -1;
}
image {
normal: "e17_menu_radio2.png";
}
}
description {
state: "active" 0.0;
inherit: "default" 0.0;
visible: 1;
}
}
part {
name: "e.swallow.icon";
type: SWALLOW;
clip_to: "icon_clip";
description {
state: "default" 0.0;
min: 16 16;
rel1 {
to_x: "outline";
relative: 1.0 0.0;
offset: 2 2;
}
rel2 {
relative: 1.0 1.0;
offset: -2 -2;
}
}
description {
state: "label_visible" 0.0;
min: 16 16;
rel1 {
to_x: "outline";
relative: 1.0 0.0;
offset: 2 2;
}
rel2 {
to_y: "e.text.label";
relative: 1.0 0.0;
offset: -2 -2;
}
}
}
part {
name: "icon_clip";
type: RECT;
mouse_events: 0;
description {
state: "default" 0.0;
min: 16 16;
rel1 {
to: "e.swallow.icon";
}
rel2 {
to: "e.swallow.icon";
}
color: 255 255 255 255;
}
description {
state: "disabled" 0.0;
inherit: "default" 0.0;
color: 255 255 255 128;
}
}
part {
name: "label_clip";
type: RECT;
mouse_events: 0;
description {
state: "default" 0.0;
visible: 0;
}
description {
state: "label_visible" 0.0;
visible: 1;
}
}
part {
name: "e.text.label";
type: TEXT;
effect: SHADOW;
mouse_events: 0;
clip_to: "label_clip";
description {
state: "default" 0.0;
min: 16 16;
rel1 {
to_x: "outline";
relative: 1.0 1.0;
offset: 2 -2;
}
rel2 {
relative: 1.0 1.0;
offset: -2 -2;
}
color: 0 0 0 255;
color3: 255 255 255 128;
color_class: "radio_text";
text {
text: "";
font: "Edje-Vera";
size: 10;
min: 1 1;
align: 0.5 0.5;
text_class: "radio_button";
}
}
description {
state: "disabled" 0.0;
inherit: "default" 0.0;
color: 0 0 0 128;
color3: 255 255 255 64;
color_class: "radio_text_disabled";
}
}
part {
name: "event";
type: RECT;
description {
state: "default" 0.0;
color: 0 0 0 0;
}
description {
state: "disabled" 0.0;
inherit: "default" 0.0;
visible: 0;
}
}
part {
name: "focus";
mouse_events: 0;
description {
state: "default" 0.0;
visible: 0;
color: 255 255 255 0;
image {
normal: "focus.png";
border: 7 7 7 7;
middle: 0;
}
fill {
smooth: 0;
}
}
description {
state: "focused" 0.0;
inherit: "default" 0.0;
visible: 1;
color: 255 255 255 255;
}
}
}
programs {
program {
name: "label_on";
signal: "e,state,labeled";
source: "e";
action: STATE_SET "label_visible" 0.0;
target: "e.swallow.icon";
target: "label_clip";
}
program {
name: "turn_on1";
signal: "e,state,on";
source: "e";
action: STATE_SET "active" 0.0;
target: "item1";
}
program {
name: "turn_off1";
signal: "e,state,off";
source: "e";
action: STATE_SET "default" 0.0;
target: "item1";
}
program {
name: "click";
signal: "mouse,down,1";
source: "event";
action: SIGNAL_EMIT "e,action,toggle" "";
}
program {
name: "focus_in";
signal: "e,state,focused";
source: "e";
action: STATE_SET "focused" 0.0;
transition: DECELERATE 0.2;
target: "focus";
}
program {
name: "focus_out";
signal: "e,state,unfocused";
source: "e";
action: STATE_SET "default" 0.0;
transition: ACCELERATE 0.5;
target: "focus";
}
program {
name: "disable";
signal: "e,state,disabled";
source: "e";
action: STATE_SET "disabled" 0.0;
target: "outline";
target: "event";
target: "e.text.label";
target: "icon_clip";
}
program {
name: "enable";
signal: "e,state,enabled";
source: "e";
action: STATE_SET "default" 0.0;
target: "outline";
target: "event";
target: "e.text.label";
target: "icon_clip";
}
}
}

@ -159,7 +159,9 @@ e_config_data.h \
e_intl_data.h \
e_toolbar.h \
e_int_toolbar_config.h \
e_powersave.h
e_powersave.h \
e_slidesel.h \
e_slidecore.h
enlightenment_src = \
e_user.c \
@ -292,6 +294,8 @@ e_fm_custom.c \
e_toolbar.c \
e_int_toolbar_config.c \
e_powersave.c \
e_slidesel.c \
e_slidecore.c \
$(ENLIGHTENMENTHEADERS)
enlightenment_SOURCES = \

@ -132,3 +132,5 @@
#include "e_toolbar.h"
#include "e_int_toolbar_config.h"
#include "e_powersave.h"
#include "e_slidesel.h"
#include "e_slidecore.h"

@ -0,0 +1,344 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "e.h"
#define SMART_NAME "e_slidecore"
#define API_ENTRY E_Smart_Data *sd; sd = evas_object_smart_data_get(obj); if ((!obj) || (!sd) || (evas_object_type_get(obj) && strcmp(evas_object_type_get(obj), SMART_NAME)))
#define INTERNAL_ENTRY E_Smart_Data *sd; sd = evas_object_smart_data_get(obj); if (!sd) return;
typedef struct _E_Smart_Data E_Smart_Data;
typedef struct _E_Smart_Item E_Smart_Item;
struct _E_Smart_Data
{
Evas_Coord x, y, w, h;
Evas_Object *smart_obj;
Evas_Object *event_obj;
Evas_Object *o1, *o2;
Evas_List *items;
Evas_Coord dist, pos;
int p1, p2, pn;
unsigned char down : 1;
};
struct _E_Smart_Item
{
const char *label;
const char *icon;
void (*func) (void *data);
void *data;
};
/* local subsystem functions */
static void _e_smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_event_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_reconfigure(E_Smart_Data *sd);
static void _e_smart_add(Evas_Object *obj);
static void _e_smart_del(Evas_Object *obj);
static void _e_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
static void _e_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
static void _e_smart_show(Evas_Object *obj);
static void _e_smart_hide(Evas_Object *obj);
static void _e_smart_color_set(Evas_Object *obj, int r, int g, int b, int a);
static void _e_smart_clip_set(Evas_Object *obj, Evas_Object * clip);
static void _e_smart_clip_unset(Evas_Object *obj);
static void _e_smart_init(void);
/* local subsystem globals */
static Evas_Smart *_e_smart = NULL;
/* externally accessible functions */
EAPI Evas_Object *
e_slidecore_add(Evas *evas)
{
_e_smart_init();
return evas_object_smart_add(evas, _e_smart);
}
EAPI void
e_slidecore_item_distance_set(Evas_Object *obj, Evas_Coord dist)
{
API_ENTRY return;
if (dist < 1) dist = 1;
sd->dist = dist;
_e_smart_reconfigure(sd);
}
EAPI void
e_slidecore_item_add(Evas_Object *obj, const char *label, const char *icon, void (*func) (void *data), void *data)
{
E_Smart_Item *it;
API_ENTRY return;
it = calloc(1, sizeof(E_Smart_Item));
if (!it) return;
if (label) it->label = evas_stringshare_add(label);
if (icon) it->icon = evas_stringshare_add(icon);
it->func = func;
it->data = data;
sd->items = evas_list_append(sd->items, it);
_e_smart_reconfigure(sd);
}
EAPI void
e_slidecore_jump(Evas_Object *obj, int num)
{
API_ENTRY return;
_e_smart_reconfigure(sd);
}
/* local subsystem functions */
static void
_e_smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Down *ev;
E_Smart_Data *sd;
sd = data;
ev = event_info;
if (ev->button == 1) sd->down = 1;
}
static void
_e_smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Down *ev;
E_Smart_Data *sd;
sd = data;
ev = event_info;
if (ev->button == 1) sd->down = 0;
}
static void
_e_smart_event_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Move *ev;
E_Smart_Data *sd;
sd = data;
ev = event_info;
if (!sd->down) return;
sd->pos += ev->cur.canvas.x - ev->prev.canvas.x;
_e_smart_reconfigure(sd);
}
static void
_e_smart_reconfigure(E_Smart_Data *sd)
{
Evas_Coord dp, pos;
int p1, p2, at, pl1, pl2, n;
int r, g, b, a;
evas_object_move(sd->event_obj, sd->x, sd->y);
evas_object_resize(sd->event_obj, sd->w, sd->h);
pos = sd->pos;
n = evas_list_count(sd->items);
while (pos < 0) pos += (sd->dist * n);
p1 = pos / sd->dist;
p2 = (pos + sd->dist) / sd->dist;
dp = pos - (p1 * sd->dist);
at = (dp * 255) / (sd->dist - 1);
printf("? %i %i | %i : %i # %i\n", p1, p2, dp, at, pos);
while ((p1 < 0) || (p2 < 0))
{
p1 += n;
p2 += n;
at += 255;
dp += sd->dist;
}
printf("??? %i %i | %i : %i # %i\n", p1, p2, dp, at, pos);
if ((sd->p1 != p1) || (sd->p2 != p2) || (sd->pn != n))
{
E_Smart_Item *it1, *it2;
/* FIXME: delete old o1, o2, create new o1, o2 */
sd->pn = n;
if (n > 0)
{
sd->p1 = p1;
sd->p2 = p2;
if (sd->o1) evas_object_del(sd->o1);
if (sd->o2) evas_object_del(sd->o2);
sd->o1 = NULL;
sd->o2 = NULL;
pl1 = sd->p1 % n;
pl2 = sd->p2 % n;
printf("## %i -> %i | %i -> %i ||| %i\n", p1, pl1, p2, pl2, dp);
it1 = evas_list_nth(sd->items, pl1);
it2 = evas_list_nth(sd->items, pl2);
if (it1 && it2)
{
sd->o1 = e_util_icon_theme_icon_add(it1->icon, "480x480",
evas_object_evas_get(sd->smart_obj));
if (sd->o1)
{
evas_object_stack_below(sd->o1, sd->event_obj);
evas_object_pass_events_set(sd->o1, 1);
evas_object_smart_member_add(sd->o1, sd->smart_obj);
e_icon_fill_inside_set(sd->o1, 0);
evas_object_clip_set(sd->o1, evas_object_clip_get(sd->smart_obj));
evas_object_show(sd->o1);
}
sd->o2 = e_util_icon_theme_icon_add(it2->icon, "480x480",
evas_object_evas_get(sd->smart_obj));
if (sd->o2)
{
evas_object_stack_below(sd->o2, sd->event_obj);
evas_object_pass_events_set(sd->o2, 1);
evas_object_smart_member_add(sd->o2, sd->smart_obj);
e_icon_fill_inside_set(sd->o2, 0);
evas_object_clip_set(sd->o2, evas_object_clip_get(sd->smart_obj));
evas_object_show(sd->o2);
}
if (a < 128)
{
if (it1->func) it1->func(it1->data);
}
else
{
if (it2->func) it2->func(it2->data);
}
}
}
}
evas_object_color_get(sd->smart_obj, &r, &g, &b, &a);
evas_object_move(sd->o1, sd->x - sd->dist + dp, sd->y);
evas_object_resize(sd->o1, sd->w + sd->dist + sd->dist, sd->h);
evas_object_color_set(sd->o1, r, g, b, a);
evas_object_move(sd->o2, sd->x - sd->dist - sd->dist + dp, sd->y);
evas_object_resize(sd->o2, sd->w + sd->dist + sd->dist, sd->h);
evas_object_color_set(sd->o2, (r * at) / 255, (g * at) / 255, (b * at) / 255, (a * at) / 255);
}
static void
_e_smart_add(Evas_Object *obj)
{
E_Smart_Data *sd;
Evas_Object *o;
sd = calloc(1, sizeof(E_Smart_Data));
if (!sd) return;
evas_object_smart_data_set(obj, sd);
sd->smart_obj = obj;
sd->x = 0;
sd->y = 0;
sd->w = 0;
sd->h = 0;
evas_object_propagate_events_set(obj, 0);
sd->dist = 48;
sd->pos = 0;
sd->p1 = -1;
sd->p2 = -1;
o = evas_object_rectangle_add(evas_object_evas_get(obj));
sd->event_obj = o;
evas_object_color_set(o, 0, 0, 0, 0);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_smart_event_mouse_down, sd);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _e_smart_event_mouse_up, sd);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _e_smart_event_mouse_move, sd);
evas_object_smart_member_add(o, obj);
evas_object_repeat_events_set(o, 1);
}
static void
_e_smart_del(Evas_Object *obj)
{
INTERNAL_ENTRY;
evas_object_del(sd->event_obj);
free(sd);
}
static void
_e_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
{
INTERNAL_ENTRY;
sd->x = x;
sd->y = y;
_e_smart_reconfigure(sd);
}
static void
_e_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
{
INTERNAL_ENTRY;
sd->w = w;
sd->h = h;
_e_smart_reconfigure(sd);
}
static void
_e_smart_show(Evas_Object *obj)
{
INTERNAL_ENTRY;
evas_object_show(sd->event_obj);
}
static void
_e_smart_hide(Evas_Object *obj)
{
INTERNAL_ENTRY;
evas_object_hide(sd->event_obj);
}
static void
_e_smart_color_set(Evas_Object *obj, int r, int g, int b, int a)
{
INTERNAL_ENTRY;
if (sd->o1) evas_object_color_set(sd->o1, r, g, b, a);
if (sd->o2) evas_object_color_set(sd->o2, r, g, b, a);
}
static void
_e_smart_clip_set(Evas_Object *obj, Evas_Object * clip)
{
INTERNAL_ENTRY;
evas_object_clip_set(sd->event_obj, clip);
if (sd->o1) evas_object_clip_set(sd->o1, clip);
if (sd->o2) evas_object_clip_set(sd->o2, clip);
}
static void
_e_smart_clip_unset(Evas_Object *obj)
{
INTERNAL_ENTRY;
evas_object_clip_unset(sd->event_obj);
}
/* never need to touch this */
static void
_e_smart_init(void)
{
if (_e_smart) return;
{
static const Evas_Smart_Class sc =
{
SMART_NAME,
EVAS_SMART_CLASS_VERSION,
_e_smart_add,
_e_smart_del,
_e_smart_move,
_e_smart_resize,
_e_smart_show,
_e_smart_hide,
_e_smart_color_set,
_e_smart_clip_set,
_e_smart_clip_unset,
NULL
};
_e_smart = evas_smart_class_new(&sc);
}
}

@ -0,0 +1,15 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef E_TYPEDEFS
#else
#ifndef E_SLIDECORE_H
#define E_SLIDECORE_H
EAPI Evas_Object *e_slidecore_add (Evas *evas);
EAPI void e_slidecore_item_distance_set(Evas_Object *obj, Evas_Coord dist);
EAPI void e_slidecore_item_add (Evas_Object *obj, const char *label, const char *icon, void (*func) (void *data), void *data);
EAPI void e_slidecore_jump (Evas_Object *obj, int num);
#endif
#endif

@ -0,0 +1,347 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include "e.h"
#define SMART_NAME "e_slidesel"
#define API_ENTRY E_Smart_Data *sd; sd = evas_object_smart_data_get(obj); if ((!obj) || (!sd) || (evas_object_type_get(obj) && strcmp(evas_object_type_get(obj), SMART_NAME)))
#define INTERNAL_ENTRY E_Smart_Data *sd; sd = evas_object_smart_data_get(obj); if (!sd) return;
typedef struct _E_Smart_Data E_Smart_Data;
typedef struct _E_Smart_Item E_Smart_Item;
struct _E_Smart_Data
{
Evas_Coord x, y, w, h;
Evas_Object *smart_obj;
Evas_Object *edje_obj;
Evas_Object *event_obj;
Evas_Object *slide_obj;
Evas_List *items;
Evas_Coord down_x, down_y;
unsigned char down : 1;
};
struct _E_Smart_Item
{
E_Smart_Data *sd;
const char *label;
const char *icon;
void (*func) (void *data);
void *data;
};
/* local subsystem functions */
static void _e_smart_event_wheel(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_event_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_event_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info);
static void _e_smart_reconfigure(E_Smart_Data *sd);
static void _e_smart_add(Evas_Object *obj);
static void _e_smart_del(Evas_Object *obj);
static void _e_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
static void _e_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h);
static void _e_smart_show(Evas_Object *obj);
static void _e_smart_hide(Evas_Object *obj);
static void _e_smart_color_set(Evas_Object *obj, int r, int g, int b, int a);
static void _e_smart_clip_set(Evas_Object *obj, Evas_Object * clip);
static void _e_smart_clip_unset(Evas_Object *obj);
static void _e_smart_init(void);
/* local subsystem globals */
static Evas_Smart *_e_smart = NULL;
static void
_e_smart_label_change(void *data)
{
E_Smart_Item *it;
it = data;
edje_object_part_text_set(it->sd->edje_obj, "e.text.label", it->label);
}
/* externally accessible functions */
EAPI Evas_Object *
e_slidesel_add(Evas *evas)
{
_e_smart_init();
return evas_object_smart_add(evas, _e_smart);
}
EAPI void
e_slidesel_item_distance_set(Evas_Object *obj, Evas_Coord dist)
{
API_ENTRY return;
e_slidecore_item_distance_set(sd->slide_obj, dist);
}
EAPI void
e_slidesel_item_add(Evas_Object *obj, const char *label, const char *icon, void (*func) (void *data), void *data)
{
E_Smart_Item *it;
API_ENTRY return;
it = calloc(1, sizeof(E_Smart_Item));
if (!it) return;
it->sd = sd;
if (label) it->label = evas_stringshare_add(label);
if (icon) it->icon = evas_stringshare_add(icon);
it->func = func;
it->data = data;
sd->items = evas_list_append(sd->items, it);
e_slidecore_item_add(sd->slide_obj, label, icon, _e_smart_label_change, it);
}
EAPI void
e_slidesel_jump(Evas_Object *obj, int num)
{
API_ENTRY return;
e_slidecore_jump(sd->slide_obj, num);
}
/* local subsystem functions */
static void
_e_smart_event_wheel(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Wheel *ev;
E_Smart_Data *sd;
sd = data;
ev = event_info;
}
static void
_e_smart_event_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Down *ev;
E_Smart_Data *sd;
sd = data;
ev = event_info;
if (ev->button == 1)
{
sd->down = 1;
sd->down_x = ev->canvas.x;
sd->down_y = ev->canvas.y;
}
}
static void
_e_smart_event_mouse_up(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Down *ev;
E_Smart_Data *sd;
sd = data;
ev = event_info;
if (ev->button == 1)
{
Evas_Coord d1, d2, d;
d1 = ev->canvas.x - sd->down_x;
d2 = ev->canvas.y - sd->down_y;
d = (d1 * d1) + (d2 * d2);
if (d < (16 * 16))
{
if (!(ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD))
{
printf("RUN!!!!\n");
/* FIXME: call current item callback */
}
}
sd->down = 0;
}
}
static void
_e_smart_event_mouse_move(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Mouse_Move *ev;
E_Smart_Data *sd;
sd = data;
ev = event_info;
}
static void
_e_smart_event_key_down(void *data, Evas *e, Evas_Object *obj, void *event_info)
{
Evas_Event_Key_Down *ev;
E_Smart_Data *sd;
sd = data;
ev = event_info;
/*
if (!strcmp(ev->keyname, "Left"))
x -= sd->step.x;
else if (!strcmp(ev->keyname, "Right"))
x += sd->step.x;
else if (!strcmp(ev->keyname, "Up"))
y -= sd->step.y;
else if (!strcmp(ev->keyname, "Home"))
y = 0;
else if (!strcmp(ev->keyname, "End"))
y = my;
else if (!strcmp(ev->keyname, "Down"))
y += sd->step.y;
else if (!strcmp(ev->keyname, "Prior"))
{
if (sd->page.y < 0)
y -= -(sd->page.y * vh) / 100;
else
y -= sd->page.y;
}
else if (!strcmp(ev->keyname, "Next"))
{
if (sd->page.y < 0)
y += -(sd->page.y * vh) / 100;
else
y += sd->page.y;
}
*/
}
static void
_e_smart_reconfigure(E_Smart_Data *sd)
{
evas_object_move(sd->edje_obj, sd->x, sd->y);
evas_object_resize(sd->edje_obj, sd->w, sd->h);
evas_object_move(sd->event_obj, sd->x, sd->y);
evas_object_resize(sd->event_obj, sd->w, sd->h);
}
static void
_e_smart_add(Evas_Object *obj)
{
E_Smart_Data *sd;
Evas_Object *o;
sd = calloc(1, sizeof(E_Smart_Data));
if (!sd) return;
evas_object_smart_data_set(obj, sd);
sd->smart_obj = obj;
sd->x = 0;
sd->y = 0;
sd->w = 0;
sd->h = 0;
evas_object_event_callback_add(obj, EVAS_CALLBACK_KEY_DOWN, _e_smart_event_key_down, sd);
evas_object_propagate_events_set(obj, 0);
o = edje_object_add(evas_object_evas_get(obj));
sd->edje_obj = o;
e_theme_edje_object_set(o, "base/theme/widgets",
"e/widgets/slidesel");
evas_object_smart_member_add(o, obj);
o = e_slidecore_add(evas_object_evas_get(obj));
sd->slide_obj = o;
edje_object_part_swallow(sd->edje_obj, "e.swallow.content", o);
evas_object_show(o);
o = evas_object_rectangle_add(evas_object_evas_get(obj));
sd->event_obj = o;
evas_object_color_set(o, 0, 0, 0, 0);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_WHEEL, _e_smart_event_wheel, sd);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_smart_event_mouse_down, sd);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_UP, _e_smart_event_mouse_up, sd);
evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_MOVE, _e_smart_event_mouse_move, sd);
evas_object_smart_member_add(o, obj);
evas_object_repeat_events_set(o, 1);
}
static void
_e_smart_del(Evas_Object *obj)
{
INTERNAL_ENTRY;
evas_object_del(sd->slide_obj);
evas_object_del(sd->edje_obj);
evas_object_del(sd->event_obj);
free(sd);
}
static void
_e_smart_move(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
{
INTERNAL_ENTRY;
sd->x = x;
sd->y = y;
_e_smart_reconfigure(sd);
}
static void
_e_smart_resize(Evas_Object *obj, Evas_Coord w, Evas_Coord h)
{
INTERNAL_ENTRY;
sd->w = w;
sd->h = h;
_e_smart_reconfigure(sd);
}
static void
_e_smart_show(Evas_Object *obj)
{
INTERNAL_ENTRY;
evas_object_show(sd->edje_obj);
evas_object_show(sd->event_obj);
}
static void
_e_smart_hide(Evas_Object *obj)
{
INTERNAL_ENTRY;
evas_object_hide(sd->edje_obj);
evas_object_hide(sd->event_obj);
}
static void
_e_smart_color_set(Evas_Object *obj, int r, int g, int b, int a)
{
INTERNAL_ENTRY;
evas_object_color_set(sd->edje_obj, r, g, b, a);
}
static void
_e_smart_clip_set(Evas_Object *obj, Evas_Object * clip)
{
INTERNAL_ENTRY;
evas_object_clip_set(sd->edje_obj, clip);
evas_object_clip_set(sd->event_obj, clip);
}
static void
_e_smart_clip_unset(Evas_Object *obj)
{
INTERNAL_ENTRY;
evas_object_clip_unset(sd->edje_obj);
evas_object_clip_unset(sd->event_obj);
}
/* never need to touch this */
static void
_e_smart_init(void)
{
if (_e_smart) return;
{
static const Evas_Smart_Class sc =
{
SMART_NAME,
EVAS_SMART_CLASS_VERSION,
_e_smart_add,
_e_smart_del,
_e_smart_move,
_e_smart_resize,
_e_smart_show,
_e_smart_hide,
_e_smart_color_set,
_e_smart_clip_set,
_e_smart_clip_unset,
NULL
};
_e_smart = evas_smart_class_new(&sc);
}
}

@ -0,0 +1,15 @@
/*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef E_TYPEDEFS
#else
#ifndef E_SLIDESEL_H
#define E_SLIDESEL_H
EAPI Evas_Object *e_slidesel_add (Evas *evas);
EAPI void e_slidesel_item_distance_set (Evas_Object *obj, Evas_Coord dist);
EAPI void e_slidesel_item_add (Evas_Object *obj, const char *label, const char *icon, void (*func) (void *data), void *data);
EAPI void e_slidesel_jump (Evas_Object *obj, int num);
#endif
#endif

@ -669,6 +669,76 @@ _e_test_internal(E_Container *con)
e_color_dialog_select_callback_set(d, _e_test_cb_ok, NULL);
}
#elif 0
static void
_e_test_internal(E_Container *con)
{
E_Dialog *dia;
Evas_Object *o, *ob, *of;
Evas_Coord mw, mh;
int i;
dia = e_dialog_new(con, "E", "_test");
e_dialog_title_set(dia, "A Test Dialog");
of = e_scrollframe_add(dia->win->evas);
ob = e_box_add(dia->win->evas);
e_box_orientation_set(ob, 0);
for (i = 0; i < 8; i++)
{
o = e_slidesel_add(dia->win->evas);
e_slidesel_item_distance_set(o, 64);
e_slidesel_item_add(o, "blah / item 1",
"/home/raster/pix/OLD/Download/Crystalline____a.jpg",
NULL, NULL);
e_slidesel_item_add(o, "blah / smelly fish",
"/home/raster/pix/OLD/Download/Reluctant_Sunrise.jpg",
NULL, NULL);
e_slidesel_item_add(o, "blah / pong",
"/home/raster/pix/OLD/Download/Soft_Wings.jpg",
NULL, NULL);
e_slidesel_item_add(o, "blah / on a stick",
"/home/raster/pix/OLD/Download/Stock_rose_1.jpg",
NULL, NULL);
e_slidesel_item_add(o, "blah / oath",
"/home/raster/pix/OLD/Download/The_Eyes_Of_A_Killer.jpg",
NULL, NULL);
e_slidesel_item_add(o, "blah / yiiihaaaaa",
"/home/raster/pix/OLD/Download/lady_bug.jpg",
NULL, NULL);
e_slidesel_item_add(o, "blah / blah blah blah",
"/home/raster/pix/OLD/Download/ocean_rocks_covered_by_ash.jpg",
NULL, NULL);
e_slidesel_item_add(o, "blah / bing bing bing",
"/home/raster/pix/OLD/Download/orange_chair_heaven_falling.jpg",
NULL, NULL);
e_box_pack_end(ob, o);
e_box_pack_options_set(o, 1, 1, 1, 0, 0.5, 0.5, 300, 100, 300, 100);
evas_object_show(o);
}
/* fixme... more */
e_box_min_size_get(ob, &mw, &mh);
evas_object_resize(ob, mw, mh);
e_scrollframe_child_set(of, ob);
evas_object_show(ob);
// e_widget_min_size_get(o, &mw, &mh);
mw = 300; mh = 300;
e_dialog_content_set(dia, of, mw, mh);
evas_object_show(of);
/* buttons at the bottom */
e_dialog_button_add(dia, "OK", NULL, NULL, NULL);
e_dialog_resizable_set(dia, 1);
e_win_centered_set(dia->win, 1);
e_dialog_show(dia);
e_win_resize(dia->win, 400, 400);
}
#else
static void
_e_test_internal(E_Container *con)

Loading…
Cancel
Save