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