Fawkes API  Fawkes Development Version
throbber.h
00001 
00002 /***************************************************************************
00003  *  throbber.h - Fawkes throbber
00004  *
00005  *  Created: Tue Nov 04 16:36:38 2008
00006  *  Copyright  2008  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 #ifndef __LIBS_GUI_UTILS_THROBBER_H_
00025 #define __LIBS_GUI_UTILS_THROBBER_H_
00026 
00027 #include <gtkmm.h>
00028 #ifdef HAVE_GLADEMM
00029 #  include <libglademm/xml.h>
00030 #endif
00031 
00032 namespace fawkes {
00033 
00034 class Throbber : public Gtk::Image
00035 {
00036  public:
00037   Throbber(Gtk::IconSize &icon_size);
00038 #ifdef HAVE_GLADEMM
00039   Throbber(BaseObjectType* cobject,
00040            const Glib::RefPtr<Gnome::Glade::Xml>& ref_glade);
00041 #endif
00042 
00043   void set_timeout(unsigned int timeout);
00044 
00045   bool anim_running();
00046 
00047   void start_anim();
00048   void stop_anim();
00049 
00050   void set_stock(const Gtk::StockID& stock_id);
00051 
00052  private:
00053   void ctor(Gtk::IconSize icon_size);
00054   bool draw_next();
00055 
00056  private:
00057   unsigned int __current;
00058   std::vector<Glib::RefPtr<Gdk::Pixbuf> > __pixbufs;
00059   Gtk::IconSize __icon_size;
00060 
00061   sigc::connection __timeout_connection;
00062   unsigned int __timeout;
00063 };
00064 
00065 } // end namespace fawkes
00066 
00067 #endif