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 
26  public ISubWidgetText
27  {
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:
142 
146 
149  float mAlpha;
151 
155 
157  size_t mStartSelect;
158  size_t mEndSelect;
162  bool mShadow;
163 
164  IntPoint mViewOffset; // смещение текста
165 
168  size_t mCountVertex;
170 
172  bool mWordWrap;
175 
177  };
178 
179 } // namespace MyGUI
180 
181 #endif // MYGUI_EDIT_TEXT_H_
uint32 mInverseColourNative
ILayerNode * mNode
unsigned int uint32
Definition: MyGUI_Types.h:48
std::vector< LineInfo > VectorLineInfo
VertexColourType mVertexFormat
uint32 mCurrentAlphaNative
RenderItem * mRenderItem
IntCoord mCurrentCoord
uint32 mCurrentColourNative
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition: MyGUI_RTTI.h:65
#define MYGUI_EXPORT
ITexture * mTexture
IntPoint mViewOffset
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
uint32 mShadowColourNative