Edje_Edit: new API to insert tween into specified place
> edje_edit_state_tween_insert_at
This commit is contained in:
parent
475496cb96
commit
e2051e334b
|
@ -5462,6 +5462,22 @@ EAPI Eina_List * edje_edit_state_tweens_list_get(Evas_Object *obj, const char *p
|
|||
*/
|
||||
EAPI Eina_Bool edje_edit_state_tween_add(Evas_Object *obj, const char *part, const char *state, double value, const char *tween);
|
||||
|
||||
/** Insert a new tween frame to the given part state into a specific place.
|
||||
*
|
||||
* The tween param must be the name of an existing image.
|
||||
*
|
||||
* @param obj Object being edited.
|
||||
* @param part Part that contain state.
|
||||
* @param state The name of the state to add a new tween frame (not including the state value).
|
||||
* @param value The state value.
|
||||
* @param tween The name of the image to add.
|
||||
* @param place Place to be added. It can't be less than 0 or more than current size of tweens.
|
||||
*
|
||||
* @return @c EINA_TRUE in case of success, @c EINA_FALSE otherwise.
|
||||
*/
|
||||
EAPI Eina_Bool
|
||||
edje_edit_state_tween_insert_at(Evas_Object *obj, const char *part, const char *state, double value, const char *tween, int place);
|
||||
|
||||
/** Remove the first tween with the given name.
|
||||
*
|
||||
* The image is not removed from the edje.
|
||||
|
|
|
@ -8733,6 +8733,54 @@ edje_edit_state_tween_add(Evas_Object *obj, const char *part, const char *state,
|
|||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
edje_edit_state_tween_insert_at(Evas_Object *obj, const char *part, const char *state, double value, const char *tween, int place)
|
||||
{
|
||||
Edje_Part_Description_Image *img;
|
||||
Edje_Part_Image_Id **tmp;
|
||||
Edje_Part_Image_Id *i;
|
||||
int id;
|
||||
unsigned int j;
|
||||
|
||||
if (place < 0)
|
||||
return EINA_FALSE;
|
||||
|
||||
GET_PD_OR_RETURN(EINA_FALSE);
|
||||
|
||||
if (rp->part->type != EDJE_PART_TYPE_IMAGE)
|
||||
return EINA_FALSE;
|
||||
|
||||
id = _edje_image_id_find(eed, tween);
|
||||
if (id < EINA_FALSE) return 0;
|
||||
|
||||
/* alloc Edje_Part_Image_Id */
|
||||
i = _alloc(sizeof(Edje_Part_Image_Id));
|
||||
if (!i) return EINA_FALSE;
|
||||
i->id = id;
|
||||
|
||||
img = (Edje_Part_Description_Image *)pd;
|
||||
|
||||
if ((unsigned)place > img->image.tweens_count)
|
||||
return EINA_FALSE;
|
||||
|
||||
/* add to tween list */
|
||||
tmp = realloc(img->image.tweens,
|
||||
sizeof(Edje_Part_Image_Id *) * (img->image.tweens_count + 1));
|
||||
if (!tmp)
|
||||
{
|
||||
free(i);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
img->image.tweens_count++;
|
||||
for (j = img->image.tweens_count - 1; j > (unsigned)place; j--)
|
||||
tmp[j] = tmp[j - 1];
|
||||
tmp[place] = i;
|
||||
img->image.tweens = tmp;
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
EAPI Eina_Bool
|
||||
edje_edit_state_tween_del(Evas_Object *obj, const char *part, const char *state, double value, const char *tween)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue