00001 // DisplayObjectContainer.h: Container of DisplayObjects. 00002 // 00003 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software 00004 // Foundation, Inc 00005 // 00006 // This program is free software; you can redistribute it and/or modify 00007 // it under the terms of the GNU General Public License as published by 00008 // the Free Software Foundation; either version 3 of the License, or 00009 // (at your option) any later version. 00010 // 00011 // This program 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 General Public License for more details. 00015 // 00016 // You should have received a copy of the GNU General Public License 00017 // along with this program; if not, write to the Free Software 00018 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00019 00020 // Stateful live Sprite instance 00021 00022 #ifndef GNASH_DISPLAYOBJECTCONTAINER_H 00023 #define GNASH_DISPLAYOBJECTCONTAINER_H 00024 00025 #ifdef HAVE_CONFIG_H 00026 #include "gnashconfig.h" // GNASH_USE_GC, USE_SWFTREE 00027 #endif 00028 00029 #include "DisplayList.h" // DisplayList 00030 #include "InteractiveObject.h" 00031 00032 #ifdef USE_SWFTREE 00033 # include "tree.hh" 00034 #endif 00035 00036 // Forward declarations 00037 namespace gnash { 00038 } 00039 00040 namespace gnash { 00041 00042 class DisplayObjectContainer : public InteractiveObject 00043 { 00044 00045 public: 00046 00047 DisplayObjectContainer(as_object* object, DisplayObject* parent) 00048 : 00049 InteractiveObject(object, parent) 00050 { 00051 assert(object); 00052 } 00053 00054 virtual ~DisplayObjectContainer(); 00055 00057 // 00060 // 00063 DisplayObject* removeChildAt(int index); 00064 00066 // 00071 // 00074 DisplayObject* removeChild(DisplayObject* obj); 00075 00077 // 00082 // 00085 DisplayObject* addChild(DisplayObject* obj); 00086 00088 // 00093 // 00097 DisplayObject* addChildAt(DisplayObject* obj, int index); 00098 00099 size_t numChildren() const { 00100 return _displayList.size(); 00101 } 00102 00103 #ifdef USE_SWFTREE 00104 // Override to append display list info, see dox in DisplayObject.h 00105 virtual InfoTree::iterator getMovieInfo(InfoTree& tr, 00106 InfoTree::iterator it); 00107 #endif 00108 00109 00110 protected: 00111 00112 // TODO: make private and move all DisplayList functions to this class. 00113 DisplayList _displayList; 00114 00115 }; 00116 00117 } // namespace gnash 00118 00119 #endif