00001 /*************************************************************************** 00002 * Copyright (C) 2004,2010 by Rick L. Vinyard, Jr. * 00003 * rvinyard@cs.nmsu.edu * 00004 * * 00005 * This file is part of the papyrus library. * 00006 * * 00007 * papyrus is free software; you can redistribute it and/or modify * 00008 * it under the terms of the GNU Lesser General Public License * 00009 * version 3.0 as published by the Free Software Foundation. * 00010 * * 00011 * papyrus is distributed in the hope that it will be useful, * 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00014 * GNU Lesser General Public License version 3.0 for more details. * 00015 * * 00016 * You should have received a copy of the GNU Lesser General Public * 00017 * License along with the papyrus library. If not, see * 00018 * <http://www.gnu.org/licenses/>. * 00019 ***************************************************************************/ 00020 #ifndef PAPYRUSFLASHER_H 00021 #define PAPYRUSFLASHER_H 00022 00023 #include <set> 00024 00025 #include <papyrus/animator.h> 00026 00027 #include <papyrus/drawable.h> 00028 00029 namespace Papyrus 00030 { 00031 00035 class Flasher : public Animator 00036 { 00037 protected: 00038 Flasher ( const Glib::ustring& id, 00039 unsigned int interval_ms ); 00040 00041 public: 00043 typedef std::set<Drawable::pointer> Drawables; 00044 00046 typedef PapyrusPointer<Flasher> pointer; 00047 00048 static pointer create ( const Glib::ustring& id=Glib::ustring(), 00049 unsigned int interval_ms=1000 ); 00050 00051 static pointer create ( unsigned int interval_ms ); 00052 00053 virtual ~Flasher(); 00054 00055 void add ( Drawable::pointer d ); 00056 00057 void remove ( Drawable::pointer d ); 00058 00059 const Drawables& drawables(); 00060 00061 protected: 00062 Drawables m_drawables; 00063 00064 bool m_last_state; 00065 00066 virtual int animate ( int n=1 ); 00067 00068 }; 00069 00070 } 00071 00072 #endif