2016-10-11 19:31:17 -07:00
|
|
|
#define EFL_CANVAS_GROUP_PROTECTED
|
|
|
|
#define EFL_CANVAS_GROUP_BETA
|
|
|
|
|
2013-06-20 03:53:29 -07:00
|
|
|
#include "evas_common_private.h"
|
2008-10-01 08:42:48 -07:00
|
|
|
#include "evas_private.h"
|
2008-09-06 19:10:17 -07:00
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
#define CSO_DATA_GET(eo_obj, ptr) \
|
2017-08-31 22:50:29 -07:00
|
|
|
Evas_Object_Smart_Clipped_Data *ptr = evas_object_smart_data_get(eo_obj);
|
2012-10-08 18:58:41 -07:00
|
|
|
|
2016-10-13 01:59:13 -07:00
|
|
|
#define CSO_DATA_GET_OR_RETURN(eo_obj, ptr, ...) \
|
|
|
|
CSO_DATA_GET(eo_obj, ptr) \
|
|
|
|
if (!ptr) return __VA_ARGS__;
|
2008-09-06 19:10:17 -07:00
|
|
|
|
2016-06-16 23:32:37 -07:00
|
|
|
EAPI Evas_Object *
|
|
|
|
evas_object_smart_clipped_clipper_get(const Evas_Object *eo_obj)
|
2008-09-06 19:10:17 -07:00
|
|
|
{
|
2016-10-13 01:59:13 -07:00
|
|
|
CSO_DATA_GET_OR_RETURN(eo_obj, cso, NULL);
|
2016-06-16 23:32:37 -07:00
|
|
|
|
2016-10-13 01:59:13 -07:00
|
|
|
return cso->clipper;
|
2008-09-06 19:10:17 -07:00
|
|
|
}
|
|
|
|
|
2017-08-31 22:50:29 -07:00
|
|
|
static void
|
|
|
|
evas_object_smart_clipped_smart_add_legacy(Evas_Object *eo_obj)
|
|
|
|
{
|
2017-08-31 23:35:33 -07:00
|
|
|
_evas_object_smart_clipped_init(eo_obj);
|
2008-09-06 19:10:17 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2017-08-31 23:21:22 -07:00
|
|
|
evas_object_smart_clipped_smart_del_legacy(Evas_Object *eo_obj)
|
2008-09-06 19:10:17 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
CSO_DATA_GET_OR_RETURN(eo_obj, cso);
|
2009-09-22 15:37:03 -07:00
|
|
|
|
2008-10-24 19:49:19 -07:00
|
|
|
if (cso->clipper)
|
|
|
|
{
|
2012-05-23 23:48:25 -07:00
|
|
|
Evas_Object *clipper = cso->clipper;
|
|
|
|
cso->clipper = NULL;
|
|
|
|
evas_object_del(clipper);
|
2008-10-24 19:49:19 -07:00
|
|
|
}
|
|
|
|
|
2016-06-17 01:26:08 -07:00
|
|
|
_efl_canvas_group_group_members_all_del(eo_obj);
|
2008-09-06 19:10:17 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-10-08 18:58:41 -07:00
|
|
|
evas_object_smart_clipped_smart_move(Evas_Object *eo_obj, Evas_Coord x, Evas_Coord y)
|
2008-09-06 19:10:17 -07:00
|
|
|
{
|
2017-02-20 00:59:50 -08:00
|
|
|
if (!efl_isa(eo_obj, EFL_CANVAS_GROUP_CLASS)) return;
|
|
|
|
_evas_object_smart_clipped_smart_move_internal(eo_obj, x, y);
|
2008-09-06 19:10:17 -07:00
|
|
|
}
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
static void
|
2016-10-10 02:59:42 -07:00
|
|
|
evas_object_smart_clipped_smart_show(Evas_Object *eo_obj)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
|
|
|
CSO_DATA_GET_OR_RETURN(eo_obj, cso);
|
2013-04-10 21:21:54 -07:00
|
|
|
if (evas_object_clipees_has(cso->clipper))
|
2008-09-06 19:10:17 -07:00
|
|
|
evas_object_show(cso->clipper); /* just show if clipper being used */
|
|
|
|
}
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
static void
|
2016-10-10 02:59:42 -07:00
|
|
|
evas_object_smart_clipped_smart_hide(Evas_Object *eo_obj)
|
2012-10-08 18:58:41 -07:00
|
|
|
{
|
|
|
|
CSO_DATA_GET_OR_RETURN(eo_obj, cso);
|
2008-09-06 19:10:17 -07:00
|
|
|
evas_object_hide(cso->clipper);
|
|
|
|
}
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
static void
|
|
|
|
evas_object_smart_clipped_smart_color_set(Evas_Object *eo_obj, int r, int g, int b, int a)
|
2008-09-06 19:10:17 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
CSO_DATA_GET_OR_RETURN(eo_obj, cso);
|
2008-09-06 19:10:17 -07:00
|
|
|
evas_object_color_set(cso->clipper, r, g, b, a);
|
|
|
|
}
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
static void
|
|
|
|
evas_object_smart_clipped_smart_clip_set(Evas_Object *eo_obj, Evas_Object *clip)
|
2008-09-06 19:10:17 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
CSO_DATA_GET_OR_RETURN(eo_obj, cso);
|
2008-09-06 19:10:17 -07:00
|
|
|
evas_object_clip_set(cso->clipper, clip);
|
|
|
|
}
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
static void
|
|
|
|
evas_object_smart_clipped_smart_clip_unset(Evas_Object *eo_obj)
|
2008-09-06 19:10:17 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
CSO_DATA_GET_OR_RETURN(eo_obj, cso);
|
2008-09-06 19:10:17 -07:00
|
|
|
evas_object_clip_unset(cso->clipper);
|
|
|
|
}
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
static void
|
|
|
|
evas_object_smart_clipped_smart_member_add(Evas_Object *eo_obj, Evas_Object *member)
|
2008-09-06 19:10:17 -07:00
|
|
|
{
|
2012-10-08 18:58:41 -07:00
|
|
|
CSO_DATA_GET_OR_RETURN(eo_obj, cso);
|
2012-08-07 03:44:15 -07:00
|
|
|
if (!cso->clipper || member == cso->clipper)
|
2008-10-24 19:49:19 -07:00
|
|
|
return;
|
2008-09-06 19:10:17 -07:00
|
|
|
evas_object_clip_set(member, cso->clipper);
|
2012-10-08 18:58:41 -07:00
|
|
|
if (evas_object_visible_get(eo_obj))
|
2008-09-06 19:10:17 -07:00
|
|
|
evas_object_show(cso->clipper);
|
|
|
|
}
|
|
|
|
|
2012-10-08 18:58:41 -07:00
|
|
|
static void
|
|
|
|
evas_object_smart_clipped_smart_member_del(Evas_Object *eo_obj, Evas_Object *member)
|
|
|
|
{
|
|
|
|
CSO_DATA_GET_OR_RETURN(eo_obj, cso);
|
2008-10-24 19:49:19 -07:00
|
|
|
if (!cso->clipper)
|
|
|
|
return;
|
2008-09-06 19:10:17 -07:00
|
|
|
evas_object_clip_unset(member);
|
2015-10-14 15:54:41 -07:00
|
|
|
if (!evas_object_clipees_has(cso->clipper))
|
2008-09-06 19:10:17 -07:00
|
|
|
evas_object_hide(cso->clipper);
|
|
|
|
}
|
|
|
|
|
2017-08-31 20:30:49 -07:00
|
|
|
/* Legacy only */
|
2008-09-06 19:10:17 -07:00
|
|
|
EAPI void
|
|
|
|
evas_object_smart_clipped_smart_set(Evas_Smart_Class *sc)
|
|
|
|
{
|
|
|
|
if (!sc)
|
|
|
|
return;
|
|
|
|
|
2017-08-31 22:50:29 -07:00
|
|
|
sc->add = evas_object_smart_clipped_smart_add_legacy;
|
2017-08-31 23:21:22 -07:00
|
|
|
sc->del = evas_object_smart_clipped_smart_del_legacy;
|
2008-09-06 19:10:17 -07:00
|
|
|
sc->move = evas_object_smart_clipped_smart_move;
|
2016-10-10 02:59:42 -07:00
|
|
|
sc->show = evas_object_smart_clipped_smart_show;
|
|
|
|
sc->hide = evas_object_smart_clipped_smart_hide;
|
2008-09-06 19:10:17 -07:00
|
|
|
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;
|
2008-10-27 14:21:53 -07:00
|
|
|
sc->calculate = NULL;
|
2008-10-24 19:49:19 -07:00
|
|
|
sc->member_add = evas_object_smart_clipped_smart_member_add;
|
|
|
|
sc->member_del = evas_object_smart_clipped_smart_member_del;
|
2008-09-06 19:10:17 -07:00
|
|
|
}
|
|
|
|
|
2010-03-22 18:22:20 -07:00
|
|
|
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;
|
|
|
|
}
|