Crazy Eddie's GUI System
0.8.4
|
00001 /*********************************************************************** 00002 created: Mon Jul 18 2005 00003 author: Paul D Turner <paul@cegui.org.uk> 00004 *************************************************************************/ 00005 /*************************************************************************** 00006 * Copyright (C) 2004 - 2012 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 _CEGUIFalFrameComponent_h_ 00028 #define _CEGUIFalFrameComponent_h_ 00029 00030 #include "CEGUI/falagard/ComponentBase.h" 00031 #include "CEGUI/XMLSerializer.h" 00032 #include "CEGUI/falagard/FormattingSetting.h" 00033 00034 #if defined(_MSC_VER) 00035 # pragma warning(push) 00036 # pragma warning(disable : 4251) 00037 #endif 00038 00039 namespace CEGUI 00040 { 00051 class CEGUIEXPORT FrameComponent : public FalagardComponentBase 00052 { 00053 public: 00054 FrameComponent(); 00055 00063 void setLeftEdgeFormatting(VerticalFormatting fmt); 00064 00072 void setRightEdgeFormatting(VerticalFormatting fmt); 00073 00081 void setTopEdgeFormatting(HorizontalFormatting fmt); 00082 00090 void setBottomEdgeFormatting(HorizontalFormatting fmt); 00091 00099 void setBackgroundVerticalFormatting(VerticalFormatting fmt); 00100 00108 void setBackgroundHorizontalFormatting(HorizontalFormatting fmt); 00109 00115 void setLeftEdgeFormattingPropertySource(const String& property_name); 00116 00122 void setRightEdgeFormattingPropertySource(const String& property_name); 00123 00129 void setTopEdgeFormattingPropertySource(const String& property_name); 00130 00136 void setBottomEdgeFormattingPropertySource(const String& property_name); 00137 00143 void setBackgroundVerticalFormattingPropertySource(const String& property_name); 00144 00150 void setBackgroundHorizontalFormattingPropertySource(const String& property_name); 00151 00159 VerticalFormatting getLeftEdgeFormatting(const Window& wnd) const; 00160 00168 VerticalFormatting getRightEdgeFormatting(const Window& wnd) const; 00169 00177 HorizontalFormatting getTopEdgeFormatting(const Window& wnd) const; 00178 00186 HorizontalFormatting getBottomEdgeFormatting(const Window& wnd) const; 00187 00195 VerticalFormatting getBackgroundVerticalFormatting(const Window& wnd) const; 00196 00204 HorizontalFormatting getBackgroundHorizontalFormatting(const Window& wnd) const; 00205 00224 const Image* getImage(FrameImageComponent part, 00225 const Window& wnd) const; 00226 00239 void setImage(FrameImageComponent part, const Image* image); 00240 00255 void setImage(FrameImageComponent part, const String& name); 00256 00272 void setImagePropertySource(FrameImageComponent part, const String& name); 00273 00286 bool isImageSpecified(FrameImageComponent part) const; 00287 00302 bool isImageFetchedFromProperty(FrameImageComponent part) const; 00303 00320 const String& getImagePropertySource(FrameImageComponent part) const; 00321 00333 void writeXMLToStream(XMLSerializer& xml_stream) const; 00334 00335 bool operator==(const FrameComponent& rhs) const; 00336 00337 00339 static const HorizontalFormatting HorizontalFormattingDefault; 00341 static const VerticalFormatting VerticalFormattingDefault; 00342 00343 protected: 00344 struct FrameImageSource 00345 { 00346 FrameImageSource() : 00347 d_specified(false), 00348 d_image(0) 00349 {} 00350 00351 bool operator==(const FrameImageSource& rhs) const 00352 { 00353 return d_specified == rhs.d_specified && 00354 d_image == rhs.d_image && 00355 d_propertyName == rhs.d_propertyName; 00356 } 00357 00358 bool operator!=(const FrameImageSource& rhs) const 00359 { 00360 return !operator==(rhs); 00361 } 00362 00363 bool d_specified; 00364 const Image* d_image; 00365 String d_propertyName; 00366 }; 00367 00368 // implemets abstract from base 00369 void render_impl(Window& srcWindow, Rectf& destRect, 00370 const CEGUI::ColourRect* modColours, 00371 const Rectf* clipper, bool clipToDisplay) const; 00372 00373 void renderImage(GeometryBuffer& buffer, const Image* image, 00374 VerticalFormatting vertFmt, 00375 HorizontalFormatting horzFmt, 00376 Rectf& destRect, const ColourRect& colours, 00377 const Rectf* clipper, bool clipToDisplay) const; 00378 00379 FormattingSetting<VerticalFormatting> d_leftEdgeFormatting; 00380 FormattingSetting<VerticalFormatting> d_rightEdgeFormatting; 00381 FormattingSetting<HorizontalFormatting> d_topEdgeFormatting; 00382 FormattingSetting<HorizontalFormatting> d_bottomEdgeFormatting; 00383 FormattingSetting<VerticalFormatting> d_backgroundVertFormatting; 00384 FormattingSetting<HorizontalFormatting> d_backgroundHorzFormatting; 00385 00387 FrameImageSource d_frameImages[FIC_FRAME_IMAGE_COUNT]; 00388 }; 00389 00390 } 00391 00392 #if defined(_MSC_VER) 00393 # pragma warning(pop) 00394 #endif 00395 00396 #endif 00397