MyGUI  3.4.1
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 
26  public ISubWidgetText
27  {
29 
30  public:
31  EditText();
32 
33  void setVisible(bool _value) override;
34 
35  // use in const methods, but actually might update object
36  void updateRawData() const;
37 
38  // метод для отрисовки себя
39  void doRender() override;
40 
41  void setCaption(const UString& _value) override;
42  const UString& getCaption() const override;
43 
44  void setTextColour(const Colour& _value)override;
45  const Colour& getTextColour() const override;
46 
47  void setAlpha(float _value) override;
48 
49  void setFontName(const std::string& _value) override;
50  const std::string& getFontName() const override;
51 
52  void setFontHeight(int _value) override;
53  int getFontHeight() const override;
54 
55  void createDrawItem(ITexture* _texture, ILayerNode* _node) override;
56  void destroyDrawItem() override;
57 
58  void setTextAlign(Align _value) override;
59  Align getTextAlign() const override;
60 
61  size_t getTextSelectionStart() const override;
62  size_t getTextSelectionEnd() const override;
63  void setTextSelection(size_t _start, size_t _end) override;
64 
65  bool getSelectBackground() const override;
66  void setSelectBackground(bool _normal) override;
67 
68  bool isVisibleCursor() const override;
69  void setVisibleCursor(bool _value) override;
70 
72  bool getInvertSelected() const override;
76  void setInvertSelected(bool _value) override;
77 
78  size_t getCursorPosition() const override;
79  void setCursorPosition(size_t _index) override;
80 
81  IntSize getTextSize() const override;
82 
83  // устанавливает смещение текста в пикселях
84  void setViewOffset(const IntPoint& _point) override;
85  IntPoint getViewOffset() const override;
86 
87  // возвращает положение курсора по произвольному положению
88  size_t getCursorPosition(const IntPoint& _point) const override;
89 
90  // возвращает положение курсора в обсолютных координатах
91  IntCoord getCursorCoord(size_t _position) const override;
92 
93  bool getShadow() const override;
94  void setShadow(bool _value) override;
95 
96  void setShiftText(bool _shift) override;
97 
98  void setWordWrap(bool _value) override;
99 
100  void setStateData(IStateInfo* _data) override;
101 
102  void setShadowColour(const Colour& _value) override;
103  const Colour& getShadowColour() const override;
104 
105  /*internal:*/
106  void _updateView() override;
107  void _correctView() override;
108 
109  void _setAlign(const IntSize& _oldsize) override;
110 
111  virtual const VectorLineInfo& getLineInfo() const;
112 
113  private:
114  void _setTextColour(const Colour& _value);
115  void checkVertexSize();
116  unsigned int getMixedNativeAlpha(float secondAlpha) const;
117 
118  void drawQuad(
119  Vertex*& _vertex,
120  size_t& _vertexCount,
121  const FloatRect& _vertexRect,
122  float _vertexZ,
123  const FloatRect& _textureRect,
124  uint32 _colour) const;
125 
126  void drawGlyph(
127  const RenderTargetInfo& renderTargetInfo,
128  Vertex*& _vertex,
129  size_t& _vertexCount,
130  FloatRect _vertexRect,
131  FloatRect _textureRect,
132  uint32 _colour) const;
133 
134  protected:
140 
143  mutable bool mTextOutDate;
145 
148  float mAlpha;
150 
154 
156  size_t mStartSelect;
157  size_t mEndSelect;
161  bool mShadow;
162 
163  IntPoint mViewOffset; // смещение текста
164 
167  size_t mCountVertex;
169 
171  bool mWordWrap;
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:48
VertexColourType mVertexFormat
uint32 mCurrentColourNative
uint32 mInverseColourNative
ITexture * mTexture
ILayerNode * mNode
IntPoint mViewOffset
RenderItem * mRenderItem
uint32 mShadowColourNative
UString::utf32string mUtf32Caption
IntCoord mCurrentCoord
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
std::vector< LineInfo > VectorLineInfo
uint32_t uint32
Definition: MyGUI_Types.h:47