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