MyGUI: MyGUI_EditText.h Source File

MyGUI 3.2.2

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::EditText::mVisibleCursor
bool mVisibleCursor
Definition: MyGUI_EditText.h:160
MyGUI::TextView
Definition: MyGUI_TextView.h:18
MyGUI::ISubWidgetText
Definition: MyGUI_ISubWidgetText.h:18
MyGUI::EditText::mCursorPosition
size_t mCursorPosition
Definition: MyGUI_EditText.h:159
MyGUI::EditText::mOldWidth
int mOldWidth
Definition: MyGUI_EditText.h:174
MyGUI::EditText::mFontHeight
int mFontHeight
Definition: MyGUI_EditText.h:154
MyGUI_XmlDocument.h
MyGUI::EditText::mManualColour
bool mManualColour
Definition: MyGUI_EditText.h:173
MyGUI::EditText::mBackgroundNormal
bool mBackgroundNormal
Definition: MyGUI_EditText.h:156
MyGUI_IFont.h
MyGUI::EditText::mCurrentAlphaNative
uint32 mCurrentAlphaNative
Definition: MyGUI_EditText.h:139
MyGUI::types::TRect< float >
MyGUI_RenderFormat.h
MyGUI::EditText::mInvertSelect
bool mInvertSelect
Definition: MyGUI_EditText.h:161
MyGUI::ILayerNode
Definition: MyGUI_ILayerNode.h:27
MyGUI::EditText::mRenderItem
RenderItem * mRenderItem
Definition: MyGUI_EditText.h:167
MyGUI::types::TPoint< int >
MyGUI_ISubWidgetText.h
MyGUI::RenderItem
Definition: MyGUI_RenderItem.h:22
MyGUI::EditText::mTextAlign
Align mTextAlign
Definition: MyGUI_EditText.h:145
MyGUI::Align
Definition: MyGUI_Align.h:19
MyGUI_VertexData.h
MyGUI::uint32
unsigned int uint32
Definition: MyGUI_Types.h:48
MyGUI::EditText::mTexture
ITexture * mTexture
Definition: MyGUI_EditText.h:153
MyGUI::EditText::mEndSelect
size_t mEndSelect
Definition: MyGUI_EditText.h:158
MyGUI::EditText::mAlpha
float mAlpha
Definition: MyGUI_EditText.h:149
MyGUI::UString
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
Definition: MyGUI_UString.h:168
MyGUI::IStateInfo
Definition: MyGUI_IStateInfo.h:16
MyGUI::EditText::mVertexFormat
VertexColourType mVertexFormat
Definition: MyGUI_EditText.h:150
MyGUI::EditText::mCurrentCoord
IntCoord mCurrentCoord
Definition: MyGUI_EditText.h:141
MyGUI::EditText::mShadowColour
Colour mShadowColour
Definition: MyGUI_EditText.h:148
MyGUI_Prerequest.h
MyGUI::EditText::mTextOutDate
bool mTextOutDate
Definition: MyGUI_EditText.h:144
MyGUI::EditText::mCurrentColourNative
uint32 mCurrentColourNative
Definition: MyGUI_EditText.h:137
MyGUI::IFont
Definition: MyGUI_IFont.h:20
MyGUI::EditText::mWordWrap
bool mWordWrap
Definition: MyGUI_EditText.h:172
MyGUI::EditText::mCaption
UString mCaption
Definition: MyGUI_EditText.h:143
MyGUI::EditText::mCountVertex
size_t mCountVertex
Definition: MyGUI_EditText.h:168
MyGUI::VertexColourType
Definition: MyGUI_RenderFormat.h:15
MyGUI::EditText::mShadow
bool mShadow
Definition: MyGUI_EditText.h:162
MyGUI::EditText::mViewOffset
IntPoint mViewOffset
Definition: MyGUI_EditText.h:164
MyGUI::EditText
Definition: MyGUI_EditText.h:25
MYGUI_RTTI_DERIVED
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition: MyGUI_RTTI.h:65
MyGUI::EditText::mShadowColourNative
uint32 mShadowColourNative
Definition: MyGUI_EditText.h:140
MyGUI::types::TSize< int >
MyGUI::EditText::mFont
IFont * mFont
Definition: MyGUI_EditText.h:152
MyGUI::EditText::mTextView
TextView mTextView
Definition: MyGUI_EditText.h:176
MyGUI::ITexture
Definition: MyGUI_ITexture.h:26
MyGUI::Colour
Definition: MyGUI_Colour.h:16
MyGUI::RenderTargetInfo
Definition: MyGUI_RenderTargetInfo.h:15
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition: MyGUI_Platform.h:103
MyGUI::EditText::mShiftText
bool mShiftText
Definition: MyGUI_EditText.h:171
MyGUI_Types.h
MyGUI::Vertex
Definition: MyGUI_VertexData.h:16
MyGUI::EditText::mColour
Colour mColour
Definition: MyGUI_EditText.h:147
MyGUI::EditText::mEmptyView
bool mEmptyView
Definition: MyGUI_EditText.h:136
MyGUI::types::TCoord< int >
MyGUI::EditText::mInverseColourNative
uint32 mInverseColourNative
Definition: MyGUI_EditText.h:138
MyGUI::VectorLineInfo
std::vector< LineInfo > VectorLineInfo
Definition: MyGUI_TextViewData.h:137
MyGUI
Definition: MyGUI_ActionController.h:14
MyGUI::EditText::mStartSelect
size_t mStartSelect
Definition: MyGUI_EditText.h:157
MyGUI::EditText::mIsAddCursorWidth
bool mIsAddCursorWidth
Definition: MyGUI_EditText.h:169
MyGUI_ResourceSkin.h
MyGUI_TextView.h
MyGUI::EditText::mNode
ILayerNode * mNode
Definition: MyGUI_EditText.h:166