MyGUI  3.0.1
MyGUI_EditText.h
Go to the documentation of this file.
1 
7 /*
8  This file is part of MyGUI.
9 
10  MyGUI is free software: you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  MyGUI is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
22 */
23 #ifndef __MYGUI_EDIT_TEXT_H__
24 #define __MYGUI_EDIT_TEXT_H__
25 
26 #include "MyGUI_Prerequest.h"
27 #include "MyGUI_XmlDocument.h"
28 #include "MyGUI_Types.h"
29 #include "MyGUI_ISubWidgetText.h"
30 #include "MyGUI_IFont.h"
31 #include "MyGUI_ResourceSkin.h"
32 #include "MyGUI_RenderFormat.h"
33 #include "MyGUI_TextView.h"
34 
35 namespace MyGUI
36 {
37 
38  class RenderItem;
39 
41  {
43 
44  public:
45  EditText();
46  virtual ~EditText();
47 
48  virtual void setVisible(bool _value);
49 
50  // обновляет все данные связанные с тектом
51  virtual void updateRawData();
52 
53  // метод для отрисовки себя
54  virtual void doRender();
55 
56  void setCaption(const UString& _value);
57  const UString& getCaption();
58 
59  void setTextColour(const Colour& _value);
60  const Colour& getTextColour();
61 
62  void setAlpha(float _value);
63  float getAlpha();
64 
65  virtual void setFontName(const std::string& _value);
66  virtual const std::string& getFontName();
67 
68  virtual void setFontHeight(int _value);
69  virtual int getFontHeight();
70 
71  virtual void createDrawItem(ITexture* _texture, ILayerNode * _node);
72  virtual void destroyDrawItem();
73 
74  virtual void setTextAlign(Align _value);
75  virtual Align getTextAlign();
76 
77  virtual size_t getTextSelectionStart();
78  virtual size_t getTextSelectionEnd();
79  virtual void setTextSelection(size_t _start, size_t _end);
80 
81  virtual bool getSelectBackground();
82  virtual void setSelectBackground(bool _normal);
83 
84  virtual bool isVisibleCursor();
85  virtual void setVisibleCursor(bool _value);
86 
88  virtual bool getInvertSelected() { return mInvertSelect; }
92  virtual void setInvertSelected(bool _value);
93 
94  virtual size_t getCursorPosition();
95  virtual void setCursorPosition(size_t _index);
96 
97  virtual IntSize getTextSize();
98 
99  // устанавливает смещение текста в пикселях
100  virtual void setViewOffset(const IntPoint& _point);
101  virtual IntPoint getViewOffset();
102 
103  // возвращает положение курсора по произвольному положению
104  virtual size_t getCursorPosition(const IntPoint& _point);
105 
106  // возвращает положение курсора в обсолютных координатах
107  virtual IntCoord getCursorCoord(size_t _position);
108 
109  void setShiftText(bool _shift);
110 
111  void setWordWrap(bool _value);
112 
113  virtual void setStateData(IStateInfo * _data);
114 
115  void _updateView();
116  void _correctView();
117 
118  /*internal:*/
119  void _setAlign(const IntSize& _oldsize, bool _update);
120  void _setAlign(const IntCoord& _oldcoord, bool _update);
121 
122  protected:
128 
132 
134  float mAlpha;
136 
140 
142  size_t mStartSelect;
143  size_t mEndSelect;
147 
148  IntPoint mViewOffset; // смещение текста
149 
152  size_t mCountVertex;
154 
156  bool mWordWrap;
158 
160  };
161 
162 } // namespace MyGUI
163 
164 #endif // __MYGUI_EDIT_TEXT_H__