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 00037 #if defined(_MSC_VER) 00038 # pragma warning(push) 00039 # pragma warning(disable : 4251) 00040 #endif 00041 00042 00043 // Start of CEGUI namespace section 00044 namespace CEGUI 00045 { 00050 class CEGUIEXPORT WindowRenderer 00051 { 00052 public: 00053 /************************************************************************* 00054 Constructor / Destructor 00055 **************************************************************************/ 00067 WindowRenderer(const String& name, const String& class_name="Window"); 00068 00073 virtual ~WindowRenderer(); 00074 00075 /************************************************************************* 00076 Public interface 00077 **************************************************************************/ 00086 virtual void render() = 0; 00087 00092 const String& getName() const {return d_name;} 00093 00098 Window* getWindow() const {return d_window;} 00099 00104 const String& getClass() const {return d_class;} 00105 00110 const WidgetLookFeel& getLookNFeel() const; 00111 00117 virtual Rect getUnclippedInnerRect() const; 00118 00124 virtual void performChildWindowLayout() {} 00125 00131 virtual void getRenderingContext(RenderingContext& ctx) const; 00132 00134 virtual void update(float /*elapsed*/) {} 00135 00136 protected: 00137 /************************************************************************* 00138 Implementation methods 00139 **************************************************************************/ 00149 void registerProperty(Property* property); 00150 00155 virtual void onAttach(); 00156 00161 virtual void onDetach(); 00162 00167 virtual void onLookNFeelAssigned() {} 00168 00173 virtual void onLookNFeelUnassigned() {} 00174 00175 void operator=(const WindowRenderer&) {} 00176 00177 /************************************************************************* 00178 Implementation data 00179 **************************************************************************/ 00180 Window* d_window; 00181 const String d_name; 00182 const String d_class; 00183 00184 typedef std::vector<Property*> PropertyList; 00185 PropertyList d_properties; 00186 00187 // Window is friend so it can manipulate our 'd_window' member directly. 00188 // We don't want users fiddling with this so no public interface. 00189 friend class Window; 00190 }; 00191 00196 class CEGUIEXPORT WindowRendererFactory 00197 { 00198 public: 00206 WindowRendererFactory(const String& name) : d_factoryName(name) {} 00207 00212 virtual ~WindowRendererFactory() {} 00213 00218 const String& getName() const {return d_factoryName;} 00219 00224 virtual WindowRenderer* create() = 0; 00225 00230 virtual void destroy(WindowRenderer* wr) = 0; 00231 00232 protected: 00233 String d_factoryName; 00234 }; 00235 00236 } // End of CEGUI namespace 00237 00238 #if defined(_MSC_VER) 00239 # pragma warning(pop) 00240 #endif 00241 00242 #endif // _CEGUIWindowRenderer_h_