source: GTP/trunk/Lib/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalTextComponent.h @ 1809

Revision 1809, 5.3 KB checked in by gumbau, 18 years ago (diff)
Line 
1/************************************************************************
2    filename:   CEGUIFalTextComponent.h
3    created:    Sun Jun 19 2005
4    author:     Paul D Turner <paul@cegui.org.uk>
5*************************************************************************/
6/*************************************************************************
7    Crazy Eddie's GUI System (http://www.cegui.org.uk)
8    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
9 
10    This library is free software; you can redistribute it and/or
11    modify it under the terms of the GNU Lesser General Public
12    License as published by the Free Software Foundation; either
13    version 2.1 of the License, or (at your option) any later version.
14 
15    This library is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    Lesser General Public License for more details.
19 
20    You should have received a copy of the GNU Lesser General Public
21    License along with this library; if not, write to the Free Software
22    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23*************************************************************************/
24#ifndef _CEGUIFalTextComponent_h_
25#define _CEGUIFalTextComponent_h_
26
27#include "falagard/CEGUIFalComponentBase.h"
28
29// Start of CEGUI namespace section
30namespace CEGUI
31{
32    /*!
33    \brief
34        Class that encapsulates information for a text component.
35    */
36    class CEGUIEXPORT TextComponent : public FalagardComponentBase
37    {
38    public:
39        /*!
40        \brief
41            Constructor
42        */
43        TextComponent();
44
45        /*!
46        \brief
47            Return the text object that will be rendered by this TextComponent.
48
49        \return
50            String object containing the text that will be rendered.
51        */
52        const String& getText() const;
53
54        /*!
55        \brief
56            Set the text that will be rendered by this TextComponent.
57
58            Note that setting this to the empty string ("") will cause the text from the
59            base window passed when rendering to be used instead.
60
61        \param text
62            String containing text to render, or "" to render text from window.
63
64        \return
65            Nothing.
66        */
67        void setText(const String& text);
68
69        /*!
70        \brief
71            Return the name of the font to be used when rendering this TextComponent.
72
73        \return
74            String object containing the name of a font, or "" if the window font is to be used.
75        */
76        const String& getFont() const;
77
78        /*!
79        \brief
80            Set the name of the font to be used when rendering this TextComponent.
81
82            Note that setting this to the empty string ("") will cause the font from the
83            base window passed when rendering to be used instead.
84
85        \param font
86            String containing name of a font
87
88        \return
89            Nothing.
90        */
91        void setFont(const String& font);
92
93        /*!
94        \brief
95            Return the current vertical formatting setting for this TextComponent.
96
97        \return
98            One of the VerticalTextFormatting enumerated values.
99        */
100        VerticalTextFormatting getVerticalFormatting() const;
101
102        /*!
103        \brief
104            Set the vertical formatting setting for this TextComponent.
105
106        \param fmt
107            One of the VerticalTextFormatting enumerated values.
108
109        \return
110            Nothing.
111        */
112        void setVerticalFormatting(VerticalTextFormatting fmt);
113
114        /*!
115        \brief
116            Return the current horizontal formatting setting for this TextComponent.
117
118        \return
119            One of the HorizontalTextFormatting enumerated values.
120        */
121        HorizontalTextFormatting getHorizontalFormatting() const;
122
123        /*!
124        \brief
125            Set the horizontal formatting setting for this TextComponent.
126
127        \param fmt
128            One of the HorizontalTextFormatting enumerated values.
129
130        \return
131            Nothing.
132        */
133        void setHorizontalFormatting(HorizontalTextFormatting fmt);
134
135        /*!
136        \brief
137            Writes an xml representation of this TextComponent to \a out_stream.
138
139        \param out_stream
140            Stream where xml data should be output.
141
142        \return
143            Nothing.
144        */
145        void writeXMLToStream(OutStream& out_stream) const;
146
147    protected:
148        // implemets abstract from base
149        void render_impl(Window& srcWindow, Rect& destRect, float base_z, const CEGUI::ColourRect* modColours, const Rect* clipper, bool clipToDisplay) const;
150
151    private:
152        String               d_text;            //!< text rendered by this component.
153        String               d_font;            //!< name of font to use.
154        VerticalTextFormatting   d_vertFormatting;  //!< Vertical formatting to be applied when rendering the component.
155        HorizontalTextFormatting d_horzFormatting;  //!< Horizontal formatting to be applied when rendering the component.
156    };
157
158} // End of  CEGUI namespace section
159
160
161#endif  // end of guard _CEGUIFalTextComponent_h_
Note: See TracBrowser for help on using the repository browser.