GtkAnimView

## GtkAnimView GtkAnimView — Subclass of GtkImageView capable of playing GIF animations. |

## Synopsis

                        GtkAnimView;
    GtkWidget *         gtk_anim_view_new                   (void);
    GdkPixbufAnimation * gtk_anim_view_get_anim             (GtkAnimView *aview);
    void                gtk_anim_view_set_anim              (GtkAnimView *aview,
                                                             GdkPixbufAnimation *anim);
    void                gtk_anim_view_set_is_playing        (GtkAnimView *aview,
                                                             gboolean playing);
    gboolean            gtk_anim_view_get_is_playing        (GtkAnimView *aview);
    void                gtk_anim_view_step                  (GtkAnimView *aview);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkObject
                   +----GtkWidget
                         +----GtkImageView
                               +----GtkAnimView

## Implemented Interfaces

GtkAnimView implements AtkImplementorIface and GtkBuildable.

## Signals

      "step"                                           : Run Last / Action
      "toggle-running"                                 : Run Last / Action

## Description

GtkAnimView subclasses GtkImageView. It has the same look and feel as its parent but is also capable of displaying GIF animations.

### Keybindings

GtkAnimView uses a few more keybindings in addition to those used by GtkImageView:

Keys | Corresponding function | Description
--- | --- | ---
`GDK_p` | `gtk_anim_view_set_is_playing()` | Stops or resumes the running animation.
`GDK_j` | `gtk_anim_view_step()` | Steps the animation one frame forward.

## Details

### GtkAnimView

    typedef struct _GtkAnimView GtkAnimView;

GtkAnimView is a subclass of GtkImageView that provies facilities for displaying and controlling an animation.

### gtk_anim_view_new ()

    GtkWidget *         gtk_anim_view_new                   (void);

Creates a new GtkAnimView with default values. The default values are:

- anim : `NULL`
- is_playing : `FALSE`

Returns : | A new GtkAnimView.

### gtk_anim_view_get_anim ()

    GdkPixbufAnimation * gtk_anim_view_get_anim             (GtkAnimView *aview);

Returns the current animation of the view.

`aview` : | a GtkAnimView.
Returns : | the current animation

### gtk_anim_view_set_anim ()

    void                gtk_anim_view_set_anim              (GtkAnimView *aview,
                                                             GdkPixbufAnimation *anim);

Sets the pixbuf animation to play, or `NULL` to not play any animation.

If the animation is a static image or only has one frame, then the static image will be displayed instead. If more frames are loaded into the animation, then GtkAnimView will automatically animate to those frames.

The effect of this method is analoguous to `gtk_image_view_set_pixbuf()`. Fit mode is reset to `GTK_FIT_SIZE_IF_LARGER` so that the whole area of the animation fits in the view. Three signals are emitted, first the GtkImageView will emit ::zoom-changed and then ::pixbuf-changed, second, GtkAnimView itself will emit ::anim-changed.

The default pixbuf animation is `NULL`.

`aview` : | A GtkAnimView.
`anim` : | A pixbuf animation to play.

### gtk_anim_view_set_is_playing ()

    void                gtk_anim_view_set_is_playing        (GtkAnimView *aview,
                                                             gboolean playing);

Sets whether the animation should play or not. If there is no current animation this method does not have any effect.

`aview` : | a GtkImageView
`playing` : | `TRUE` to play the animation, `FALSE` otherwise

### gtk_anim_view_get_is_playing ()

    gboolean            gtk_anim_view_get_is_playing        (GtkAnimView *aview);

Returns whether the animation is playing or not. If there is no current animation, this method will always returns `FALSE`.

`aview` : | A GtkImageView.
Returns : | `TRUE` if an animation is playing, `FALSE` otherwise.

### gtk_anim_view_step ()

    void                gtk_anim_view_step                  (GtkAnimView *aview);

Steps the animation one frame forward. If the animation is playing it will be stopped. Will it wrap around if the animation is at its last frame?

`aview` : | A GtkImageView.

## Signal Details

### The `"step"` signal

    void                user_function                      (GtkAnimView *aview,
                                                            gpointer     user_data)      : Run Last / Action

Steps the animation one frame forward. If the animation is playing it will first be stopped. ::step is a keybinding signal emitted when `GDK_j` is pressed on the widget and should not be used by clients of this library.

`aview` : | a GtkAnimView
`user_data` : | user data set when the signal handler was connected.

### The `"toggle-running"` signal

    void                user_function                      (GtkAnimView *aview,
                                                            gpointer     user_data)      : Run Last / Action

Stops the animation if it was playing or resumes it, if it was playing. ::toggle-running is a keybinding signal emitted when `GDK_p` is pressed on the widget and should not be used by clients of this library.

`aview` : | a GtkAnimView
`user_data` : | user data set when the signal handler was connected.

## See Also

GtkImageView, The `./tests/ex-anim.c` program for an example of how this widget is used