Crazy Eddie's GUI System  0.8.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
WindowRenderer.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 "CEGUI/Window.h"
34 #include "CEGUI/Property.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  public AllocatedObject<WindowRenderer>
53 {
54 public:
55  /*************************************************************************
56  Constructor / Destructor
57  **************************************************************************/
69  WindowRenderer(const String& name, const String& class_name="Window");
70 
75  virtual ~WindowRenderer();
76 
77  /*************************************************************************
78  Public interface
79  **************************************************************************/
88  virtual void render() = 0;
89 
94  const String& getName() const {return d_name;}
95 
100  Window* getWindow() const {return d_window;}
101 
106  const String& getClass() const {return d_class;}
107 
112  const WidgetLookFeel& getLookNFeel() const;
113 
119  virtual Rectf getUnclippedInnerRect() const;
120 
126  virtual void performChildWindowLayout() {}
127 
133  virtual void getRenderingContext(RenderingContext& ctx) const;
134 
136  virtual void update(float /*elapsed*/) {}
137 
155  virtual bool handleFontRenderSizeChange(const Font* const font);
156 
157 protected:
158  /*************************************************************************
159  Implementation methods
160  **************************************************************************/
175  void registerProperty(Property* property, const bool ban_from_xml);
176 
186  void registerProperty(Property* property);
187 
192  virtual void onAttach();
193 
198  virtual void onDetach();
199 
204  virtual void onLookNFeelAssigned() {}
205 
210  virtual void onLookNFeelUnassigned() {}
211 
212  /*************************************************************************
213  Implementation data
214  **************************************************************************/
216  const String d_name;
217  const String d_class;
218 
220  typedef std::pair<Property*, bool> PropertyEntry;
222  typedef std::vector<PropertyEntry
223  CEGUI_VECTOR_ALLOC(PropertyEntry)> PropertyList;
225 
226  // Window is friend so it can manipulate our 'd_window' member directly.
227  // We don't want users fiddling with this so no public interface.
228  friend class Window;
229 
230 private:
231  WindowRenderer& operator=(const WindowRenderer&) { return *this; }
232 };
233 
238 class CEGUIEXPORT WindowRendererFactory
239 {
240 public:
248  WindowRendererFactory(const String& name) : d_factoryName(name) {}
249 
255 
260  const String& getName() const {return d_factoryName;}
261 
266  virtual WindowRenderer* create() = 0;
267 
272  virtual void destroy(WindowRenderer* wr) = 0;
273 
274 protected:
276 };
277 
278 } // End of CEGUI namespace
279 
280 #if defined(_MSC_VER)
281 # pragma warning(pop)
282 #endif
283 
284 #endif // _CEGUIWindowRenderer_h_