efl_ui/image: implement required efl.player::playback_position methods

Reviewed-by: Cedric BAIL <cedric.bail@free.fr>
Differential Revision: https://phab.enlightenment.org/D10119
This commit is contained in:
Mike Blumenkrantz 2019-09-24 15:27:24 -04:00 committed by Cedric Bail
parent 189c9a16a4
commit e4ce41d6a6
4 changed files with 50 additions and 0 deletions

View File

@ -1809,6 +1809,30 @@ _efl_ui_image_efl_player_playing_get(const Eo *obj, Efl_Ui_Image_Data *sd)
return _efl_ui_image_animated_get_internal(obj, sd);
}
EOLIAN static void
_efl_ui_image_efl_player_playback_position_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd, double sec)
{
EINA_SAFETY_ON_TRUE_RETURN(sec < 0.0);
if (sd->edje)
efl_player_playback_position_set(sd->img, sec);
else if ((sd->frame_count > 0) && (sd->frame_duration > 0.0))
{
/* validate total animation time */
EINA_SAFETY_ON_TRUE_RETURN(sd->frame_count * sd->frame_duration < sec);
sd->cur_frame = lround(sec / sd->frame_duration);
}
}
EOLIAN static double
_efl_ui_image_efl_player_playback_position_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Data *sd)
{
if (sd->edje)
efl_player_playback_position_get(sd->img);
else if ((sd->frame_count > 0) && (sd->frame_duration > 0.0))
return sd->cur_frame * sd->frame_duration;
return 0.0;
}
static Eina_Bool
_efl_ui_image_animated_paused_set_internal(Eo *obj, Efl_Ui_Image_Data *sd, Eina_Bool paused)
{

View File

@ -100,6 +100,7 @@ class Efl.Ui.Image extends Efl.Ui.Widget implements Efl.Input.Clickable, Efl.Ui.
Efl.Playable.playable { get; }
Efl.Player.playing { get; set; }
Efl.Player.paused { get; set; }
Efl.Player.playback_position { get; set; }
Efl.Layout.Signal.signal_emit;
Efl.Layout.Signal.message_send;
Efl.Layout.Signal.signal_callback_add;

View File

@ -3126,6 +3126,30 @@ _efl_ui_image_zoomable_efl_player_paused_get(const Eo *obj EINA_UNUSED, Efl_Ui_I
return sd->paused;
}
EOLIAN static void
_efl_ui_image_zoomable_efl_player_playback_position_set(Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd, double sec)
{
EINA_SAFETY_ON_TRUE_RETURN(sec < 0.0);
if (sd->edje)
efl_player_playback_position_set(sd->edje, sec);
else if ((sd->frame_count > 0) && (sd->frame_duration > 0.0))
{
/* validate total animation time */
EINA_SAFETY_ON_TRUE_RETURN(sd->frame_count * sd->frame_duration < sec);
sd->cur_frame = lround(sec / sd->frame_duration);
}
}
EOLIAN static double
_efl_ui_image_zoomable_efl_player_playback_position_get(const Eo *obj EINA_UNUSED, Efl_Ui_Image_Zoomable_Data *sd)
{
if (sd->edje)
efl_player_playback_position_get(sd->edje);
else if ((sd->frame_count > 0) && (sd->frame_duration > 0.0))
return sd->cur_frame * sd->frame_duration;
return 0.0;
}
EOLIAN static void
_efl_ui_image_zoomable_class_constructor(Efl_Class *klass EINA_UNUSED)
{

View File

@ -46,6 +46,7 @@ class @beta Efl.Ui.Image_Zoomable extends Efl.Ui.Image implements Efl.Ui.Zoom
Efl.Playable.playable { get; }
Efl.Player.playing { get; set; }
Efl.Player.paused { get; set; }
Efl.Player.playback_position { get; set; }
Efl.Ui.Zoom.zoom_animation { set; get; }
Efl.Ui.Zoom.zoom_level { set; get; }
Efl.Ui.Zoom.zoom_mode { set; get; }