Crazy Eddie's GUI System  0.8.4
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
CEGUI::RenderedString Class Reference

Class representing a rendered string of entities. More...

+ Inheritance diagram for CEGUI::RenderedString:
+ Collaboration diagram for CEGUI::RenderedString:

Public Member Functions

 RenderedString ()
 Constructor.
 
virtual ~RenderedString ()
 Destructor.
 
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. More...
 
Sizef getPixelSize (const Window *ref_wnd, const size_t line) const
 Return the pixel size of a specified line for the RenderedString. More...
 
float getHorizontalExtent (const Window *ref_wnd) const
 Return the maximum horizontal extent of all lines, in pixels.
 
float getVerticalExtent (const Window *ref_wnd) const
 Return the sum vertical extent of all lines, in pixels.
 
void appendComponent (const RenderedStringComponent &component)
 append component to the list of components drawn for this string.
 
void clearComponents ()
 clear the list of components drawn for this string.
 
size_t getComponentCount () const
 return the number of components that make up this string.
 
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. More...
 
size_t getSpaceCount (const size_t line) const
 return the total number of spacing characters in the specified line.
 
void appendLineBreak ()
 linebreak the rendered string at the present position.
 
size_t getLineCount () const
 return number of lines in this string.
 
void setSelection (const Window *ref_wnd, float start, float end)
 set selection highlight
 
 RenderedString (const RenderedString &other)
 Copy constructor.
 
RenderedStringoperator= (const RenderedString &rhs)
 Assignment.
 

Protected Types

typedef std::vector
< RenderedStringComponent
*CEGUI_VECTOR_ALLOC(RenderedStringComponent *)> 
ComponentList
 Collection type used to hold the string components.
 
typedef std::pair< size_t, size_t > LineInfo
 track info for a line. first is componetn idx, second is component count.
 
typedef std::vector< LineInfo
CEGUI_VECTOR_ALLOC(LineInfo)> 
LineList
 Collection type used to hold details about the lines.
 

Protected Member Functions

void cloneComponentList (const ComponentList &list)
 Make this object's component list a clone of list.
 

Static Protected Member Functions

static void clearComponentList (ComponentList &list)
 Free components in the given ComponentList and clear the list.
 

Protected Attributes

ComponentList d_components
 RenderedStringComponent objects that comprise this RenderedString.
 
LineList d_lines
 lines that make up this string.
 

Detailed Description

Class representing a rendered string of entities.

Here 'string' does not refer solely to a text string, rather a string of any renderable items.

Member Function Documentation

void CEGUI::RenderedString::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.

Parameters
lineThe line of the RenderedString to draw.
bufferGeometryBuffer object that is to receive the geometry resulting from the draw operations.
positionVector2 describing the position where the RenderedString is to be drawn. Note that this is not the final onscreen position, but the position as offset from the top-left corner of the entity represented by the GeometryBuffer.
mod_coloursPointer to a ColourRect describing colour values that are to be modulated with the any stored colour values to calculate the final colour values to be used. This may be 0 if no modulated colours are required. NB: Each specific component will decide if and how it will apply the modulated colours.
clip_rectPointer to a Rect object that describes a clipping rectangle that should be used when drawing the RenderedString. This may be 0 if no clipping is required.
space_extrafloat value indicating additional padding value to be applied to space characters in the string.
Exceptions
InvalidRequestExceptionthrown if line is out of range.
Sizef CEGUI::RenderedString::getPixelSize ( const Window ref_wnd,
const size_t  line 
) const

Return the pixel size of a specified line for the RenderedString.

Parameters
lineThe line number whose size is to be returned.
Returns
Size object describing the size of the rendered output of the specified line of this RenderedString, in pixels.
Exceptions
InvalidRequestExceptionthrown if line is out of range.
void CEGUI::RenderedString::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.

The RenderedString \a left will receive the left portion of the split,
while the right portion of the split will remain in this RenderedString.
Parameters
lineThe line number on which the split is to occur.
split_pointfloat value specifying the pixel location where the split should occur. The actual split will occur as close to this point as possible, though preferring a shorter 'left' portion when the split can not be made exactly at the requested point.
leftRenderedString object that will receieve the left portion of the split. Any existing content in the RenderedString is replaced.
Exceptions
InvalidRequestExceptionthrown if line is out of range.