1 | /************************************************************************
|
---|
2 | filename: CEGUIGUISheet.h
|
---|
3 | created: 5/6/2004
|
---|
4 | author: Paul D Turner
|
---|
5 |
|
---|
6 | purpose: Interface to a default window
|
---|
7 | *************************************************************************/
|
---|
8 | /*************************************************************************
|
---|
9 | Crazy Eddie's GUI System (http://www.cegui.org.uk)
|
---|
10 | Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
|
---|
11 |
|
---|
12 | This library is free software; you can redistribute it and/or
|
---|
13 | modify it under the terms of the GNU Lesser General Public
|
---|
14 | License as published by the Free Software Foundation; either
|
---|
15 | version 2.1 of the License, or (at your option) any later version.
|
---|
16 |
|
---|
17 | This library is distributed in the hope that it will be useful,
|
---|
18 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | Lesser General Public License for more details.
|
---|
21 |
|
---|
22 | You should have received a copy of the GNU Lesser General Public
|
---|
23 | License along with this library; if not, write to the Free Software
|
---|
24 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
25 | *************************************************************************/
|
---|
26 | #ifndef _CEGUIGUISheet_h_
|
---|
27 | #define _CEGUIGUISheet_h_
|
---|
28 |
|
---|
29 | #include "CEGUIWindow.h"
|
---|
30 | #include "CEGUIWindowFactory.h"
|
---|
31 |
|
---|
32 |
|
---|
33 | // Start of CEGUI namespace section
|
---|
34 | namespace CEGUI
|
---|
35 | {
|
---|
36 | /*!
|
---|
37 | \brief
|
---|
38 | Window class intended to be used as a simple, generic Window.
|
---|
39 |
|
---|
40 | This class does no rendering and so appears totally transparent. This window defaults
|
---|
41 | to position 0.0f, 0.0f with a size of 1.0f x 1.0f.
|
---|
42 |
|
---|
43 | /note
|
---|
44 | The C++ name of this class has been retained for backward compatibility reasons. The intended usage of
|
---|
45 | this window type has now been extended beyond that of a gui-sheet or root window.
|
---|
46 | */
|
---|
47 | class CEGUIEXPORT GUISheet : public Window
|
---|
48 | {
|
---|
49 | public:
|
---|
50 | /*************************************************************************
|
---|
51 | Constants
|
---|
52 | *************************************************************************/
|
---|
53 | // type name for this widget
|
---|
54 | static const String WidgetTypeName; //!< The unique typename of this widget
|
---|
55 |
|
---|
56 |
|
---|
57 | /*************************************************************************
|
---|
58 | Construction and Destruction
|
---|
59 | *************************************************************************/
|
---|
60 | /*!
|
---|
61 | \brief
|
---|
62 | Constructor for GUISheet windows.
|
---|
63 | */
|
---|
64 | GUISheet(const String& type, const String& name) : Window(type, name) {}
|
---|
65 |
|
---|
66 |
|
---|
67 | /*!
|
---|
68 | \brief
|
---|
69 | Destructor for GUISheet windows.
|
---|
70 | */
|
---|
71 | virtual ~GUISheet(void) {}
|
---|
72 |
|
---|
73 |
|
---|
74 | protected:
|
---|
75 | /*!
|
---|
76 | \brief
|
---|
77 | Perform the actual rendering for this Window.
|
---|
78 |
|
---|
79 | \param z
|
---|
80 | float value specifying the base Z co-ordinate that should be used when rendering
|
---|
81 |
|
---|
82 | \return
|
---|
83 | Nothing
|
---|
84 | */
|
---|
85 | virtual void drawSelf(float z) {}
|
---|
86 |
|
---|
87 |
|
---|
88 | /*!
|
---|
89 | \brief
|
---|
90 | Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
|
---|
91 |
|
---|
92 | \param class_name
|
---|
93 | The class name that is to be checked.
|
---|
94 |
|
---|
95 | \return
|
---|
96 | true if this window was inherited from \a class_name. false if not.
|
---|
97 | */
|
---|
98 | virtual bool testClassName_impl(const String& class_name) const
|
---|
99 | {
|
---|
100 | if (class_name==(const utf8*)"GUISheet") return true;
|
---|
101 | return Window::testClassName_impl(class_name);
|
---|
102 | }
|
---|
103 | };
|
---|
104 |
|
---|
105 |
|
---|
106 | /*!
|
---|
107 | \brief
|
---|
108 | Factory class for producing default windows
|
---|
109 | */
|
---|
110 | class GUISheetFactory : public WindowFactory
|
---|
111 | {
|
---|
112 | public:
|
---|
113 | /*************************************************************************
|
---|
114 | Construction and Destruction
|
---|
115 | *************************************************************************/
|
---|
116 | GUISheetFactory(void) : WindowFactory(GUISheet::WidgetTypeName) { }
|
---|
117 | ~GUISheetFactory(void){}
|
---|
118 |
|
---|
119 |
|
---|
120 | /*!
|
---|
121 | \brief
|
---|
122 | Create a new Window object of whatever type this WindowFactory produces.
|
---|
123 |
|
---|
124 | \param name
|
---|
125 | A unique name that is to be assigned to the newly created Window object
|
---|
126 |
|
---|
127 | \return
|
---|
128 | Pointer to the new Window object.
|
---|
129 | */
|
---|
130 | Window* createWindow(const String& name)
|
---|
131 | {
|
---|
132 | GUISheet* wnd = new GUISheet(d_type, name);
|
---|
133 | wnd->initialise();
|
---|
134 | wnd->setMaximumSize(Size(1.0f, 1.0f));
|
---|
135 | wnd->setSize(Size(1.0f, 1.0f));
|
---|
136 |
|
---|
137 | return wnd;
|
---|
138 | }
|
---|
139 |
|
---|
140 |
|
---|
141 | /*!
|
---|
142 | \brief
|
---|
143 | Destroys the given Window object.
|
---|
144 |
|
---|
145 | \param window
|
---|
146 | Pointer to the Window object to be destroyed.
|
---|
147 |
|
---|
148 | \return
|
---|
149 | Nothing.
|
---|
150 | */
|
---|
151 | virtual void destroyWindow(Window* window) { if (window->getType() == d_type) delete window; }
|
---|
152 | };
|
---|
153 |
|
---|
154 | /*!
|
---|
155 | \brief
|
---|
156 | typedef for DefaultWindow, which is the new name for GUISheet.
|
---|
157 | */
|
---|
158 | typedef GUISheet DefaultWindow;
|
---|
159 |
|
---|
160 |
|
---|
161 | } // End of CEGUI namespace section
|
---|
162 |
|
---|
163 |
|
---|
164 | #endif // end of guard _CEGUIGUISheet_h_
|
---|