Crazy Eddie's GUI System
0.8.4
|
00001 /*********************************************************************** 00002 created: Sun Jun 19 2005 00003 author: Paul D Turner <paul@cegui.org.uk> 00004 *************************************************************************/ 00005 /*************************************************************************** 00006 * Copyright (C) 2004 - 2012 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 _CEGUIFalTextComponent_h_ 00028 #define _CEGUIFalTextComponent_h_ 00029 00030 #include "./ComponentBase.h" 00031 #include "../RenderedString.h" 00032 #include "../RefCounted.h" 00033 #include "../FormattedRenderedString.h" 00034 #include "CEGUI/falagard/FormattingSetting.h" 00035 00036 #if defined(_MSC_VER) 00037 # pragma warning(push) 00038 # pragma warning(disable : 4251) 00039 #endif 00040 00041 // Start of CEGUI namespace section 00042 namespace CEGUI 00043 { 00048 class CEGUIEXPORT TextComponent : public FalagardComponentBase 00049 { 00050 public: 00051 TextComponent(); 00052 ~TextComponent(); 00053 TextComponent(const TextComponent& obj); 00054 TextComponent& operator=(const TextComponent& other); 00055 00068 const String& getText() const; 00069 00070 /* 00071 \brief 00072 Return a copy of the actual text string that will be used when 00073 rendering this TextComponent. 00074 */ 00075 String getEffectiveText(const Window& wnd) const; 00076 00089 const String& getTextVisual() const; 00090 00091 /* 00092 \brief 00093 Return a copy of the actual text - with visual ordering - that 00094 will be used when rendering this TextComponent. 00095 */ 00096 String getEffectiveVisualText(const Window& wnd) const; 00097 00111 void setText(const String& text); 00112 00129 const String& getFont() const; 00130 00131 /* 00132 \brief 00133 Return a copy of the name of the font that will actually be used 00134 when rendering this TextComponent. 00135 */ 00136 String getEffectiveFont(const Window& wnd) const; 00137 00151 void setFont(const String& font); 00152 00160 VerticalTextFormatting getVerticalFormatting(const Window& wnd) const; 00161 00172 void setVerticalFormatting(VerticalTextFormatting fmt); 00173 00181 HorizontalTextFormatting getHorizontalFormatting(const Window& wnd) const; 00182 00193 void setHorizontalFormatting(HorizontalTextFormatting fmt); 00194 00200 void setHorizontalFormattingPropertySource(const String& property_name); 00201 00207 void setVerticalFormattingPropertySource(const String& property_name); 00208 00220 void writeXMLToStream(XMLSerializer& xml_stream) const; 00221 00230 bool isTextFetchedFromProperty() const; 00231 00240 const String& getTextPropertySource() const; 00241 00253 void setTextPropertySource(const String& property); 00254 00263 bool isFontFetchedFromProperty() const; 00264 00273 const String& getFontPropertySource() const; 00274 00286 void setFontPropertySource(const String& property); 00287 00289 float getHorizontalTextExtent(const Window& window) const; 00290 00292 float getVerticalTextExtent(const Window& window) const; 00293 00294 // overridden from ComponentBase. 00295 bool handleFontRenderSizeChange(Window& window, const Font* font) const; 00296 00297 protected: 00298 // implemets abstract from base 00299 void render_impl(Window& srcWindow, Rectf& destRect, const CEGUI::ColourRect* modColours, const Rectf* clipper, bool clipToDisplay) const; 00301 void setupStringFormatter(const Window& window, 00302 const RenderedString& rendered_string) const; 00304 const Font* getFontObject(const Window& window) const; 00305 00306 private: 00308 String d_textLogical; 00310 BidiVisualMapping* d_bidiVisualMapping; 00312 mutable bool d_bidiDataValid; 00314 mutable RenderedString d_renderedString; 00316 mutable RefCounted<FormattedRenderedString> d_formattedRenderedString; 00318 mutable HorizontalTextFormatting d_lastHorzFormatting; 00319 00320 String d_font; 00321 00322 FormattingSetting<VerticalTextFormatting> d_vertFormatting; 00324 FormattingSetting<HorizontalTextFormatting> d_horzFormatting; 00325 String d_textPropertyName; 00326 String d_fontPropertyName; 00327 }; 00328 00329 } // End of CEGUI namespace section 00330 00331 #if defined(_MSC_VER) 00332 # pragma warning(pop) 00333 #endif 00334 00335 #endif // end of guard _CEGUIFalTextComponent_h_