Crazy Eddie's GUI System  0.8.4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
FrameComponent.h
1 /***********************************************************************
2  created: Mon Jul 18 2005
3  author: Paul D Turner <paul@cegui.org.uk>
4 *************************************************************************/
5 /***************************************************************************
6  * Copyright (C) 2004 - 2012 Paul D Turner & The CEGUI Development Team
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining
9  * a copy of this software and associated documentation files (the
10  * "Software"), to deal in the Software without restriction, including
11  * without limitation the rights to use, copy, modify, merge, publish,
12  * distribute, sublicense, and/or sell copies of the Software, and to
13  * permit persons to whom the Software is furnished to do so, subject to
14  * the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be
17  * included in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  ***************************************************************************/
27 #ifndef _CEGUIFalFrameComponent_h_
28 #define _CEGUIFalFrameComponent_h_
29 
30 #include "CEGUI/falagard/ComponentBase.h"
31 #include "CEGUI/XMLSerializer.h"
32 #include "CEGUI/falagard/FormattingSetting.h"
33 
34 #if defined(_MSC_VER)
35 # pragma warning(push)
36 # pragma warning(disable : 4251)
37 #endif
38 
39 namespace CEGUI
40 {
51 class CEGUIEXPORT FrameComponent : public FalagardComponentBase
52 {
53 public:
55 
63  void setLeftEdgeFormatting(VerticalFormatting fmt);
64 
72  void setRightEdgeFormatting(VerticalFormatting fmt);
73 
81  void setTopEdgeFormatting(HorizontalFormatting fmt);
82 
90  void setBottomEdgeFormatting(HorizontalFormatting fmt);
91 
99  void setBackgroundVerticalFormatting(VerticalFormatting fmt);
100 
108  void setBackgroundHorizontalFormatting(HorizontalFormatting fmt);
109 
115  void setLeftEdgeFormattingPropertySource(const String& property_name);
116 
122  void setRightEdgeFormattingPropertySource(const String& property_name);
123 
129  void setTopEdgeFormattingPropertySource(const String& property_name);
130 
136  void setBottomEdgeFormattingPropertySource(const String& property_name);
137 
143  void setBackgroundVerticalFormattingPropertySource(const String& property_name);
144 
150  void setBackgroundHorizontalFormattingPropertySource(const String& property_name);
151 
159  VerticalFormatting getLeftEdgeFormatting(const Window& wnd) const;
160 
168  VerticalFormatting getRightEdgeFormatting(const Window& wnd) const;
169 
177  HorizontalFormatting getTopEdgeFormatting(const Window& wnd) const;
178 
186  HorizontalFormatting getBottomEdgeFormatting(const Window& wnd) const;
187 
195  VerticalFormatting getBackgroundVerticalFormatting(const Window& wnd) const;
196 
204  HorizontalFormatting getBackgroundHorizontalFormatting(const Window& wnd) const;
205 
224  const Image* getImage(FrameImageComponent part,
225  const Window& wnd) const;
226 
239  void setImage(FrameImageComponent part, const Image* image);
240 
255  void setImage(FrameImageComponent part, const String& name);
256 
272  void setImagePropertySource(FrameImageComponent part, const String& name);
273 
286  bool isImageSpecified(FrameImageComponent part) const;
287 
302  bool isImageFetchedFromProperty(FrameImageComponent part) const;
303 
320  const String& getImagePropertySource(FrameImageComponent part) const;
321 
333  void writeXMLToStream(XMLSerializer& xml_stream) const;
334 
335  bool operator==(const FrameComponent& rhs) const;
336 
337 
342 
343 protected:
345  {
346  FrameImageSource() :
347  d_specified(false),
348  d_image(0)
349  {}
350 
351  bool operator==(const FrameImageSource& rhs) const
352  {
353  return d_specified == rhs.d_specified &&
354  d_image == rhs.d_image &&
355  d_propertyName == rhs.d_propertyName;
356  }
357 
358  bool operator!=(const FrameImageSource& rhs) const
359  {
360  return !operator==(rhs);
361  }
362 
363  bool d_specified;
364  const Image* d_image;
365  String d_propertyName;
366  };
367 
368  // implemets abstract from base
369  void render_impl(Window& srcWindow, Rectf& destRect,
370  const CEGUI::ColourRect* modColours,
371  const Rectf* clipper, bool clipToDisplay) const;
372 
373  void renderImage(GeometryBuffer& buffer, const Image* image,
374  VerticalFormatting vertFmt,
375  HorizontalFormatting horzFmt,
376  Rectf& destRect, const ColourRect& colours,
377  const Rectf* clipper, bool clipToDisplay) const;
378 
379  FormattingSetting<VerticalFormatting> d_leftEdgeFormatting;
380  FormattingSetting<VerticalFormatting> d_rightEdgeFormatting;
381  FormattingSetting<HorizontalFormatting> d_topEdgeFormatting;
382  FormattingSetting<HorizontalFormatting> d_bottomEdgeFormatting;
383  FormattingSetting<VerticalFormatting> d_backgroundVertFormatting;
384  FormattingSetting<HorizontalFormatting> d_backgroundHorzFormatting;
385 
388 };
389 
390 }
391 
392 #if defined(_MSC_VER)
393 # pragma warning(pop)
394 #endif
395 
396 #endif
397