forked from enlightenment/efl
Edje: Adapt to Efl.Container
This basically renames swallow into content.
This commit is contained in:
parent
d962705e41
commit
e1092b84eb
|
@ -228,6 +228,67 @@ Edje object
|
|||
*/
|
||||
EAPI Eina_Bool edje_object_mmap_set(Edje_Object *obj, const Eina_File *file, const char *group);
|
||||
|
||||
/**
|
||||
* @brief "Swallows" an object into one of the Edje object @c SWALLOW parts.
|
||||
*
|
||||
* Swallowing an object into an Edje object is, for a given part of type
|
||||
* @c SWALLOW in the EDC group which gave life to obj, to set an external
|
||||
* object to be controlled by obj, being displayed exactly over that part's
|
||||
* region inside the whole Edje object's viewport.
|
||||
*
|
||||
* From this point on, obj will have total control over obj_swallow's geometry
|
||||
* and visibility. For instance, if obj is visible, as in @ref
|
||||
* evas_object_show(), the swallowed object will be visible too -- if the given
|
||||
* @c SWALLOW part it's in is also visible. Other actions on obj will also
|
||||
* reflect on the swallowed object as well (e.g. resizing, moving,
|
||||
* raising/lowering, etc.).
|
||||
*
|
||||
* Finally, all internal changes to part, specifically, will reflect on the
|
||||
* displaying of obj_swallow, for example state changes leading to different
|
||||
* visibility states, geometries, positions, etc.
|
||||
*
|
||||
* If an object has already been swallowed into this part, then it will first
|
||||
* be unswallowed (as in edje_object_part_unswallow()) before the new object is
|
||||
* swallowed.
|
||||
*
|
||||
* @note obj won't delete the swallowed object once it is deleted --
|
||||
* obj_swallow will get to an unparented state again.
|
||||
*
|
||||
* For more details on EDC @c SWALLOW parts, see @ref edcref "syntax
|
||||
* reference".
|
||||
*
|
||||
* @param[in] obj_swallow The object to occupy that part
|
||||
*
|
||||
* @ingroup Edje_Object
|
||||
*/
|
||||
EAPI Eina_Bool edje_object_part_swallow(Edje_Object *obj, const char *part, Evas_Object *obj_swallow);
|
||||
|
||||
/**
|
||||
* @brief Get the object currently swallowed by a part.
|
||||
*
|
||||
* @param[in] part The part name
|
||||
*
|
||||
* @return The swallowed object, or @c null if there is none.
|
||||
*
|
||||
* @ingroup Edje_Object
|
||||
*/
|
||||
EAPI Evas_Object *edje_object_part_swallow_get(const Edje_Object *obj, const char *part);
|
||||
|
||||
/**
|
||||
* @brief Unswallow an object.
|
||||
*
|
||||
* Causes the edje to regurgitate a previously swallowed object. :)
|
||||
*
|
||||
* @note obj_swallow will not be deleted or hidden. Note: obj_swallow may
|
||||
* appear shown on the evas depending on its state when it got unswallowed.
|
||||
* Make sure you delete it or hide it if you do not want it to.
|
||||
*
|
||||
* @param[in] obj_swallow The swallowed object
|
||||
*
|
||||
* @ingroup Edje_Object
|
||||
*/
|
||||
EAPI void edje_object_part_unswallow(Edje_Object *obj, Evas_Object *obj_swallow);
|
||||
|
||||
|
||||
#include "edje_object.eo.legacy.h"
|
||||
#include "edje_edit.eo.legacy.h"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import edje_types;
|
||||
|
||||
class Edje.Object (Evas.Smart_Clipped, Efl.File)
|
||||
class Edje.Object (Evas.Smart_Clipped, Efl.File, Efl.Container)
|
||||
{
|
||||
legacy_prefix: edje_object;
|
||||
eo_prefix: edje_obj;
|
||||
|
@ -1408,19 +1408,6 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File)
|
|||
@in part: const(char)*; [[The part name]]
|
||||
}
|
||||
}
|
||||
part_unswallow {
|
||||
[[Unswallow an object.
|
||||
|
||||
Causes the edje to regurgitate a previously swallowed object. :)
|
||||
|
||||
Note: obj_swallow will not be deleted or hidden.
|
||||
Note: obj_swallow may appear shown on the evas depending on its state when
|
||||
it got unswallowed. Make sure you delete it or hide it if you do not want it to.]]
|
||||
|
||||
params {
|
||||
@in obj_swallow: Evas.Object *; [[The swallowed object]]
|
||||
}
|
||||
}
|
||||
part_text_prediction_allow_set {
|
||||
[[Set whether the prediction is allowed or not.
|
||||
|
||||
|
@ -1543,14 +1530,6 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File)
|
|||
|
||||
return: int; [[The frozen state or 0 if the object is not frozen or on error.]]
|
||||
}
|
||||
part_swallow_get @const {
|
||||
[[Get the object currently swallowed by a part.]]
|
||||
|
||||
return: Evas.Object *; [[The swallowed object, or $null if there is none.]]
|
||||
params {
|
||||
@in part: const(char)*; [[The part name]]
|
||||
}
|
||||
}
|
||||
part_text_imf_context_reset @const {
|
||||
[[Reset the input method context if needed.
|
||||
|
||||
|
@ -2168,44 +2147,6 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File)
|
|||
@in part: const(char)*; [[The part name]]
|
||||
}
|
||||
}
|
||||
part_swallow {
|
||||
[["Swallows" an object into one of the Edje object $SWALLOW
|
||||
parts.
|
||||
|
||||
Swallowing an object into an Edje object is, for a given part of
|
||||
type $SWALLOW in the EDC group which gave life to obj, to set
|
||||
an external object to be controlled by obj, being displayed
|
||||
exactly over that part's region inside the whole Edje object's
|
||||
viewport.
|
||||
|
||||
From this point on, obj will have total control over
|
||||
obj_swallow's geometry and visibility. For instance, if obj is
|
||||
visible, as in \@ref evas_object_show(), the swallowed object will be
|
||||
visible too -- if the given $SWALLOW part it's in is also visible.
|
||||
Other actions on obj will also reflect on the swallowed object as
|
||||
well (e.g. resizing, moving, raising/lowering, etc.).
|
||||
|
||||
Finally, all internal changes to part, specifically, will
|
||||
reflect on the displaying of obj_swallow, for example state
|
||||
changes leading to different visibility states, geometries,
|
||||
positions, etc.
|
||||
|
||||
If an object has already been swallowed into this part, then it
|
||||
will first be unswallowed (as in edje_object_part_unswallow())
|
||||
before the new object is swallowed.
|
||||
|
||||
Note: obj won't delete the swallowed object once it is
|
||||
deleted -- obj_swallow will get to an unparented state again.
|
||||
|
||||
For more details on EDC $SWALLOW parts, see \@ref edcref "syntax
|
||||
reference".]]
|
||||
|
||||
return: bool;
|
||||
params {
|
||||
@in part: const(char)*; [[The swallow part's name]]
|
||||
@in obj_swallow: Evas.Object *; [[The object to occupy that part]]
|
||||
}
|
||||
}
|
||||
@property transition_duration_factor {
|
||||
set {
|
||||
[[Set transition duration factor.
|
||||
|
@ -2243,6 +2184,10 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File)
|
|||
Efl.File.file.get;
|
||||
Efl.File.mmap.set;
|
||||
Efl.File.mmap.get;
|
||||
Efl.Container.content.set;
|
||||
Efl.Container.content.get;
|
||||
Efl.Container.content_unset; /* swallow NULL */
|
||||
Efl.Container.content_remove; /* unswallow */
|
||||
}
|
||||
events {
|
||||
recalc; [[Edje re-calculated the object.]]
|
||||
|
|
|
@ -3502,7 +3502,8 @@ _edje_object_text_markup_filter_callback_del_full(Eo *obj EINA_UNUSED, Edje *ed,
|
|||
}
|
||||
|
||||
EOLIAN Eina_Bool
|
||||
_edje_object_part_swallow(Eo *obj EINA_UNUSED, Edje *ed, const char *part, Evas_Object *obj_swallow)
|
||||
_edje_object_efl_container_content_set(Eo *obj EINA_UNUSED, Edje *ed,
|
||||
const char *part, Efl_Gfx_Base *obj_swallow)
|
||||
{
|
||||
Edje_Real_Part *rp, *rpcur;
|
||||
Edje_User_Defined *eud = NULL;
|
||||
|
@ -3800,7 +3801,7 @@ edje_box_layout_register(const char *name, Evas_Object_Box_Layout func, void *(*
|
|||
}
|
||||
|
||||
EOLIAN void
|
||||
_edje_object_part_unswallow(Eo *obj EINA_UNUSED, Edje *ed, Evas_Object *obj_swallow)
|
||||
_edje_object_efl_container_content_remove(Eo *obj EINA_UNUSED, Edje *ed, Evas_Object *obj_swallow)
|
||||
{
|
||||
Edje_Real_Part *rp;
|
||||
|
||||
|
@ -3861,8 +3862,8 @@ _edje_object_part_unswallow(Eo *obj EINA_UNUSED, Edje *ed, Evas_Object *obj_swal
|
|||
}
|
||||
}
|
||||
|
||||
EOLIAN Evas_Object *
|
||||
_edje_object_part_swallow_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part)
|
||||
EOLIAN Efl_Gfx_Base *
|
||||
_edje_object_efl_container_content_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part)
|
||||
{
|
||||
Edje_Real_Part *rp;
|
||||
|
||||
|
@ -3879,6 +3880,17 @@ _edje_object_part_swallow_get(Eo *obj EINA_UNUSED, Edje *ed, const char *part)
|
|||
return rp->typedata.swallow->swallowed_object;
|
||||
}
|
||||
|
||||
EOLIAN Eina_Bool
|
||||
_edje_object_efl_container_content_unset(Eo *obj, Edje *ed EINA_UNUSED, const char *part)
|
||||
{
|
||||
Efl_Gfx_Base *content;
|
||||
|
||||
content = efl_content_get(obj, part);
|
||||
if (!content) return EINA_TRUE;
|
||||
|
||||
return efl_content_remove(obj, content);
|
||||
}
|
||||
|
||||
EOLIAN void
|
||||
_edje_object_size_min_get(Eo *obj EINA_UNUSED, Edje *ed, Evas_Coord *minw, Evas_Coord *minh)
|
||||
{
|
||||
|
@ -6670,4 +6682,24 @@ _edje_part_mask_flags_set(Edje *ed EINA_UNUSED, Edje_Real_Part *rp, Evas_Event_F
|
|||
rp->part->mask_flags = mask_flags;
|
||||
}
|
||||
|
||||
/* Legacy APIs */
|
||||
|
||||
EAPI Eina_Bool
|
||||
edje_object_part_swallow(Edje_Object *obj, const char *part, Evas_Object *obj_swallow)
|
||||
{
|
||||
return efl_content_set(obj, part, obj_swallow);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
edje_object_part_unswallow(Edje_Object *obj, Evas_Object *obj_swallow)
|
||||
{
|
||||
efl_content_remove(obj, obj_swallow);
|
||||
}
|
||||
|
||||
EAPI Evas_Object *
|
||||
edje_object_part_swallow_get(const Edje_Object *obj, const char *part)
|
||||
{
|
||||
return efl_content_get(obj, part);
|
||||
}
|
||||
|
||||
/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/
|
||||
|
|
|
@ -34,6 +34,13 @@ interface Efl.Container (Efl.Gfx.Base)
|
|||
}
|
||||
return: Efl.Gfx.Base*;
|
||||
}
|
||||
content_remove {
|
||||
[[Unswallow an object from this container.]]
|
||||
params {
|
||||
@in content: Efl.Gfx.Base*;
|
||||
}
|
||||
return: bool; [[$false if $content was not a child or can not be removed.]]
|
||||
}
|
||||
content_iterate {
|
||||
[[Begin iterating over this object's contents.]]
|
||||
return: free(own(iterator<Efl.Gfx.Base *> *), eina_iterator_free) @warn_unused;
|
||||
|
|
|
@ -362,17 +362,48 @@ START_TEST(edje_test_swallows)
|
|||
|
||||
|
||||
o1 = eo_add(EDJE_OBJECT_CLASS, ly);
|
||||
fail_if(!edje_obj_part_swallow(ly, "swallow", o1));
|
||||
fail_if(!edje_object_part_swallow(ly, "swallow", o1));
|
||||
ck_assert_ptr_eq(eo_parent_get(o1), ly);
|
||||
|
||||
edje_obj_part_unswallow(ly, o1);
|
||||
edje_object_part_unswallow(ly, o1);
|
||||
ck_assert_ptr_eq(eo_parent_get(o1), evas_common_evas_get(o1));
|
||||
|
||||
fail_if(!edje_obj_part_swallow(ly, "swallow", o1));
|
||||
fail_if(!edje_object_part_swallow(ly, "swallow", o1));
|
||||
ck_assert_ptr_eq(eo_parent_get(o1), ly);
|
||||
|
||||
o2 = eo_add(EDJE_OBJECT_CLASS, ly);
|
||||
fail_if(!edje_obj_part_swallow(ly, "swallow", o2));
|
||||
fail_if(!edje_object_part_swallow(ly, "swallow", o2));
|
||||
ck_assert_ptr_eq(eo_parent_get(o2), ly);
|
||||
/* o1 is deleted at this point. */
|
||||
ck_assert_ptr_eq(eo_parent_get(o1), evas_common_evas_get(o1));
|
||||
|
||||
EDJE_TEST_FREE_EVAS();
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(edje_test_swallows_eoapi)
|
||||
{
|
||||
Evas *evas = EDJE_TEST_INIT_EVAS();
|
||||
Evas_Object *ly, *o1, *o2;
|
||||
|
||||
ly = eo_add(EDJE_OBJECT_CLASS, evas);
|
||||
fail_unless(edje_object_file_set(ly, test_layout_get("test_swallows.edj"), "test_group"));
|
||||
|
||||
fail_unless(edje_object_part_exists(ly, "swallow"));
|
||||
|
||||
|
||||
o1 = eo_add(EDJE_OBJECT_CLASS, ly);
|
||||
fail_if(!efl_content_set(ly, "swallow", o1));
|
||||
ck_assert_ptr_eq(eo_parent_get(o1), ly);
|
||||
|
||||
efl_content_remove(ly, o1);
|
||||
ck_assert_ptr_eq(eo_parent_get(o1), evas_common_evas_get(o1));
|
||||
|
||||
fail_if(!efl_content_set(ly, "swallow", o1));
|
||||
ck_assert_ptr_eq(eo_parent_get(o1), ly);
|
||||
|
||||
o2 = eo_add(EDJE_OBJECT_CLASS, ly);
|
||||
fail_if(!efl_content_set(ly, "swallow", o2));
|
||||
ck_assert_ptr_eq(eo_parent_get(o2), ly);
|
||||
/* o1 is deleted at this point. */
|
||||
ck_assert_ptr_eq(eo_parent_get(o1), evas_common_evas_get(o1));
|
||||
|
@ -434,5 +465,6 @@ void edje_test_edje(TCase *tc)
|
|||
tcase_add_test(tc, edje_test_size_class);
|
||||
tcase_add_test(tc, edje_test_color_class);
|
||||
tcase_add_test(tc, edje_test_swallows);
|
||||
tcase_add_test(tc, edje_test_swallows_eoapi);
|
||||
tcase_add_test(tc, edje_test_box);
|
||||
}
|
||||
|
|
|
@ -353,11 +353,11 @@ video_obj_frame_resize_cb(void *data, const Eo_Event *event)
|
|||
printf("HANDLE %ix%i @ %3.3f\n", iw, ih, ratio);
|
||||
if (ratio > 0.0) iw = (ih * ratio) + 0.5;
|
||||
evas_object_size_hint_min_set(event->obj, iw, ih);
|
||||
edje_obj_part_swallow(oe, "video_swallow", event->obj);
|
||||
edje_object_part_swallow(oe, "video_swallow", event->obj);
|
||||
edje_obj_size_min_calc(oe, &w, &h);
|
||||
efl_gfx_size_set(oe, w, h);
|
||||
evas_obj_size_hint_min_set(event->obj, 0, 0);
|
||||
edje_obj_part_swallow(oe, "video_swallow", event->obj);
|
||||
evas_object_size_hint_min_set(event->obj, 0, 0);
|
||||
edje_object_part_swallow(oe, "video_swallow", event->obj);
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
@ -643,7 +643,7 @@ init_video_object(const char *module_filename, const char *filename)
|
|||
eo_event_callback_add(oe, EVAS_OBJECT_EVENT_FREE, _oe_free_cb, fd);
|
||||
eo_key_data_set(oe, "frame_data", fd);
|
||||
efl_file_set(oe, theme_file, reflex ? "video_controller/reflex" : "video_controller");
|
||||
edje_obj_part_swallow(oe, "video_swallow", o);
|
||||
edje_object_part_swallow(oe, "video_swallow", o);
|
||||
|
||||
offset = 20 * (eina_list_count(video_objs) - 1);
|
||||
efl_gfx_position_set(oe, offset, offset);
|
||||
|
|
Loading…
Reference in New Issue