Crazy Eddie's GUI System  0.8.6
RenderedString.h
1 /***********************************************************************
2  created: 25/05/2009
3  author: Paul Turner
4  *************************************************************************/
5 /***************************************************************************
6  * Copyright (C) 2004 - 2009 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 _CEGUIRenderedString_h_
28 #define _CEGUIRenderedString_h_
29 
30 #include "CEGUI/Size.h"
31 #include "CEGUI/Rect.h"
32 #include <vector>
33 #include <utility>
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 {
50 class CEGUIEXPORT RenderedString :
51  public AllocatedObject<RenderedString>
52 {
53 public:
56 
58  virtual ~RenderedString();
59 
96  void draw(const Window* ref_wnd,
97  const size_t line, GeometryBuffer& buffer,
98  const Vector2f& position, const ColourRect* mod_colours,
99  const Rectf* clip_rect, const float space_extra) const;
100 
115  Sizef getPixelSize(const Window* ref_wnd, const size_t line) const;
116 
118  float getHorizontalExtent(const Window* ref_wnd) const;
119 
121  float getVerticalExtent(const Window* ref_wnd) const;
122 
124  void appendComponent(const RenderedStringComponent& component);
125 
127  void clearComponents();
128 
130  size_t getComponentCount() const;
131 
155  void split(const Window* ref_wnd,
156  const size_t line, float split_point, RenderedString& left);
157 
159  size_t getSpaceCount(const size_t line) const;
160 
162  void appendLineBreak();
163 
165  size_t getLineCount() const;
166 
168  void setSelection(const Window* ref_wnd, float start, float end);
169 
171  RenderedString(const RenderedString& other);
173  RenderedString& operator=(const RenderedString& rhs);
174 
175 protected:
177  typedef std::vector<RenderedStringComponent*
178  CEGUI_VECTOR_ALLOC(RenderedStringComponent*)> ComponentList;
182  typedef std::pair<size_t, size_t> LineInfo;
184  typedef std::vector<LineInfo
185  CEGUI_VECTOR_ALLOC(LineInfo)> LineList;
189  void cloneComponentList(const ComponentList& list);
191  static void clearComponentList(ComponentList& list);
192 };
193 
194 } // End of CEGUI namespace section
195 
196 #if defined(_MSC_VER)
197 # pragma warning(pop)
198 #endif
199 
200 #endif // end of guard _CEGUIRenderedString_h_
Definition: MemoryAllocatedObject.h:109
std::vector< LineInfo CEGUI_VECTOR_ALLOC(LineInfo)> LineList
Collection type used to hold details about the lines.
Definition: RenderedString.h:185
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
LineList d_lines
lines that make up this string.
Definition: RenderedString.h:187
ComponentList d_components
RenderedStringComponent objects that comprise this RenderedString.
Definition: RenderedString.h:180
std::vector< RenderedStringComponent *CEGUI_VECTOR_ALLOC(RenderedStringComponent *)> ComponentList
Collection type used to hold the string components.
Definition: RenderedString.h:178
Class that holds details of colours for the four corners of a rectangle.
Definition: ColourRect.h:43
Class representing a rendered string of entities.
Definition: RenderedString.h:50
std::pair< size_t, size_t > LineInfo
track info for a line. first is componetn idx, second is component count.
Definition: RenderedString.h:182
Base class representing a part of a rendered string. The 'part' represented may be a text string...
Definition: RenderedStringComponent.h:47
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: Window.h:149