forked from enlightenment/efl
133 lines
3.5 KiB
C
133 lines
3.5 KiB
C
/* Legacy only */
|
|
|
|
#include "evas_common_private.h"
|
|
#include "evas_private.h"
|
|
|
|
#define CSO_DATA_GET(eo_obj, ptr) \
|
|
Evas_Object_Smart_Clipped_Data *ptr = evas_object_smart_data_get(eo_obj);
|
|
|
|
#define CSO_DATA_GET_OR_RETURN(eo_obj, ptr, ...) \
|
|
CSO_DATA_GET(eo_obj, ptr) \
|
|
if (!ptr) return __VA_ARGS__;
|
|
|
|
EAPI Evas_Object *
|
|
evas_object_smart_clipped_clipper_get(const Evas_Object *eo_obj)
|
|
{
|
|
CSO_DATA_GET_OR_RETURN(eo_obj, cso, NULL);
|
|
|
|
return cso->clipper;
|
|
}
|
|
|
|
static void
|
|
evas_object_smart_clipped_smart_add(Evas_Object *eo_obj)
|
|
{
|
|
_evas_object_smart_clipped_init(eo_obj);
|
|
}
|
|
|
|
static void
|
|
evas_object_smart_clipped_smart_del(Evas_Object *eo_obj)
|
|
{
|
|
CSO_DATA_GET_OR_RETURN(eo_obj, cso);
|
|
|
|
_efl_canvas_group_group_members_all_del(eo_obj);
|
|
cso->clipper = NULL;
|
|
}
|
|
|
|
static void
|
|
evas_object_smart_clipped_smart_move(Evas_Object *eo_obj, Evas_Coord x, Evas_Coord y)
|
|
{
|
|
if (!efl_isa(eo_obj, EFL_CANVAS_GROUP_CLASS)) return;
|
|
_evas_object_smart_clipped_smart_move_internal(eo_obj, x, y);
|
|
}
|
|
|
|
static void
|
|
evas_object_smart_clipped_smart_show(Evas_Object *eo_obj)
|
|
{
|
|
CSO_DATA_GET_OR_RETURN(eo_obj, cso);
|
|
if (evas_object_clipees_has(cso->clipper))
|
|
evas_object_show(cso->clipper); /* just show if clipper being used */
|
|
}
|
|
|
|
static void
|
|
evas_object_smart_clipped_smart_hide(Evas_Object *eo_obj)
|
|
{
|
|
CSO_DATA_GET_OR_RETURN(eo_obj, cso);
|
|
evas_object_hide(cso->clipper);
|
|
}
|
|
|
|
static void
|
|
evas_object_smart_clipped_smart_color_set(Evas_Object *eo_obj, int r, int g, int b, int a)
|
|
{
|
|
CSO_DATA_GET_OR_RETURN(eo_obj, cso);
|
|
evas_object_color_set(cso->clipper, r, g, b, a);
|
|
}
|
|
|
|
static void
|
|
evas_object_smart_clipped_smart_clip_set(Evas_Object *eo_obj, Evas_Object *clip)
|
|
{
|
|
CSO_DATA_GET_OR_RETURN(eo_obj, cso);
|
|
evas_object_clip_set(cso->clipper, clip);
|
|
}
|
|
|
|
static void
|
|
evas_object_smart_clipped_smart_clip_unset(Evas_Object *eo_obj)
|
|
{
|
|
CSO_DATA_GET_OR_RETURN(eo_obj, cso);
|
|
evas_object_clip_unset(cso->clipper);
|
|
}
|
|
|
|
static void
|
|
evas_object_smart_clipped_smart_member_add(Evas_Object *eo_obj, Evas_Object *member)
|
|
{
|
|
CSO_DATA_GET_OR_RETURN(eo_obj, cso);
|
|
if (!cso->clipper || member == cso->clipper)
|
|
return;
|
|
evas_object_clip_set(member, cso->clipper);
|
|
if (evas_object_visible_get(eo_obj))
|
|
evas_object_show(cso->clipper);
|
|
}
|
|
|
|
static void
|
|
evas_object_smart_clipped_smart_member_del(Evas_Object *eo_obj, Evas_Object *member)
|
|
{
|
|
CSO_DATA_GET_OR_RETURN(eo_obj, cso);
|
|
if (!cso->clipper)
|
|
return;
|
|
evas_object_clip_unset(member);
|
|
if (!evas_object_clipees_has(cso->clipper))
|
|
evas_object_hide(cso->clipper);
|
|
}
|
|
|
|
EAPI void
|
|
evas_object_smart_clipped_smart_set(Evas_Smart_Class *sc)
|
|
{
|
|
if (!sc)
|
|
return;
|
|
|
|
sc->add = evas_object_smart_clipped_smart_add;
|
|
sc->del = evas_object_smart_clipped_smart_del;
|
|
sc->move = evas_object_smart_clipped_smart_move;
|
|
sc->show = evas_object_smart_clipped_smart_show;
|
|
sc->hide = evas_object_smart_clipped_smart_hide;
|
|
sc->color_set = evas_object_smart_clipped_smart_color_set;
|
|
sc->clip_set = evas_object_smart_clipped_smart_clip_set;
|
|
sc->clip_unset = evas_object_smart_clipped_smart_clip_unset;
|
|
sc->calculate = NULL;
|
|
sc->member_add = evas_object_smart_clipped_smart_member_add;
|
|
sc->member_del = evas_object_smart_clipped_smart_member_del;
|
|
}
|
|
|
|
EAPI const Evas_Smart_Class *
|
|
evas_object_smart_clipped_class_get(void)
|
|
{
|
|
static Evas_Smart_Class _sc = EVAS_SMART_CLASS_INIT_NAME_VERSION("EvasObjectSmartClipped");
|
|
static const Evas_Smart_Class *class = NULL;
|
|
|
|
if (class)
|
|
return class;
|
|
|
|
evas_object_smart_clipped_smart_set(&_sc);
|
|
class = &_sc;
|
|
return class;
|
|
}
|