forked from enlightenment/efl
elementary/transit - added elm_transit_objects_prop_hold_disabled_set/get APIs.
These APIs provide options to user to set the properties of the transit objects will be rest or not when the transition ends. The properties include geometry, color, evas_map data.. SVN revision: 57498
This commit is contained in:
parent
f522b7385c
commit
66e21b839c
|
@ -2525,6 +2525,8 @@ extern "C" {
|
|||
EAPI void elm_transit_object_add(Elm_Transit *transit, Evas_Object *obj) EINA_ARG_NONNULL(1, 2);
|
||||
EAPI void elm_transit_object_remove(Elm_Transit *transit, Evas_Object *obj) EINA_ARG_NONNULL(1, 2);
|
||||
EAPI const Eina_List *elm_transit_objects_get(const Elm_Transit *transit) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_transit_objects_prop_hold_disabled_set(Elm_Transit *transit, Eina_Bool disabled) EINA_ARG_NONNULL(1);
|
||||
EAPI Eina_Bool elm_transit_objects_prop_hold_disabled_get(const Elm_Transit *transit) EINA_ARG_NONNULL(1);
|
||||
EINA_DEPRECATED EAPI void elm_transit_event_block_set(Elm_Transit *transit, Eina_Bool disabled) EINA_ARG_NONNULL(1);
|
||||
EINA_DEPRECATED EAPI Eina_Bool elm_transit_event_block_get(const Elm_Transit *transit) EINA_ARG_NONNULL(1);
|
||||
EAPI void elm_transit_event_enabled_set(Elm_Transit *transit, Eina_Bool enabled) EINA_ARG_NONNULL(1);
|
||||
|
|
|
@ -83,6 +83,7 @@ struct _Elm_Transit
|
|||
Eina_Bool auto_reverse : 1;
|
||||
Eina_Bool event_enabled : 1;
|
||||
Eina_Bool deleted : 1;
|
||||
Eina_Bool prop_hold_disabled : 1;
|
||||
};
|
||||
|
||||
struct _Elm_Transit_Effect
|
||||
|
@ -93,22 +94,58 @@ struct _Elm_Transit_Effect
|
|||
Eina_Bool deleted : 1;
|
||||
};
|
||||
|
||||
struct _Elm_Obj_Prop
|
||||
{
|
||||
Evas_Coord x, y, w, h;
|
||||
int r,g,b,a;
|
||||
Evas_Map *map;
|
||||
Eina_Bool map_enabled : 1;
|
||||
Eina_Bool visible : 1;
|
||||
};
|
||||
|
||||
struct _Elm_Obj_Data
|
||||
{
|
||||
Elm_Transit *transit;
|
||||
struct _Elm_Obj_Prop *prop;
|
||||
Eina_Bool pass_events : 1;
|
||||
};
|
||||
|
||||
typedef struct _Elm_Transit_Effect Elm_Transit_Effect;
|
||||
typedef struct _Elm_Obj_Data Elm_Obj_Data;
|
||||
typedef struct _Elm_Obj_Prop Elm_Obj_Prop;
|
||||
|
||||
static void
|
||||
_elm_transit_objs_prop_save(Elm_Transit *transit)
|
||||
{
|
||||
Eina_List *list;
|
||||
Evas_Object *obj;
|
||||
Elm_Obj_Data *obj_data;
|
||||
Elm_Obj_Prop *prop;
|
||||
|
||||
EINA_LIST_FOREACH(transit->objs, list, obj)
|
||||
{
|
||||
obj_data = evas_object_data_get(obj, _transit_key);
|
||||
if (!obj_data) continue;
|
||||
prop = calloc(1, sizeof(Elm_Obj_Prop));
|
||||
if (!prop) continue;
|
||||
evas_object_geometry_get(obj, &prop->x, &prop->y, &prop->w, &prop->h);
|
||||
evas_object_color_get(obj, &prop->r, &prop->g, &prop->b, &prop->a);
|
||||
prop->visible = evas_object_visible_get(obj);
|
||||
prop->map_enabled = evas_object_map_enable_get(obj);
|
||||
if (evas_object_map_get(obj))
|
||||
prop->map = evas_map_dup(evas_object_map_get(obj));
|
||||
obj_data->prop = prop;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_elm_transit_object_remove_cb(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
|
||||
{
|
||||
Elm_Transit *transit = data;
|
||||
|
||||
Elm_Obj_Data *obj_data = evas_object_data_del(obj, _transit_key);
|
||||
evas_object_pass_events_set(obj, obj_data->pass_events);
|
||||
if (obj_data->prop)
|
||||
free(obj_data->prop);
|
||||
free(obj_data);
|
||||
transit->objs = eina_list_remove(transit->objs, obj);
|
||||
if (!transit->objs) elm_transit_del(transit);
|
||||
|
@ -118,8 +155,26 @@ static void
|
|||
_elm_transit_object_remove(Elm_Transit *transit, Evas_Object *obj)
|
||||
{
|
||||
Elm_Obj_Data *obj_data = evas_object_data_del(obj, _transit_key);
|
||||
Elm_Obj_Prop *prop = obj_data->prop;
|
||||
|
||||
evas_object_pass_events_set(obj, obj_data->pass_events);
|
||||
|
||||
//recover the properties of the object.
|
||||
if (prop)
|
||||
{
|
||||
evas_object_move(obj, prop->x, prop->y);
|
||||
evas_object_resize(obj, prop->w, prop->h);
|
||||
evas_object_color_set(obj, prop->r, prop->g, prop->b, prop->a);
|
||||
if (prop->visible) evas_object_show(obj);
|
||||
else evas_object_hide(obj);
|
||||
if (prop->map_enabled)
|
||||
evas_object_map_enable_set(obj, EINA_TRUE);
|
||||
else
|
||||
evas_object_map_enable_set(obj, EINA_FALSE);
|
||||
if (prop->map)
|
||||
evas_object_map_set(obj, prop->map);
|
||||
free(prop);
|
||||
}
|
||||
free(obj_data);
|
||||
transit->objs = eina_list_remove(transit->objs, obj);
|
||||
evas_object_event_callback_del(obj, EVAS_CALLBACK_DEL,
|
||||
|
@ -798,6 +853,9 @@ elm_transit_go(Elm_Transit *transit)
|
|||
if (transit->animator)
|
||||
ecore_animator_del(transit->animator);
|
||||
|
||||
if (transit->prop_hold_disabled)
|
||||
_elm_transit_objs_prop_save(transit);
|
||||
|
||||
transit->time.paused = 0;
|
||||
transit->time.delayed = 0;
|
||||
transit->time.begin = ecore_loop_time_get();
|
||||
|
@ -881,6 +939,47 @@ elm_transit_progress_value_get(const Elm_Transit *transit)
|
|||
return transit->progress;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/disable holding up the objects properties.
|
||||
* If it is disabled, the objects properties will be reset when transition ends.
|
||||
*
|
||||
* @note @p transit can not be NULL.
|
||||
* @note These properties include geometry, color, map data.
|
||||
*
|
||||
* @param transit The transit object.
|
||||
* @param disabled Disable or enable.
|
||||
*
|
||||
* @ingroup Transit
|
||||
*/
|
||||
EAPI void
|
||||
elm_transit_objects_prop_hold_disabled_set(Elm_Transit *transit, Eina_Bool disabled)
|
||||
{
|
||||
ELM_TRANSIT_CHECK_OR_RETURN(transit);
|
||||
if (transit->prop_hold_disabled == disabled) return;
|
||||
if (transit->animator) return;
|
||||
transit->prop_hold_disabled = !!disabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value whether the objects properties will be reset or not.
|
||||
*
|
||||
* @note @p transit can not be NULL
|
||||
*
|
||||
* @see elm_transit_objects_prop_hold_disabled_set()
|
||||
*
|
||||
* @param transit The transit object.
|
||||
* @return EINA_TRUE means the properties of the objects will be reset.
|
||||
* If @p transit is NULL, EINA_FALSE is returned
|
||||
|
||||
* @ingroup Transit
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
elm_transit_objects_prop_hold_disabled_get(const Elm_Transit *transit)
|
||||
{
|
||||
ELM_TRANSIT_CHECK_OR_RETURN(transit, EINA_FALSE);
|
||||
return transit->prop_hold_disabled;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//Resizing FX
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue