1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
27 #include "nel/misc/types_nl.h"
28 #include "nel/misc/ucstring.h"
29 #include "nel/misc/rgba.h"
31 #include "nel/3d/u_text_context.h"
41 using NL3D::UTextContext
;
45 * Class to manage a Text.
46 * \author Guillaume PUZIN
47 * \author Nevrax France
50 class CText
: public CControl
, public CPen
53 /// Initialize the button (1 function called for all constructors -> easier).
54 inline void init(const ucstring
&text
);
59 /// The text HotSpot (in the text library).
60 UTextContext::THotSpot _TextHotSpot
;
62 /// index of the computed String associated to this text control
65 /// info on the computed String associated to this text control
66 UTextContext::CStringInfo _Info
;
68 /// Calculate the Display X, Y, Width, Height.
69 virtual void calculateDisplay();
70 /// Calculate the display position of the control in relation to the position of the control (Hot Spot).
71 virtual void calculateHS();
76 CText(uint id
, float x
, float y
, float x_pixel
, float y_pixel
, const ucstring
&text
, const CPen
&pen
);
77 CText(uint id
, float x
, float y
, float x_pixel
, float y_pixel
, const ucstring
&text
, uint32 fontSize
, CRGBA color
, bool shadow
);
79 /// Display the Bitmap.
80 virtual void display();
85 void text(ucstring txt
);
87 // replace the methods of CPen class (the CComputedString needs to be recomputed when we change color or size or shadow)
88 /// Set the font size.
89 void fontSize(uint32 fs
);
91 /// Set the pen color.
92 void color(CRGBA color
);
94 /// Set the shadow state.