forked from enlightenment/efl
evas: Add group_member_is to smart objects
This is a new function that indicates whether an object is a child of a parent or not. Dead simple, as this simply compares if parent == this. Note that this check was impossible to do with the event grabber. Also, rename group_children_iterate to group_members_iterate for consistency with the other group_member functions. @feature
This commit is contained in:
parent
0885d0c405
commit
bb9d8bdbaa
|
@ -52,8 +52,7 @@ class Efl.Canvas.Group (Efl.Canvas.Object)
|
|||
]]
|
||||
legacy: evas_object_smart_calculate;
|
||||
}
|
||||
/* FIXME: children -> members? */
|
||||
group_children_iterate @const {
|
||||
group_members_iterate @const {
|
||||
[[Returns an iterator over the children of this object, that are
|
||||
canvas objects.
|
||||
|
||||
|
@ -61,25 +60,28 @@ class Efl.Canvas.Group (Efl.Canvas.Object)
|
|||
from both the $Efl.Object children list as well as the $Efl.Container
|
||||
content list.
|
||||
]]
|
||||
return: free(own(iterator<Efl.Canvas.Object>), eina_iterator_free); [[Iterator to object children]]
|
||||
return: free(own(iterator<Efl.Canvas.Object>), eina_iterator_free);
|
||||
[[Iterator to object children]]
|
||||
legacy: evas_object_smart_iterator_new;
|
||||
}
|
||||
group_member_add {
|
||||
[[Set an Evas object as a member of a given smart object.
|
||||
[[Set a canvas object as a member of a given group (or smart object).
|
||||
|
||||
Members will automatically be stacked and layered together with the
|
||||
smart object. The various stacking functions will operate on
|
||||
members relative to the other members instead of the entire canvas,
|
||||
since they now live on an exclusive layer (see
|
||||
evas_object_stack_above(), for more details).
|
||||
@Efl.Gfx.Stack.stack_above(), for more details).
|
||||
|
||||
Any $smart_obj object's specific implementation of the
|
||||
$member_add() smart function will take place too, naturally.
|
||||
Subclasses inheriting from this one may override this function
|
||||
to ensure the proper stacking of special objects, such as clippers,
|
||||
event rectangles, etc...
|
||||
|
||||
See also @.group_member_del.
|
||||
See also @.group_member_is.
|
||||
]]
|
||||
params {
|
||||
@in sub_obj: Efl.Canvas.Object @nonull; [[The member object.]]
|
||||
@in sub_obj: own(Efl.Canvas.Object) @nonull; [[The member object.]]
|
||||
}
|
||||
legacy: null;
|
||||
}
|
||||
|
@ -90,18 +92,27 @@ class Efl.Canvas.Group (Efl.Canvas.Object)
|
|||
to any. The object will still be on the canvas, but no longer
|
||||
associated with whichever smart object it was associated with.
|
||||
|
||||
See also @.group_member_add for more details.
|
||||
See also @.group_member_add.
|
||||
See also @.group_member_is.
|
||||
]]
|
||||
params {
|
||||
@in sub_obj: Efl.Canvas.Object; [[The member object.]]
|
||||
@in sub_obj: Efl.Canvas.Object; [[The member object to remove.]]
|
||||
}
|
||||
legacy: null;
|
||||
}
|
||||
group_member_is @const {
|
||||
[[Finds out if a given object is a member of this group.]]
|
||||
params {
|
||||
@in sub_obj: const(Efl.Canvas.Object); [[A potential sub object.]]
|
||||
}
|
||||
return: bool; [[$true if $sub_obj is a member of this group.]]
|
||||
legacy: null;
|
||||
}
|
||||
@property group_clipper @protected {
|
||||
[[The internal clipper object used by this group.
|
||||
|
||||
This is the object clipping all the children objects. Do not
|
||||
delete or otherwise modify this clipper!
|
||||
This is the object clipping all the child objects. Do not delete
|
||||
or otherwise modify this clipper!
|
||||
]]
|
||||
values {
|
||||
clipper: const(Efl.Canvas.Object); [[A clipper rectangle.]]
|
||||
|
|
|
@ -46,7 +46,7 @@ _efl_canvas_group_group_iterator_free(Efl_Object_Event_Grabber_Iterator *it)
|
|||
}
|
||||
|
||||
EOLIAN static Eina_Iterator*
|
||||
_efl_canvas_object_event_grabber_efl_canvas_group_group_children_iterate(const Eo *eo_obj, Efl_Object_Event_Grabber_Data *pd)
|
||||
_efl_canvas_object_event_grabber_efl_canvas_group_group_members_iterate(const Eo *eo_obj, Efl_Object_Event_Grabber_Data *pd)
|
||||
{
|
||||
Efl_Object_Event_Grabber_Iterator *it;
|
||||
|
||||
|
@ -66,6 +66,18 @@ _efl_canvas_object_event_grabber_efl_canvas_group_group_children_iterate(const E
|
|||
return &it->iterator;
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_canvas_object_event_grabber_efl_canvas_group_group_member_is(const Eo *eo_obj, Efl_Object_Event_Grabber_Data *pd EINA_UNUSED, const Eo *sub_obj)
|
||||
{
|
||||
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
||||
Evas_Object_Protected_Data *sub = efl_data_scope_safe_get(sub_obj, EFL_CANVAS_OBJECT_CLASS);
|
||||
|
||||
evas_object_async_block(obj);
|
||||
|
||||
if (!sub) return EINA_FALSE;
|
||||
return (sub->events->parent == eo_obj);
|
||||
}
|
||||
|
||||
static void
|
||||
_stacking_verify(Efl_Object_Event_Grabber_Data *pd, Evas_Object_Protected_Data *obj)
|
||||
{
|
||||
|
|
|
@ -36,7 +36,8 @@ class Efl.Canvas.Object.Event.Grabber (Efl.Canvas.Group)
|
|||
Efl.Object.destructor;
|
||||
Efl.Canvas.Group.group_member_add;
|
||||
Efl.Canvas.Group.group_member_del;
|
||||
Efl.Canvas.Group.group_children_iterate;
|
||||
Efl.Canvas.Group.group_member_is;
|
||||
Efl.Canvas.Group.group_members_iterate;
|
||||
Efl.Canvas.Group.group_calculate;
|
||||
Efl.Canvas.Group.group_change;
|
||||
Efl.Canvas.Group.group_need_recalculate { get; set; }
|
||||
|
|
|
@ -494,8 +494,9 @@ _efl_canvas_group_group_iterator_free(Evas_Object_Smart_Iterator *it)
|
|||
}
|
||||
|
||||
// Should we have an efl_children_iterator_new API and just inherit from it ?
|
||||
// No, because each hierarchy is different (Eo, Smart, Widget) -- jpeg
|
||||
EOLIAN static Eina_Iterator*
|
||||
_efl_canvas_group_group_children_iterate(const Eo *eo_obj, Evas_Smart_Data *priv)
|
||||
_efl_canvas_group_group_members_iterate(const Eo *eo_obj, Evas_Smart_Data *priv)
|
||||
{
|
||||
Evas_Object_Smart_Iterator *it;
|
||||
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
||||
|
@ -517,6 +518,18 @@ _efl_canvas_group_group_children_iterate(const Eo *eo_obj, Evas_Smart_Data *priv
|
|||
return &it->iterator;
|
||||
}
|
||||
|
||||
EOLIAN static Eina_Bool
|
||||
_efl_canvas_group_group_member_is(const Eo *eo_obj, Evas_Smart_Data *pd EINA_UNUSED, const Eo *sub_obj)
|
||||
{
|
||||
Evas_Object_Protected_Data *obj = efl_data_scope_get(eo_obj, EFL_CANVAS_OBJECT_CLASS);
|
||||
Evas_Object_Protected_Data *sub = efl_data_scope_safe_get(sub_obj, EFL_CANVAS_OBJECT_CLASS);
|
||||
|
||||
evas_object_async_block(obj);
|
||||
|
||||
if (!sub) return EINA_FALSE;
|
||||
return (sub->smart.parent == eo_obj);
|
||||
}
|
||||
|
||||
EAPI Eina_List*
|
||||
evas_object_smart_members_get(const Evas_Object *eo_obj)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue