00001 /*************************************************************************** 00002 * Copyright (C) 2007 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 PAPYRUSDRAWABLESINGLECONTAINER_H 00021 #define PAPYRUSDRAWABLESINGLECONTAINER_H 00022 00023 #include <papyrus/drawable.h> 00024 00025 namespace Papyrus 00026 { 00027 00033 class DrawableSingleContainer 00034 { 00035 public: 00036 00037 DrawableSingleContainer(); 00038 00039 virtual ~DrawableSingleContainer(); 00040 00041 virtual Drawable::pointer child(); 00042 00043 virtual void add( Drawable::pointer new_child = Drawable::pointer() ); 00044 00045 virtual void clear(); 00046 00047 virtual bool has ( Drawable::pointer drawable ) const; 00048 00049 virtual size_t size() const; 00050 00051 virtual bool empty() const; 00052 00053 sigc::signal<void, Drawable::pointer> signal_added(); 00054 00055 sigc::signal<void, Drawable::pointer> signal_removed(); 00056 00057 sigc::signal<void> signal_cleared(); 00058 00059 protected: 00060 Drawable::pointer m_child; 00061 00062 sigc::signal<void, Drawable::pointer> m_signal_added; 00063 00064 sigc::signal<void, Drawable::pointer> m_signal_removed; 00065 00066 sigc::signal<void> m_signal_cleared; 00067 00068 sigc::connection m_child_changed_conn; 00069 00070 virtual void on_child_changed(Drawable::pointer); 00071 00072 private: 00073 00074 void on_child_changed_proxy(Drawable::weak_pointer); 00075 00076 }; 00077 00078 } 00079 00080 #endif