Crazy Eddie's GUI System
0.8.4
|
00001 /*********************************************************************** 00002 created: Jan 11 2006 00003 author: Tomas Lindquist Olsen 00004 00005 purpose: Defines interface for the WindowRenderer base class 00006 *************************************************************************/ 00007 /*************************************************************************** 00008 * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team 00009 * 00010 * Permission is hereby granted, free of charge, to any person obtaining 00011 * a copy of this software and associated documentation files (the 00012 * "Software"), to deal in the Software without restriction, including 00013 * without limitation the rights to use, copy, modify, merge, publish, 00014 * distribute, sublicense, and/or sell copies of the Software, and to 00015 * permit persons to whom the Software is furnished to do so, subject to 00016 * the following conditions: 00017 * 00018 * The above copyright notice and this permission notice shall be 00019 * included in all copies or substantial portions of the Software. 00020 * 00021 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00022 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00023 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00024 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00025 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00026 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00027 * OTHER DEALINGS IN THE SOFTWARE. 00028 ***************************************************************************/ 00029 #ifndef _CEGUIWindowRenderer_h_ 00030 #define _CEGUIWindowRenderer_h_ 00031 00032 #include "CEGUI/Window.h" 00033 #include "CEGUI/Property.h" 00034 #include <vector> 00035 #include <utility> 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 public AllocatedObject<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 Rectf getUnclippedInnerRect() const; 00119 00125 virtual void performChildWindowLayout() {} 00126 00132 virtual void getRenderingContext(RenderingContext& ctx) const; 00133 00135 virtual void update(float /*elapsed*/) {} 00136 00154 virtual bool handleFontRenderSizeChange(const Font* const font); 00155 00156 protected: 00157 /************************************************************************* 00158 Implementation methods 00159 **************************************************************************/ 00174 void registerProperty(Property* property, const bool ban_from_xml); 00175 00185 void registerProperty(Property* property); 00186 00191 virtual void onAttach(); 00192 00197 virtual void onDetach(); 00198 00203 virtual void onLookNFeelAssigned() {} 00204 00209 virtual void onLookNFeelUnassigned() {} 00210 00211 /************************************************************************* 00212 Implementation data 00213 **************************************************************************/ 00214 Window* d_window; 00215 const String d_name; 00216 const String d_class; 00217 00219 typedef std::pair<Property*, bool> PropertyEntry; 00221 typedef std::vector<PropertyEntry 00222 CEGUI_VECTOR_ALLOC(PropertyEntry)> PropertyList; 00223 PropertyList d_properties; 00224 00225 // Window is friend so it can manipulate our 'd_window' member directly. 00226 // We don't want users fiddling with this so no public interface. 00227 friend class Window; 00228 00229 private: 00230 WindowRenderer& operator=(const WindowRenderer&) { return *this; } 00231 }; 00232 00237 class CEGUIEXPORT WindowRendererFactory 00238 { 00239 public: 00247 WindowRendererFactory(const String& name) : d_factoryName(name) {} 00248 00253 virtual ~WindowRendererFactory() {} 00254 00259 const String& getName() const {return d_factoryName;} 00260 00265 virtual WindowRenderer* create() = 0; 00266 00271 virtual void destroy(WindowRenderer* wr) = 0; 00272 00273 protected: 00274 String d_factoryName; 00275 }; 00276 00277 } // End of CEGUI namespace 00278 00279 #if defined(_MSC_VER) 00280 # pragma warning(pop) 00281 #endif 00282 00283 #endif // _CEGUIWindowRenderer_h_