Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/ogre/OgreMain/include/OgreOverlayElementFactory.h @ 29

Last change on this file since 29 was 5, checked in by anonymous, 17 years ago

=hoffentlich gehts jetzt

File size: 4.4 KB
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-2006 Torus Knot Software Ltd
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
24You may alternatively use this source under the terms of a specific version of
25the OGRE Unrestricted License provided you have obtained such a license from
26Torus Knot Software Ltd.
27-----------------------------------------------------------------------------
28*/
29#ifndef __OverlayElementFactory_H__
30#define __OverlayElementFactory_H__
31
32#include "OgrePrerequisites.h"
33#include "OgreOverlayElement.h"
34#include "OgrePanelOverlayElement.h"
35#include "OgreBorderPanelOverlayElement.h"
36#include "OgreTextAreaOverlayElement.h"
37
38namespace Ogre {
39
40    /** Defines the interface which all components wishing to
41        supply OverlayElement subclasses must implement.
42    @remarks
43        To allow the OverlayElement types available for inclusion on
44        overlays to be extended, OGRE allows external apps or plugins
45        to register their ability to create custom OverlayElements with
46        the OverlayManager, using the addOverlayElementFactory method. Classes
47        wanting to do this must implement this interface.
48    @par
49        Each OverlayElementFactory creates a single type of OverlayElement,
50        identified by a 'type name' which must be unique.
51    */
52    class _OgreExport OverlayElementFactory
53    {
54    public:
55        /** Destroy the overlay element factory */
56        virtual ~OverlayElementFactory () {}
57        /** Creates a new OverlayElement instance with the name supplied. */
58        virtual OverlayElement* createOverlayElement(const String& instanceName) = 0;
59        /** Destroys a OverlayElement which this factory created previously. */
60        virtual void destroyOverlayElement(OverlayElement* pElement) { delete pElement; };
61        /** Gets the string uniquely identifying the type of element this factory creates. */
62        virtual const String& getTypeName(void) const = 0;
63    };
64
65
66    /** Factory for creating PanelOverlayElement instances. */
67    class _OgreExport PanelOverlayElementFactory: public OverlayElementFactory
68    {
69    public:
70        /** See OverlayElementFactory */
71        OverlayElement* createOverlayElement(const String& instanceName)
72        {
73            return new PanelOverlayElement(instanceName);
74        }
75        /** See OverlayElementFactory */
76        const String& getTypeName(void) const
77        {
78            static String name = "Panel";
79            return name;
80        }
81    };
82
83    /** Factory for creating BorderPanelOverlayElement instances. */
84    class _OgreExport BorderPanelOverlayElementFactory: public OverlayElementFactory
85    {
86    public:
87        /** See OverlayElementFactory */
88        OverlayElement* createOverlayElement(const String& instanceName)
89        {
90            return new BorderPanelOverlayElement(instanceName);
91        }
92        /** See OverlayElementFactory */
93        const String& getTypeName(void) const
94        {
95            static String name = "BorderPanel";
96            return name;
97        }
98    };
99
100    /** Factory for creating TextAreaOverlayElement instances. */
101    class _OgreExport TextAreaOverlayElementFactory: public OverlayElementFactory
102    {
103    public:
104        /** See OverlayElementFactory */
105        OverlayElement* createOverlayElement(const String& instanceName)
106        {
107            return new TextAreaOverlayElement(instanceName);
108        }
109        /** See OverlayElementFactory */
110        const String& getTypeName(void) const
111        {
112            static String name = "TextArea";
113            return name;
114        }
115    };
116
117}
118
119
120
121#endif
Note: See TracBrowser for help on using the repository browser.