Crazy Eddies GUI System  0.7.2
CEGUIWindowRenderer.h
1 /***********************************************************************
2  filename: CEGUIWindowRenderer.h
3  created: Jan 11 2006
4  author: Tomas Lindquist Olsen
5 
6  purpose: Defines interface for the WindowRenderer base class
7 *************************************************************************/
8 /***************************************************************************
9  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining
12  * a copy of this software and associated documentation files (the
13  * "Software"), to deal in the Software without restriction, including
14  * without limitation the rights to use, copy, modify, merge, publish,
15  * distribute, sublicense, and/or sell copies of the Software, and to
16  * permit persons to whom the Software is furnished to do so, subject to
17  * the following conditions:
18  *
19  * The above copyright notice and this permission notice shall be
20  * included in all copies or substantial portions of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
26  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
27  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28  * OTHER DEALINGS IN THE SOFTWARE.
29  ***************************************************************************/
30 #ifndef _CEGUIWindowRenderer_h_
31 #define _CEGUIWindowRenderer_h_
32 
33 #include "CEGUIWindow.h"
34 #include "CEGUIProperty.h"
35 #include <vector>
36 #include <utility>
37 
38 #if defined(_MSC_VER)
39 # pragma warning(push)
40 # pragma warning(disable : 4251)
41 #endif
42 
43 
44 // Start of CEGUI namespace section
45 namespace CEGUI
46 {
51 class CEGUIEXPORT WindowRenderer
52 {
53 public:
54  /*************************************************************************
55  Constructor / Destructor
56  **************************************************************************/
68  WindowRenderer(const String& name, const String& class_name="Window");
69 
74  virtual ~WindowRenderer();
75 
76  /*************************************************************************
77  Public interface
78  **************************************************************************/
87  virtual void render() = 0;
88 
93  const String& getName() const {return d_name;}
94 
99  Window* getWindow() const {return d_window;}
100 
105  const String& getClass() const {return d_class;}
106 
111  const WidgetLookFeel& getLookNFeel() const;
112 
118  virtual Rect getUnclippedInnerRect() const;
119 
125  virtual void performChildWindowLayout() {}
126 
132  virtual void getRenderingContext(RenderingContext& ctx) const;
133 
135  virtual void update(float /*elapsed*/) {}
136 
137 protected:
138  /*************************************************************************
139  Implementation methods
140  **************************************************************************/
155  void registerProperty(Property* property, const bool ban_from_xml);
156 
166  void registerProperty(Property* property);
167 
172  virtual void onAttach();
173 
178  virtual void onDetach();
179 
184  virtual void onLookNFeelAssigned() {}
185 
190  virtual void onLookNFeelUnassigned() {}
191 
192  void operator=(const WindowRenderer&) {}
193 
194  /*************************************************************************
195  Implementation data
196  **************************************************************************/
198  const String d_name;
199  const String d_class;
200 
202  typedef std::pair<Property*, bool> PropertyEntry;
204  typedef std::vector<PropertyEntry> PropertyList;
206 
207  // Window is friend so it can manipulate our 'd_window' member directly.
208  // We don't want users fiddling with this so no public interface.
209  friend class Window;
210 };
211 
216 class CEGUIEXPORT WindowRendererFactory
217 {
218 public:
226  WindowRendererFactory(const String& name) : d_factoryName(name) {}
227 
233 
238  const String& getName() const {return d_factoryName;}
239 
244  virtual WindowRenderer* create() = 0;
245 
250  virtual void destroy(WindowRenderer* wr) = 0;
251 
252 protected:
254 };
255 
256 } // End of CEGUI namespace
257 
258 #if defined(_MSC_VER)
259 # pragma warning(pop)
260 #endif
261 
262 #endif // _CEGUIWindowRenderer_h_