source: OGRE/trunk/ogrenew/OgreMain/include/OgreOverlayContainer.h @ 657

Revision 657, 5.2 KB checked in by mattausch, 19 years ago (diff)

added ogre dependencies and patched ogre sources

Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2005 The OGRE Team
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23-----------------------------------------------------------------------------
24*/
25
26#ifndef __OverlayContainer_H__
27#define __OverlayContainer_H__
28
29#include "OgrePrerequisites.h"
30#include "OgreOverlayElement.h"
31#include "OgreIteratorWrappers.h"
32
33
34namespace Ogre {
35
36
37    /** A 2D element which contains other OverlayElement instances.
38    @remarks
39        This is a specialisation of OverlayElement for 2D elements that contain other
40        elements. These are also the smallest elements that can be attached directly
41        to an Overlay.
42    @remarks
43        OverlayContainers should be managed using OverlayManager. This class is responsible for
44        instantiating / deleting elements, and also for accepting new types of element
45        from plugins etc.
46    */
47    class _OgreExport OverlayContainer : public OverlayElement
48    {
49    public:
50        typedef std::map<String, OverlayElement*> ChildMap;
51        typedef MapIterator<ChildMap> ChildIterator;
52        typedef std::map<String, OverlayContainer*> ChildContainerMap;
53        typedef MapIterator<ChildContainerMap> ChildContainerIterator;
54    protected:
55        // Map of all children
56        ChildMap mChildren;
57        // Map of container children (subset of mChildren)
58        ChildContainerMap mChildContainers;
59
60                bool mChildrenProcessEvents;
61 
62    public:
63        /// Constructor: do not call direct, use OverlayManager::createOverlayElement
64        OverlayContainer(const String& name);
65        virtual ~OverlayContainer();
66
67        /** Adds another OverlayElement to this container. */
68        virtual void addChild(OverlayElement* elem);
69        /** Adds another OverlayElement to this container. */
70        virtual void addChildImpl(OverlayElement* elem);
71        /** Add a nested container to this container. */
72        virtual void addChildImpl(OverlayContainer* cont);
73        /** Removes a named element from this container. */
74        virtual void removeChild(const String& name);
75        /** Gets the named child of this container. */
76        virtual OverlayElement* getChild(const String& name);
77
78                /** @copydoc OverlayElement::initialise */
79                void initialise(void);
80
81        void _addChild(OverlayElement* elem);
82        void _removeChild(OverlayElement* elem) { _removeChild(elem->getName()); }
83        void _removeChild(const String& name);
84
85        /** Gets an object for iterating over all the children of this object. */
86        virtual ChildIterator getChildIterator(void);
87
88        /** Gets an iterator for just the container children of this object.
89        @remarks
90            Good for cascading updates without having to use RTTI
91        */
92        virtual ChildContainerIterator getChildContainerIterator(void);
93
94                /** Tell the object and its children to recalculate */
95                virtual void _positionsOutOfDate(void);
96
97        /** Overridden from OverlayElement. */
98        virtual void _update(void);
99
100        /** Overridden from OverlayElement. */
101        virtual void _notifyZOrder(ushort newZOrder);
102
103        /** Overridden from OverlayElement. */
104        virtual void _notifyViewport();
105
106        /** Overridden from OverlayElement. */
107        virtual void _notifyWorldTransforms(const Matrix4& xform);
108
109        /** Overridden from OverlayElement. */
110            virtual void _notifyParent(OverlayContainer* parent, Overlay* overlay);
111
112        /** Overridden from OverlayElement. */
113        virtual void _updateRenderQueue(RenderQueue* queue);
114
115        /** Overridden from OverlayElement. */
116                inline bool isContainer() const
117                { return true; }
118
119                /** Should this container pass events to their children */
120                virtual inline bool isChildrenProcessEvents() const
121                { return true; }
122
123                /** Should this container pass events to their children */
124                virtual inline void setChildrenProcessEvents(bool val)
125                { mChildrenProcessEvents = val; }
126
127        /** This returns a OverlayElement at position x,y. */
128                virtual OverlayElement* findElementAt(Real x, Real y);          // relative to parent
129
130            void copyFromTemplate(OverlayElement* templateOverlay);
131        virtual OverlayElement* clone(const String& instanceName);
132
133    };
134
135
136
137}
138
139
140#endif
141
Note: See TracBrowser for help on using the repository browser.