forked from enlightenment/efl
evas: Remove private data for clipped object
Another step towards merging both classes of smart objects.
This commit is contained in:
parent
f5a56789e0
commit
230b234891
|
@ -32,11 +32,10 @@ _edje_object_efl_object_constructor(Eo *obj, Edje *ed)
|
||||||
Evas *e;
|
Evas *e;
|
||||||
void *tmp;
|
void *tmp;
|
||||||
|
|
||||||
ed->base = efl_data_ref(obj, EFL_CANVAS_GROUP_CLIPPED_CLASS);
|
|
||||||
ed->duration_scale = 1.0;
|
|
||||||
|
|
||||||
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
obj = efl_constructor(efl_super(obj, MY_CLASS));
|
||||||
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
efl_canvas_object_type_set(obj, MY_CLASS_NAME_LEGACY);
|
||||||
|
ed->base = evas_object_smart_data_get(obj);
|
||||||
|
ed->duration_scale = 1.0;
|
||||||
_edje_lib_ref();
|
_edje_lib_ref();
|
||||||
|
|
||||||
parent = efl_parent_get(obj);
|
parent = efl_parent_get(obj);
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
abstract Efl.Canvas.Group.Clipped (Efl.Canvas.Group)
|
abstract Efl.Canvas.Group.Clipped (Efl.Canvas.Group)
|
||||||
{
|
{
|
||||||
[[Internal class representing a canvas object group with a clipper.]]
|
[[Internal class representing a canvas object group with a clipper.]]
|
||||||
data: Evas_Object_Smart_Clipped_Data;
|
data: null;
|
||||||
implements {
|
implements {
|
||||||
Efl.Object.constructor;
|
Efl.Object.constructor;
|
||||||
Efl.Gfx.color { set; }
|
Efl.Gfx.color { set; }
|
||||||
|
|
|
@ -405,9 +405,10 @@ _evas_box_efl_canvas_group_group_add(Eo *eo_obj, Evas_Object_Box_Data *priv)
|
||||||
|
|
||||||
// make sure evas box smart data is fully initialized and set (for legacy)
|
// make sure evas box smart data is fully initialized and set (for legacy)
|
||||||
// this assumes only box and smart clipped access the smart data
|
// this assumes only box and smart clipped access the smart data
|
||||||
cso = efl_data_scope_get(eo_obj, EFL_CANVAS_GROUP_CLIPPED_CLASS);
|
cso = evas_object_smart_data_get(eo_obj);
|
||||||
priv->base = *cso;
|
priv->base = *cso;
|
||||||
evas_object_smart_data_set(eo_obj, priv);
|
evas_object_smart_data_set(eo_obj, priv);
|
||||||
|
free(cso);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
|
|
|
@ -10,8 +10,7 @@
|
||||||
#define MY_CLASS_NAME_LEGACY "Evas_Object_Smart"
|
#define MY_CLASS_NAME_LEGACY "Evas_Object_Smart"
|
||||||
|
|
||||||
#define EVAS_OBJECT_SMART_GET_OR_RETURN(eo_obj, ...) \
|
#define EVAS_OBJECT_SMART_GET_OR_RETURN(eo_obj, ...) \
|
||||||
Evas_Smart_Data *o = efl_isa(eo_obj, EFL_CANVAS_GROUP_CLASS) ? \
|
Evas_Smart_Data *o = efl_data_scope_safe_get(eo_obj, EFL_CANVAS_GROUP_CLASS); \
|
||||||
efl_data_scope_get(eo_obj, EFL_CANVAS_GROUP_CLASS) : NULL; \
|
|
||||||
do { if (!o) { MAGIC_CHECK_FAILED(eo_obj,0,MAGIC_SMART) return __VA_ARGS__; } } while (0)
|
do { if (!o) { MAGIC_CHECK_FAILED(eo_obj,0,MAGIC_SMART) return __VA_ARGS__; } } while (0)
|
||||||
|
|
||||||
extern Eina_Hash* signals_hash_table;
|
extern Eina_Hash* signals_hash_table;
|
||||||
|
@ -37,8 +36,7 @@ struct _Evas_Smart_Data
|
||||||
|
|
||||||
Evas_Smart_Cb_Description_Array callbacks_descriptions;
|
Evas_Smart_Cb_Description_Array callbacks_descriptions;
|
||||||
|
|
||||||
Evas_Coord x, y;
|
int x, y;
|
||||||
|
|
||||||
int walking_list;
|
int walking_list;
|
||||||
int member_count; /** number of smart member objects */
|
int member_count; /** number of smart member objects */
|
||||||
|
|
||||||
|
@ -1671,6 +1669,8 @@ _efl_canvas_group_group_unclipped_set(Eo *eo_obj EINA_UNUSED, Evas_Smart_Data *s
|
||||||
// We must call this function BEFORE the constructor (yes, it's hacky)
|
// We must call this function BEFORE the constructor (yes, it's hacky)
|
||||||
EINA_SAFETY_ON_FALSE_RETURN(!sd->object);
|
EINA_SAFETY_ON_FALSE_RETURN(!sd->object);
|
||||||
sd->unclipped = !!unclipped;
|
sd->unclipped = !!unclipped;
|
||||||
|
if (!unclipped && !sd->data)
|
||||||
|
sd->data = calloc(1, sizeof(Evas_Object_Smart_Clipped_Data));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Internal EO APIs */
|
/* Internal EO APIs */
|
||||||
|
|
|
@ -7,9 +7,7 @@
|
||||||
#define MY_CLASS EFL_CANVAS_GROUP_CLIPPED_CLASS
|
#define MY_CLASS EFL_CANVAS_GROUP_CLIPPED_CLASS
|
||||||
|
|
||||||
#define CSO_DATA_GET(eo_obj, ptr) \
|
#define CSO_DATA_GET(eo_obj, ptr) \
|
||||||
Evas_Object_Smart_Clipped_Data *ptr = (efl_isa(eo_obj, MY_CLASS) ? \
|
Evas_Object_Smart_Clipped_Data *ptr = evas_object_smart_data_get(eo_obj);
|
||||||
efl_data_scope_get(eo_obj, MY_CLASS) : \
|
|
||||||
evas_object_smart_data_get(eo_obj));
|
|
||||||
|
|
||||||
#define CSO_DATA_GET_OR_RETURN(eo_obj, ptr, ...) \
|
#define CSO_DATA_GET_OR_RETURN(eo_obj, ptr, ...) \
|
||||||
CSO_DATA_GET(eo_obj, ptr) \
|
CSO_DATA_GET(eo_obj, ptr) \
|
||||||
|
@ -24,14 +22,10 @@ evas_object_smart_clipped_clipper_get(const Evas_Object *eo_obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
evas_object_smart_clipped_smart_add(Evas_Object *eo_obj)
|
evas_object_smart_clipped_smart_add(Evas_Object *eo_obj, Evas_Object_Smart_Clipped_Data *cso)
|
||||||
{
|
{
|
||||||
Evas_Object *clipper;
|
Evas_Object *clipper;
|
||||||
|
|
||||||
CSO_DATA_GET(eo_obj, cso)
|
|
||||||
if (!cso)
|
|
||||||
cso = calloc(1, sizeof(*cso)); /* users can provide it or realloc() later */
|
|
||||||
|
|
||||||
cso->evas = evas_object_evas_get(eo_obj);
|
cso->evas = evas_object_evas_get(eo_obj);
|
||||||
clipper = evas_object_rectangle_add(cso->evas);
|
clipper = evas_object_rectangle_add(cso->evas);
|
||||||
evas_object_static_clip_set(clipper, 1);
|
evas_object_static_clip_set(clipper, 1);
|
||||||
|
@ -48,10 +42,22 @@ evas_object_smart_clipped_smart_add(Evas_Object *eo_obj)
|
||||||
evas_object_smart_data_set(eo_obj, cso);
|
evas_object_smart_data_set(eo_obj, cso);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
static void
|
||||||
_efl_canvas_group_clipped_efl_canvas_group_group_add(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED)
|
evas_object_smart_clipped_smart_add_legacy(Evas_Object *eo_obj)
|
||||||
{
|
{
|
||||||
evas_object_smart_clipped_smart_add(eo_obj);
|
Evas_Object_Smart_Clipped_Data *cso;
|
||||||
|
|
||||||
|
cso = calloc(1, sizeof(*cso));
|
||||||
|
evas_object_smart_clipped_smart_add(eo_obj, cso);
|
||||||
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_efl_canvas_group_clipped_efl_canvas_group_group_add(Eo *eo_obj, void *_pd EINA_UNUSED)
|
||||||
|
{
|
||||||
|
Evas_Object_Smart_Clipped_Data *cso;
|
||||||
|
|
||||||
|
cso = evas_object_smart_data_get(eo_obj);
|
||||||
|
evas_object_smart_clipped_smart_add(eo_obj, cso);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -76,7 +82,7 @@ evas_object_smart_clipped_smart_del(Evas_Object *eo_obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_canvas_group_clipped_efl_canvas_group_group_del(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED)
|
_efl_canvas_group_clipped_efl_canvas_group_group_del(Eo *eo_obj, void *_pd EINA_UNUSED)
|
||||||
{
|
{
|
||||||
evas_object_smart_clipped_smart_del(eo_obj);
|
evas_object_smart_clipped_smart_del(eo_obj);
|
||||||
// group_del_called was already set to true, no need to call super here.
|
// group_del_called was already set to true, no need to call super here.
|
||||||
|
@ -90,7 +96,7 @@ evas_object_smart_clipped_smart_move(Evas_Object *eo_obj, Evas_Coord x, Evas_Coo
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_canvas_group_clipped_efl_gfx_position_set(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED, Evas_Coord x, Evas_Coord y)
|
_efl_canvas_group_clipped_efl_gfx_position_set(Eo *eo_obj, void *_pd EINA_UNUSED, Evas_Coord x, Evas_Coord y)
|
||||||
{
|
{
|
||||||
if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y))
|
if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_MOVE, 0, x, y))
|
||||||
return;
|
return;
|
||||||
|
@ -115,7 +121,7 @@ evas_object_smart_clipped_smart_hide(Evas_Object *eo_obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_canvas_group_clipped_efl_gfx_visible_set(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED, Eina_Bool vis)
|
_efl_canvas_group_clipped_efl_gfx_visible_set(Eo *eo_obj, void *_pd EINA_UNUSED, Eina_Bool vis)
|
||||||
{
|
{
|
||||||
if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 0, vis))
|
if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_VISIBLE, 0, vis))
|
||||||
return;
|
return;
|
||||||
|
@ -127,8 +133,9 @@ _efl_canvas_group_clipped_efl_gfx_visible_set(Eo *eo_obj, Evas_Object_Smart_Clip
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_canvas_group_clipped_efl_canvas_object_no_render_set(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *cso, Eina_Bool enable)
|
_efl_canvas_group_clipped_efl_canvas_object_no_render_set(Eo *eo_obj, void *_pd EINA_UNUSED, Eina_Bool enable)
|
||||||
{
|
{
|
||||||
|
CSO_DATA_GET_OR_RETURN(eo_obj, cso);
|
||||||
enable = !!enable;
|
enable = !!enable;
|
||||||
if (efl_canvas_object_no_render_get(eo_obj) == enable) return;
|
if (efl_canvas_object_no_render_get(eo_obj) == enable) return;
|
||||||
efl_canvas_object_no_render_set(efl_super(eo_obj, MY_CLASS), enable);
|
efl_canvas_object_no_render_set(efl_super(eo_obj, MY_CLASS), enable);
|
||||||
|
@ -143,7 +150,7 @@ evas_object_smart_clipped_smart_color_set(Evas_Object *eo_obj, int r, int g, int
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_canvas_group_clipped_efl_gfx_color_set(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED, int r, int g, int b, int a)
|
_efl_canvas_group_clipped_efl_gfx_color_set(Eo *eo_obj, void *_pd EINA_UNUSED, int r, int g, int b, int a)
|
||||||
{
|
{
|
||||||
evas_object_smart_clipped_smart_color_set(eo_obj, r, g, b, a);
|
evas_object_smart_clipped_smart_color_set(eo_obj, r, g, b, a);
|
||||||
}
|
}
|
||||||
|
@ -163,7 +170,7 @@ evas_object_smart_clipped_smart_clip_unset(Evas_Object *eo_obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_canvas_group_clipped_efl_canvas_object_clip_set(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED, Evas_Object *clip)
|
_efl_canvas_group_clipped_efl_canvas_object_clip_set(Eo *eo_obj, void *_pd EINA_UNUSED, Evas_Object *clip)
|
||||||
{
|
{
|
||||||
if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_CLIP_SET, 0, clip))
|
if (_evas_object_intercept_call(eo_obj, EVAS_OBJECT_INTERCEPT_CB_CLIP_SET, 0, clip))
|
||||||
return;
|
return;
|
||||||
|
@ -185,7 +192,7 @@ evas_object_smart_clipped_smart_member_add(Evas_Object *eo_obj, Evas_Object *mem
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_canvas_group_clipped_efl_canvas_group_group_member_add(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED, Evas_Object *member)
|
_efl_canvas_group_clipped_efl_canvas_group_group_member_add(Eo *eo_obj, void *_pd EINA_UNUSED, Evas_Object *member)
|
||||||
{
|
{
|
||||||
efl_canvas_group_member_add(efl_super(eo_obj, MY_CLASS), member);
|
efl_canvas_group_member_add(efl_super(eo_obj, MY_CLASS), member);
|
||||||
evas_object_smart_clipped_smart_member_add(eo_obj, member);
|
evas_object_smart_clipped_smart_member_add(eo_obj, member);
|
||||||
|
@ -203,14 +210,14 @@ evas_object_smart_clipped_smart_member_del(Evas_Object *eo_obj, Evas_Object *mem
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_canvas_group_clipped_efl_canvas_group_group_member_del(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED, Evas_Object *member)
|
_efl_canvas_group_clipped_efl_canvas_group_group_member_del(Eo *eo_obj, void *_pd EINA_UNUSED, Evas_Object *member)
|
||||||
{
|
{
|
||||||
evas_object_smart_clipped_smart_member_del(eo_obj, member);
|
evas_object_smart_clipped_smart_member_del(eo_obj, member);
|
||||||
efl_canvas_group_member_del(efl_super(eo_obj, MY_CLASS), member);
|
efl_canvas_group_member_del(efl_super(eo_obj, MY_CLASS), member);
|
||||||
}
|
}
|
||||||
|
|
||||||
EOLIAN static Eo *
|
EOLIAN static Eo *
|
||||||
_efl_canvas_group_clipped_efl_object_constructor(Eo *eo_obj, Evas_Object_Smart_Clipped_Data *obj EINA_UNUSED)
|
_efl_canvas_group_clipped_efl_object_constructor(Eo *eo_obj, void *_pd EINA_UNUSED)
|
||||||
{
|
{
|
||||||
// Setting this flag before the parent constructor on purpose.
|
// Setting this flag before the parent constructor on purpose.
|
||||||
efl_canvas_group_unclipped_set(eo_obj, EINA_FALSE);
|
efl_canvas_group_unclipped_set(eo_obj, EINA_FALSE);
|
||||||
|
@ -224,7 +231,7 @@ evas_object_smart_clipped_smart_set(Evas_Smart_Class *sc)
|
||||||
if (!sc)
|
if (!sc)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sc->add = evas_object_smart_clipped_smart_add;
|
sc->add = evas_object_smart_clipped_smart_add_legacy;
|
||||||
sc->del = evas_object_smart_clipped_smart_del;
|
sc->del = evas_object_smart_clipped_smart_del;
|
||||||
sc->move = evas_object_smart_clipped_smart_move;
|
sc->move = evas_object_smart_clipped_smart_move;
|
||||||
sc->show = evas_object_smart_clipped_smart_show;
|
sc->show = evas_object_smart_clipped_smart_show;
|
||||||
|
|
Loading…
Reference in New Issue