MyGUI  3.2.0
MyGUI_ISubWidgetText.h
Go to the documentation of this file.
1 
6 /*
7  This file is part of MyGUI.
8 
9  MyGUI is free software: you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  MyGUI is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
21 */
22 #ifndef __MYGUI_I_SUB_WIDGET_TEXT_H__
23 #define __MYGUI_I_SUB_WIDGET_TEXT_H__
24 
25 #include "MyGUI_Prerequest.h"
26 #include "MyGUI_ISubWidget.h"
27 #include "MyGUI_Colour.h"
28 
29 namespace MyGUI
30 {
31 
33  public ISubWidget
34  {
36 
37  public:
38  virtual ~ISubWidgetText() { }
39 
41  virtual size_t getTextSelectionStart() const
42  {
43  return 0;
44  }
45 
47  virtual size_t getTextSelectionEnd() const
48  {
49  return 0;
50  }
51 
53  virtual void setTextSelection(size_t _start, size_t _end) { }
54 
55  // интенсивность выделенного текста
56  virtual bool getSelectBackground() const
57  {
58  return true;
59  }
60 
61  virtual void setSelectBackground(bool _normal) { }
62 
63  // нужно ли инвертировать выделение
64  virtual bool getInvertSelected() const
65  {
66  return true;
67  }
68 
69  virtual void setInvertSelected(bool _value) { }
70 
71  // нужно ли показывать тень
72  virtual bool getShadow() const
73  {
74  return false;
75  }
76 
77  virtual void setShadow(bool _value) { }
78 
79  // управление видимостью курсора
80  virtual bool isVisibleCursor() const
81  {
82  return false;
83  }
84 
85  virtual void setVisibleCursor(bool _value) { }
86 
87  // управление положением курсора
88  virtual size_t getCursorPosition() const
89  {
90  return 0;
91  }
92 
93  virtual void setCursorPosition(size_t _index) { }
94 
95  virtual void setWordWrap(bool _value) { }
96 
97  // возвращает положение курсора по произвольному положению
98  // позиция абсолютная, без учета смещений
99  virtual size_t getCursorPosition(const IntPoint& _point) /*const*/
100  {
101  return 0;
102  }
103 
104  // возвращает положение курсора в обсолютных координатах
105  virtual IntCoord getCursorCoord(size_t _position) /*const*/
106  {
107  return IntCoord();
108  }
109 
110  // возвращает положение курсора в обсолютных координатах
111  IntPoint getCursorPoint(size_t _position) /*const*/
112  {
113  const IntCoord& coord = getCursorCoord(_position);
114  return IntPoint(coord.left + coord.width / 2, coord.top + coord.height / 2);
115  }
116 
117  // возвращает положение курсора в обсолютных координатах
118  IntRect getCursorRect(size_t _position) /*const*/
119  {
120  const IntCoord& coord = getCursorCoord(_position);
121  return IntRect(coord.left, coord.top, coord.left + coord.width, coord.top + coord.height);
122  }
123 
124  // возвращает размер текста в пикселях
125  virtual IntSize getTextSize() /*const*/
126  {
127  return IntSize();
128  }
129 
130  // устанавливает смещение текста в пикселях
131  virtual void setViewOffset(const IntPoint& _point) { }
132  virtual IntPoint getViewOffset() const
133  {
134  return IntPoint();
135  }
136 
137  virtual void setCaption(const UString& _value) { }
138  virtual const UString& getCaption() const
139  {
140  static UString caption;
141  return caption;
142  }
143 
144  virtual void setTextColour(const Colour& _value) { }
145  virtual const Colour& getTextColour() const
146  {
147  return Colour::Zero;
148  }
149 
150  virtual void setFontName(const std::string& _value) { }
151  virtual const std::string& getFontName() const
152  {
153  static std::string name;
154  return name;
155  }
156 
157  virtual void setFontHeight(int _value) { }
158  virtual int getFontHeight() const
159  {
160  return 0;
161  }
162 
163  virtual void setTextAlign(Align _value) { }
164  virtual Align getTextAlign() const
165  {
166  return Align::Default;
167  }
168 
169  virtual void setShiftText(bool _value) { }
170 
171  virtual void setShadowColour(const Colour& _value) { }
172  virtual const Colour& getShadowColour() const
173  {
174  return Colour::Zero;
175  }
176 
177  };
178 
179 } // namespace MyGUI
180 
181 #endif // __MYGUI_I_SUB_WIDGET_TEXT_H__