Crazy Eddie's GUI System  0.8.7
ImagerySection.h
1 /***********************************************************************
2  created: Mon Jun 13 2005
3  author: Paul D Turner <paul@cegui.org.uk>
4 *************************************************************************/
5 /***************************************************************************
6  * Copyright (C) 2004 - 2006 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 _CEGUIFalImagerySection_h_
28 #define _CEGUIFalImagerySection_h_
29 
30 #include "./ImageryComponent.h"
31 #include "./TextComponent.h"
32 #include "./FrameComponent.h"
33 #include "../XMLSerializer.h"
34 
35 #if defined(_MSC_VER)
36 # pragma warning(push)
37 # pragma warning(disable : 4251)
38 #endif
39 
40 // Start of CEGUI namespace section
41 namespace CEGUI
42 {
47  class CEGUIEXPORT ImagerySection :
48  public AllocatedObject<ImagerySection>
49  {
50  public:
52  typedef std::vector<ImageryComponent* CEGUI_VECTOR_ALLOC(ImageryComponent*)> ImageryComponentPointerList;
54  typedef std::vector<TextComponent* CEGUI_VECTOR_ALLOC(TextComponent*)> TextComponentPointerList;
56  typedef std::vector<FrameComponent* CEGUI_VECTOR_ALLOC(FrameComponent*)> FrameComponentPointerList;
57 
58 
65 
73  ImagerySection(const String& name);
74 
88  void render(Window& srcWindow, const CEGUI::ColourRect* modColours = 0, const Rectf* clipper = 0, bool clipToDisplay = false) const;
89 
106  void render(Window& srcWindow, const Rectf& baseRect, const CEGUI::ColourRect* modColours = 0, const Rectf* clipper = 0, bool clipToDisplay = false) const;
107 
115  void addImageryComponent(const ImageryComponent& imageryComponent);
116 
126  void removeImageryComponent(const ImageryComponent& imageryComponent);
127 
135  void clearImageryComponents();
136 
144  void addTextComponent(const TextComponent& textComponent);
145 
155  void removeTextComponent(const TextComponent& textComponent);
156 
164  void clearTextComponents();
165 
173  void clearFrameComponents();
174 
182  void addFrameComponent(const FrameComponent& frameComponent);
183 
193  void removeFrameComponent(const FrameComponent& frameComponent);
194 
202  const ColourRect& getMasterColours() const;
203 
214  void setMasterColours(const ColourRect& cols);
215 
223  const String& getName() const;
224 
235  void setName(const String& name);
236 
244  const String& getMasterColoursPropertySource() const;
245 
256  void setMasterColoursPropertySource(const String& property);
257 
262  Rectf getBoundingRect(const Window& wnd) const;
263 
268  Rectf getBoundingRect(const Window& wnd, const Rectf& rect) const;
269 
281  void writeXMLToStream(XMLSerializer& xml_stream) const;
282 
284  bool handleFontRenderSizeChange(Window& window, const Font* font) const;
285 
295  ImageryComponentPointerList getImageryComponentPointers();
296 
306  TextComponentPointerList getTextComponentPointers();
307 
317  FrameComponentPointerList getFrameComponentPointers();
318 
319  protected:
329  void initMasterColourRect(const Window& wnd, ColourRect& cr) const;
330 
331  private:
332  typedef std::vector<ImageryComponent
333  CEGUI_VECTOR_ALLOC(ImageryComponent)> ImageryList;
334  typedef std::vector<TextComponent
335  CEGUI_VECTOR_ALLOC(TextComponent)> TextList;
336  typedef std::vector<FrameComponent
337  CEGUI_VECTOR_ALLOC(FrameComponent)> FrameList;
338 
339  CEGUI::String d_name;
340  CEGUI::ColourRect d_masterColours;
341  FrameList d_frames;
342  ImageryList d_images;
343  TextList d_texts;
344  String d_colourPropertyName;
345 
346  public:
353 
364  ImageryComponentIterator getImageryComponentIterator() const;
375  TextComponentIterator getTextComponentIterator() const;
386  FrameComponentIterator getFrameComponentIterator() const;
387 
388  };
389 
390 } // End of CEGUI namespace section
391 
392 
393 #if defined(_MSC_VER)
394 # pragma warning(pop)
395 #endif
396 
397 #endif // end of guard _CEGUIFalImagerySection_h_
Class that encapsulates information for a text component.
Definition: TextComponent.h:48
Definition: MemoryAllocatedObject.h:109
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
ConstVectorIterator< TextList > TextComponentIterator
Definition: ImagerySection.h:350
iterator for vectors
Definition: IteratorBase.h:287
Class that holds details of colours for the four corners of a rectangle.
Definition: ColourRect.h:43
ConstVectorIterator< ImageryList > ImageryComponentIterator
Definition: ImagerySection.h:348
Class that encapsulates information for a single image component.
Definition: ImageryComponent.h:46
Class that encapsulates a typeface.
Definition: Font.h:58
std::vector< ImageryComponent *CEGUI_VECTOR_ALLOC(ImageryComponent *)> ImageryComponentPointerList
Vector of ImageryComponent Pointers.
Definition: ImagerySection.h:52
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: Window.h:149
std::vector< TextComponent *CEGUI_VECTOR_ALLOC(TextComponent *)> TextComponentPointerList
Vector of TextComponent Pointers.
Definition: ImagerySection.h:54
std::vector< FrameComponent *CEGUI_VECTOR_ALLOC(FrameComponent *)> FrameComponentPointerList
Vector of FrameComponent Pointers.
Definition: ImagerySection.h:56
Class that encapsulates information for a frame with background (9 images in total) ...
Definition: FrameComponent.h:51
ConstVectorIterator< FrameList > FrameComponentIterator
Definition: ImagerySection.h:352
Class used to create XML Document.
Definition: XMLSerializer.h:85
Class that encapsulates a re-usable collection of imagery specifications.
Definition: ImagerySection.h:47
String class used within the GUI system.
Definition: String.h:62