MyGUI 3.2.2

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files
- Examples

- File List
- Globals

MyGUI_EditText.h
Go to the documentation of this file.
1 /*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7 #ifndef MYGUI_EDIT_TEXT_H_
8 #define MYGUI_EDIT_TEXT_H_
9
10 #include "MyGUI_Prerequest.h"
11 #include "MyGUI_XmlDocument.h"
12 #include "MyGUI_Types.h"
13 #include "MyGUI_ISubWidgetText.h"
14 #include "MyGUI_IFont.h"
15 #include "MyGUI_ResourceSkin.h"
16 #include "MyGUI_RenderFormat.h"
17 #include "MyGUI_TextView.h"
18 #include "MyGUI_VertexData.h"
19
20 namespace MyGUI
21 {
22
23 class RenderItem;
24
25 class MYGUI_EXPORT EditText :
26 public ISubWidgetText
27 {
28 MYGUI_RTTI_DERIVED( EditText )
29
30 public:
31 EditText();
32 virtual ~EditText();
33
34 virtual void setVisible(bool _value);
35
36 // обновляет все данные связанные с тектом
37 virtual void updateRawData();
38
39 // метод для отрисовки себя
40 virtual void doRender();
41
42 void setCaption(const UString& _value);
43 const UString& getCaption() const;
44
45 void setTextColour(const Colour& _value);
46 const Colour& getTextColour() const;
47
48 void setAlpha(float _value);
49 float getAlpha() const;
50
51 virtual void setFontName(const std::string& _value);
52 virtual const std::string& getFontName() const;
53
54 virtual void setFontHeight(int _value);
55 virtual int getFontHeight() const;
56
57 virtual void createDrawItem(ITexture* _texture, ILayerNode* _node);
58 virtual void destroyDrawItem();
59
60 virtual void setTextAlign(Align _value);
61 virtual Align getTextAlign() const;
62
63 virtual size_t getTextSelectionStart() const;
64 virtual size_t getTextSelectionEnd() const;
65 virtual void setTextSelection(size_t _start, size_t _end);
66
67 virtual bool getSelectBackground() const;
68 virtual void setSelectBackground(bool _normal);
69
70 virtual bool isVisibleCursor() const;
71 virtual void setVisibleCursor(bool _value);
72
74 virtual bool getInvertSelected() const;
78 virtual void setInvertSelected(bool _value);
79
80 virtual size_t getCursorPosition() const;
81 virtual void setCursorPosition(size_t _index);
82
83 virtual IntSize getTextSize();
84
85 // устанавливает смещение текста в пикселях
86 virtual void setViewOffset(const IntPoint& _point);
87 virtual IntPoint getViewOffset() const;
88
89 // возвращает положение курсора по произвольному положению
90 virtual size_t getCursorPosition(const IntPoint& _point);
91
92 // возвращает положение курсора в обсолютных координатах
93 virtual IntCoord getCursorCoord(size_t _position);
94
95 virtual bool getShadow() const;
96 virtual void setShadow(bool _value);
97
98 virtual void setShiftText(bool _shift);
99
100 virtual void setWordWrap(bool _value);
101
102 virtual void setStateData(IStateInfo* _data);
103
104 virtual void setShadowColour(const Colour& _value);
105 virtual const Colour& getShadowColour() const;
106
107 /*internal:*/
108 virtual void _updateView();
109 virtual void _correctView();
110
111 virtual void _setAlign(const IntSize& _oldsize);
112
113 virtual const VectorLineInfo& getLineInfo() const;
114
115 private:
116 void _setTextColour(const Colour& _value);
117 void checkVertexSize();
118
119 void drawQuad(
120 Vertex*& _vertex,
121 size_t& _vertexCount,
122 const FloatRect& _vertexRect,
123 float _vertexZ,
124 const FloatRect& _textureRect,
125 uint32 _colour) const;
126
127 void drawGlyph(
128 const RenderTargetInfo& renderTargetInfo,
129 Vertex*& _vertex,
130 size_t& _vertexCount,
131 FloatRect _vertexRect,
132 FloatRect _textureRect,
133 uint32 _colour) const;
134
135 protected:
136 bool mEmptyView;
137 uint32 mCurrentColourNative;
138 uint32 mInverseColourNative;
139 uint32 mCurrentAlphaNative;
140 uint32 mShadowColourNative;
141 IntCoord mCurrentCoord;
142
143 UString mCaption;
144 bool mTextOutDate;
145 Align mTextAlign;
146
147 Colour mColour;
148 Colour mShadowColour;
149 float mAlpha;
150 VertexColourType mVertexFormat;
151
152 IFont* mFont;
153 ITexture* mTexture;
154 int mFontHeight;
155
156 bool mBackgroundNormal;
157 size_t mStartSelect;
158 size_t mEndSelect;
159 size_t mCursorPosition;
160 bool mVisibleCursor;
161 bool mInvertSelect;
162 bool mShadow;
163
164 IntPoint mViewOffset; // смещение текста
165
166 ILayerNode* mNode;
167 RenderItem* mRenderItem;
168 size_t mCountVertex;
169 bool mIsAddCursorWidth;
170
171 bool mShiftText;
172 bool mWordWrap;
173 bool mManualColour;
174 int mOldWidth;
175
176 TextView mTextView;
177 };
178
179 } // namespace MyGUI
180
181 #endif // MYGUI_EDIT_TEXT_H_
MyGUI::types::TCoord< int >
MyGUI_VertexData.h
MyGUI::uint32
unsigned int uint32
Definition: MyGUI_Types.h:48
MyGUI::types::TPoint< int >
MyGUI::ILayerNode
Definition: MyGUI_ILayerNode.h:27
MyGUI_Prerequest.h
MyGUI::IStateInfo
Definition: MyGUI_IStateInfo.h:16
MyGUI::types::TSize< int >
MyGUI::VectorLineInfo
std::vector< LineInfo > VectorLineInfo
Definition: MyGUI_TextViewData.h:137
MyGUI_IFont.h
MyGUI::RenderItem
Definition: MyGUI_RenderItem.h:22
MyGUI::TextView
Definition: MyGUI_TextView.h:18
MyGUI_Types.h
MyGUI::VertexColourType
Definition: MyGUI_RenderFormat.h:15
MyGUI::IFont
Definition: MyGUI_IFont.h:20
MyGUI_XmlDocument.h
MyGUI
Definition: MyGUI_ActionController.h:14
MyGUI_TextView.h
MYGUI_RTTI_DERIVED
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition: MyGUI_RTTI.h:65
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition: MyGUI_Platform.h:103
MyGUI::types::TRect< float >
MyGUI::ITexture
Definition: MyGUI_ITexture.h:26
MyGUI_ResourceSkin.h
MyGUI::UString
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
Definition: MyGUI_UString.h:168
MyGUI::ISubWidgetText
Definition: MyGUI_ISubWidgetText.h:18
MyGUI::RenderTargetInfo
Definition: MyGUI_RenderTargetInfo.h:15
MyGUI::Align
Definition: MyGUI_Align.h:19
MyGUI::Colour
Definition: MyGUI_Colour.h:16
MyGUI::Vertex
Definition: MyGUI_VertexData.h:16
MyGUI_RenderFormat.h
MyGUI::EditText
Definition: MyGUI_EditText.h:25
MyGUI_ISubWidgetText.h