Crazy Eddie's GUI System 0.8.7
Loading...
Searching...
No Matches
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
41namespace CEGUI
42{
50class CEGUIEXPORT RenderedString :
51 public AllocatedObject<RenderedString>
52{
53public:
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
125
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
163
165 size_t getLineCount() const;
166
168 void setSelection(const Window* ref_wnd, float start, float end);
169
174
175protected:
177 typedef std::vector<RenderedStringComponent*
182 typedef std::pair<size_t, size_t> LineInfo;
184 typedef std::vector<LineInfo
185 CEGUI_VECTOR_ALLOC(LineInfo)> LineList;
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:110
Class that holds details of colours for the four corners of a rectangle.
Definition ColourRect.h:45
Abstract class defining the interface for objects that buffer geometry for later rendering.
Definition GeometryBuffer.h:44
Base class representing a part of a rendered string. The 'part' represented may be a text string,...
Definition RenderedStringComponent.h:49
Class representing a rendered string of entities.
Definition RenderedString.h:52
void cloneComponentList(const ComponentList &list)
Make this object's component list a clone of list.
std::vector< RenderedStringComponent *CEGUI_VECTOR_ALLOC(RenderedStringComponent *)> ComponentList
Collection type used to hold the string components.
Definition RenderedString.h:178
LineList d_lines
lines that make up this string.
Definition RenderedString.h:187
Sizef getPixelSize(const Window *ref_wnd, const size_t line) const
Return the pixel size of a specified line for the RenderedString.
float getVerticalExtent(const Window *ref_wnd) const
Return the sum vertical extent of all lines, in pixels.
RenderedString()
Constructor.
void setSelection(const Window *ref_wnd, float start, float end)
set selection highlight
std::pair< size_t, size_t > LineInfo
track info for a line. first is componetn idx, second is component count.
Definition RenderedString.h:182
virtual ~RenderedString()
Destructor.
size_t getSpaceCount(const size_t line) const
return the total number of spacing characters in the specified line.
void split(const Window *ref_wnd, const size_t line, float split_point, RenderedString &left)
split the string in line line as close to split_point as possible.
ComponentList d_components
RenderedStringComponent objects that comprise this RenderedString.
Definition RenderedString.h:180
static void clearComponentList(ComponentList &list)
Free components in the given ComponentList and clear the list.
size_t getLineCount() const
return number of lines in this string.
size_t getComponentCount() const
return the number of components that make up this string.
void appendLineBreak()
linebreak the rendered string at the present position.
void appendComponent(const RenderedStringComponent &component)
append component to the list of components drawn for this string.
RenderedString(const RenderedString &other)
Copy constructor.
float getHorizontalExtent(const Window *ref_wnd) const
Return the maximum horizontal extent of all lines, in pixels.
void clearComponents()
clear the list of components drawn for this string.
RenderedString & operator=(const RenderedString &rhs)
Assignment.
void draw(const Window *ref_wnd, const size_t line, GeometryBuffer &buffer, const Vector2f &position, const ColourRect *mod_colours, const Rectf *clip_rect, const float space_extra) const
Draw the string to a GeometryBuffer.
std::vector< LineInfo CEGUI_VECTOR_ALLOC(LineInfo)> LineList
Collection type used to hold details about the lines.
Definition RenderedString.h:185
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition Window.h:151
Main namespace for Crazy Eddie's GUI Library.
Definition arch_overview.dox:1