1 // ======================================================================== 2 // gnubiff -- a mail notification program 3 // Copyright (c) 2000-2007 Nicolas Rougier, 2004-2007 Robert Sowada 4 // 5 // This program is free software: you can redistribute it and/or 6 // modify it under the terms of the GNU General Public License as 7 // published by the Free Software Foundation, either version 3 of the 8 // License, or (at your option) any later version. 9 // 10 // This program is distributed in the hope that it will be useful, but 11 // WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 // General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with this program. If not, see <http://www.gnu.org/licenses/>. 17 // ======================================================================== 18 // 19 // File : $RCSfile: gtk_image_animation.h,v $ 20 // Revision : $Revision: 1.4.2.2 $ 21 // Revision date : $Date: 2007/09/08 18:06:30 $ 22 // Author(s) : Nicolas Rougier, Robert Sowada 23 // Short : 24 // 25 // This file is part of gnubiff. 26 // 27 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- 28 // ======================================================================== 29 30 #ifndef __GTK_IMAGE_ANIMATION_H__ 31 #define __GTK_IMAGE_ANIMATION_H__ 32 33 #ifdef HAVE_CONFIG_H 34 # include <config.h> 35 #endif 36 #include <string> 37 #include <vector> 38 #include <gtk/gtk.h> 39 40 41 class GtkImageAnimation { 42 43 protected: 44 std::string _filename; 45 GtkImage * _image; 46 GdkPixbufAnimation * _animation; 47 GdkPixbuf * _original_pixbuf; 48 GdkPixbuf * _scaled_pixbuf; 49 std::vector<GdkPixbuf *> _frame; 50 gint _current; 51 guint _original_width; 52 guint _original_height; 53 guint _scaled_width; 54 guint _scaled_height; 55 gint _timetag; 56 guint _speed; 57 GMutex * _object_mutex; 58 59 60 public: 61 /** 62 * Base 63 **/ 64 GtkImageAnimation (GtkImage *image); 65 ~GtkImageAnimation (void); 66 67 /** 68 * Misc. 69 **/ 70 gboolean open (std::string filename); 71 void resize (guint width, guint height, gboolean locked=false); 72 void start (void); 73 void stop (void); 74 75 /** 76 * Access 77 **/ attach(GtkImage * image)78 void attach (GtkImage *image) {_image = image;} filename(void)79 std::string filename (void) {return _filename;} original_width(void)80 guint original_width (void) {return _original_width;} original_height(void)81 guint original_height (void) {return _original_height;} scaled_width(void)82 guint scaled_width (void) {return _scaled_width;} scaled_height(void)83 guint scaled_height (void) {return _scaled_height;} 84 85 86 /** 87 * Callbacks 88 **/ 89 gboolean timeout (void); 90 gboolean on_delete (void); 91 gboolean on_destroy (void); 92 void on_show (void); 93 void on_hide (void); 94 private: 95 gboolean is_animation (void); 96 }; 97 98 #endif 99