Crazy Eddie's GUI System  0.8.6
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_
virtual ~WindowRendererFactory()
Destructor.
Definition: WindowRenderer.h:253
Window * getWindow() const
Get the window this windowrenderer is attached to.
Definition: WindowRenderer.h:99
const String & getClass() const
Get the "minimum" Window class this renderer requires.
Definition: WindowRenderer.h:105
Base-class for WindowRendererFactory.
Definition: WindowRenderer.h:237
std::vector< PropertyEntry CEGUI_VECTOR_ALLOC(PropertyEntry)> PropertyList
type to use for the property list.
Definition: WindowRenderer.h:222
Definition: MemoryAllocatedObject.h:109
Window * d_window
Pointer to the window this windowrenderer is assigned to.
Definition: WindowRenderer.h:214
PropertyList d_properties
The list of properties that this windowrenderer will be handling.
Definition: WindowRenderer.h:223
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
String d_factoryName
Our factory type name.
Definition: WindowRenderer.h:274
std::pair< Property *, bool > PropertyEntry
type used for entries in the PropertyList.
Definition: WindowRenderer.h:219
struct that holds some context relating to a RenderingSurface object.
Definition: RenderingContext.h:39
virtual void update(float)
perform any time based updates for this WindowRenderer.
Definition: WindowRenderer.h:135
WindowRendererFactory(const String &name)
Contructor.
Definition: WindowRenderer.h:247
const String d_class
Name of the widget class that is the "minimum" requirement.
Definition: WindowRenderer.h:216
Base-class for the assignable WindowRenderer object.
Definition: WindowRenderer.h:50
Class that encapsulates a typeface.
Definition: Font.h:58
const String & getName() const
Returns the type name of this window renderer factory.
Definition: WindowRenderer.h:259
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: Window.h:149
virtual void onLookNFeelAssigned()
Handler called when a Look'N'Feel is assigned to our window.
Definition: WindowRenderer.h:203
Class that encapsulates Look N' Feel information for a widget.
Definition: WidgetLookFeel.h:54
virtual void performChildWindowLayout()
Method called to perform extended laying out of the window's attached child windows.
Definition: WindowRenderer.h:125
An abstract class that defines the interface to access object properties by name. ...
Definition: Property.h:60
virtual void onLookNFeelUnassigned()
Handler called when a Look'N'Feel is removed/unassigned from our window.
Definition: WindowRenderer.h:209
const String d_name
Name of the factory type used to create this window renderer.
Definition: WindowRenderer.h:215
String class used within the GUI system.
Definition: String.h:62
const String & getName() const
Returns the factory type name of this window renderer.
Definition: WindowRenderer.h:93