1 /* 2 * Copyright © 2009-2018 Siyan Panayotov <contact@siyanpanayotov.com> 3 * 4 * Based on code by (see README for details): 5 * - Björn Lindqvist <bjourne@gmail.com> 6 * 7 * This file is part of Viewnior. 8 * 9 * Viewnior is free software: you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation, either version 3 of the License, or 12 * (at your option) any later version. 13 * 14 * Viewnior is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with Viewnior. If not, see <http://www.gnu.org/licenses/>. 21 */ 22 23 #ifndef __UNI_ANIM_VIEW_H__ 24 #define __UNI_ANIM_VIEW_H__ 25 26 #include "uni-image-view.h" 27 28 G_BEGIN_DECLS 29 #define UNI_TYPE_ANIM_VIEW (uni_anim_view_get_type ()) 30 #define UNI_ANIM_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNI_TYPE_ANIM_VIEW, UniAnimView)) 31 #define UNI_ANIM_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNI_TYPE_ANIM_VIEW, UniAnimViewClass)) 32 #define UNI_IS_ANIM_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNI_TYPE_ANIM_VIEW)) 33 #define UNI_IS_ANIM_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNI_TYPE_ANIM_VIEW)) 34 #define UNI_ANIM_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNI_TYPE_ANIM_VIEW, UniAnimViewClass)) 35 typedef struct _UniAnimView UniAnimView; 36 typedef struct _UniAnimViewClass UniAnimViewClass; 37 38 /** 39 * UniAnimView: 40 * 41 * UniAnimView is a subclass of #UniImageView that provies facilities 42 * for displaying and controlling an animation. 43 **/ 44 struct _UniAnimView { 45 UniImageView parent; 46 47 /* The current animation. */ 48 GdkPixbufAnimation *anim; 49 50 /* The iterator of the current animation. */ 51 GdkPixbufAnimationIter *iter; 52 53 /* ID of the currently running animation timer. */ 54 int timer_id; 55 56 /* Timer used to get the right frame. */ 57 GTimeVal time; 58 int delay; 59 60 }; 61 62 struct _UniAnimViewClass { 63 UniImageViewClass parent_class; 64 65 /* Keybinding signals. */ 66 void (*toggle_running) (UniAnimView * aview); 67 void (*step) (UniAnimView * aview); 68 }; 69 70 GType uni_anim_view_get_type (void) G_GNUC_CONST; 71 72 /* Constructors */ 73 GtkWidget *uni_anim_view_new (void); 74 75 /* Read-write properties */ 76 gboolean uni_anim_view_set_anim (UniAnimView * aview, 77 GdkPixbufAnimation * anim); 78 79 void uni_anim_view_set_static (UniAnimView * aview, 80 GdkPixbuf *anim); 81 82 void uni_anim_view_set_is_playing (UniAnimView * aview, 83 gboolean playing); 84 85 gboolean uni_anim_view_get_is_playing (UniAnimView * aview); 86 87 G_END_DECLS 88 #endif /* __UNI_ANIM_VIEW_H__ */ 89