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 { 00046 00047 class WidgetLookFeel; 00048 00053 class CEGUIEXPORT WindowRenderer 00054 { 00055 public: 00056 /************************************************************************* 00057 Constructor / Destructor 00058 **************************************************************************/ 00070 WindowRenderer(const String& name, const String& class_name="Window"); 00071 00076 virtual ~WindowRenderer(); 00077 00078 /************************************************************************* 00079 Public interface 00080 **************************************************************************/ 00089 virtual void render() = 0; 00090 00095 const String& getName() const {return d_name;} 00096 00101 Window* getWindow() const {return d_window;} 00102 00107 const String& getClass() const {return d_class;} 00108 00113 const WidgetLookFeel& getLookNFeel() const; 00114 00120 virtual Rect getUnclippedInnerRect() const; 00121 00127 virtual Rect getPixelRect() const; 00128 00134 virtual void performChildWindowLayout() {} 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 /************************************************************************* 00176 Implementation data 00177 **************************************************************************/ 00178 Window* d_window; 00179 const String d_name; 00180 const String d_class; 00181 00182 typedef std::vector<Property*> PropertyList; 00183 PropertyList d_properties; 00184 00185 // Window is friend so it can manipulate our 'd_window' member directly. 00186 // We don't want users fiddling with this so no public interface. 00187 friend class Window; 00188 }; 00189 00194 class CEGUIEXPORT WindowRendererFactory 00195 { 00196 public: 00204 WindowRendererFactory(const String& name) : d_factoryName(name) {} 00205 00210 virtual ~WindowRendererFactory() {} 00211 00216 const String& getName() const {return d_factoryName;} 00217 00222 virtual WindowRenderer* create() = 0; 00223 00228 virtual void destroy(WindowRenderer* wr) = 0; 00229 00230 protected: 00231 String d_factoryName; 00232 }; 00233 00234 } // End of CEGUI namespace 00235 00236 #if defined(_MSC_VER) 00237 # pragma warning(pop) 00238 #endif 00239 00240 #endif // _CEGUIWindowRenderer_h_