Crazy Eddie's GUI System  0.8.4
RenderedString.h
00001 /***********************************************************************
00002     created:    25/05/2009
00003     author:     Paul Turner
00004  *************************************************************************/
00005 /***************************************************************************
00006  *   Copyright (C) 2004 - 2009 Paul D Turner & The CEGUI Development Team
00007  *
00008  *   Permission is hereby granted, free of charge, to any person obtaining
00009  *   a copy of this software and associated documentation files (the
00010  *   "Software"), to deal in the Software without restriction, including
00011  *   without limitation the rights to use, copy, modify, merge, publish,
00012  *   distribute, sublicense, and/or sell copies of the Software, and to
00013  *   permit persons to whom the Software is furnished to do so, subject to
00014  *   the following conditions:
00015  *
00016  *   The above copyright notice and this permission notice shall be
00017  *   included in all copies or substantial portions of the Software.
00018  *
00019  *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00020  *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00021  *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00022  *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00023  *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00024  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00025  *   OTHER DEALINGS IN THE SOFTWARE.
00026  ***************************************************************************/
00027 #ifndef _CEGUIRenderedString_h_
00028 #define _CEGUIRenderedString_h_
00029 
00030 #include "CEGUI/Size.h"
00031 #include "CEGUI/Rect.h"
00032 #include <vector>
00033 #include <utility>
00034 
00035 #if defined(_MSC_VER)
00036 #       pragma warning(push)
00037 #       pragma warning(disable : 4251)
00038 #endif
00039 
00040 // Start of CEGUI namespace section
00041 namespace CEGUI
00042 {
00050 class CEGUIEXPORT RenderedString :
00051     public AllocatedObject<RenderedString>
00052 {
00053 public:
00055     RenderedString();
00056 
00058     virtual ~RenderedString();
00059 
00096     void draw(const Window* ref_wnd,
00097               const size_t line, GeometryBuffer& buffer,
00098               const Vector2f& position, const ColourRect* mod_colours,
00099               const Rectf* clip_rect, const float space_extra) const;
00100 
00115     Sizef getPixelSize(const Window* ref_wnd, const size_t line) const;
00116 
00118     float getHorizontalExtent(const Window* ref_wnd) const;
00119 
00121     float getVerticalExtent(const Window* ref_wnd) const;
00122 
00124     void appendComponent(const RenderedStringComponent& component);
00125 
00127     void clearComponents();
00128 
00130     size_t getComponentCount() const;
00131 
00155     void split(const Window* ref_wnd,
00156                const size_t line, float split_point, RenderedString& left);
00157 
00159     size_t getSpaceCount(const size_t line) const;
00160 
00162     void appendLineBreak();
00163 
00165     size_t getLineCount() const;
00166 
00168     void setSelection(const Window* ref_wnd, float start, float end);
00169 
00171     RenderedString(const RenderedString& other);
00173     RenderedString& operator=(const RenderedString& rhs);
00174 
00175 protected:
00177     typedef std::vector<RenderedStringComponent*
00178         CEGUI_VECTOR_ALLOC(RenderedStringComponent*)> ComponentList;
00180     ComponentList d_components;
00182     typedef std::pair<size_t, size_t> LineInfo;
00184     typedef std::vector<LineInfo
00185         CEGUI_VECTOR_ALLOC(LineInfo)> LineList;
00187     LineList d_lines;
00189     void cloneComponentList(const ComponentList& list);
00191     static void clearComponentList(ComponentList& list);
00192 };
00193 
00194 } // End of  CEGUI namespace section
00195 
00196 #if defined(_MSC_VER)
00197 #       pragma warning(pop)
00198 #endif
00199 
00200 #endif // end of guard _CEGUIRenderedString_h_
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends