Crazy Eddie's GUI System
0.8.4
|
00001 /*********************************************************************** 00002 created: Mon Jun 13 2005 00003 author: Paul D Turner <paul@cegui.org.uk> 00004 *************************************************************************/ 00005 /*************************************************************************** 00006 * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team 00007 * 00008 * Permission is hereby granted, free of charge, to any person obtaining 00009 * a copy of this software and associated documentation files (the 00010 * "Software"), to deal in the Software without restriction, including 00011 * without limitation the rights to use, copy, modify, merge, publish, 00012 * distribute, sublicense, and/or sell copies of the Software, and to 00013 * permit persons to whom the Software is furnished to do so, subject to 00014 * the following conditions: 00015 * 00016 * The above copyright notice and this permission notice shall be 00017 * included in all copies or substantial portions of the Software. 00018 * 00019 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00020 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00021 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00022 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00023 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00024 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00025 * OTHER DEALINGS IN THE SOFTWARE. 00026 ***************************************************************************/ 00027 #ifndef _CEGUIFalWidgetComponent_h_ 00028 #define _CEGUIFalWidgetComponent_h_ 00029 00030 #include "CEGUI/falagard/Dimensions.h" 00031 #include "CEGUI/falagard/PropertyInitialiser.h" 00032 #include "CEGUI/falagard/EventAction.h" 00033 #include "CEGUI/Window.h" 00034 00035 #if defined(_MSC_VER) 00036 # pragma warning(push) 00037 # pragma warning(disable : 4251) 00038 #endif 00039 00040 // Start of CEGUI namespace section 00041 namespace CEGUI 00042 { 00050 class CEGUIEXPORT WidgetComponent : 00051 public AllocatedObject<WidgetComponent> 00052 { 00053 public: 00054 WidgetComponent() {} 00055 WidgetComponent(const String& type, 00056 const String& look, 00057 const String& suffix, 00058 const String& renderer, 00059 bool autoWindow); 00060 00066 void create(Window& parent) const; 00067 00073 void cleanup(Window& parent) const; 00074 00075 const ComponentArea& getComponentArea() const; 00076 void setComponentArea(const ComponentArea& area); 00077 00078 const String& getBaseWidgetType() const; 00079 void setBaseWidgetType(const String& type); 00080 00081 const String& getWidgetLookName() const; 00082 void setWidgetLookName(const String& look); 00083 00084 const String& getWidgetName() const; 00085 void setWidgetName(const String& name); 00086 00087 const String& getWindowRendererType() const; 00088 void setWindowRendererType(const String& type); 00089 00090 VerticalAlignment getVerticalWidgetAlignment() const; 00091 void setVerticalWidgetAlignment(VerticalAlignment alignment); 00092 00093 HorizontalAlignment getHorizontalWidgetAlignment() const; 00094 void setHorizontalWidgetAlignment(HorizontalAlignment alignment); 00095 00096 void addPropertyInitialiser(const PropertyInitialiser& initialiser); 00097 void removePropertyInitialiser(const String& name); 00098 void clearPropertyInitialisers(); 00099 00100 void setAutoWindow(bool is_auto); 00101 bool isAutoWindow() const; 00102 00103 void addEventAction(const EventAction& event_action); 00104 void clearEventActions(); 00105 00106 void layout(const Window& owner) const; 00107 00119 void writeXMLToStream(XMLSerializer& xml_stream) const; 00120 00130 const PropertyInitialiser* findPropertyInitialiser(const String& propertyName) const; 00131 00133 bool handleFontRenderSizeChange(Window& window, const Font* font) const; 00134 00136 static const HorizontalAlignment HorizontalAlignmentDefault; 00138 static const VerticalAlignment VerticalAlignmentDefault; 00139 00140 private: 00141 typedef std::vector<PropertyInitialiser 00142 CEGUI_VECTOR_ALLOC(PropertyInitialiser)> PropertiesList; 00143 typedef std::vector<EventAction 00144 CEGUI_VECTOR_ALLOC(EventAction)> EventActionList; 00145 00146 public: 00147 /************************************************************************* 00148 Iterator stuff 00149 *************************************************************************/ 00150 typedef ConstVectorIterator<PropertiesList> PropertyIterator; 00151 typedef ConstVectorIterator<EventActionList> EventActionIterator; 00152 00157 PropertyIterator getPropertyIterator() const; 00158 00163 EventActionIterator getEventActionIterator() const; 00164 00165 private: 00166 ComponentArea d_area; 00167 String d_baseType; 00168 String d_imageryName; 00169 String d_name; 00170 String d_rendererType; 00171 bool d_autoWindow; 00172 VerticalAlignment d_vertAlign; 00173 HorizontalAlignment d_horzAlign; 00174 PropertiesList d_properties; 00175 00176 EventActionList d_eventActions; 00177 }; 00178 00179 } // End of CEGUI namespace section 00180 00181 00182 #if defined(_MSC_VER) 00183 # pragma warning(pop) 00184 #endif 00185 00186 #endif // end of guard _CEGUIFalWidgetComponent_h_