Crazy Eddie's GUI System  0.8.7
TextComponent.h
1 /***********************************************************************
2  created: Sun Jun 19 2005
3  author: Paul D Turner <paul@cegui.org.uk>
4 *************************************************************************/
5 /***************************************************************************
6  * Copyright (C) 2004 - 2012 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 _CEGUIFalTextComponent_h_
28 #define _CEGUIFalTextComponent_h_
29 
30 #include "./ComponentBase.h"
31 #include "../RenderedString.h"
32 #include "../RefCounted.h"
33 #include "../FormattedRenderedString.h"
34 #include "CEGUI/falagard/FormattingSetting.h"
35 
36 #if defined(_MSC_VER)
37 # pragma warning(push)
38 # pragma warning(disable : 4251)
39 #endif
40 
41 // Start of CEGUI namespace section
42 namespace CEGUI
43 {
48  class CEGUIEXPORT TextComponent : public FalagardComponentBase
49  {
50  public:
51  TextComponent();
52  ~TextComponent();
53  TextComponent(const TextComponent& obj);
54  TextComponent& operator=(const TextComponent& other);
55 
68  const String& getText() const;
69 
70  /*
71  \brief
72  Return a copy of the actual text string that will be used when
73  rendering this TextComponent.
74  */
75  String getEffectiveText(const Window& wnd) const;
76 
89  const String& getTextVisual() const;
90 
91  /*
92  \brief
93  Return a copy of the actual text - with visual ordering - that
94  will be used when rendering this TextComponent.
95  */
96  String getEffectiveVisualText(const Window& wnd) const;
97 
111  void setText(const String& text);
112 
129  const String& getFont() const;
130 
131  /*
132  \brief
133  Return a copy of the name of the font that will actually be used
134  when rendering this TextComponent.
135  */
136  String getEffectiveFont(const Window& wnd) const;
137 
151  void setFont(const String& font);
152 
161 
170 
182 
191 
200 
212 
222 
228  void setHorizontalFormattingPropertySource(const String& property_name);
229 
239 
245  void setVerticalFormattingPropertySource(const String& property_name);
246 
258  void writeXMLToStream(XMLSerializer& xml_stream) const;
259 
269 
279 
291  void setTextPropertySource(const String& property);
292 
302 
312 
324  void setFontPropertySource(const String& property);
325 
327  float getHorizontalTextExtent(const Window& window) const;
328 
330  float getVerticalTextExtent(const Window& window) const;
331 
332  // overridden from ComponentBase.
333  bool handleFontRenderSizeChange(Window& window, const Font* font) const;
334 
335 
337  void updateFormatting(const Window& srcWindow) const;
338 
346  void updateFormatting(const Window& srcWindow, const Sizef& size) const;
347 
348  protected:
349  // implemets abstract from base
350  void render_impl(Window& srcWindow, Rectf& destRect, const CEGUI::ColourRect* modColours, const Rectf* clipper, bool clipToDisplay) const;
352  void setupStringFormatter(const Window& window,
353  const RenderedString& rendered_string) const;
355  const Font* getFontObject(const Window& window) const;
356 
357  private:
359  String d_textLogical;
361  BidiVisualMapping* d_bidiVisualMapping;
363  mutable bool d_bidiDataValid;
365  mutable RenderedString d_renderedString;
367  mutable RefCounted<FormattedRenderedString> d_formattedRenderedString;
369  mutable HorizontalTextFormatting d_lastHorzFormatting;
370 
371  String d_font;
376  String d_textPropertyName;
377  String d_fontPropertyName;
378  };
379 
380 } // End of CEGUI namespace section
381 
382 #if defined(_MSC_VER)
383 # pragma warning(pop)
384 #endif
385 
386 #endif // end of guard _CEGUIFalTextComponent_h_
CEGUI::Font
Class that encapsulates a typeface.
Definition: Font.h:62
CEGUI::TextComponent::getHorizontalTextExtent
float getHorizontalTextExtent(const Window &window) const
return the horizontal pixel extent of the formatted rendered string.
CEGUI::TextComponent::render_impl
void render_impl(Window &srcWindow, Rectf &destRect, const CEGUI::ColourRect *modColours, const Rectf *clipper, bool clipToDisplay) const
Function to do main render caching work.
CEGUI::FormattingSetting< VerticalTextFormatting >
CEGUI::TextComponent
Class that encapsulates information for a text component.
Definition: TextComponent.h:49
CEGUI::TextComponent::setFontPropertySource
void setFontPropertySource(const String &property)
Set the name of the property that will be used to determine the font to use for rendering the text st...
CEGUI::TextComponent::getVerticalTextExtent
float getVerticalTextExtent(const Window &window) const
return the vertical pixel extent of the formatted rendered string.
CEGUI::VerticalTextFormatting
VerticalTextFormatting
Enumeration of possible values to indicate the vertical formatting to be used for a text component.
Definition: Enums.h:85
CEGUI::TextComponent::writeXMLToStream
void writeXMLToStream(XMLSerializer &xml_stream) const
Writes an xml representation of this TextComponent to out_stream.
CEGUI::TextComponent::getFont
const String & getFont() const
Return the name of the font set to be used when rendering this TextComponent.
CEGUI::TextComponent::setHorizontalFormatting
void setHorizontalFormatting(HorizontalTextFormatting fmt)
Set the horizontal formatting setting for this TextComponent.
CEGUI::TextComponent::setVerticalFormattingPropertySource
void setVerticalFormattingPropertySource(const String &property_name)
Set the name of a property that will be used to obtain the vertical formatting to use for this Imager...
CEGUI::XMLSerializer
Class used to create XML Document.
Definition: XMLSerializer.h:87
CEGUI
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
CEGUI::RenderedString
Class representing a rendered string of entities.
Definition: RenderedString.h:52
CEGUI::TextComponent::getFontObject
const Font * getFontObject(const Window &window) const
helper to get the font object to use
CEGUI::TextComponent::getTextVisual
const String & getTextVisual() const
return text string with visual ordering of glyphs.
CEGUI::TextComponent::getFontPropertySource
const String & getFontPropertySource() const
Return the name of the property that will be used to determine the font to use for rendering the text...
CEGUI::TextComponent::setTextPropertySource
void setTextPropertySource(const String &property)
Set the name of the property that will be used to determine the text string to render for this TextCo...
CEGUI::RefCounted
Simple, generic, reference counted pointer class. This is primarily here for use by the Events system...
Definition: RefCounted.h:43
CEGUI::TextComponent::getHorizontalFormattingFromComponent
HorizontalTextFormatting getHorizontalFormattingFromComponent() const
Directly returns the horizontal formatting which was set for the ImageryComponent.
CEGUI::ColourRect
Class that holds details of colours for the four corners of a rectangle.
Definition: ColourRect.h:45
CEGUI::TextComponent::setupStringFormatter
void setupStringFormatter(const Window &window, const RenderedString &rendered_string) const
helper to set up an appropriate FormattedRenderedString
CEGUI::BidiVisualMapping
Abstract class to wrap a Bidi visual mapping of a text string.
Definition: BidiVisualMapping.h:52
CEGUI::TextComponent::setFont
void setFont(const String &font)
Set the name of a font to be used when rendering this TextComponent.
CEGUI::TextComponent::isFontFetchedFromProperty
bool isFontFetchedFromProperty() const
Return whether this TextComponent fetches it's font via a property on the target window.
CEGUI::TextComponent::getHorizontalFormattingPropertySource
const String & getHorizontalFormattingPropertySource() const
Returns the name of the property that will be used to obtain the horizontal formatting to use for thi...
CEGUI::TextComponent::getVerticalFormattingFromComponent
VerticalTextFormatting getVerticalFormattingFromComponent() const
Directly returns the vertical formatting which was set for the ImageryComponent.
CEGUI::TextComponent::setHorizontalFormattingPropertySource
void setHorizontalFormattingPropertySource(const String &property_name)
Set the name of a property that will be used to obtain the horizontal formatting to use for this Imag...
CEGUI::TextComponent::getVerticalFormatting
VerticalTextFormatting getVerticalFormatting(const Window &wnd) const
Return the current vertical formatting setting for this TextComponent.
CEGUI::TextComponent::updateFormatting
void updateFormatting(const Window &srcWindow, const Sizef &size) const
Update string formatting.
CEGUI::TextComponent::setText
void setText(const String &text)
Set the text string for this TextComponent.
CEGUI::TextComponent::getVerticalFormattingPropertySource
const String & getVerticalFormattingPropertySource() const
Returns the name of the property that will be used to obtain the vertical formatting to use for this ...
CEGUI::TextComponent::getText
const String & getText() const
Return the text set for this TextComponent.
CEGUI::FalagardComponentBase
Common base class used for renderable components within an ImagerySection.
Definition: ComponentBase.h:39
CEGUI::Window
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition: Window.h:151
CEGUI::HorizontalTextFormatting
HorizontalTextFormatting
Enumeration of possible values to indicate the horizontal formatting to be used for a text component.
Definition: Enums.h:96
CEGUI::TextComponent::setVerticalFormatting
void setVerticalFormatting(VerticalTextFormatting fmt)
Set the vertical formatting setting for this TextComponent.
CEGUI::Size< float >
CEGUI::String
String class used within the GUI system.
Definition: String.h:64
CEGUI::TextComponent::handleFontRenderSizeChange
bool handleFontRenderSizeChange(Window &window, const Font *font) const
perform any processing required due to the given font having changed.
CEGUI::Rect< float >
CEGUI::TextComponent::getTextPropertySource
const String & getTextPropertySource() const
Return the name of the property that will be used to determine the text string to render for this Tex...
CEGUI::TextComponent::getHorizontalFormatting
HorizontalTextFormatting getHorizontalFormatting(const Window &wnd) const
Return the current horizontal formatting setting for this TextComponent.
CEGUI::TextComponent::updateFormatting
void updateFormatting(const Window &srcWindow) const
Update string formatting.
CEGUI::TextComponent::isTextFetchedFromProperty
bool isTextFetchedFromProperty() const
Return whether this TextComponent fetches it's text string via a property on the target window.