papyrus logo

drawableset.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2009 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 PAPYRUSDRAWABLESET_H
00021 #define PAPYRUSDRAWABLESET_H
00022 
00023 #include <set>
00024 #include <papyrus/drawablecontainer.h>
00025 
00026 namespace Papyrus
00027 {
00028 
00035   class DrawableSet: public DrawableContainer
00036   {
00037     public:
00038       typedef PapyrusPointer<DrawableSet> pointer;
00039       
00040       typedef std::set<Drawable::pointer> Drawables;
00041 
00042       typedef Drawables::iterator iterator;
00043       typedef Drawables::reverse_iterator reverse_iterator;
00044       typedef Drawables::const_iterator const_iterator;
00045       typedef Drawables::const_reverse_iterator const_reverse_iterator;
00046 
00047       DrawableSet(pointer to_copy=pointer());
00048 
00049       virtual ~DrawableSet();
00050 
00051       const Drawables& drawables();
00052 
00053       virtual void set_drawables( pointer drawables );
00054 
00055       virtual void set_drawables( const DrawableSet& drawables );
00056       
00057       virtual void add( Drawable::pointer drawable );
00058 
00059       virtual void remove ( Drawable::pointer drawable );
00060 
00061       virtual void clear();
00062 
00063       virtual bool has ( Drawable::pointer drawable ) const;
00064 
00065       virtual size_t size() const;
00066 
00067       virtual iterator begin();
00068 
00069       virtual const_iterator begin() const;
00070 
00071       virtual iterator end();
00072 
00073       virtual const_iterator end() const;
00074 
00075       virtual reverse_iterator rbegin();
00076 
00077       virtual const_reverse_iterator rbegin() const;
00078 
00079       virtual reverse_iterator rend();
00080 
00081       virtual const_reverse_iterator rend() const;
00082 
00083       virtual bool empty() const;
00084 
00085       Region extents();
00086 
00094       virtual void link( DrawableSet::pointer s );
00095 
00097       virtual void unlink( DrawableSet::pointer s );
00098       
00099     protected:
00100       Drawables m_drawables;
00101       
00102       std::map< DrawableSet::pointer, sigc::connection > m_linked_added_conn_map;
00103       std::map< DrawableSet::pointer, sigc::connection > m_linked_removed_conn_map;
00104 
00105       void on_linked_set_drawable_added( Drawable::pointer added );
00106 
00107       void on_linked_set_drawable_removed( Drawable::pointer removed );
00108       
00109   };
00110 
00111 }
00112 
00113 #endif

Generated on Fri Apr 16 12:40:10 2010 for papyrus by doxygen 1.6.1