Crazy Eddie's GUI System  0.8.4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
WindowRenderer.h
1 /***********************************************************************
2  created: Jan 11 2006
3  author: Tomas Lindquist Olsen
4 
5  purpose: Defines interface for the WindowRenderer base class
6 *************************************************************************/
7 /***************************************************************************
8  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining
11  * a copy of this software and associated documentation files (the
12  * "Software"), to deal in the Software without restriction, including
13  * without limitation the rights to use, copy, modify, merge, publish,
14  * distribute, sublicense, and/or sell copies of the Software, and to
15  * permit persons to whom the Software is furnished to do so, subject to
16  * the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be
19  * included in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27  * OTHER DEALINGS IN THE SOFTWARE.
28  ***************************************************************************/
29 #ifndef _CEGUIWindowRenderer_h_
30 #define _CEGUIWindowRenderer_h_
31 
32 #include "CEGUI/Window.h"
33 #include "CEGUI/Property.h"
34 #include <vector>
35 #include <utility>
36 
37 #if defined(_MSC_VER)
38 # pragma warning(push)
39 # pragma warning(disable : 4251)
40 #endif
41 
42 
43 // Start of CEGUI namespace section
44 namespace CEGUI
45 {
50 class CEGUIEXPORT WindowRenderer :
51  public AllocatedObject<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 Rectf getUnclippedInnerRect() const;
119 
125  virtual void performChildWindowLayout() {}
126 
132  virtual void getRenderingContext(RenderingContext& ctx) const;
133 
135  virtual void update(float /*elapsed*/) {}
136 
154  virtual bool handleFontRenderSizeChange(const Font* const font);
155 
156 protected:
157  /*************************************************************************
158  Implementation methods
159  **************************************************************************/
174  void registerProperty(Property* property, const bool ban_from_xml);
175 
185  void registerProperty(Property* property);
186 
191  virtual void onAttach();
192 
197  virtual void onDetach();
198 
203  virtual void onLookNFeelAssigned() {}
204 
209  virtual void onLookNFeelUnassigned() {}
210 
211  /*************************************************************************
212  Implementation data
213  **************************************************************************/
215  const String d_name;
216  const String d_class;
217 
219  typedef std::pair<Property*, bool> PropertyEntry;
221  typedef std::vector<PropertyEntry
222  CEGUI_VECTOR_ALLOC(PropertyEntry)> PropertyList;
224 
225  // Window is friend so it can manipulate our 'd_window' member directly.
226  // We don't want users fiddling with this so no public interface.
227  friend class Window;
228 
229 private:
230  WindowRenderer& operator=(const WindowRenderer&) { return *this; }
231 };
232 
237 class CEGUIEXPORT WindowRendererFactory
238 {
239 public:
247  WindowRendererFactory(const String& name) : d_factoryName(name) {}
248 
254 
259  const String& getName() const {return d_factoryName;}
260 
265  virtual WindowRenderer* create() = 0;
266 
271  virtual void destroy(WindowRenderer* wr) = 0;
272 
273 protected:
275 };
276 
277 } // End of CEGUI namespace
278 
279 #if defined(_MSC_VER)
280 # pragma warning(pop)
281 #endif
282 
283 #endif // _CEGUIWindowRenderer_h_