Merge branch '138-toggle-free-look-with-hotkey' into main/gingo-test
[ryzomcore.git] / ryzom / client / src / interfaces_manager / text.h
blob4e840bf74f4c0918a543005e9803d902f189fdd7
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
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.
8 //
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/>.
19 #ifndef CL_TEXT_H
20 #define CL_TEXT_H
23 //////////////
24 // Includes //
25 //////////////
26 // Misc.
27 #include "nel/misc/types_nl.h"
28 #include "nel/misc/ucstring.h"
29 #include "nel/misc/rgba.h"
30 // 3D Interface.
31 #include "nel/3d/u_text_context.h"
32 // Client.
33 #include "control.h"
34 #include "pen.h"
37 ///////////
38 // Using //
39 ///////////
40 using NLMISC::CRGBA;
41 using NL3D::UTextContext;
44 /**
45 * Class to manage a Text.
46 * \author Guillaume PUZIN
47 * \author Nevrax France
48 * \date 2001
50 class CText : public CControl, public CPen
52 private:
53 /// Initialize the button (1 function called for all constructors -> easier).
54 inline void init(const ucstring &text);
56 protected:
57 /// Text to display.
58 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
63 uint32 _Index;
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();
73 public:
74 /// Constructor
75 CText(uint id = 0);
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();
82 /// Get the Text.
83 ucstring text();
84 /// Set the Text.
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.
95 void shadow(bool s);
99 #endif // CL_TEXT_H
101 /* End of text.h */