2009-12-01 23:22:35 -08:00
|
|
|
#include <Elementary.h>
|
|
|
|
#include "elm_priv.h"
|
|
|
|
|
|
|
|
typedef struct _Widget_Data Widget_Data;
|
2011-05-25 03:20:49 -07:00
|
|
|
typedef struct _Slice Slice;
|
|
|
|
typedef struct _Vertex2 Vertex2;
|
|
|
|
typedef struct _Vertex3 Vertex3;
|
|
|
|
|
|
|
|
struct _Slice
|
|
|
|
{
|
|
|
|
Evas_Object *obj;
|
|
|
|
double u[4], v[4], x[4], y[4], z[4];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _Vertex2
|
|
|
|
{
|
|
|
|
double x, y;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _Vertex3
|
|
|
|
{
|
|
|
|
double x, y, z;
|
|
|
|
};
|
2009-12-01 23:22:35 -08:00
|
|
|
|
|
|
|
struct _Widget_Data
|
|
|
|
{
|
2011-05-24 23:06:48 -07:00
|
|
|
Evas_Object *obj;
|
2009-12-11 00:12:58 -08:00
|
|
|
Ecore_Animator *animator;
|
|
|
|
double start, len;
|
|
|
|
Elm_Flip_Mode mode;
|
2010-09-02 03:25:05 -07:00
|
|
|
Evas_Object *clip;
|
2011-05-24 23:06:48 -07:00
|
|
|
Evas_Object *event[4];
|
2009-12-01 23:22:35 -08:00
|
|
|
struct {
|
2011-05-24 23:06:48 -07:00
|
|
|
Evas_Object *content, *clip;
|
2009-12-01 23:22:35 -08:00
|
|
|
} front, back;
|
2011-05-24 23:06:48 -07:00
|
|
|
Ecore_Job *job;
|
|
|
|
Evas_Coord down_x, down_y, x, y, ox, oy, w, h;
|
|
|
|
Elm_Flip_Interaction intmode;
|
|
|
|
int dir;
|
2011-05-25 03:20:49 -07:00
|
|
|
double dir_hitsize[4];
|
2011-05-24 23:06:48 -07:00
|
|
|
Eina_Bool dir_enabled[4];
|
2011-05-25 03:20:49 -07:00
|
|
|
int slices_w, slices_h;
|
|
|
|
Slice **slices, **slices2;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2009-12-11 00:12:58 -08:00
|
|
|
Eina_Bool state : 1;
|
2011-05-24 23:06:48 -07:00
|
|
|
Eina_Bool down : 1;
|
|
|
|
Eina_Bool finish : 1;
|
|
|
|
Eina_Bool started : 1;
|
2011-05-25 03:20:49 -07:00
|
|
|
Eina_Bool backflip : 1;
|
|
|
|
Eina_Bool pageflip : 1;
|
2009-12-01 23:22:35 -08:00
|
|
|
};
|
|
|
|
|
2010-03-08 22:15:39 -08:00
|
|
|
static const char *widtype = NULL;
|
2009-12-01 23:22:35 -08:00
|
|
|
static void _del_hook(Evas_Object *obj);
|
|
|
|
static void _theme_hook(Evas_Object *obj);
|
|
|
|
static void _sizing_eval(Evas_Object *obj);
|
|
|
|
static void _changed_size_hints(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
|
|
|
static void _sub_del(void *data, Evas_Object *obj, void *event_info);
|
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
static void _state_slices_clear(Widget_Data *st);
|
2010-01-26 00:17:26 -08:00
|
|
|
static void _configure(Evas_Object *obj);
|
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
static const char SIG_ANIMATE_BEGIN[] = "animate,begin";
|
2011-04-03 09:26:25 -07:00
|
|
|
static const char SIG_ANIMATE_DONE[] = "animate,done";
|
|
|
|
|
|
|
|
static const Evas_Smart_Cb_Description _signals[] = {
|
2011-05-25 03:20:49 -07:00
|
|
|
{SIG_ANIMATE_BEGIN, ""},
|
2011-04-03 09:26:25 -07:00
|
|
|
{SIG_ANIMATE_DONE, ""},
|
|
|
|
{NULL, NULL}
|
|
|
|
};
|
|
|
|
|
2009-12-01 23:22:35 -08:00
|
|
|
static void
|
|
|
|
_del_hook(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 08:46:13 -08:00
|
|
|
if (!wd) return;
|
2009-12-11 00:12:58 -08:00
|
|
|
if (wd->animator) ecore_animator_del(wd->animator);
|
2011-05-25 03:20:49 -07:00
|
|
|
_state_slices_clear(wd);
|
2009-12-01 23:22:35 -08:00
|
|
|
free(wd);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_theme_hook(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 08:46:13 -08:00
|
|
|
if (!wd) return;
|
2009-12-01 23:22:35 -08:00
|
|
|
_sizing_eval(obj);
|
|
|
|
}
|
|
|
|
|
2010-10-01 12:03:02 -07:00
|
|
|
static Eina_Bool
|
2010-10-06 13:24:19 -07:00
|
|
|
_elm_flip_focus_next_hook(const Evas_Object *obj, Elm_Focus_Direction dir, Evas_Object **next)
|
2010-10-01 12:03:02 -07:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
|
|
|
|
if (!wd)
|
|
|
|
return EINA_FALSE;
|
|
|
|
|
|
|
|
/* Try Focus cycle in subitem */
|
|
|
|
if (wd->state)
|
2010-10-06 13:24:13 -07:00
|
|
|
return elm_widget_focus_next_get(wd->front.content, dir, next);
|
2010-10-01 12:03:02 -07:00
|
|
|
else
|
2010-10-06 13:24:13 -07:00
|
|
|
return elm_widget_focus_next_get(wd->back.content, dir, next);
|
2010-10-01 12:03:02 -07:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-12-01 23:22:35 -08:00
|
|
|
static void
|
|
|
|
_sizing_eval(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
Evas_Coord minw = -1, minh = -1, minw2 = -1, minh2 = -1;
|
|
|
|
Evas_Coord maxw = -1, maxh = -1, maxw2 = -1, maxh2 = -1;
|
2011-05-24 23:06:48 -07:00
|
|
|
int fingx = 0, fingy = 0;
|
2010-03-09 08:46:13 -08:00
|
|
|
if (!wd) return;
|
2009-12-01 23:22:35 -08:00
|
|
|
if (wd->front.content)
|
|
|
|
evas_object_size_hint_min_get(wd->front.content, &minw, &minh);
|
|
|
|
if (wd->back.content)
|
|
|
|
evas_object_size_hint_min_get(wd->back.content, &minw2, &minh2);
|
|
|
|
if (wd->front.content)
|
|
|
|
evas_object_size_hint_max_get(wd->front.content, &maxw, &maxh);
|
|
|
|
if (wd->back.content)
|
|
|
|
evas_object_size_hint_max_get(wd->back.content, &maxw2, &maxh2);
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2009-12-01 23:22:35 -08:00
|
|
|
if (minw2 > minw) minw = minw2;
|
|
|
|
if (minh2 > minh) minh = minh2;
|
|
|
|
if ((maxw2 >= 0) && (maxw2 < maxw)) maxw = maxw2;
|
|
|
|
if ((maxh2 >= 0) && (maxh2 < maxh)) maxh = maxh2;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
if (wd->dir_enabled[0]) fingy++;
|
|
|
|
if (wd->dir_enabled[1]) fingy++;
|
|
|
|
if (wd->dir_enabled[2]) fingx++;
|
|
|
|
if (wd->dir_enabled[3]) fingx++;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
elm_coords_finger_size_adjust(fingx, &minw, fingy, &minh);
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2009-12-01 23:22:35 -08:00
|
|
|
evas_object_size_hint_min_set(obj, minw, minh);
|
|
|
|
evas_object_size_hint_max_set(obj, maxw, maxh);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
|
2009-12-01 23:22:35 -08:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(data);
|
2010-03-09 08:46:13 -08:00
|
|
|
if (!wd) return;
|
2009-12-01 23:22:35 -08:00
|
|
|
_sizing_eval(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_sub_del(void *data __UNUSED__, Evas_Object *obj, void *event_info)
|
2009-12-01 23:22:35 -08:00
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
Evas_Object *sub = event_info;
|
2010-03-09 08:46:13 -08:00
|
|
|
if (!wd) return;
|
2009-12-01 23:22:35 -08:00
|
|
|
if (sub == wd->front.content)
|
|
|
|
{
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
2009-12-01 23:22:35 -08:00
|
|
|
_changed_size_hints, obj);
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
wd->front.content = NULL;
|
2010-03-08 20:00:08 -08:00
|
|
|
evas_object_hide(wd->front.clip);
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
_sizing_eval(obj);
|
2009-12-01 23:22:35 -08:00
|
|
|
}
|
|
|
|
else if (sub == wd->back.content)
|
|
|
|
{
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
evas_object_event_callback_del_full(sub, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
2009-12-01 23:22:35 -08:00
|
|
|
_changed_size_hints, obj);
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
wd->back.content = NULL;
|
2010-03-08 20:00:08 -08:00
|
|
|
evas_object_hide(wd->back.clip);
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
_sizing_eval(obj);
|
2009-12-01 23:22:35 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
static Slice *
|
|
|
|
_slice_new(Widget_Data *st __UNUSED__, Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Slice *sl;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
sl = calloc(1, sizeof(Slice));
|
|
|
|
if (!sl) return NULL;
|
|
|
|
sl->obj = evas_object_image_add(evas_object_evas_get(obj));
|
|
|
|
elm_widget_sub_object_add(st->obj, sl->obj);
|
|
|
|
evas_object_clip_set(sl->obj, evas_object_clip_get(st->obj));
|
|
|
|
evas_object_smart_member_add(sl->obj, st->obj);
|
|
|
|
evas_object_image_smooth_scale_set(sl->obj, 0);
|
|
|
|
evas_object_pass_events_set(sl->obj, 1);
|
|
|
|
evas_object_image_source_set(sl->obj, obj);
|
|
|
|
return sl;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_slice_free(Slice *sl)
|
|
|
|
{
|
|
|
|
evas_object_del(sl->obj);
|
|
|
|
free(sl);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_slice_apply(Widget_Data *st, Slice *sl,
|
|
|
|
Evas_Coord x __UNUSED__, Evas_Coord y __UNUSED__, Evas_Coord w, Evas_Coord h __UNUSED__,
|
|
|
|
Evas_Coord ox, Evas_Coord oy, Evas_Coord ow, Evas_Coord oh)
|
|
|
|
{
|
|
|
|
Evas_Map *m;
|
|
|
|
int i;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
m = evas_map_new(4);
|
|
|
|
if (!m) return;
|
|
|
|
evas_map_smooth_set(m, 0);
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
evas_map_point_color_set(m, i, 255, 255, 255, 255);
|
|
|
|
if (st->dir == 0)
|
|
|
|
{
|
|
|
|
int p[4] = { 0, 1, 2, 3 };
|
|
|
|
evas_map_point_coord_set(m, i, ox + sl->x[p[i]], oy + sl->y[p[i]], sl->z[p[i]]);
|
|
|
|
evas_map_point_image_uv_set(m, i, sl->u[p[i]] , sl->v[p[i]]);
|
|
|
|
}
|
|
|
|
else if (st->dir == 1)
|
|
|
|
{
|
|
|
|
int p[4] = { 1, 0, 3, 2 };
|
|
|
|
evas_map_point_coord_set(m, i, ox + (w - sl->x[p[i]]), oy + sl->y[p[i]], sl->z[p[i]]);
|
|
|
|
evas_map_point_image_uv_set(m, i, ow - sl->u[p[i]] , sl->v[p[i]]);
|
|
|
|
}
|
|
|
|
else if (st->dir == 2)
|
|
|
|
{
|
|
|
|
int p[4] = { 1, 0, 3, 2 };
|
|
|
|
evas_map_point_coord_set(m, i, ox + sl->y[p[i]], oy + sl->x[p[i]], sl->z[p[i]]);
|
|
|
|
evas_map_point_image_uv_set(m, i, sl->v[p[i]] , sl->u[p[i]]);
|
|
|
|
}
|
2011-08-05 19:34:27 -07:00
|
|
|
else/* if (st->dir == 3) will be this anyway */
|
2011-05-25 03:20:49 -07:00
|
|
|
{
|
|
|
|
int p[4] = { 0, 1, 2, 3 };
|
|
|
|
evas_map_point_coord_set(m, i, ox + sl->y[p[i]], oy + (w - sl->x[p[i]]), sl->z[p[i]]);
|
|
|
|
evas_map_point_image_uv_set(m, i, sl->v[p[i]] , oh - sl->u[p[i]]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
evas_object_map_enable_set(sl->obj, EINA_TRUE);
|
|
|
|
evas_object_image_fill_set(sl->obj, 0, 0, ow, oh);
|
|
|
|
evas_object_map_set(sl->obj, m);
|
|
|
|
evas_map_free(m);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_slice_3d(Widget_Data *st __UNUSED__, Slice *sl, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
|
|
|
|
{
|
|
|
|
Evas_Map *m = (Evas_Map *)evas_object_map_get(sl->obj);
|
|
|
|
int i;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
if (!m) return;
|
|
|
|
// vanishing point is center of page, and focal dist is 1024
|
|
|
|
evas_map_util_3d_perspective(m, x + (w / 2), y + (h / 2), 0, 1024);
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
Evas_Coord x, y, z;
|
|
|
|
evas_map_point_coord_get(m, i, &x, &y, &z);
|
|
|
|
evas_map_point_coord_set(m, i, x, y, 0);
|
|
|
|
}
|
|
|
|
if (evas_map_util_clockwise_get(m)) evas_object_show(sl->obj);
|
|
|
|
else evas_object_hide(sl->obj);
|
|
|
|
evas_object_map_set(sl->obj, m);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_slice_light(Widget_Data *st __UNUSED__, Slice *sl, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h)
|
|
|
|
{
|
|
|
|
Evas_Map *m = (Evas_Map *)evas_object_map_get(sl->obj);
|
|
|
|
int i;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
if (!m) return;
|
|
|
|
evas_map_util_3d_lighting(m,
|
|
|
|
// light position
|
|
|
|
// (centered over page 10 * h toward camera)
|
|
|
|
x + (w / 2) , y + (h / 2) , -10000,
|
|
|
|
255, 255, 255, // light color
|
|
|
|
0 , 0 , 0); // ambient minimum
|
|
|
|
// multiply brightness by 1.2 to make lightish bits all white so we dont
|
|
|
|
// add shading where we could otherwise be pure white
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
int r, g, b, a;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
evas_map_point_color_get(m, i, &r, &g, &b, &a);
|
|
|
|
r = (double)r * 1.2; if (r > 255) r = 255;
|
|
|
|
g = (double)g * 1.2; if (g > 255) g = 255;
|
|
|
|
b = (double)b * 1.2; if (b > 255) b = 255;
|
|
|
|
evas_map_point_color_set(m, i, r, g, b, a);
|
|
|
|
}
|
|
|
|
evas_object_map_set(sl->obj, m);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_slice_xyz(Widget_Data *st __UNUSED__, Slice *sl,
|
|
|
|
double x1, double y1, double z1,
|
|
|
|
double x2, double y2, double z2,
|
|
|
|
double x3, double y3, double z3,
|
|
|
|
double x4, double y4, double z4)
|
|
|
|
{
|
|
|
|
sl->x[0] = x1; sl->y[0] = y1; sl->z[0] = z1;
|
|
|
|
sl->x[1] = x2; sl->y[1] = y2; sl->z[1] = z2;
|
|
|
|
sl->x[2] = x3; sl->y[2] = y3; sl->z[2] = z3;
|
|
|
|
sl->x[3] = x4; sl->y[3] = y4; sl->z[3] = z4;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_slice_uv(Widget_Data *st __UNUSED__, Slice *sl,
|
|
|
|
double u1, double v1,
|
|
|
|
double u2, double v2,
|
|
|
|
double u3, double v3,
|
|
|
|
double u4, double v4)
|
|
|
|
{
|
|
|
|
sl->u[0] = u1; sl->v[0] = v1;
|
|
|
|
sl->u[1] = u2; sl->v[1] = v2;
|
|
|
|
sl->u[2] = u3; sl->v[2] = v3;
|
|
|
|
sl->u[3] = u4; sl->v[3] = v4;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_deform_point(Vertex2 *vi, Vertex3 *vo, double rho, double theta, double A)
|
|
|
|
{
|
|
|
|
// ^Y
|
|
|
|
// |
|
|
|
|
// | X
|
|
|
|
// +---->
|
|
|
|
// theta == cone angle (0 -> PI/2)
|
|
|
|
// A == distance of cone apex from origin
|
|
|
|
// rho == angle of cone from vertical axis (...-PI/2 to PI/2...)
|
|
|
|
Vertex3 v1;
|
|
|
|
double d, r, b;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
d = sqrt((vi->x * vi->x) + pow(vi->y - A, 2));
|
|
|
|
r = d * sin(theta);
|
|
|
|
b = asin(vi->x / d) / sin(theta);
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
v1.x = r * sin(b);
|
|
|
|
v1.y = d + A - (r * (1 - cos(b)) * sin(theta));
|
|
|
|
v1.z = r * (1 - cos(b)) * cos(theta);
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
vo->x = (v1.x * cos(rho)) - (v1.z * sin(rho));
|
|
|
|
vo->y = v1.y;
|
|
|
|
vo->z = (v1.x * sin(rho)) + (v1.z * cos(rho));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_interp_point(Vertex3 *vi1, Vertex3 *vi2, Vertex3 *vo, double v)
|
|
|
|
{
|
|
|
|
vo->x = (v * vi2->x) + ((1.0 - v) * vi1->x);
|
|
|
|
vo->y = (v * vi2->y) + ((1.0 - v) * vi1->y);
|
|
|
|
vo->z = (v * vi2->z) + ((1.0 - v) * vi1->z);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_state_slices_clear(Widget_Data *st)
|
|
|
|
{
|
|
|
|
int i, j, num;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
if (st->slices)
|
|
|
|
{
|
|
|
|
num = 0;
|
|
|
|
for (j = 0; j < st->slices_h; j++)
|
|
|
|
{
|
|
|
|
for (i = 0; i < st->slices_w; i++)
|
|
|
|
{
|
|
|
|
if (st->slices[num]) _slice_free(st->slices[num]);
|
|
|
|
if (st->slices2[num]) _slice_free(st->slices2[num]);
|
|
|
|
num++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(st->slices);
|
|
|
|
free(st->slices2);
|
|
|
|
st->slices = NULL;
|
|
|
|
st->slices2 = NULL;
|
|
|
|
}
|
|
|
|
st->slices_w = 0;
|
|
|
|
st->slices_h = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_slice_obj_color_sum(Slice *s, int p, int *r, int *g, int *b, int *a)
|
|
|
|
{
|
|
|
|
Evas_Map *m;
|
|
|
|
int rr = 0, gg = 0, bb = 0, aa = 0;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
if (!s) return 0;
|
|
|
|
m = (Evas_Map *)evas_object_map_get(s->obj);
|
|
|
|
if (!m) return 0;
|
|
|
|
evas_map_point_color_get(m, p, &rr, &gg, &bb, &aa);
|
|
|
|
*r += rr; *g += gg; *b += bb; *a += aa;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_slice_obj_color_set(Slice *s, int p, int r, int g, int b, int a)
|
|
|
|
{
|
|
|
|
Evas_Map *m;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
if (!s) return;
|
|
|
|
m = (Evas_Map *)evas_object_map_get(s->obj);
|
|
|
|
if (!m) return;
|
|
|
|
evas_map_point_color_set(m, p, r, g, b, a);
|
|
|
|
evas_object_map_set(s->obj, m);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_slice_obj_vert_color_merge(Slice *s1, int p1, Slice *s2, int p2,
|
|
|
|
Slice *s3, int p3, Slice *s4, int p4)
|
|
|
|
{
|
|
|
|
int r = 0, g = 0, b = 0, a = 0, n = 0;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
n += _slice_obj_color_sum(s1, p1, &r, &g, &b, &a);
|
|
|
|
n += _slice_obj_color_sum(s2, p2, &r, &g, &b, &a);
|
|
|
|
n += _slice_obj_color_sum(s3, p3, &r, &g, &b, &a);
|
|
|
|
n += _slice_obj_color_sum(s4, p4, &r, &g, &b, &a);
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
if (n < 1) return;
|
|
|
|
r /= n; g /= n; b /= n; a /= n;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
_slice_obj_color_set(s1, p1, r, g, b, a);
|
|
|
|
_slice_obj_color_set(s2, p2, r, g, b, a);
|
|
|
|
_slice_obj_color_set(s3, p3, r, g, b, a);
|
|
|
|
_slice_obj_color_set(s4, p4, r, g, b, a);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_state_update(Widget_Data *st)
|
|
|
|
{
|
|
|
|
Evas_Coord x1, y1, x2, y2, mx, my;
|
|
|
|
Evas_Coord x, y, w, h, ox, oy, ow, oh;
|
|
|
|
int i, j, num, nn, jump, num2;
|
|
|
|
Slice *sl;
|
|
|
|
double b, minv = 0.0, minva, mgrad;
|
|
|
|
int gx, gy, gszw, gszh, gw, gh, col, row, nw, nh;
|
|
|
|
double rho, A, theta, perc, percm, n, rhol, Al, thetal;
|
|
|
|
Vertex3 *tvo, *tvol;
|
|
|
|
Evas_Object *front, *back;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
st->backflip = 1;
|
|
|
|
if (st->state)
|
|
|
|
{
|
|
|
|
front = st->front.content;
|
|
|
|
back = st->front.content;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
front = st->back.content;
|
|
|
|
back = st->back.content;
|
|
|
|
}
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
evas_object_geometry_get(st->obj, &x, &y, &w, &h);
|
|
|
|
ox = x; oy = y; ow = w; oh = h;
|
|
|
|
x1 = st->down_x;
|
|
|
|
y1 = st->down_y;
|
|
|
|
x2 = st->x;
|
|
|
|
y2 = st->y;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
if (st->dir == 0)
|
|
|
|
{
|
|
|
|
// no nothing. left drag is standard
|
|
|
|
}
|
|
|
|
else if (st->dir == 1)
|
|
|
|
{
|
|
|
|
x1 = (w - 1) - x1;
|
|
|
|
x2 = (w - 1) - x2;
|
|
|
|
}
|
|
|
|
else if (st->dir == 2)
|
|
|
|
{
|
|
|
|
Evas_Coord tmp;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
tmp = x1; x1 = y1; y1 = tmp;
|
|
|
|
tmp = x2; x2 = y2; y2 = tmp;
|
|
|
|
tmp = w; w = h; h = tmp;
|
|
|
|
}
|
2011-08-05 19:34:27 -07:00
|
|
|
else/* if (st->dir == 3) will be this anyway */
|
2011-05-25 03:20:49 -07:00
|
|
|
{
|
|
|
|
Evas_Coord tmp;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
tmp = x1; x1 = y1; y1 = tmp;
|
|
|
|
tmp = x2; x2 = y2; y2 = tmp;
|
|
|
|
tmp = w; w = h; h = tmp;
|
|
|
|
x1 = (w - 1) - x1;
|
|
|
|
x2 = (w - 1) - x2;
|
|
|
|
}
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
if (x2 >= x1) x2 = x1 - 1;
|
|
|
|
mx = (x1 + x2) / 2;
|
|
|
|
my = (y1 + y2) / 2;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
if (mx < 0) mx = 0;
|
|
|
|
else if (mx >= w) mx = w - 1;
|
|
|
|
if (my < 0) my = 0;
|
|
|
|
else if (my >= h) my = h - 1;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
mgrad = (double)(y1 - y2) / (double)(x1 - x2);
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
if (mx < 1) mx = 1; // quick hack to keep curl line visible
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
if (mgrad == 0.0) // special horizontal case
|
|
|
|
mgrad = 0.001; // quick dirty hack for now
|
|
|
|
// else
|
|
|
|
{
|
|
|
|
minv = 1.0 / mgrad;
|
|
|
|
// y = (m * x) + b
|
|
|
|
b = my + (minv * mx);
|
|
|
|
}
|
|
|
|
if ((b >= -5) && (b <= (h + 5)))
|
|
|
|
{
|
|
|
|
if (minv > 0.0) // clamp to h
|
|
|
|
{
|
|
|
|
minv = (double)(h + 5 - my) / (double)(mx);
|
|
|
|
b = my + (minv * mx);
|
|
|
|
}
|
|
|
|
else // clamp to 0
|
|
|
|
{
|
|
|
|
minv = (double)(-5 - my) / (double)(mx);
|
|
|
|
b = my + (minv * mx);
|
|
|
|
}
|
|
|
|
}
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
perc = (double)x2 / (double)x1;
|
|
|
|
percm = (double)mx / (double)x1;
|
|
|
|
if (perc < 0.0) perc = 0.0;
|
|
|
|
else if (perc > 1.0) perc = 1.0;
|
|
|
|
if (percm < 0.0) percm = 0.0;
|
|
|
|
else if (percm > 1.0) percm = 1.0;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
minva = atan(minv) / (M_PI / 2);
|
|
|
|
if (minva < 0.0) minva = -minva;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
// A = apex of cone
|
|
|
|
if (b <= 0) A = b;
|
|
|
|
else A = h - b;
|
|
|
|
if (A < -(h * 20)) A = -h * 20;
|
|
|
|
//--//
|
|
|
|
Al = -5;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
// rho = is how much the page is turned
|
|
|
|
n = 1.0 - perc;
|
|
|
|
n = 1.0 - cos(n * M_PI / 2.0);
|
|
|
|
n = n * n;
|
|
|
|
rho = -(n * M_PI);
|
|
|
|
//--//
|
|
|
|
rhol = -(n * M_PI);
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
// theta == curliness (how much page culrs in on itself
|
|
|
|
n = sin((1.0 - perc) * M_PI);
|
|
|
|
n = n * 1.2;
|
|
|
|
theta = 7.86 + n;
|
|
|
|
//--//
|
|
|
|
n = sin((1.0 - perc) * M_PI);
|
|
|
|
n = 1.0 - n;
|
|
|
|
n = n * n;
|
|
|
|
n = 1.0 - n;
|
|
|
|
thetal = 7.86 + n;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
nw = 16;
|
|
|
|
nh = 16;
|
|
|
|
gszw = w / nw;
|
|
|
|
gszh = h / nh;
|
|
|
|
if (gszw < 4) gszw = 4;
|
|
|
|
if (gszh < 4) gszh = 4;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
nw = (w + gszw - 1) / gszw;
|
|
|
|
nh = (h + gszh - 1) / gszh;
|
|
|
|
if ((st->slices_w != nw) || (st->slices_h != nh)) _state_slices_clear(st);
|
|
|
|
st->slices_w = nw;
|
|
|
|
st->slices_h = nh;
|
|
|
|
if (!st->slices)
|
|
|
|
{
|
|
|
|
st->slices = calloc(st->slices_w * st->slices_h, sizeof(Slice *));
|
|
|
|
if (!st->slices) return 0;
|
|
|
|
st->slices2 = calloc(st->slices_w * st->slices_h, sizeof(Slice *));
|
|
|
|
if (!st->slices2)
|
|
|
|
{
|
|
|
|
free(st->slices);
|
|
|
|
st->slices = NULL;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
num = (st->slices_w + 1) * (st->slices_h + 1);
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
tvo = alloca(sizeof(Vertex3) * num);
|
|
|
|
tvol = alloca(sizeof(Vertex3) * (st->slices_w + 1));
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
for (col = 0, gx = 0; gx <= (w + gszw - 1); gx += gszw, col++)
|
|
|
|
{
|
|
|
|
Vertex2 vil;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
vil.x = gx;
|
|
|
|
vil.y = h - ((gx * h) / (w + gszw - 1));
|
|
|
|
_deform_point(&vil, &(tvol[col]), rhol, thetal, Al);
|
|
|
|
}
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
n = minva * sin(perc * M_PI);
|
|
|
|
n = n * n;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
num = 0;
|
|
|
|
for (col = 0, gx = 0; gx <= (w + gszw - 1); gx += gszw, col++)
|
|
|
|
{
|
|
|
|
for (gy = 0; gy <= (h + gszh - 1); gy += gszh)
|
|
|
|
{
|
|
|
|
Vertex2 vi;
|
|
|
|
Vertex3 vo, tvo1;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
if (gx > w) vi.x = w;
|
|
|
|
else vi.x = gx;
|
|
|
|
if (gy > h) vi.y = h;
|
|
|
|
else vi.y = gy;
|
|
|
|
_deform_point(&vi, &vo, rho, theta, A);
|
|
|
|
tvo1 = tvol[col];
|
|
|
|
if (gy > h) tvo1.y = h;
|
|
|
|
else tvo1.y = gy;
|
|
|
|
_interp_point(&vo, &tvo1, &(tvo[num]), n);
|
|
|
|
num++;
|
|
|
|
}
|
|
|
|
}
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
jump = st->slices_h + 1;
|
|
|
|
for (col = 0, gx = 0; gx < w; gx += gszw, col++)
|
|
|
|
{
|
|
|
|
num = st->slices_h * col;
|
|
|
|
num2 = jump * col;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
gw = gszw;
|
|
|
|
if ((gx + gw) > w) gw = w - gx;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
for (row = 0, gy = 0; gy < h; gy += gszh, row++)
|
|
|
|
{
|
|
|
|
Vertex3 vo[4];
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
if (b > 0) nn = num + st->slices_h - row - 1;
|
|
|
|
else nn = num + row;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
gh = gszh;
|
|
|
|
if ((gy + gh) > h) gh = h - gy;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
vo[0] = tvo[num2 + row];
|
|
|
|
vo[1] = tvo[num2 + row + jump];
|
|
|
|
vo[2] = tvo[num2 + row + jump + 1];
|
|
|
|
vo[3] = tvo[num2 + row + 1];
|
|
|
|
#define SWP(a, b) do {typeof(a) vt; vt = (a); (a) = (b); (b) = vt;} while (0)
|
|
|
|
if (b > 0)
|
|
|
|
{
|
|
|
|
SWP(vo[0], vo[3]);
|
|
|
|
SWP(vo[1], vo[2]);
|
|
|
|
vo[0].y = h - vo[0].y;
|
|
|
|
vo[1].y = h - vo[1].y;
|
|
|
|
vo[2].y = h - vo[2].y;
|
|
|
|
vo[3].y = h - vo[3].y;
|
|
|
|
}
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
// FRONT
|
|
|
|
sl = st->slices[nn];
|
|
|
|
if (!sl)
|
|
|
|
{
|
|
|
|
sl = _slice_new(st, front);
|
|
|
|
st->slices[nn] = sl;
|
|
|
|
}
|
|
|
|
_slice_xyz(st, sl,
|
|
|
|
vo[0].x, vo[0].y, vo[0].z,
|
|
|
|
vo[1].x, vo[1].y, vo[1].z,
|
|
|
|
vo[2].x, vo[2].y, vo[2].z,
|
|
|
|
vo[3].x, vo[3].y, vo[3].z);
|
|
|
|
if (b <= 0)
|
|
|
|
_slice_uv(st, sl,
|
|
|
|
gx, gy, gx + gw, gy,
|
|
|
|
gx + gw, gy + gh, gx, gy + gh);
|
|
|
|
else
|
|
|
|
_slice_uv(st, sl,
|
|
|
|
gx, h - (gy + gh), gx + gw, h - (gy + gh),
|
|
|
|
gx + gw, h - gy, gx, h - gy);
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
// BACK
|
|
|
|
sl = st->slices2[nn];
|
|
|
|
if (!sl)
|
|
|
|
{
|
|
|
|
sl = _slice_new(st, back);
|
|
|
|
st->slices2[nn] = sl;
|
|
|
|
}
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
_slice_xyz(st, sl,
|
|
|
|
vo[1].x, vo[1].y, vo[1].z,
|
|
|
|
vo[0].x, vo[0].y, vo[0].z,
|
|
|
|
vo[3].x, vo[3].y, vo[3].z,
|
|
|
|
vo[2].x, vo[2].y, vo[2].z);
|
|
|
|
if (st->backflip)
|
|
|
|
{
|
|
|
|
if (b <= 0)
|
|
|
|
_slice_uv(st, sl,
|
|
|
|
gx + gw, gy, gx, gy,
|
|
|
|
gx, gy + gh, gx + gw, gy + gh);
|
|
|
|
else
|
|
|
|
_slice_uv(st, sl,
|
|
|
|
gx + gw, h - (gy + gh), gx, h - (gy + gh),
|
|
|
|
gx, h - gy, gx + gw, h - gy);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (b <= 0)
|
|
|
|
_slice_uv(st, sl,
|
|
|
|
w - (gx + gw), gy, w - (gx), gy,
|
|
|
|
w - (gx), gy + gh, w - (gx + gw), gy + gh);
|
|
|
|
else
|
|
|
|
_slice_uv(st, sl,
|
|
|
|
w - (gx + gw), h - (gy + gh), w - (gx), h - (gy + gh),
|
|
|
|
w - (gx), h - gy, w - (gx + gw), h - gy);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
num = 0;
|
|
|
|
for (j = 0; j < st->slices_h; j++)
|
|
|
|
{
|
|
|
|
for (i = 0; i < st->slices_w; i++)
|
|
|
|
{
|
|
|
|
_slice_apply(st, st->slices[num], x, y, w, h, ox, oy, ow, oh);
|
|
|
|
_slice_apply(st, st->slices2[num], x, y, w, h, ox, oy, ow, oh);
|
|
|
|
_slice_light(st, st->slices[num], ox, oy, ow, oh);
|
|
|
|
_slice_light(st, st->slices2[num], ox, oy, ow, oh);
|
|
|
|
num++;
|
|
|
|
}
|
|
|
|
}
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
for (i = 0; i <= st->slices_w; i++)
|
|
|
|
{
|
|
|
|
num = i * st->slices_h;
|
|
|
|
for (j = 0; j <= st->slices_h; j++)
|
|
|
|
{
|
|
|
|
Slice *s[4];
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
s[0] = s[1] = s[2] = s[3] = NULL;
|
|
|
|
if ((i > 0) && (j > 0))
|
|
|
|
s[0] = st->slices[num - 1 - st->slices_h];
|
|
|
|
if ((i < st->slices_w) && (j > 0))
|
|
|
|
s[1] = st->slices[num - 1];
|
|
|
|
if ((i > 0) && (j < st->slices_h))
|
|
|
|
s[2] = st->slices[num - st->slices_h];
|
|
|
|
if ((i < st->slices_w) && (j < st->slices_h))
|
|
|
|
s[3] = st->slices[num];
|
|
|
|
if (st->dir == 0)
|
|
|
|
_slice_obj_vert_color_merge(s[0], 2, s[1], 3,
|
|
|
|
s[2], 1, s[3], 0);
|
|
|
|
else if (st->dir == 1)
|
|
|
|
_slice_obj_vert_color_merge(s[0], 3, s[1], 2,
|
|
|
|
s[2], 0, s[3], 1);
|
|
|
|
else if (st->dir == 2)
|
|
|
|
_slice_obj_vert_color_merge(s[0], 3, s[1], 2,
|
|
|
|
s[2], 0, s[3], 1);
|
2011-08-05 19:34:27 -07:00
|
|
|
else/* if (st->dir == 3) will be this anyway */
|
2011-05-25 03:20:49 -07:00
|
|
|
_slice_obj_vert_color_merge(s[0], 2, s[1], 3,
|
|
|
|
s[2], 1, s[3], 0);
|
|
|
|
s[0] = s[1] = s[2] = s[3] = NULL;
|
|
|
|
if ((i > 0) && (j > 0))
|
|
|
|
s[0] = st->slices2[num - 1 - st->slices_h];
|
|
|
|
if ((i < st->slices_w) && (j > 0))
|
|
|
|
s[1] = st->slices2[num - 1];
|
|
|
|
if ((i > 0) && (j < st->slices_h))
|
|
|
|
s[2] = st->slices2[num - st->slices_h];
|
|
|
|
if ((i < st->slices_w) && (j < st->slices_h))
|
|
|
|
s[3] = st->slices2[num];
|
|
|
|
if (st->dir == 0)
|
|
|
|
_slice_obj_vert_color_merge(s[0], 3, s[1], 2,
|
|
|
|
s[2], 0, s[3], 1);
|
|
|
|
else if (st->dir == 1)
|
|
|
|
_slice_obj_vert_color_merge(s[0], 2, s[1], 3,
|
|
|
|
s[2], 1, s[3], 0);
|
|
|
|
else if (st->dir == 2)
|
|
|
|
_slice_obj_vert_color_merge(s[0], 2, s[1], 3,
|
|
|
|
s[2], 1, s[3], 0);
|
2011-08-05 19:34:27 -07:00
|
|
|
else/* if (st->dir == 3) will be this anyway */
|
2011-05-25 03:20:49 -07:00
|
|
|
_slice_obj_vert_color_merge(s[0], 3, s[1], 2,
|
|
|
|
s[2], 0, s[3], 1);
|
|
|
|
num++;
|
|
|
|
}
|
|
|
|
}
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
num = 0;
|
|
|
|
for (i = 0; i < st->slices_w; i++)
|
|
|
|
{
|
|
|
|
for (j = 0; j < st->slices_h; j++)
|
|
|
|
{
|
|
|
|
_slice_3d(st, st->slices[num], ox, oy, ow, oh);
|
|
|
|
_slice_3d(st, st->slices2[num], ox, oy, ow, oh);
|
|
|
|
num++;
|
|
|
|
}
|
|
|
|
}
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_state_end(Widget_Data *st)
|
|
|
|
{
|
|
|
|
_state_slices_clear(st);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-09-02 02:58:52 -07:00
|
|
|
static void
|
|
|
|
flip_show_hide(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (elm_flip_front_get(obj))
|
|
|
|
{
|
2011-05-25 03:20:49 -07:00
|
|
|
if (wd->pageflip)
|
|
|
|
{
|
|
|
|
if (wd->front.content)
|
|
|
|
{
|
|
|
|
evas_object_move(wd->front.content, 4999, 4999);
|
|
|
|
evas_object_show(wd->front.clip);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
evas_object_hide(wd->front.clip);
|
|
|
|
if (wd->back.content)
|
|
|
|
evas_object_show(wd->back.clip);
|
|
|
|
else
|
|
|
|
evas_object_hide(wd->back.clip);
|
|
|
|
}
|
2010-09-02 02:58:52 -07:00
|
|
|
else
|
2011-05-25 03:20:49 -07:00
|
|
|
{
|
|
|
|
if (wd->front.content)
|
|
|
|
evas_object_show(wd->front.clip);
|
|
|
|
else
|
|
|
|
evas_object_hide(wd->front.clip);
|
|
|
|
if (wd->back.content)
|
|
|
|
evas_object_hide(wd->back.clip);
|
|
|
|
else
|
|
|
|
evas_object_hide(wd->back.clip);
|
|
|
|
}
|
2010-09-02 02:58:52 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-05-25 03:20:49 -07:00
|
|
|
if (wd->pageflip)
|
|
|
|
{
|
|
|
|
if (wd->front.content)
|
|
|
|
evas_object_show(wd->front.clip);
|
|
|
|
else
|
|
|
|
evas_object_hide(wd->front.clip);
|
|
|
|
if (wd->back.content)
|
|
|
|
{
|
|
|
|
evas_object_move(wd->back.content, 4999, 4999);
|
|
|
|
evas_object_show(wd->back.clip);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
evas_object_hide(wd->back.clip);
|
|
|
|
}
|
2010-09-02 02:58:52 -07:00
|
|
|
else
|
2011-05-25 03:20:49 -07:00
|
|
|
{
|
|
|
|
if (wd->front.content)
|
|
|
|
evas_object_hide(wd->front.clip);
|
|
|
|
else
|
|
|
|
evas_object_hide(wd->front.clip);
|
|
|
|
if (wd->back.content)
|
|
|
|
evas_object_show(wd->back.clip);
|
|
|
|
else
|
|
|
|
evas_object_hide(wd->back.clip);
|
|
|
|
}
|
2010-09-02 02:58:52 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
static void
|
|
|
|
_flip_do(Evas_Object *obj, double t, Elm_Flip_Mode mode, int lin, int rev)
|
2009-12-11 00:12:58 -08:00
|
|
|
{
|
|
|
|
Evas_Coord x, y, w, h;
|
2011-05-24 23:06:48 -07:00
|
|
|
double p, deg, pp;
|
2009-12-11 00:12:58 -08:00
|
|
|
Evas_Map *mf, *mb;
|
2010-03-09 08:46:13 -08:00
|
|
|
Evas_Coord cx, cy, px, py, foc;
|
2009-12-11 00:12:58 -08:00
|
|
|
int lx, ly, lz, lr, lg, lb, lar, lag, lab;
|
2011-05-24 23:06:48 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
if (!wd) return;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2009-12-11 00:12:58 -08:00
|
|
|
mf = evas_map_new(4);
|
|
|
|
evas_map_smooth_set(mf, 0);
|
|
|
|
mb = evas_map_new(4);
|
|
|
|
evas_map_smooth_set(mb, 0);
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2009-12-11 00:12:58 -08:00
|
|
|
if (wd->front.content)
|
2010-09-25 05:41:06 -07:00
|
|
|
{
|
2011-05-24 23:06:48 -07:00
|
|
|
const char *type = evas_object_type_get(wd->front.content);
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
// FIXME: only handles filled obj
|
|
|
|
if ((type) && (!strcmp(type, "image")))
|
|
|
|
{
|
|
|
|
int iw, ih;
|
|
|
|
evas_object_image_size_get(wd->front.content, &iw, &ih);
|
|
|
|
evas_object_geometry_get(wd->front.content, &x, &y, &w, &h);
|
|
|
|
evas_map_util_points_populate_from_geometry(mf, x, y, w, h, 0);
|
|
|
|
evas_map_point_image_uv_set(mf, 0, 0, 0);
|
|
|
|
evas_map_point_image_uv_set(mf, 1, iw, 0);
|
|
|
|
evas_map_point_image_uv_set(mf, 2, iw, ih);
|
|
|
|
evas_map_point_image_uv_set(mf, 3, 0, ih);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_geometry_get(wd->front.content, &x, &y, &w, &h);
|
|
|
|
evas_map_util_points_populate_from_geometry(mf, x, y, w, h, 0);
|
|
|
|
}
|
2010-09-25 05:41:06 -07:00
|
|
|
}
|
2009-12-11 00:12:58 -08:00
|
|
|
if (wd->back.content)
|
2010-09-25 05:41:06 -07:00
|
|
|
{
|
2011-05-24 23:06:48 -07:00
|
|
|
const char *type = evas_object_type_get(wd->back.content);
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
if ((type) && (!strcmp(type, "image")))
|
|
|
|
{
|
|
|
|
int iw, ih;
|
|
|
|
evas_object_image_size_get(wd->back.content, &iw, &ih);
|
|
|
|
evas_object_geometry_get(wd->back.content, &x, &y, &w, &h);
|
|
|
|
evas_map_util_points_populate_from_geometry(mb, x, y, w, h, 0);
|
|
|
|
evas_map_point_image_uv_set(mb, 0, 0, 0);
|
|
|
|
evas_map_point_image_uv_set(mb, 1, iw, 0);
|
|
|
|
evas_map_point_image_uv_set(mb, 2, iw, ih);
|
|
|
|
evas_map_point_image_uv_set(mb, 3, 0, ih);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_object_geometry_get(wd->back.content, &x, &y, &w, &h);
|
|
|
|
evas_map_util_points_populate_from_geometry(mb, x, y, w, h, 0);
|
|
|
|
}
|
2010-09-25 05:41:06 -07:00
|
|
|
}
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2010-09-25 05:41:06 -07:00
|
|
|
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2009-12-11 00:12:58 -08:00
|
|
|
cx = x + (w / 2);
|
|
|
|
cy = y + (h / 2);
|
|
|
|
|
|
|
|
px = x + (w / 2);
|
|
|
|
py = y + (h / 2);
|
|
|
|
foc = 2048;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2009-12-11 00:12:58 -08:00
|
|
|
lx = cx;
|
|
|
|
ly = cy;
|
|
|
|
lz = -10000;
|
|
|
|
lr = 255;
|
|
|
|
lg = 255;
|
|
|
|
lb = 255;
|
|
|
|
lar = 0;
|
|
|
|
lag = 0;
|
|
|
|
lab = 0;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
switch (mode)
|
2009-12-11 00:12:58 -08:00
|
|
|
{
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
case ELM_FLIP_ROTATE_Y_CENTER_AXIS:
|
|
|
|
p = 1.0 - t;
|
2011-05-24 23:06:48 -07:00
|
|
|
pp = p;
|
|
|
|
if (!lin) pp = (p * p);
|
|
|
|
p = 1.0 - pp;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
if (wd->state) deg = 180.0 * p;
|
|
|
|
else deg = 180 + (180.0 * p);
|
2011-05-24 23:06:48 -07:00
|
|
|
if (rev) deg = -deg;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
evas_map_util_3d_rotate(mf, 0.0, deg, 0.0, cx, cy, 0);
|
2011-05-24 23:06:48 -07:00
|
|
|
evas_map_util_3d_rotate(mb, 0.0, 180 + deg, 0.0, cx, cy, 0);
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
break;
|
|
|
|
case ELM_FLIP_ROTATE_X_CENTER_AXIS:
|
|
|
|
p = 1.0 - t;
|
2011-05-24 23:06:48 -07:00
|
|
|
pp = p;
|
|
|
|
if (!lin) pp = (p * p);
|
|
|
|
p = 1.0 - pp;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
if (wd->state) deg = 180.0 * p;
|
|
|
|
else deg = 180 + (180.0 * p);
|
2011-05-24 23:06:48 -07:00
|
|
|
if (rev) deg = -deg;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
evas_map_util_3d_rotate(mf, deg, 0.0, 0.0, cx, cy, 0);
|
2011-05-24 23:06:48 -07:00
|
|
|
evas_map_util_3d_rotate(mb, 180.0 + deg, 0.0, 0.0, cx, cy, 0);
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
break;
|
|
|
|
case ELM_FLIP_ROTATE_XZ_CENTER_AXIS:
|
|
|
|
p = 1.0 - t;
|
2011-05-24 23:06:48 -07:00
|
|
|
pp = p;
|
|
|
|
if (!lin) pp = (p * p);
|
|
|
|
p = 1.0 - pp;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
if (wd->state) deg = 180.0 * p;
|
|
|
|
else deg = 180 + (180.0 * p);
|
2011-05-24 23:06:48 -07:00
|
|
|
if (rev) deg = -deg;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
evas_map_util_3d_rotate(mf, deg, 0.0, deg, cx, cy, 0);
|
2011-05-24 23:06:48 -07:00
|
|
|
evas_map_util_3d_rotate(mb, 180 + deg, 0.0, 180 + deg, cx, cy, 0);
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
break;
|
|
|
|
case ELM_FLIP_ROTATE_YZ_CENTER_AXIS:
|
|
|
|
p = 1.0 - t;
|
2011-05-24 23:06:48 -07:00
|
|
|
pp = p;
|
|
|
|
if (!lin) pp = (p * p);
|
|
|
|
p = 1.0 - pp;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
if (wd->state) deg = 180.0 * p;
|
|
|
|
else deg = 180 + (180.0 * p);
|
2011-05-24 23:06:48 -07:00
|
|
|
if (rev) deg = -deg;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
evas_map_util_3d_rotate(mf, 0.0, deg, deg, cx, cy, 0);
|
2011-05-24 23:06:48 -07:00
|
|
|
evas_map_util_3d_rotate(mb, 0.0, 180.0 + deg, 180.0 + deg, cx, cy, 0);
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
break;
|
|
|
|
case ELM_FLIP_CUBE_LEFT:
|
|
|
|
p = 1.0 - t;
|
2011-05-24 23:06:48 -07:00
|
|
|
pp = p;
|
|
|
|
if (!lin) pp = (p * p);
|
|
|
|
p = 1.0 - pp;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
deg = -90.0 * p;
|
|
|
|
if (wd->state)
|
|
|
|
{
|
|
|
|
evas_map_util_3d_rotate(mf, 0.0, deg, 0.0, cx, cy, w / 2);
|
|
|
|
evas_map_util_3d_rotate(mb, 0.0, deg + 90, 0.0, cx, cy, w / 2);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_map_util_3d_rotate(mf, 0.0, deg + 90, 0.0, cx, cy, w / 2);
|
|
|
|
evas_map_util_3d_rotate(mb, 0.0, deg, 0.0, cx, cy, w / 2);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ELM_FLIP_CUBE_RIGHT:
|
|
|
|
p = 1.0 - t;
|
2011-05-24 23:06:48 -07:00
|
|
|
pp = p;
|
|
|
|
if (!lin) pp = (p * p);
|
|
|
|
p = 1.0 - pp;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
deg = 90.0 * p;
|
|
|
|
if (wd->state)
|
|
|
|
{
|
|
|
|
evas_map_util_3d_rotate(mf, 0.0, deg, 0.0, cx, cy, w / 2);
|
|
|
|
evas_map_util_3d_rotate(mb, 0.0, deg - 90, 0.0, cx, cy, w / 2);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_map_util_3d_rotate(mf, 0.0, deg - 90, 0.0, cx, cy, w / 2);
|
|
|
|
evas_map_util_3d_rotate(mb, 0.0, deg, 0.0, cx, cy, w / 2);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ELM_FLIP_CUBE_UP:
|
|
|
|
p = 1.0 - t;
|
2011-05-24 23:06:48 -07:00
|
|
|
pp = p;
|
|
|
|
if (!lin) pp = (p * p);
|
|
|
|
p = 1.0 - pp;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
deg = -90.0 * p;
|
|
|
|
if (wd->state)
|
|
|
|
{
|
|
|
|
evas_map_util_3d_rotate(mf, deg, 0.0, 0.0, cx, cy, h / 2);
|
|
|
|
evas_map_util_3d_rotate(mb, deg + 90, 0.0, 0.0, cx, cy, h / 2);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_map_util_3d_rotate(mf, deg + 90, 0.0, 0.0, cx, cy, h / 2);
|
|
|
|
evas_map_util_3d_rotate(mb, deg, 0.0, 0.0, cx, cy, h / 2);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ELM_FLIP_CUBE_DOWN:
|
|
|
|
p = 1.0 - t;
|
2011-05-24 23:06:48 -07:00
|
|
|
pp = p;
|
|
|
|
if (!lin) pp = (p * p);
|
|
|
|
p = 1.0 - pp;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
deg = 90.0 * p;
|
|
|
|
if (wd->state)
|
|
|
|
{
|
|
|
|
evas_map_util_3d_rotate(mf, deg, 0.0, 0.0, cx, cy, h / 2);
|
|
|
|
evas_map_util_3d_rotate(mb, deg - 90, 0.0, 0.0, cx, cy, h / 2);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
evas_map_util_3d_rotate(mf, deg - 90, 0.0, 0.0, cx, cy, h / 2);
|
|
|
|
evas_map_util_3d_rotate(mb, deg, 0.0, 0.0, cx, cy, h / 2);
|
|
|
|
}
|
|
|
|
break;
|
2011-05-25 03:20:49 -07:00
|
|
|
case ELM_FLIP_PAGE_LEFT:
|
|
|
|
break;
|
|
|
|
case ELM_FLIP_PAGE_RIGHT:
|
|
|
|
break;
|
|
|
|
case ELM_FLIP_PAGE_UP:
|
|
|
|
break;
|
|
|
|
case ELM_FLIP_PAGE_DOWN:
|
|
|
|
break;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
default:
|
|
|
|
break;
|
2009-12-11 00:12:58 -08:00
|
|
|
}
|
|
|
|
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2009-12-11 00:12:58 -08:00
|
|
|
if (wd->front.content)
|
|
|
|
{
|
|
|
|
evas_map_util_3d_lighting(mf, lx, ly, lz, lr, lg, lb, lar, lag, lab);
|
|
|
|
evas_map_util_3d_perspective(mf, px, py, 0, foc);
|
|
|
|
evas_object_map_set(wd->front.content, mf);
|
|
|
|
evas_object_map_enable_set(wd->front.content, 1);
|
2010-03-08 20:00:08 -08:00
|
|
|
if (evas_map_util_clockwise_get(mf)) evas_object_show(wd->front.clip);
|
|
|
|
else evas_object_hide(wd->front.clip);
|
2009-12-11 00:12:58 -08:00
|
|
|
}
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2009-12-11 00:12:58 -08:00
|
|
|
if (wd->back.content)
|
|
|
|
{
|
|
|
|
evas_map_util_3d_lighting(mb, lx, ly, lz, lr, lg, lb, lar, lag, lab);
|
|
|
|
evas_map_util_3d_perspective(mb, px, py, 0, foc);
|
|
|
|
evas_object_map_set(wd->back.content, mb);
|
|
|
|
evas_object_map_enable_set(wd->back.content, 1);
|
2010-03-08 20:00:08 -08:00
|
|
|
if (evas_map_util_clockwise_get(mb)) evas_object_show(wd->back.clip);
|
|
|
|
else evas_object_hide(wd->back.clip);
|
2009-12-11 00:12:58 -08:00
|
|
|
}
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2009-12-11 00:12:58 -08:00
|
|
|
evas_map_free(mf);
|
|
|
|
evas_map_free(mb);
|
2011-05-24 23:06:48 -07:00
|
|
|
}
|
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
static void
|
|
|
|
_showhide(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
if (!wd) return;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
|
|
|
if (wd->front.content)
|
|
|
|
{
|
|
|
|
if ((wd->pageflip) && (wd->state))
|
|
|
|
{
|
|
|
|
evas_object_move(wd->front.content, 4999, 4999);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!wd->animator)
|
|
|
|
evas_object_move(wd->front.content, x, y);
|
|
|
|
}
|
|
|
|
evas_object_resize(wd->front.content, w, h);
|
|
|
|
}
|
|
|
|
if (wd->back.content)
|
|
|
|
{
|
|
|
|
if ((wd->pageflip) && (!wd->state))
|
|
|
|
{
|
|
|
|
evas_object_move(wd->back.content, 4999, 4999);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!wd->animator)
|
|
|
|
evas_object_move(wd->back.content, x, y);
|
|
|
|
}
|
|
|
|
evas_object_resize(wd->back.content, w, h);
|
|
|
|
}
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
}
|
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
static Eina_Bool
|
|
|
|
_flip(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
double t = ecore_loop_time_get() - wd->start;
|
2011-05-25 03:20:49 -07:00
|
|
|
Evas_Coord w, h;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
if (!wd) return ECORE_CALLBACK_CANCEL;
|
|
|
|
if (!wd->animator) return ECORE_CALLBACK_CANCEL;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
t = t / wd->len;
|
|
|
|
if (t > 1.0) t = 1.0;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
evas_object_geometry_get(obj, NULL, NULL, &w, &h);
|
|
|
|
if (wd->mode == ELM_FLIP_PAGE_LEFT)
|
|
|
|
{
|
|
|
|
wd->dir = 0;
|
|
|
|
wd->started = EINA_TRUE;
|
|
|
|
wd->pageflip = EINA_TRUE;
|
|
|
|
wd->down_x = w - 1;
|
|
|
|
wd->down_y = h / 2;
|
|
|
|
wd->x = (1.0 - t) * wd->down_x;
|
|
|
|
wd->y = wd->down_y;
|
|
|
|
flip_show_hide(obj);
|
|
|
|
_state_update(wd);
|
|
|
|
}
|
|
|
|
else if (wd->mode == ELM_FLIP_PAGE_RIGHT)
|
|
|
|
{
|
|
|
|
wd->dir = 1;
|
|
|
|
wd->started = EINA_TRUE;
|
|
|
|
wd->pageflip = EINA_TRUE;
|
|
|
|
wd->down_x = 0;
|
|
|
|
wd->down_y = h / 2;
|
|
|
|
wd->x = (t) * w;
|
|
|
|
wd->y = wd->down_y;
|
|
|
|
flip_show_hide(obj);
|
|
|
|
_state_update(wd);
|
|
|
|
}
|
|
|
|
else if (wd->mode == ELM_FLIP_PAGE_UP)
|
|
|
|
{
|
|
|
|
wd->dir = 2;
|
|
|
|
wd->started = EINA_TRUE;
|
|
|
|
wd->pageflip = EINA_TRUE;
|
|
|
|
wd->down_x = w / 2;
|
|
|
|
wd->down_y = h - 1;
|
|
|
|
wd->x = wd->down_x;
|
|
|
|
wd->y = (1.0 - t) * wd->down_y;
|
|
|
|
flip_show_hide(obj);
|
|
|
|
_state_update(wd);
|
|
|
|
}
|
|
|
|
else if (wd->mode == ELM_FLIP_PAGE_DOWN)
|
|
|
|
{
|
|
|
|
wd->dir = 3;
|
|
|
|
wd->started = EINA_TRUE;
|
|
|
|
wd->pageflip = EINA_TRUE;
|
|
|
|
wd->down_x = w / 2;
|
|
|
|
wd->down_y = 0;
|
|
|
|
wd->x = wd->down_x;
|
|
|
|
wd->y = (t) * h;
|
|
|
|
flip_show_hide(obj);
|
|
|
|
_state_update(wd);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
_flip_do(obj, t, wd->mode, 0, 0);
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2009-12-11 00:12:58 -08:00
|
|
|
if (t >= 1.0)
|
|
|
|
{
|
2011-05-25 03:20:49 -07:00
|
|
|
wd->pageflip = EINA_FALSE;
|
|
|
|
_state_end(wd);
|
2009-12-11 00:12:58 -08:00
|
|
|
evas_object_map_enable_set(wd->front.content, 0);
|
|
|
|
evas_object_map_enable_set(wd->back.content, 0);
|
2010-09-03 01:27:05 -07:00
|
|
|
// FIXME: hack around evas rendering bug (only fix makes evas bitch-slow
|
|
|
|
evas_object_resize(wd->front.content, 0, 0);
|
|
|
|
evas_object_resize(wd->back.content, 0, 0);
|
|
|
|
evas_smart_objects_calculate(evas_object_evas_get(obj));
|
|
|
|
// FIXME: end hack
|
2009-12-11 00:12:58 -08:00
|
|
|
wd->animator = NULL;
|
|
|
|
wd->state = !wd->state;
|
2010-01-26 00:17:26 -08:00
|
|
|
_configure(obj);
|
2011-05-25 03:20:49 -07:00
|
|
|
flip_show_hide(obj);
|
2011-04-03 09:26:25 -07:00
|
|
|
evas_object_smart_callback_call(obj, SIG_ANIMATE_DONE, NULL);
|
2010-06-25 02:58:14 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
2009-12-11 00:12:58 -08:00
|
|
|
}
|
2010-06-25 02:58:14 -07:00
|
|
|
return ECORE_CALLBACK_RENEW;
|
2009-12-11 00:12:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_configure(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
Evas_Coord x, y, w, h;
|
2011-05-24 23:06:48 -07:00
|
|
|
Evas_Coord fsize;
|
2010-03-09 08:46:13 -08:00
|
|
|
if (!wd) return;
|
2011-05-25 03:20:49 -07:00
|
|
|
|
|
|
|
_showhide(obj);
|
2009-12-11 00:12:58 -08:00
|
|
|
evas_object_geometry_get(obj, &x, &y, &w, &h);
|
2011-05-25 03:20:49 -07:00
|
|
|
// FIXME: manual flip wont get fixed
|
|
|
|
if (wd->animator) _flip(obj);
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
if (wd->event[0])
|
|
|
|
{
|
2011-05-25 03:20:49 -07:00
|
|
|
fsize = (double)w * wd->dir_hitsize[0];
|
2011-05-24 23:06:48 -07:00
|
|
|
elm_coords_finger_size_adjust(0, NULL, 1, &fsize);
|
|
|
|
evas_object_move(wd->event[0], x, y);
|
|
|
|
evas_object_resize(wd->event[0], w, fsize);
|
|
|
|
}
|
|
|
|
if (wd->event[1])
|
|
|
|
{
|
2011-05-25 03:20:49 -07:00
|
|
|
fsize = (double)w * wd->dir_hitsize[1];
|
2011-05-24 23:06:48 -07:00
|
|
|
elm_coords_finger_size_adjust(0, NULL, 1, &fsize);
|
|
|
|
evas_object_move(wd->event[1], x, y + h - fsize);
|
|
|
|
evas_object_resize(wd->event[1], w, fsize);
|
|
|
|
}
|
|
|
|
if (wd->event[2])
|
|
|
|
{
|
2011-05-25 03:20:49 -07:00
|
|
|
fsize = (double)h * wd->dir_hitsize[2];
|
2011-05-24 23:06:48 -07:00
|
|
|
elm_coords_finger_size_adjust(1, &fsize, 0, NULL);
|
|
|
|
evas_object_move(wd->event[2], x, y);
|
|
|
|
evas_object_resize(wd->event[2], fsize, h);
|
|
|
|
}
|
|
|
|
if (wd->event[3])
|
|
|
|
{
|
2011-05-25 03:20:49 -07:00
|
|
|
fsize = (double)h * wd->dir_hitsize[3];
|
2011-05-24 23:06:48 -07:00
|
|
|
elm_coords_finger_size_adjust(1, &fsize, 0, NULL);
|
|
|
|
evas_object_move(wd->event[3], x + w - fsize, y);
|
|
|
|
evas_object_resize(wd->event[3], fsize, h);
|
|
|
|
}
|
2009-12-11 00:12:58 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_move(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
|
2009-12-11 00:12:58 -08:00
|
|
|
{
|
|
|
|
_configure(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-03-09 09:51:30 -08:00
|
|
|
_resize(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
{
|
2009-12-11 00:12:58 -08:00
|
|
|
_configure(obj);
|
|
|
|
}
|
|
|
|
|
2010-06-25 02:58:14 -07:00
|
|
|
static Eina_Bool
|
2009-12-11 00:12:58 -08:00
|
|
|
_animate(void *data)
|
|
|
|
{
|
|
|
|
return _flip(data);
|
|
|
|
}
|
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
static double
|
|
|
|
_pos_get(Widget_Data *wd, int *rev, Elm_Flip_Mode *m)
|
|
|
|
{
|
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
double t = 1.0;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
evas_object_geometry_get(wd->obj, &x, &y, &w, &h);
|
|
|
|
switch (wd->intmode)
|
|
|
|
{
|
|
|
|
case ELM_FLIP_INTERACTION_ROTATE:
|
|
|
|
case ELM_FLIP_INTERACTION_CUBE:
|
|
|
|
{
|
|
|
|
if (wd->dir == 0)
|
|
|
|
{
|
|
|
|
if (wd->down_x > 0)
|
|
|
|
t = 1.0 - ((double)wd->x / (double)wd->down_x);
|
|
|
|
*rev = 1;
|
|
|
|
}
|
|
|
|
else if (wd->dir == 1)
|
|
|
|
{
|
|
|
|
if (wd->down_x < w)
|
|
|
|
t = 1.0 - ((double)(w - wd->x) / (double)(w - wd->down_x));
|
|
|
|
}
|
|
|
|
else if (wd->dir == 2)
|
|
|
|
{
|
|
|
|
if (wd->down_y > 0)
|
|
|
|
t = 1.0 - ((double)wd->y / (double)wd->down_y);
|
|
|
|
}
|
|
|
|
else if (wd->dir == 3)
|
|
|
|
{
|
|
|
|
if (wd->down_y < h)
|
|
|
|
t = 1.0 - ((double)(h - wd->y) / (double)(h - wd->down_y));
|
|
|
|
*rev = 1;
|
|
|
|
}
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
if (t < 0.0) t = 0.0;
|
|
|
|
else if (t > 1.0) t = 1.0;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
if ((wd->dir == 0) || (wd->dir == 1))
|
|
|
|
{
|
2011-06-01 21:24:58 -07:00
|
|
|
if (wd->intmode == ELM_FLIP_INTERACTION_ROTATE)
|
2011-05-24 23:06:48 -07:00
|
|
|
*m = ELM_FLIP_ROTATE_Y_CENTER_AXIS;
|
|
|
|
else if (wd->intmode == ELM_FLIP_INTERACTION_CUBE)
|
|
|
|
{
|
|
|
|
if (*rev)
|
|
|
|
*m = ELM_FLIP_CUBE_LEFT;
|
|
|
|
else
|
|
|
|
*m = ELM_FLIP_CUBE_RIGHT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-06-01 21:24:58 -07:00
|
|
|
if (wd->intmode == ELM_FLIP_INTERACTION_ROTATE)
|
2011-05-24 23:06:48 -07:00
|
|
|
*m = ELM_FLIP_ROTATE_X_CENTER_AXIS;
|
|
|
|
else if (wd->intmode == ELM_FLIP_INTERACTION_CUBE)
|
|
|
|
{
|
|
|
|
if (*rev)
|
|
|
|
*m = ELM_FLIP_CUBE_UP;
|
|
|
|
else
|
|
|
|
*m = ELM_FLIP_CUBE_DOWN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_event_anim(void *data, double pos)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = data;
|
|
|
|
double p;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
p = ecore_animator_pos_map(pos, ECORE_POS_MAP_ACCELERATE, 0.0, 0.0);
|
|
|
|
if (wd->finish)
|
|
|
|
{
|
|
|
|
if (wd->dir == 0)
|
|
|
|
wd->x = wd->ox * (1.0 - p);
|
|
|
|
else if (wd->dir == 1)
|
|
|
|
wd->x = wd->ox + ((wd->w - wd->ox) * p);
|
|
|
|
else if (wd->dir == 2)
|
|
|
|
wd->y = wd->oy * (1.0 - p);
|
|
|
|
else if (wd->dir == 3)
|
|
|
|
wd->y = wd->oy + ((wd->h - wd->oy) * p);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (wd->dir == 0)
|
|
|
|
wd->x = wd->ox + ((wd->w - wd->ox) * p);
|
|
|
|
else if (wd->dir == 1)
|
|
|
|
wd->x = wd->ox * (1.0 - p);
|
|
|
|
else if (wd->dir == 2)
|
|
|
|
wd->y = wd->oy + ((wd->h - wd->oy) * p);
|
|
|
|
else if (wd->dir == 3)
|
|
|
|
wd->y = wd->oy * (1.0 - p);
|
|
|
|
}
|
|
|
|
switch (wd->intmode)
|
|
|
|
{
|
|
|
|
case ELM_FLIP_INTERACTION_NONE:
|
|
|
|
break;
|
|
|
|
case ELM_FLIP_INTERACTION_ROTATE:
|
|
|
|
case ELM_FLIP_INTERACTION_CUBE:
|
|
|
|
{
|
|
|
|
Elm_Flip_Mode m = ELM_FLIP_ROTATE_X_CENTER_AXIS;
|
|
|
|
int rev = 0;
|
|
|
|
p = _pos_get(wd, &rev, &m);
|
|
|
|
_flip_do(wd->obj, p, m, 1, rev);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ELM_FLIP_INTERACTION_PAGE:
|
2011-05-25 03:20:49 -07:00
|
|
|
wd->pageflip = EINA_TRUE;
|
|
|
|
_configure(data);
|
|
|
|
_state_update(wd);
|
2011-05-24 23:06:48 -07:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (pos < 1.0) return ECORE_CALLBACK_RENEW;
|
|
|
|
|
2011-05-25 03:20:49 -07:00
|
|
|
wd->pageflip = EINA_FALSE;
|
|
|
|
_state_end(wd);
|
2011-05-24 23:06:48 -07:00
|
|
|
evas_object_map_enable_set(wd->front.content, 0);
|
|
|
|
evas_object_map_enable_set(wd->back.content, 0);
|
|
|
|
// FIXME: hack around evas rendering bug (only fix makes evas bitch-slow
|
|
|
|
evas_object_resize(wd->front.content, 0, 0);
|
|
|
|
evas_object_resize(wd->back.content, 0, 0);
|
|
|
|
evas_smart_objects_calculate(evas_object_evas_get(wd->obj));
|
|
|
|
// FIXME: end hack
|
|
|
|
wd->animator = NULL;
|
|
|
|
if (wd->finish) wd->state = !wd->state;
|
2011-05-25 03:20:49 -07:00
|
|
|
flip_show_hide(wd->obj);
|
2011-05-24 23:06:48 -07:00
|
|
|
_configure(wd->obj);
|
|
|
|
wd->animator = NULL;
|
|
|
|
evas_object_smart_callback_call(wd->obj, SIG_ANIMATE_DONE, NULL);
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
return ECORE_CALLBACK_CANCEL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_update_job(void *data)
|
|
|
|
{
|
|
|
|
Widget_Data *wd = data;
|
|
|
|
double p;
|
|
|
|
Elm_Flip_Mode m = ELM_FLIP_ROTATE_X_CENTER_AXIS;
|
|
|
|
int rev = 0;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
wd->job = NULL;
|
|
|
|
switch (wd->intmode)
|
|
|
|
{
|
|
|
|
case ELM_FLIP_INTERACTION_ROTATE:
|
|
|
|
case ELM_FLIP_INTERACTION_CUBE:
|
|
|
|
p = _pos_get(wd, &rev, &m);
|
|
|
|
_flip_do(wd->obj, p, m, 1, rev);
|
|
|
|
break;
|
|
|
|
case ELM_FLIP_INTERACTION_PAGE:
|
2011-05-25 03:20:49 -07:00
|
|
|
wd->pageflip = EINA_TRUE;
|
|
|
|
_configure(data);
|
|
|
|
_state_update(wd);
|
2011-05-24 23:06:48 -07:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_down_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
|
|
|
{
|
|
|
|
Evas_Object *fl = data;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(fl);
|
|
|
|
Evas_Event_Mouse_Down *ev = event_info;
|
|
|
|
Evas_Coord x, y, w, h;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
if (!wd) return;
|
|
|
|
if (ev->button != 1) return;
|
2011-05-26 02:02:00 -07:00
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return ;
|
2011-05-24 23:06:48 -07:00
|
|
|
if (wd->animator)
|
|
|
|
{
|
|
|
|
ecore_animator_del(wd->animator);
|
|
|
|
wd->animator = NULL;
|
|
|
|
}
|
|
|
|
wd->down = EINA_TRUE;
|
|
|
|
wd->started = EINA_FALSE;
|
|
|
|
evas_object_geometry_get(data, &x, &y, &w, &h);
|
|
|
|
wd->x = ev->canvas.x - x;
|
|
|
|
wd->y = ev->canvas.y - y;
|
2011-06-01 21:24:58 -07:00
|
|
|
wd->w = w;
|
2011-05-24 23:06:48 -07:00
|
|
|
wd->h = h;
|
|
|
|
wd->down_x = wd->x;
|
|
|
|
wd->down_y = wd->y;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_up_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
|
|
|
{
|
|
|
|
Evas_Object *fl = data;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(fl);
|
|
|
|
Evas_Event_Mouse_Up *ev = event_info;
|
|
|
|
Evas_Coord x, y, w, h;
|
|
|
|
double tm = 0.5;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
if (!wd) return;
|
|
|
|
if (ev->button != 1) return;
|
2011-05-26 02:02:00 -07:00
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return ;
|
2011-05-24 23:06:48 -07:00
|
|
|
wd->down = 0;
|
|
|
|
evas_object_geometry_get(data, &x, &y, &w, &h);
|
|
|
|
wd->x = ev->canvas.x - x;
|
|
|
|
wd->y = ev->canvas.y - y;
|
|
|
|
wd->w = w;
|
|
|
|
wd->h = h;
|
|
|
|
wd->ox = wd->x;
|
|
|
|
wd->oy = wd->y;
|
|
|
|
if (wd->job)
|
|
|
|
{
|
|
|
|
ecore_job_del(wd->job);
|
|
|
|
wd->job = NULL;
|
|
|
|
}
|
|
|
|
wd->finish = EINA_FALSE;
|
|
|
|
if (wd->dir == 0)
|
|
|
|
{
|
|
|
|
tm = (double)wd->x / (double)wd->w;
|
|
|
|
if (wd->x < (wd->w / 2)) wd->finish = EINA_TRUE;
|
|
|
|
}
|
|
|
|
else if (wd->dir == 1)
|
|
|
|
{
|
|
|
|
if (wd->x > (wd->w / 2)) wd->finish = EINA_TRUE;
|
|
|
|
tm = 1.0 - ((double)wd->x / (double)wd->w);
|
|
|
|
}
|
|
|
|
else if (wd->dir == 2)
|
|
|
|
{
|
|
|
|
if (wd->y < (wd->h / 2)) wd->finish = EINA_TRUE;
|
|
|
|
tm = (double)wd->y / (double)wd->h;
|
|
|
|
}
|
|
|
|
else if (wd->dir == 3)
|
|
|
|
{
|
|
|
|
if (wd->y > (wd->h / 2)) wd->finish = EINA_TRUE;
|
|
|
|
tm = 1.0 - ((double)wd->y / (double)wd->h);
|
|
|
|
}
|
|
|
|
if (tm < 0.01) tm = 0.01;
|
|
|
|
else if (tm > 0.99) tm = 0.99;
|
|
|
|
if (!wd->finish) tm = 1.0 - tm;
|
|
|
|
tm *= 1.0; // FIXME: config for anim time
|
|
|
|
if (wd->animator) ecore_animator_del(wd->animator);
|
|
|
|
wd->animator = ecore_animator_timeline_add(tm, _event_anim, wd);
|
|
|
|
_event_anim(wd, 0.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_move_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info)
|
|
|
|
{
|
|
|
|
Evas_Object *fl = data;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(fl);
|
|
|
|
Evas_Event_Mouse_Move *ev = event_info;
|
|
|
|
Evas_Coord x, y, w, h;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
if (!wd) return;
|
|
|
|
if (!wd->down) return;
|
2011-05-26 02:02:00 -07:00
|
|
|
if (ev->event_flags & EVAS_EVENT_FLAG_ON_HOLD) return ;
|
2011-05-24 23:06:48 -07:00
|
|
|
evas_object_geometry_get(data, &x, &y, &w, &h);
|
|
|
|
wd->x = ev->cur.canvas.x - x;
|
|
|
|
wd->y = ev->cur.canvas.y - y;
|
2011-06-01 21:24:58 -07:00
|
|
|
wd->w = w;
|
2011-05-24 23:06:48 -07:00
|
|
|
wd->h = h;
|
|
|
|
if (!wd->started)
|
|
|
|
{
|
|
|
|
Evas_Coord dx, dy;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
dx = wd->x - wd->down_x;
|
|
|
|
dy = wd->y - wd->down_y;
|
|
|
|
if (((dx * dx) + (dy * dy)) > (_elm_config->finger_size * _elm_config->finger_size / 4))
|
|
|
|
{
|
|
|
|
wd->dir = 0;
|
|
|
|
if ((wd->x > (w / 2)) && (dx < 0) && (abs(dx) > abs(dy))) wd->dir = 0; // left
|
|
|
|
else if ((wd->x < (w / 2)) && (dx >= 0) && (abs(dx) > abs(dy))) wd->dir = 1; // right
|
|
|
|
else if ((wd->y > (h / 2)) && (dy < 0) && (abs(dy) >= abs(dx))) wd->dir = 2; // up
|
|
|
|
else if ((wd->y < (h / 2)) && (dy >= 0) && (abs(dy) >= abs(dx))) wd->dir = 3; // down
|
|
|
|
wd->started = EINA_TRUE;
|
2011-05-25 03:20:49 -07:00
|
|
|
if (wd->intmode == ELM_FLIP_INTERACTION_PAGE)
|
|
|
|
wd->pageflip = EINA_TRUE;
|
2011-05-24 23:06:48 -07:00
|
|
|
flip_show_hide(data);
|
|
|
|
evas_smart_objects_calculate(evas_object_evas_get(data));
|
|
|
|
_flip(data);
|
|
|
|
// FIXME: hack around evas rendering bug (only fix makes evas bitch-slow)
|
|
|
|
evas_object_map_enable_set(wd->front.content, 0);
|
|
|
|
evas_object_map_enable_set(wd->back.content, 0);
|
2011-06-01 21:24:58 -07:00
|
|
|
// FIXME: XXX why does this bork interactive flip??
|
2011-05-24 23:06:48 -07:00
|
|
|
// evas_object_resize(wd->front.content, 0, 0);
|
|
|
|
// evas_object_resize(wd->back.content, 0, 0);
|
|
|
|
evas_smart_objects_calculate(evas_object_evas_get(data));
|
|
|
|
_configure(obj);
|
|
|
|
// FIXME: end hack
|
2011-05-25 03:20:49 -07:00
|
|
|
evas_object_smart_callback_call(obj, SIG_ANIMATE_BEGIN, NULL);
|
2011-05-24 23:06:48 -07:00
|
|
|
}
|
|
|
|
else return;
|
|
|
|
}
|
2011-05-26 02:02:00 -07:00
|
|
|
ev->event_flags |= EVAS_EVENT_FLAG_ON_HOLD;
|
2011-05-24 23:06:48 -07:00
|
|
|
if (wd->job) ecore_job_del(wd->job);
|
|
|
|
wd->job = ecore_job_add(_update_job, wd);
|
|
|
|
}
|
|
|
|
|
2009-12-01 23:22:35 -08:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_flip_add(Evas_Object *parent)
|
|
|
|
{
|
|
|
|
Evas_Object *obj;
|
|
|
|
Evas *e;
|
|
|
|
Widget_Data *wd;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2011-03-31 23:08:02 -07:00
|
|
|
ELM_WIDGET_STANDARD_SETUP(wd, Widget_Data, parent, e, obj, NULL);
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_SET_WIDTYPE(widtype, "flip");
|
2009-12-01 23:22:35 -08:00
|
|
|
elm_widget_type_set(obj, "flip");
|
|
|
|
elm_widget_sub_object_add(parent, obj);
|
|
|
|
elm_widget_data_set(obj, wd);
|
|
|
|
elm_widget_del_hook_set(obj, _del_hook);
|
|
|
|
elm_widget_theme_hook_set(obj, _theme_hook);
|
2010-10-06 13:24:13 -07:00
|
|
|
elm_widget_focus_next_hook_set(obj, _elm_flip_focus_next_hook);
|
2010-09-29 05:22:30 -07:00
|
|
|
elm_widget_can_focus_set(obj, EINA_FALSE);
|
2009-12-01 23:22:35 -08:00
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
wd->obj = obj;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2010-09-02 03:25:05 -07:00
|
|
|
wd->clip = evas_object_rectangle_add(e);
|
2010-09-02 17:08:11 -07:00
|
|
|
evas_object_static_clip_set(wd->clip, 1);
|
2010-09-02 03:25:05 -07:00
|
|
|
evas_object_color_set(wd->clip, 255, 255, 255, 255);
|
|
|
|
evas_object_move(wd->clip, -49999, -49999);
|
|
|
|
evas_object_resize(wd->clip, 99999, 99999);
|
|
|
|
elm_widget_sub_object_add(obj, wd->clip);
|
|
|
|
evas_object_clip_set(wd->clip, evas_object_clip_get(obj));
|
|
|
|
evas_object_smart_member_add(wd->clip, obj);
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2010-03-08 20:00:08 -08:00
|
|
|
wd->front.clip = evas_object_rectangle_add(e);
|
2010-09-02 17:08:11 -07:00
|
|
|
evas_object_static_clip_set(wd->front.clip, 1);
|
2010-09-02 03:25:05 -07:00
|
|
|
evas_object_data_set(wd->front.clip, "_elm_leaveme", obj);
|
2010-03-08 20:00:08 -08:00
|
|
|
evas_object_color_set(wd->front.clip, 255, 255, 255, 255);
|
|
|
|
evas_object_move(wd->front.clip, -49999, -49999);
|
|
|
|
evas_object_resize(wd->front.clip, 99999, 99999);
|
2010-09-02 02:58:52 -07:00
|
|
|
elm_widget_sub_object_add(obj, wd->front.clip);
|
2010-03-08 20:00:08 -08:00
|
|
|
evas_object_smart_member_add(wd->front.clip, obj);
|
2010-09-02 03:25:05 -07:00
|
|
|
evas_object_clip_set(wd->front.clip, wd->clip);
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2010-03-08 20:00:08 -08:00
|
|
|
wd->back.clip = evas_object_rectangle_add(e);
|
2010-09-02 17:08:11 -07:00
|
|
|
evas_object_static_clip_set(wd->back.clip, 1);
|
2010-09-02 03:25:05 -07:00
|
|
|
evas_object_data_set(wd->back.clip, "_elm_leaveme", obj);
|
2010-03-08 20:00:08 -08:00
|
|
|
evas_object_color_set(wd->back.clip, 255, 255, 255, 255);
|
|
|
|
evas_object_move(wd->back.clip, -49999, -49999);
|
|
|
|
evas_object_resize(wd->back.clip, 99999, 99999);
|
|
|
|
elm_widget_sub_object_add(wd->back.clip, obj);
|
2010-09-02 02:58:52 -07:00
|
|
|
evas_object_smart_member_add(obj, wd->back.clip);
|
2010-09-02 03:25:05 -07:00
|
|
|
evas_object_clip_set(wd->back.clip, wd->clip);
|
2010-03-08 20:00:08 -08:00
|
|
|
|
2009-12-01 23:22:35 -08:00
|
|
|
evas_object_smart_callback_add(obj, "sub-object-del", _sub_del, obj);
|
2009-12-11 00:12:58 -08:00
|
|
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_MOVE, _move, NULL);
|
|
|
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_RESIZE, _resize, NULL);
|
2011-11-25 13:40:00 -08:00
|
|
|
evas_object_event_callback_add(obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_changed_size_hints, obj);;
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
|
2011-04-03 09:26:25 -07:00
|
|
|
evas_object_smart_callbacks_descriptions_set(obj, _signals);
|
|
|
|
|
2009-12-11 00:12:58 -08:00
|
|
|
wd->state = 1;
|
2011-05-24 23:06:48 -07:00
|
|
|
wd->intmode = ELM_FLIP_INTERACTION_NONE;
|
2011-06-01 21:24:58 -07:00
|
|
|
|
2009-12-01 23:22:35 -08:00
|
|
|
_sizing_eval(obj);
|
2011-04-03 09:26:25 -07:00
|
|
|
|
2009-12-01 23:22:35 -08:00
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_flip_content_front_set(Evas_Object *obj, Evas_Object *content)
|
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2009-12-01 23:22:35 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2011-05-24 23:06:48 -07:00
|
|
|
int i;
|
2010-03-09 08:46:13 -08:00
|
|
|
if (!wd) return;
|
2010-02-27 07:14:34 -08:00
|
|
|
if (wd->front.content == content) return;
|
2011-12-03 23:35:33 -08:00
|
|
|
if (wd->front.content) evas_object_del(wd->front.content);
|
2009-12-01 23:22:35 -08:00
|
|
|
wd->front.content = content;
|
|
|
|
if (content)
|
|
|
|
{
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
elm_widget_sub_object_add(obj, content);
|
2010-02-27 07:14:34 -08:00
|
|
|
evas_object_smart_member_add(content, obj);
|
2010-03-08 20:00:08 -08:00
|
|
|
evas_object_clip_set(content, wd->front.clip);
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
evas_object_event_callback_add(content,
|
2009-12-01 23:22:35 -08:00
|
|
|
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
_changed_size_hints, obj);
|
|
|
|
_sizing_eval(obj);
|
2009-12-01 23:22:35 -08:00
|
|
|
}
|
2010-09-25 05:41:06 -07:00
|
|
|
// force calc to contents are the right size before transition
|
|
|
|
evas_smart_objects_calculate(evas_object_evas_get(obj));
|
2010-09-02 02:58:52 -07:00
|
|
|
flip_show_hide(obj);
|
2009-12-11 00:12:58 -08:00
|
|
|
_configure(obj);
|
2011-05-24 23:06:48 -07:00
|
|
|
if (wd->intmode != ELM_FLIP_INTERACTION_NONE)
|
|
|
|
{
|
|
|
|
for (i = 0; i < 4; i++) evas_object_raise(wd->event[i]);
|
|
|
|
}
|
2009-12-01 23:22:35 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_flip_content_back_set(Evas_Object *obj, Evas_Object *content)
|
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2009-12-01 23:22:35 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2011-05-24 23:06:48 -07:00
|
|
|
int i;
|
2010-03-09 08:46:13 -08:00
|
|
|
if (!wd) return;
|
2010-02-27 07:14:34 -08:00
|
|
|
if (wd->back.content == content) return;
|
2010-10-14 11:54:42 -07:00
|
|
|
if (wd->back.content) evas_object_del(wd->back.content);
|
2009-12-01 23:22:35 -08:00
|
|
|
wd->back.content = content;
|
|
|
|
if (content)
|
|
|
|
{
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
elm_widget_sub_object_add(obj, content);
|
2010-05-24 01:28:23 -07:00
|
|
|
evas_object_smart_member_add(content, obj);
|
2010-03-08 20:00:08 -08:00
|
|
|
evas_object_clip_set(content, wd->back.clip);
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
evas_object_event_callback_add(content,
|
2009-12-01 23:22:35 -08:00
|
|
|
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
elementary - entry, genlist, gengrid, image, icon, hover, frame, diskselector, index, layout, label, conform, flip, flipselector - removed white spaces
SVN revision: 58252
2011-04-01 04:32:33 -07:00
|
|
|
_changed_size_hints, obj);
|
|
|
|
_sizing_eval(obj);
|
2009-12-01 23:22:35 -08:00
|
|
|
}
|
2010-09-25 05:41:06 -07:00
|
|
|
// force calc to contents are the right size before transition
|
|
|
|
evas_smart_objects_calculate(evas_object_evas_get(obj));
|
2010-09-02 02:58:52 -07:00
|
|
|
flip_show_hide(obj);
|
2009-12-11 00:12:58 -08:00
|
|
|
_configure(obj);
|
2011-05-24 23:06:48 -07:00
|
|
|
if (wd->intmode != ELM_FLIP_INTERACTION_NONE)
|
|
|
|
{
|
|
|
|
for (i = 0; i < 4; i++) evas_object_raise(wd->event[i]);
|
|
|
|
}
|
2009-12-01 23:22:35 -08:00
|
|
|
}
|
|
|
|
|
2010-05-12 09:32:12 -07:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_flip_content_front_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
return wd->front.content;
|
|
|
|
}
|
|
|
|
|
2010-10-14 11:54:42 -07:00
|
|
|
|
2010-05-12 09:32:12 -07:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_flip_content_back_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
return wd->back.content;
|
|
|
|
}
|
|
|
|
|
2010-10-14 11:54:42 -07:00
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_flip_content_front_unset(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return NULL;
|
|
|
|
if (!wd->front.content) return NULL;
|
|
|
|
Evas_Object *content = wd->front.content;
|
2010-11-26 05:35:33 -08:00
|
|
|
evas_object_clip_unset(content);
|
2010-10-14 11:54:42 -07:00
|
|
|
elm_widget_sub_object_del(obj, content);
|
2011-10-30 17:13:32 -07:00
|
|
|
evas_object_event_callback_del_full(content,
|
|
|
|
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_changed_size_hints, obj);
|
2010-10-14 11:54:42 -07:00
|
|
|
evas_object_smart_member_del(content);
|
|
|
|
wd->front.content = NULL;
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Evas_Object *
|
|
|
|
elm_flip_content_back_unset(Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) NULL;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return NULL;
|
|
|
|
if (!wd->back.content) return NULL;
|
|
|
|
Evas_Object *content = wd->back.content;
|
2010-11-26 05:35:33 -08:00
|
|
|
evas_object_clip_unset(content);
|
2010-10-14 11:54:42 -07:00
|
|
|
elm_widget_sub_object_del(obj, content);
|
2011-10-30 17:13:32 -07:00
|
|
|
evas_object_event_callback_del_full(content,
|
|
|
|
EVAS_CALLBACK_CHANGED_SIZE_HINTS,
|
|
|
|
_changed_size_hints, obj);
|
2010-10-14 11:54:42 -07:00
|
|
|
evas_object_smart_member_del(content);
|
|
|
|
wd->back.content = NULL;
|
|
|
|
return content;
|
|
|
|
}
|
|
|
|
|
2009-12-01 23:22:35 -08:00
|
|
|
EAPI Eina_Bool
|
2010-03-23 20:06:00 -07:00
|
|
|
elm_flip_front_get(const Evas_Object *obj)
|
2009-12-01 23:22:35 -08:00
|
|
|
{
|
2010-03-09 08:46:13 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
|
2009-12-01 23:22:35 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 08:46:13 -08:00
|
|
|
if (!wd) return EINA_FALSE;
|
2009-12-11 00:12:58 -08:00
|
|
|
return wd->state;
|
2009-12-01 23:22:35 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
2010-03-09 09:51:30 -08:00
|
|
|
elm_flip_perspective_set(Evas_Object *obj, Evas_Coord foc __UNUSED__, Evas_Coord x __UNUSED__, Evas_Coord y __UNUSED__)
|
2009-12-01 23:22:35 -08:00
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2009-12-01 23:22:35 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 08:46:13 -08:00
|
|
|
if (!wd) return;
|
2009-12-01 23:22:35 -08:00
|
|
|
}
|
|
|
|
|
2011-05-24 23:06:48 -07:00
|
|
|
// FIXME: add ambient and lighting control
|
|
|
|
|
2009-12-01 23:22:35 -08:00
|
|
|
EAPI void
|
|
|
|
elm_flip_go(Evas_Object *obj, Elm_Flip_Mode mode)
|
|
|
|
{
|
2010-03-08 22:15:39 -08:00
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2009-12-01 23:22:35 -08:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
2010-03-09 08:46:13 -08:00
|
|
|
if (!wd) return;
|
2009-12-11 00:12:58 -08:00
|
|
|
if (!wd->animator) wd->animator = ecore_animator_add(_animate, obj);
|
2010-09-02 02:58:52 -07:00
|
|
|
flip_show_hide(obj);
|
2009-12-11 00:12:58 -08:00
|
|
|
wd->mode = mode;
|
|
|
|
wd->start = ecore_loop_time_get();
|
2011-05-25 03:20:49 -07:00
|
|
|
wd->len = 0.5; // FIXME: make config val
|
|
|
|
if ((wd->mode == ELM_FLIP_PAGE_LEFT) ||
|
|
|
|
(wd->mode == ELM_FLIP_PAGE_RIGHT) ||
|
|
|
|
(wd->mode == ELM_FLIP_PAGE_UP) ||
|
|
|
|
(wd->mode == ELM_FLIP_PAGE_DOWN))
|
|
|
|
wd->pageflip = EINA_TRUE;
|
2010-09-25 05:41:06 -07:00
|
|
|
// force calc to contents are the right size before transition
|
|
|
|
evas_smart_objects_calculate(evas_object_evas_get(obj));
|
2010-09-02 02:58:52 -07:00
|
|
|
_flip(obj);
|
2011-05-24 00:49:50 -07:00
|
|
|
// FIXME: hack around evas rendering bug (only fix makes evas bitch-slow)
|
2010-09-25 07:57:34 -07:00
|
|
|
evas_object_map_enable_set(wd->front.content, 0);
|
|
|
|
evas_object_map_enable_set(wd->back.content, 0);
|
|
|
|
evas_object_resize(wd->front.content, 0, 0);
|
|
|
|
evas_object_resize(wd->back.content, 0, 0);
|
|
|
|
evas_smart_objects_calculate(evas_object_evas_get(obj));
|
|
|
|
_configure(obj);
|
|
|
|
// FIXME: end hack
|
2011-05-25 03:20:49 -07:00
|
|
|
evas_object_smart_callback_call(obj, SIG_ANIMATE_BEGIN, NULL);
|
2009-12-01 23:22:35 -08:00
|
|
|
}
|
2011-05-24 23:06:48 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_flip_interaction_set(Evas_Object *obj, Elm_Flip_Interaction mode)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
2011-05-25 03:20:49 -07:00
|
|
|
int i;
|
2011-05-24 23:06:48 -07:00
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return;
|
|
|
|
if (wd->intmode == mode) return;
|
|
|
|
wd->intmode = mode;
|
2011-05-25 03:20:49 -07:00
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
if (wd->intmode == ELM_FLIP_INTERACTION_NONE)
|
|
|
|
{
|
|
|
|
if (wd->event[i])
|
|
|
|
{
|
|
|
|
evas_object_del(wd->event[i]);
|
|
|
|
wd->event[i] = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ((wd->dir_enabled[i]) && (!wd->event[i]))
|
|
|
|
{
|
|
|
|
wd->event[i] = evas_object_rectangle_add(evas_object_evas_get(obj));
|
|
|
|
elm_widget_sub_object_add(obj, wd->event[i]);
|
|
|
|
evas_object_clip_set(wd->event[i], evas_object_clip_get(obj));
|
|
|
|
evas_object_color_set(wd->event[i], 0, 0, 0, 0);
|
|
|
|
evas_object_show(wd->event[i]);
|
|
|
|
evas_object_smart_member_add(wd->event[i], obj);
|
|
|
|
evas_object_event_callback_add(wd->event[i], EVAS_CALLBACK_MOUSE_DOWN, _down_cb, obj);
|
|
|
|
evas_object_event_callback_add(wd->event[i], EVAS_CALLBACK_MOUSE_UP, _up_cb, obj);
|
|
|
|
evas_object_event_callback_add(wd->event[i], EVAS_CALLBACK_MOUSE_MOVE, _move_cb, obj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_sizing_eval(obj);
|
|
|
|
_configure(obj);
|
2011-05-24 23:06:48 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Elm_Flip_Interaction
|
|
|
|
elm_flip_interaction_get(const Evas_Object *obj)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) ELM_FLIP_INTERACTION_NONE;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
if (!wd) return ELM_FLIP_INTERACTION_NONE;
|
|
|
|
return wd->intmode;
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_flip_interacton_direction_enabled_set(Evas_Object *obj, Elm_Flip_Direction dir, Eina_Bool enabled)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
int i = -1;
|
|
|
|
if (!wd) return;
|
|
|
|
enabled = !!enabled;
|
|
|
|
if (dir == ELM_FLIP_DIRECTION_UP) i = 0;
|
|
|
|
else if (dir == ELM_FLIP_DIRECTION_DOWN) i = 1;
|
|
|
|
else if (dir == ELM_FLIP_DIRECTION_LEFT) i = 2;
|
|
|
|
else if (dir == ELM_FLIP_DIRECTION_RIGHT) i = 3;
|
|
|
|
if (i < 0) return;
|
|
|
|
if (wd->dir_enabled[i] == enabled) return;
|
|
|
|
wd->dir_enabled[i] = enabled;
|
2011-05-25 03:20:49 -07:00
|
|
|
if (wd->intmode == ELM_FLIP_INTERACTION_NONE) return;
|
|
|
|
if ((wd->dir_enabled[i]) && (!wd->event[i]))
|
2011-05-24 23:06:48 -07:00
|
|
|
{
|
|
|
|
wd->event[i] = evas_object_rectangle_add(evas_object_evas_get(obj));
|
|
|
|
elm_widget_sub_object_add(obj, wd->event[i]);
|
|
|
|
evas_object_clip_set(wd->event[i], evas_object_clip_get(obj));
|
|
|
|
evas_object_color_set(wd->event[i], 0, 0, 0, 0);
|
|
|
|
evas_object_show(wd->event[i]);
|
|
|
|
evas_object_smart_member_add(wd->event[i], obj);
|
|
|
|
evas_object_event_callback_add(wd->event[i], EVAS_CALLBACK_MOUSE_DOWN, _down_cb, obj);
|
|
|
|
evas_object_event_callback_add(wd->event[i], EVAS_CALLBACK_MOUSE_UP, _up_cb, obj);
|
|
|
|
evas_object_event_callback_add(wd->event[i], EVAS_CALLBACK_MOUSE_MOVE, _move_cb, obj);
|
|
|
|
}
|
2011-05-25 03:20:49 -07:00
|
|
|
else if (!(wd->dir_enabled[i]) && (wd->event[i]))
|
2011-05-24 23:06:48 -07:00
|
|
|
{
|
|
|
|
evas_object_del(wd->event[i]);
|
|
|
|
wd->event[i] = NULL;
|
|
|
|
}
|
|
|
|
_sizing_eval(obj);
|
2011-05-25 03:20:49 -07:00
|
|
|
_configure(obj);
|
2011-05-24 23:06:48 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EAPI Eina_Bool
|
|
|
|
elm_flip_interacton_direction_enabled_get(Evas_Object *obj, Elm_Flip_Direction dir)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
int i = -1;
|
|
|
|
if (!wd) return EINA_FALSE;
|
|
|
|
if (dir == ELM_FLIP_DIRECTION_UP) i = 0;
|
|
|
|
else if (dir == ELM_FLIP_DIRECTION_DOWN) i = 1;
|
|
|
|
else if (dir == ELM_FLIP_DIRECTION_LEFT) i = 2;
|
|
|
|
else if (dir == ELM_FLIP_DIRECTION_RIGHT) i = 3;
|
|
|
|
if (i < 0) return EINA_FALSE;
|
|
|
|
return wd->dir_enabled[i];
|
|
|
|
}
|
2011-05-25 03:20:49 -07:00
|
|
|
|
|
|
|
EAPI void
|
|
|
|
elm_flip_interacton_direction_hitsize_set(Evas_Object *obj, Elm_Flip_Direction dir, double hitsize)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype);
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
int i = -1;
|
|
|
|
if (!wd) return;
|
|
|
|
if (dir == ELM_FLIP_DIRECTION_UP) i = 0;
|
|
|
|
else if (dir == ELM_FLIP_DIRECTION_DOWN) i = 1;
|
|
|
|
else if (dir == ELM_FLIP_DIRECTION_LEFT) i = 2;
|
|
|
|
else if (dir == ELM_FLIP_DIRECTION_RIGHT) i = 3;
|
|
|
|
if (i < 0) return;
|
|
|
|
if (hitsize < 0.0) hitsize = 0.0;
|
|
|
|
else if (hitsize > 1.0) hitsize = 1.0;
|
|
|
|
if (wd->dir_hitsize[i] == hitsize) return;
|
|
|
|
wd->dir_hitsize[i] = hitsize;
|
|
|
|
_sizing_eval(obj);
|
|
|
|
_configure(obj);
|
|
|
|
}
|
|
|
|
|
|
|
|
EAPI double
|
|
|
|
elm_flip_interacton_direction_hitsize_get(Evas_Object *obj, Elm_Flip_Direction dir)
|
|
|
|
{
|
|
|
|
ELM_CHECK_WIDTYPE(obj, widtype) EINA_FALSE;
|
|
|
|
Widget_Data *wd = elm_widget_data_get(obj);
|
|
|
|
int i = -1;
|
|
|
|
if (!wd) return 0.0;
|
|
|
|
if (dir == ELM_FLIP_DIRECTION_UP) i = 0;
|
|
|
|
else if (dir == ELM_FLIP_DIRECTION_DOWN) i = 1;
|
|
|
|
else if (dir == ELM_FLIP_DIRECTION_LEFT) i = 2;
|
|
|
|
else if (dir == ELM_FLIP_DIRECTION_RIGHT) i = 3;
|
|
|
|
if (i < 0) return 0.0;
|
|
|
|
return wd->dir_hitsize[i];
|
|
|
|
}
|