00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright © 2000-2002 The OGRE Team 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 ----------------------------------------------------------------------------- 00024 */ 00025 00026 #ifndef __GuiContainer_H__ 00027 #define __GuiContainer_H__ 00028 00029 #include "OgrePrerequisites.h" 00030 #include "OgreGuiElement.h" 00031 #include "OgreIteratorWrappers.h" 00032 00033 00034 namespace Ogre { 00035 00036 00047 class _OgreExport GuiContainer : public GuiElement 00048 { 00049 public: 00050 typedef std::map<String, GuiElement*> ChildMap; 00051 typedef MapIterator<ChildMap> ChildIterator; 00052 typedef std::map<String, GuiContainer*> ChildContainerMap; 00053 typedef MapIterator<ChildContainerMap> ChildContainerIterator; 00054 protected: 00055 // Map of all children 00056 ChildMap mChildren; 00057 // Map of container children (subset of mChildren) 00058 ChildContainerMap mChildContainers; 00059 00060 bool mChildrenProcessEvents; 00061 00062 public: 00064 GuiContainer(const String& name); 00065 virtual ~GuiContainer(); 00066 00068 virtual void addChild(GuiElement* elem); 00070 virtual void addChildImpl(GuiElement* elem); 00072 virtual void addChildImpl(GuiContainer* cont); 00074 virtual void removeChild(const String& name); 00076 virtual GuiElement* getChild(const String& name); 00077 00078 void _addChild(GuiElement* elem); 00079 void _removeChild(GuiElement* elem) { _removeChild(elem->getName()); } 00080 void _removeChild(const String& name); 00081 00083 virtual ChildIterator getChildIterator(void); 00084 00089 virtual ChildContainerIterator getChildContainerIterator(void); 00090 00092 virtual void _positionsOutOfDate(void); 00093 00095 virtual void _update(void); 00096 00098 virtual void _notifyZOrder(ushort newZOrder); 00099 00101 virtual void _notifyViewport(); 00102 00104 virtual void _notifyWorldTransforms(const Matrix4& xform); 00105 00107 virtual void _notifyParent(GuiContainer* parent, Overlay* overlay); 00108 00110 virtual void _updateRenderQueue(RenderQueue* queue); 00111 00113 inline bool isContainer() const 00114 { return true; } 00115 00117 virtual inline bool isChildrenProcessEvents() const 00118 { return true; } 00119 00121 virtual inline void setChildrenProcessEvents(bool val) 00122 { mChildrenProcessEvents = val; } 00123 00125 virtual GuiElement* findElementAt(Real x, Real y); // relative to parent 00126 00127 void copyFromTemplate(GuiElement* templateGui); 00128 virtual GuiElement* clone(const String& instanceName); 00129 00130 }; 00131 00132 00133 00134 } 00135 00136 00137 #endif 00138
Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:48:28 2004