Crazy Eddie's GUI System  0.8.7
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 imageComponent,
225  const Window& wnd) const;
226 
240  const Image* getImage(FrameImageComponent imageComponent) const;
241 
254  void setImage(FrameImageComponent part, const Image* image);
255 
270  void setImage(FrameImageComponent part, const String& name);
271 
287  void setImagePropertySource(FrameImageComponent part, const String& name);
288 
301  bool isImageSpecified(FrameImageComponent part) const;
302 
317  bool isImageFetchedFromProperty(FrameImageComponent part) const;
318 
335  const String& getImagePropertySource(FrameImageComponent part) const;
336 
348  void writeXMLToStream(XMLSerializer& xml_stream) const;
349 
350  bool operator==(const FrameComponent& rhs) const;
351 
352 
357 
358 protected:
360  {
361  FrameImageSource() :
362  d_specified(false),
363  d_image(0)
364  {}
365 
366  bool operator==(const FrameImageSource& rhs) const
367  {
368  return d_specified == rhs.d_specified &&
369  d_image == rhs.d_image &&
370  d_propertyName == rhs.d_propertyName;
371  }
372 
373  bool operator!=(const FrameImageSource& rhs) const
374  {
375  return !operator==(rhs);
376  }
377 
378  bool d_specified;
379  const Image* d_image;
380  String d_propertyName;
381  };
382 
383  // implemets abstract from base
384  void render_impl(Window& srcWindow, Rectf& destRect,
385  const CEGUI::ColourRect* modColours,
386  const Rectf* clipper, bool clipToDisplay) const;
387 
388  void renderImage(GeometryBuffer& buffer, const Image* image,
389  VerticalFormatting vertFmt,
390  HorizontalFormatting horzFmt,
391  Rectf& destRect, const ColourRect& colours,
392  const Rectf* clipper, bool clipToDisplay) const;
393 
394  FormattingSetting<VerticalFormatting> d_leftEdgeFormatting;
395  FormattingSetting<VerticalFormatting> d_rightEdgeFormatting;
396  FormattingSetting<HorizontalFormatting> d_topEdgeFormatting;
397  FormattingSetting<HorizontalFormatting> d_bottomEdgeFormatting;
398  FormattingSetting<VerticalFormatting> d_backgroundVertFormatting;
399  FormattingSetting<HorizontalFormatting> d_backgroundHorzFormatting;
400 
403 };
404 
405 }
406 
407 #if defined(_MSC_VER)
408 # pragma warning(pop)
409 #endif
410 
411 #endif
412 
VerticalFormatting
Enumeration of possible values to indicate the vertical formatting to be used for an image component...
Definition: Enums.h:58
Common base class used for renderable components within an ImagerySection.
Definition: ComponentBase.h:37
bool CEGUIEXPORT operator==(const String &str1, const String &str2)
Return true if String str1 is equal to String str2.
Interface for Image.
Definition: Image.h:158
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
Abstract class defining the interface for objects that buffer geometry for later rendering.
Definition: GeometryBuffer.h:42
Class that holds details of colours for the four corners of a rectangle.
Definition: ColourRect.h:43
Max number of images for a frame.
Definition: Enums.h:146
static const HorizontalFormatting HorizontalFormattingDefault
Default value for the HorzFormat elements of the FrameComponent.
Definition: FrameComponent.h:354
static const VerticalFormatting VerticalFormattingDefault
Default value for the VertFormat elements of the FrameComponent.
Definition: FrameComponent.h:356
HorizontalFormatting
Enumeration of possible values to indicate the horizontal formatting to be used for an image componen...
Definition: Enums.h:71
FrameImageComponent
Enumeration of values referencing available images forming a frame component.
Definition: Enums.h:135
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: Window.h:149
Definition: FrameComponent.h:359
bool CEGUIEXPORT operator!=(const String &str1, const String &str2)
Return true if String str1 is not equal to String str2.
Class that encapsulates information for a frame with background (9 images in total) ...
Definition: FrameComponent.h:51
Class used to create XML Document.
Definition: XMLSerializer.h:85
String class used within the GUI system.
Definition: String.h:62