MyGUI 3.4.3
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"
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
20namespace MyGUI
21{
22
23 class RenderItem;
24
26 {
28
29 public:
30 EditText();
31
32 void setVisible(bool _visible) override;
33
34 // use in const methods, but actually might update object
35 void updateRawData() const;
36
37 // метод для отрисовки себя
38 void doRender() override;
39
40 void setCaption(const UString& _value) override;
41 const UString& getCaption() const override;
42
43 void setTextColour(const Colour& _value) override;
44 const Colour& getTextColour() const override;
45
46 void setAlpha(float _value) override;
47
48 void setFontName(std::string_view _value) override;
49 std::string_view getFontName() const override;
50
51 void setFontHeight(int _value) override;
52 int getFontHeight() const override;
53
54 void createDrawItem(ITexture* _texture, ILayerNode* _node) override;
55 void destroyDrawItem() override;
56
57 void setTextAlign(Align _value) override;
58 Align getTextAlign() const override;
59
60 size_t getTextSelectionStart() const override;
61 size_t getTextSelectionEnd() const override;
62 void setTextSelection(size_t _start, size_t _end) override;
63
64 bool getSelectBackground() const override;
65 void setSelectBackground(bool _normal) override;
66
67 bool isVisibleCursor() const override;
68 void setVisibleCursor(bool _value) override;
69
71 bool getInvertSelected() const override;
75 void setInvertSelected(bool _value) override;
76
77 size_t getCursorPosition() const override;
78 void setCursorPosition(size_t _index) override;
79
80 IntSize getTextSize() const override;
81
82 // устанавливает смещение текста в пикселях
83 void setViewOffset(const IntPoint& _point) override;
84 IntPoint getViewOffset() const override;
85
86 // возвращает положение курсора по произвольному положению
87 size_t getCursorPosition(const IntPoint& _point) const override;
88
89 // возвращает положение курсора в обсолютных координатах
90 IntCoord getCursorCoord(size_t _position) const override;
91
92 bool getShadow() const override;
93 void setShadow(bool _value) override;
94
95 void setShiftText(bool _value) override;
96
97 void setWordWrap(bool _value) override;
98
99 void setStateData(IStateInfo* _data) override;
100
101 void setShadowColour(const Colour& _value) override;
102 const Colour& getShadowColour() const override;
103
104 /*internal:*/
105 void _updateView() override;
106 void _correctView() override;
107
108 void _setAlign(const IntSize& _oldsize) override;
109
110 virtual const VectorLineInfo& getLineInfo() const;
111
112 private:
113 void _setTextColour(const Colour& _value);
114 void checkVertexSize();
115 unsigned int getMixedNativeAlpha(float secondAlpha) const;
116
117 void drawQuad(
118 Vertex*& _vertex,
119 size_t& _vertexCount,
120 const FloatRect& _vertexRect,
121 float _vertexZ,
122 const FloatRect& _textureRect,
123 uint32 _colour) const;
124
125 void drawGlyph(
126 const RenderTargetInfo& renderTargetInfo,
127 Vertex*& _vertex,
128 size_t& _vertexCount,
129 FloatRect _vertexRect,
130 FloatRect _textureRect,
131 uint32 _colour) const;
132
133 protected:
134 bool mEmptyView{false};
139
142 mutable bool mTextOutDate{false};
144
149
150 IFont* mFont{nullptr};
154
156 size_t mStartSelect{0};
157 size_t mEndSelect{0};
159 bool mVisibleCursor{false};
160 bool mInvertSelect{true};
161 bool mShadow{false};
162
163 IntPoint mViewOffset; // смещение текста
164
165 ILayerNode* mNode{nullptr};
169
170 bool mShiftText{false};
171 bool mWordWrap{false};
172 bool mManualColour{false};
173 int mOldWidth{0};
174
176 };
177
178} // namespace MyGUI
179
180#endif // MYGUI_EDIT_TEXT_H_
#define MYGUI_EXPORT
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition MyGUI_RTTI.h:69
void setTextColour(const Colour &_value) override
VertexColourType mVertexFormat
size_t getTextSelectionEnd() const override
void setAlpha(float _value) override
uint32 mCurrentColourNative
void setFontName(std::string_view _value) override
void setSelectBackground(bool _normal) override
void setTextSelection(size_t _start, size_t _end) override
void setWordWrap(bool _value) override
void _setAlign(const IntSize &_oldsize) override
bool isVisibleCursor() const override
bool getShadow() const override
IntCoord getCursorCoord(size_t _position) const override
void _correctView() override
void setVisible(bool _visible) override
virtual const VectorLineInfo & getLineInfo() const
void setInvertSelected(bool _value) override
const Colour & getTextColour() const override
void setFontHeight(int _value) override
uint32 mInverseColourNative
const Colour & getShadowColour() const override
ITexture * mTexture
void setShadowColour(const Colour &_value) override
ILayerNode * mNode
const UString & getCaption() const override
bool getInvertSelected() const override
void setCaption(const UString &_value) override
void setTextAlign(Align _value) override
void setStateData(IStateInfo *_data) override
int getFontHeight() const override
size_t getTextSelectionStart() const override
void doRender() override
IntPoint getViewOffset() const override
void setVisibleCursor(bool _value) override
std::string_view getFontName() const override
bool getSelectBackground() const override
IntSize getTextSize() const override
size_t getCursorPosition() const override
void setViewOffset(const IntPoint &_point) override
Align getTextAlign() const override
void _updateView() override
RenderItem * mRenderItem
void setShiftText(bool _value) override
UString::utf32string mUtf32Caption
void createDrawItem(ITexture *_texture, ILayerNode *_node) override
void setCursorPosition(size_t _index) override
void setShadow(bool _value) override
void updateRawData() const
void destroyDrawItem() override
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
std::basic_string< unicode_char > utf32string
string type used for returning UTF-32 formatted data
uint32_t uint32
Definition MyGUI_Types.h:48
std::vector< LineInfo > VectorLineInfo
constexpr float ALPHA_MAX
types::TPoint< int > IntPoint
Definition MyGUI_Types.h:27
types::TRect< float > FloatRect
Definition MyGUI_Types.h:34
types::TCoord< int > IntCoord
Definition MyGUI_Types.h:36
types::TSize< int > IntSize
Definition MyGUI_Types.h:30
static const Colour White
static const Colour Black