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