forked from enlightenment/enlightenment
parent
8d352bc01e
commit
13838f3dd0
111
src/bin/e_pan.c
111
src/bin/e_pan.c
|
@ -1,16 +1,16 @@
|
|||
#include "e.h"
|
||||
|
||||
#define SMART_NAME "e_pan"
|
||||
#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 SMART_NAME "e_pan"
|
||||
#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
|
||||
{
|
||||
{
|
||||
Evas_Object *smart_obj, *child_obj;
|
||||
Evas_Coord x, y, w, h;
|
||||
Evas_Coord child_w, child_h, px, py;
|
||||
};
|
||||
Evas_Coord x, y, w, h;
|
||||
Evas_Coord child_w, child_h, px, py;
|
||||
};
|
||||
|
||||
/* local subsystem functions */
|
||||
static void _e_smart_child_del_hook(void *data, Evas *e, Evas_Object *obj, void *event_info);
|
||||
|
@ -24,7 +24,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);
|
||||
|
||||
|
@ -46,31 +46,31 @@ e_pan_child_set(Evas_Object *obj, Evas_Object *child)
|
|||
if (child == sd->child_obj) return;
|
||||
if (sd->child_obj)
|
||||
{
|
||||
evas_object_clip_unset(sd->child_obj);
|
||||
evas_object_smart_member_del(sd->child_obj);
|
||||
evas_object_clip_unset(sd->child_obj);
|
||||
evas_object_smart_member_del(sd->child_obj);
|
||||
evas_object_event_callback_del(sd->child_obj, EVAS_CALLBACK_FREE, _e_smart_child_del_hook);
|
||||
evas_object_event_callback_del(sd->child_obj, EVAS_CALLBACK_RESIZE, _e_smart_child_resize_hook);
|
||||
sd->child_obj = NULL;
|
||||
evas_object_event_callback_del(sd->child_obj, EVAS_CALLBACK_RESIZE, _e_smart_child_resize_hook);
|
||||
sd->child_obj = NULL;
|
||||
}
|
||||
if (child)
|
||||
{
|
||||
int r, g, b, a;
|
||||
int r, g, b, a;
|
||||
|
||||
sd->child_obj = child;
|
||||
evas_object_smart_member_add(sd->child_obj, sd->smart_obj);
|
||||
evas_object_geometry_get(sd->child_obj, NULL, NULL,
|
||||
sd->child_obj = child;
|
||||
evas_object_smart_member_add(sd->child_obj, sd->smart_obj);
|
||||
evas_object_geometry_get(sd->child_obj, NULL, NULL,
|
||||
&sd->child_w, &sd->child_h);
|
||||
evas_object_event_callback_add(child, EVAS_CALLBACK_FREE,
|
||||
evas_object_event_callback_add(child, EVAS_CALLBACK_FREE,
|
||||
_e_smart_child_del_hook, sd);
|
||||
evas_object_event_callback_add(child, EVAS_CALLBACK_RESIZE,
|
||||
evas_object_event_callback_add(child, EVAS_CALLBACK_RESIZE,
|
||||
_e_smart_child_resize_hook, sd);
|
||||
evas_object_color_get(sd->smart_obj, &r, &g, &b, &a);
|
||||
evas_object_color_set(sd->child_obj, r, g, b, a);
|
||||
evas_object_clip_set(sd->child_obj, evas_object_clip_get(sd->smart_obj));
|
||||
if (evas_object_visible_get(sd->smart_obj))
|
||||
evas_object_color_get(sd->smart_obj, &r, &g, &b, &a);
|
||||
evas_object_color_set(sd->child_obj, r, g, b, a);
|
||||
evas_object_clip_set(sd->child_obj, evas_object_clip_get(sd->smart_obj));
|
||||
if (evas_object_visible_get(sd->smart_obj))
|
||||
evas_object_show(sd->child_obj);
|
||||
else evas_object_hide(sd->child_obj);
|
||||
_e_smart_reconfigure(sd);
|
||||
else evas_object_hide(sd->child_obj);
|
||||
_e_smart_reconfigure(sd);
|
||||
}
|
||||
evas_object_smart_callback_call(sd->smart_obj, "changed", NULL);
|
||||
}
|
||||
|
@ -111,13 +111,13 @@ e_pan_max_get(Evas_Object *obj, Evas_Coord *x, Evas_Coord *y)
|
|||
API_ENTRY return;
|
||||
if (x)
|
||||
{
|
||||
if (sd->w < sd->child_w) *x = sd->child_w - sd->w;
|
||||
else *x = 0;
|
||||
if (sd->w < sd->child_w) *x = sd->child_w - sd->w;
|
||||
else *x = 0;
|
||||
}
|
||||
if (y)
|
||||
{
|
||||
if (sd->h < sd->child_h) *y = sd->child_h - sd->h;
|
||||
else *y = 0;
|
||||
if (sd->h < sd->child_h) *y = sd->child_h - sd->h;
|
||||
else *y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,9 +151,9 @@ _e_smart_child_resize_hook(void *data, Evas *e __UNUSED__, Evas_Object *obj __UN
|
|||
evas_object_geometry_get(sd->child_obj, NULL, NULL, &w, &h);
|
||||
if ((w != sd->child_w) || (h != sd->child_h))
|
||||
{
|
||||
sd->child_w = w;
|
||||
sd->child_h = h;
|
||||
_e_smart_reconfigure(sd);
|
||||
sd->child_w = w;
|
||||
sd->child_h = h;
|
||||
_e_smart_reconfigure(sd);
|
||||
}
|
||||
evas_object_smart_callback_call(sd->smart_obj, "changed", NULL);
|
||||
}
|
||||
|
@ -253,28 +253,29 @@ 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,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
_e_smart = evas_smart_class_new(&sc);
|
||||
}
|
||||
{
|
||||
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,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
_e_smart = evas_smart_class_new(&sc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue