diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CGUIStaticText.h | 145 |
1 files changed, 145 insertions, 0 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CGUIStaticText.h b/libraries/irrlicht-1.8/source/Irrlicht/CGUIStaticText.h new file mode 100644 index 0000000..33daa98 --- /dev/null +++ b/libraries/irrlicht-1.8/source/Irrlicht/CGUIStaticText.h | |||
@@ -0,0 +1,145 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | ||
2 | // This file is part of the "Irrlicht Engine". | ||
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | ||
4 | |||
5 | #ifndef __C_GUI_STATIC_TEXT_H_INCLUDED__ | ||
6 | #define __C_GUI_STATIC_TEXT_H_INCLUDED__ | ||
7 | |||
8 | #include "IrrCompileConfig.h" | ||
9 | #ifdef _IRR_COMPILE_WITH_GUI_ | ||
10 | |||
11 | #include "IGUIStaticText.h" | ||
12 | #include "irrArray.h" | ||
13 | |||
14 | namespace irr | ||
15 | { | ||
16 | namespace gui | ||
17 | { | ||
18 | class CGUIStaticText : public IGUIStaticText | ||
19 | { | ||
20 | public: | ||
21 | |||
22 | //! constructor | ||
23 | CGUIStaticText(const wchar_t* text, bool border, IGUIEnvironment* environment, | ||
24 | IGUIElement* parent, s32 id, const core::rect<s32>& rectangle, | ||
25 | bool background = false); | ||
26 | |||
27 | //! destructor | ||
28 | virtual ~CGUIStaticText(); | ||
29 | |||
30 | //! draws the element and its children | ||
31 | virtual void draw(); | ||
32 | |||
33 | //! Sets another skin independent font. | ||
34 | virtual void setOverrideFont(IGUIFont* font=0); | ||
35 | |||
36 | //! Gets the override font (if any) | ||
37 | virtual IGUIFont* getOverrideFont() const; | ||
38 | |||
39 | //! Get the font which is used right now for drawing | ||
40 | virtual IGUIFont* getActiveFont() const; | ||
41 | |||
42 | //! Sets another color for the text. | ||
43 | virtual void setOverrideColor(video::SColor color); | ||
44 | |||
45 | //! Sets another color for the background. | ||
46 | virtual void setBackgroundColor(video::SColor color); | ||
47 | |||
48 | //! Sets whether to draw the background | ||
49 | virtual void setDrawBackground(bool draw); | ||
50 | |||
51 | //! Gets the background color | ||
52 | virtual video::SColor getBackgroundColor() const; | ||
53 | |||
54 | //! Checks if background drawing is enabled | ||
55 | virtual bool isDrawBackgroundEnabled() const; | ||
56 | |||
57 | //! Sets whether to draw the border | ||
58 | virtual void setDrawBorder(bool draw); | ||
59 | |||
60 | //! Checks if border drawing is enabled | ||
61 | virtual bool isDrawBorderEnabled() const; | ||
62 | |||
63 | //! Sets alignment mode for text | ||
64 | virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical); | ||
65 | |||
66 | //! Gets the override color | ||
67 | virtual video::SColor getOverrideColor() const; | ||
68 | |||
69 | //! Sets if the static text should use the overide color or the | ||
70 | //! color in the gui skin. | ||
71 | virtual void enableOverrideColor(bool enable); | ||
72 | |||
73 | //! Checks if an override color is enabled | ||
74 | virtual bool isOverrideColorEnabled() const; | ||
75 | |||
76 | //! Set whether the text in this label should be clipped if it goes outside bounds | ||
77 | virtual void setTextRestrainedInside(bool restrainedInside); | ||
78 | |||
79 | //! Checks if the text in this label should be clipped if it goes outside bounds | ||
80 | virtual bool isTextRestrainedInside() const; | ||
81 | |||
82 | //! Enables or disables word wrap for using the static text as | ||
83 | //! multiline text control. | ||
84 | virtual void setWordWrap(bool enable); | ||
85 | |||
86 | //! Checks if word wrap is enabled | ||
87 | virtual bool isWordWrapEnabled() const; | ||
88 | |||
89 | //! Sets the new caption of this element. | ||
90 | virtual void setText(const wchar_t* text); | ||
91 | |||
92 | //! Returns the height of the text in pixels when it is drawn. | ||
93 | virtual s32 getTextHeight() const; | ||
94 | |||
95 | //! Returns the width of the current text, in the current font | ||
96 | virtual s32 getTextWidth() const; | ||
97 | |||
98 | //! Updates the absolute position, splits text if word wrap is enabled | ||
99 | virtual void updateAbsolutePosition(); | ||
100 | |||
101 | //! Set whether the string should be interpreted as right-to-left (RTL) text | ||
102 | /** \note This component does not implement the Unicode bidi standard, the | ||
103 | text of the component should be already RTL if you call this. The | ||
104 | main difference when RTL is enabled is that the linebreaks for multiline | ||
105 | elements are performed starting from the end. | ||
106 | */ | ||
107 | virtual void setRightToLeft(bool rtl); | ||
108 | |||
109 | //! Checks if the text should be interpreted as right-to-left text | ||
110 | virtual bool isRightToLeft() const; | ||
111 | |||
112 | //! Writes attributes of the element. | ||
113 | virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const; | ||
114 | |||
115 | //! Reads attributes of the element | ||
116 | virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options); | ||
117 | |||
118 | private: | ||
119 | |||
120 | //! Breaks the single text line. | ||
121 | void breakText(); | ||
122 | |||
123 | EGUI_ALIGNMENT HAlign, VAlign; | ||
124 | bool Border; | ||
125 | bool OverrideColorEnabled; | ||
126 | bool OverrideBGColorEnabled; | ||
127 | bool WordWrap; | ||
128 | bool Background; | ||
129 | bool RestrainTextInside; | ||
130 | bool RightToLeft; | ||
131 | |||
132 | video::SColor OverrideColor, BGColor; | ||
133 | gui::IGUIFont* OverrideFont; | ||
134 | gui::IGUIFont* LastBreakFont; // stored because: if skin changes, line break must be recalculated. | ||
135 | |||
136 | core::array< core::stringw > BrokenText; | ||
137 | }; | ||
138 | |||
139 | } // end namespace gui | ||
140 | } // end namespace irr | ||
141 | |||
142 | #endif // _IRR_COMPILE_WITH_GUI_ | ||
143 | |||
144 | #endif | ||
145 | |||