forked from enlightenment/enlightenment
parent
a58ddcbb92
commit
8d352bc01e
|
@ -1,8 +1,8 @@
|
|||
#include "e.h"
|
||||
|
||||
#define SMART_NAME "e_scrollframe"
|
||||
#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;
|
||||
#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;
|
||||
|
||||
struct _E_Smart_Data
|
||||
|
@ -17,11 +17,13 @@ struct _E_Smart_Data
|
|||
|
||||
E_Scrollframe_Policy hbar_flags, vbar_flags;
|
||||
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
Evas_Coord x, y;
|
||||
Evas_Coord sx, sy;
|
||||
Evas_Coord dx, dy;
|
||||
struct {
|
||||
struct
|
||||
{
|
||||
Evas_Coord x, y;
|
||||
double timestamp;
|
||||
} history[20];
|
||||
|
@ -46,10 +48,10 @@ struct _E_Smart_Data
|
|||
|
||||
struct
|
||||
{
|
||||
void (*set) (Evas_Object *obj, Evas_Coord x, Evas_Coord y);
|
||||
void (*get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
|
||||
void (*max_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
|
||||
void (*child_size_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
|
||||
void (*set)(Evas_Object *obj, Evas_Coord x, Evas_Coord y);
|
||||
void (*get)(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
|
||||
void (*max_get)(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
|
||||
void (*child_size_get)(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y);
|
||||
} pan_func;
|
||||
struct
|
||||
{
|
||||
|
@ -88,7 +90,7 @@ 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_set(Evas_Object *obj, Evas_Object *clip);
|
||||
static void _e_smart_clip_unset(Evas_Object *obj);
|
||||
static void _e_smart_init(void);
|
||||
|
||||
|
@ -149,10 +151,10 @@ e_scrollframe_child_set(Evas_Object *obj, Evas_Object *child)
|
|||
|
||||
EAPI void
|
||||
e_scrollframe_extern_pan_set(Evas_Object *obj, Evas_Object *pan,
|
||||
void (*pan_set) (Evas_Object *obj, Evas_Coord x, Evas_Coord y),
|
||||
void (*pan_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y),
|
||||
void (*pan_max_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y),
|
||||
void (*pan_child_size_get) (Evas_Object *obj, Evas_Coord *x, Evas_Coord *y))
|
||||
void (*pan_set)(Evas_Object *obj, Evas_Coord x, Evas_Coord y),
|
||||
void (*pan_get)(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y),
|
||||
void (*pan_max_get)(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y),
|
||||
void (*pan_child_size_get)(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y))
|
||||
{
|
||||
API_ENTRY return;
|
||||
|
||||
|
@ -234,11 +236,13 @@ e_scrollframe_child_pos_set(Evas_Object *obj, Evas_Coord x, Evas_Coord y)
|
|||
if (mx > 0) vx = (double)x / (double)mx;
|
||||
else vx = 0.0;
|
||||
if (vx < 0.0) vx = 0.0;
|
||||
else if (vx > 1.0) vx = 1.0;
|
||||
else if (vx > 1.0)
|
||||
vx = 1.0;
|
||||
if (my > 0) vy = (double)y / (double)my;
|
||||
else vy = 0.0;
|
||||
if (vy < 0.0) vy = 0.0;
|
||||
else if (vy > 1.0) vy = 1.0;
|
||||
else if (vy > 1.0)
|
||||
vy = 1.0;
|
||||
edje_object_part_drag_value_set(sd->edje_obj, "e.dragable.vbar", 0.0, vy);
|
||||
edje_object_part_drag_value_set(sd->edje_obj, "e.dragable.hbar", vx, 0.0);
|
||||
sd->pan_func.set(sd->pan_obj, x, y);
|
||||
|
@ -1083,7 +1087,7 @@ _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)
|
||||
_e_smart_clip_set(Evas_Object *obj, Evas_Object *clip)
|
||||
{
|
||||
INTERNAL_ENTRY;
|
||||
evas_object_clip_set(sd->edje_obj, clip);
|
||||
|
@ -1123,3 +1127,4 @@ _e_smart_init(void)
|
|||
_e_smart = evas_smart_class_new(&sc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue