Crazy Eddies GUI System 0.7.5

CEGUIWindowRenderer.h

00001 /***********************************************************************
00002     filename:   CEGUIWindowRenderer.h
00003     created:    Jan 11 2006
00004     author:     Tomas Lindquist Olsen
00005 
00006     purpose:    Defines interface for the WindowRenderer base class
00007 *************************************************************************/
00008 /***************************************************************************
00009  *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
00010  *
00011  *   Permission is hereby granted, free of charge, to any person obtaining
00012  *   a copy of this software and associated documentation files (the
00013  *   "Software"), to deal in the Software without restriction, including
00014  *   without limitation the rights to use, copy, modify, merge, publish,
00015  *   distribute, sublicense, and/or sell copies of the Software, and to
00016  *   permit persons to whom the Software is furnished to do so, subject to
00017  *   the following conditions:
00018  *
00019  *   The above copyright notice and this permission notice shall be
00020  *   included in all copies or substantial portions of the Software.
00021  *
00022  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00023  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00024  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00025  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00026  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00027  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00028  *   OTHER DEALINGS IN THE SOFTWARE.
00029  ***************************************************************************/
00030 #ifndef _CEGUIWindowRenderer_h_
00031 #define _CEGUIWindowRenderer_h_
00032 
00033 #include "CEGUIWindow.h"
00034 #include "CEGUIProperty.h"
00035 #include <vector>
00036 #include <utility>
00037 
00038 #if defined(_MSC_VER)
00039 #   pragma warning(push)
00040 #   pragma warning(disable : 4251)
00041 #endif
00042 
00043 
00044 // Start of CEGUI namespace section
00045 namespace CEGUI
00046 {
00051 class CEGUIEXPORT WindowRenderer
00052 {
00053 public:
00054     /*************************************************************************
00055         Constructor / Destructor
00056     **************************************************************************/
00068     WindowRenderer(const String& name, const String& class_name="Window");
00069 
00074     virtual ~WindowRenderer();
00075 
00076     /*************************************************************************
00077         Public interface
00078     **************************************************************************/
00087     virtual void render() = 0;
00088 
00093     const String& getName() const   {return d_name;}
00094 
00099     Window* getWindow() const       {return d_window;}
00100 
00105     const String& getClass() const  {return d_class;}
00106 
00111     const WidgetLookFeel& getLookNFeel() const;
00112 
00118     virtual Rect getUnclippedInnerRect() const;
00119 
00125     virtual void performChildWindowLayout() {}
00126 
00132     virtual void getRenderingContext(RenderingContext& ctx) const;
00133 
00135     virtual void update(float /*elapsed*/) {}
00136 
00137 protected:
00138     /*************************************************************************
00139         Implementation methods
00140     **************************************************************************/
00155     void registerProperty(Property* property, const bool ban_from_xml);
00156 
00166     void registerProperty(Property* property);
00167 
00172     virtual void onAttach();
00173 
00178     virtual void onDetach();
00179 
00184     virtual void onLookNFeelAssigned() {}
00185 
00190     virtual void onLookNFeelUnassigned() {}
00191 
00192     void operator=(const WindowRenderer&) {}
00193 
00194     /*************************************************************************
00195         Implementation data
00196     **************************************************************************/
00197     Window* d_window;       
00198     const String d_name;    
00199     const String d_class;   
00200 
00202     typedef std::pair<Property*, bool> PropertyEntry;
00204     typedef std::vector<PropertyEntry> PropertyList;
00205     PropertyList d_properties;  
00206 
00207     // Window is friend so it can manipulate our 'd_window' member directly.
00208     // We don't want users fiddling with this so no public interface.
00209     friend class Window;
00210 };
00211 
00216 class CEGUIEXPORT WindowRendererFactory
00217 {
00218 public:
00226     WindowRendererFactory(const String& name) : d_factoryName(name) {}
00227 
00232     virtual ~WindowRendererFactory() {}
00233 
00238     const String& getName() const {return d_factoryName;}
00239 
00244     virtual WindowRenderer* create() = 0;
00245 
00250     virtual void destroy(WindowRenderer* wr) = 0;
00251 
00252 protected:
00253     String d_factoryName;   
00254 };
00255 
00256 } // End of CEGUI namespace
00257 
00258 #if defined(_MSC_VER)
00259 #   pragma warning(pop)
00260 #endif
00261 
00262 #endif // _CEGUIWindowRenderer_h_