Crazy Eddie's GUI System
0.8.4
|
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 _CEGUIRenderedStringTextComponent_h_ 00028 #define _CEGUIRenderedStringTextComponent_h_ 00029 00030 #include "CEGUI/RenderedStringComponent.h" 00031 #include "CEGUI/ColourRect.h" 00032 #include "CEGUI/String.h" 00033 00034 // Start of CEGUI namespace section 00035 namespace CEGUI 00036 { 00038 class CEGUIEXPORT RenderedStringTextComponent : public RenderedStringComponent 00039 { 00040 public: 00042 RenderedStringTextComponent(); 00043 RenderedStringTextComponent(const String& text); 00044 RenderedStringTextComponent(const String& text, const String& font_name); 00045 RenderedStringTextComponent(const String& text, const Font* font); 00046 00048 void setText(const String& text); 00050 const String& getText() const; 00052 void setFont(const Font* font); 00054 void setFont(const String& font_name); 00056 const Font* getFont() const; 00058 void setColours(const ColourRect& cr); 00060 void setColours(const Colour& c); 00062 const ColourRect& getColours() const; 00063 00064 // implementation of abstract base interface 00065 void draw(const Window* ref_wnd, GeometryBuffer& buffer, 00066 const Vector2f& position, const ColourRect* mod_colours, 00067 const Rectf* clip_rect, const float vertical_space, 00068 const float space_extra) const; 00069 Sizef getPixelSize(const Window* ref_wnd) const; 00070 bool canSplit() const; 00071 RenderedStringTextComponent* split(const Window* ref_wnd, 00072 float split_point, bool first_component); 00073 RenderedStringTextComponent* clone() const; 00074 size_t getSpaceCount() const; 00075 void setSelection(const Window* ref_wnd, 00076 const float start, const float end); 00077 00078 protected: 00079 const Font* getEffectiveFont(const Window* window) const; 00080 00081 static size_t getNextTokenLength(const String& text, size_t start_idx); 00082 00084 String d_text; 00086 const Font* d_font; 00088 ColourRect d_colours; 00090 size_t d_selectionStart, d_selectionLength; 00091 }; 00092 00093 } // End of CEGUI namespace section 00094 00095 #endif // end of guard _CEGUIRenderedStringTextComponent_h_