MyGUI  3.4.1
MyGUI_ISubWidgetText.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_I_SUB_WIDGET_TEXT_H_
8 #define MYGUI_I_SUB_WIDGET_TEXT_H_
9 
10 #include "MyGUI_Prerequest.h"
11 #include "MyGUI_ISubWidget.h"
12 #include "MyGUI_Colour.h"
13 #include "MyGUI_Constants.h"
14 
15 namespace MyGUI
16 {
17 
19  public ISubWidget
20  {
22 
23  public:
25  virtual size_t getTextSelectionStart() const
26  {
27  return 0;
28  }
29 
31  virtual size_t getTextSelectionEnd() const
32  {
33  return 0;
34  }
35 
37  virtual void setTextSelection(size_t _start, size_t _end) { }
38 
39  // интенсивность выделенного текста
40  virtual bool getSelectBackground() const
41  {
42  return true;
43  }
44 
45  virtual void setSelectBackground(bool _normal) { }
46 
47  // нужно ли инвертировать выделение
48  virtual bool getInvertSelected() const
49  {
50  return true;
51  }
52 
53  virtual void setInvertSelected(bool _value) { }
54 
55  // нужно ли показывать тень
56  virtual bool getShadow() const
57  {
58  return false;
59  }
60 
61  virtual void setShadow(bool _value) { }
62 
63  // управление видимостью курсора
64  virtual bool isVisibleCursor() const
65  {
66  return false;
67  }
68 
69  virtual void setVisibleCursor(bool _value) { }
70 
71  // управление положением курсора
72  virtual size_t getCursorPosition() const
73  {
74  return 0;
75  }
76 
77  virtual void setCursorPosition(size_t _index) { }
78 
79  virtual void setWordWrap(bool _value) { }
80 
81  // возвращает положение курсора по произвольному положению
82  // позиция абсолютная, без учета смещений
83  virtual size_t getCursorPosition(const IntPoint& _point) const
84  {
85  return 0;
86  }
87 
88  // возвращает положение курсора в обсолютных координатах
89  virtual IntCoord getCursorCoord(size_t _position) const
90  {
91  return IntCoord();
92  }
93 
94  // возвращает положение курсора в обсолютных координатах
95  IntPoint getCursorPoint(size_t _position) const
96  {
97  const IntCoord& coord = getCursorCoord(_position);
98  return IntPoint(coord.left + coord.width / 2, coord.top + coord.height / 2);
99  }
100 
101  // возвращает положение курсора в обсолютных координатах
102  IntRect getCursorRect(size_t _position) const
103  {
104  const IntCoord& coord = getCursorCoord(_position);
105  return IntRect(coord.left, coord.top, coord.left + coord.width, coord.top + coord.height);
106  }
107 
108  // возвращает размер текста в пикселях
109  virtual IntSize getTextSize() const
110  {
111  return IntSize();
112  }
113 
114  // устанавливает смещение текста в пикселях
115  virtual void setViewOffset(const IntPoint& _point) { }
116  virtual IntPoint getViewOffset() const
117  {
118  return IntPoint();
119  }
120 
121  virtual void setCaption(const UString& _value) { }
122  virtual const UString& getCaption() const
123  {
125  }
126 
127  virtual void setTextColour(const Colour& _value) { }
128  virtual const Colour& getTextColour() const
129  {
130  return Colour::Zero;
131  }
132 
133  virtual void setFontName(const std::string& _value) { }
134  virtual const std::string& getFontName() const
135  {
136  return Constants::getEmptyString();
137  }
138 
139  virtual void setFontHeight(int _value) { }
140  virtual int getFontHeight() const
141  {
142  return 0;
143  }
144 
145  virtual void setTextAlign(Align _value) { }
146  virtual Align getTextAlign() const
147  {
148  return Align::Default;
149  }
150 
151  virtual void setShiftText(bool _value) { }
152 
153  virtual void setShadowColour(const Colour& _value) { }
154  virtual const Colour& getShadowColour() const
155  {
156  return Colour::Zero;
157  }
158 
159  };
160 
161 } // namespace MyGUI
162 
163 #endif // MYGUI_I_SUB_WIDGET_TEXT_H_
#define MYGUI_EXPORT
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition: MyGUI_RTTI.h:48
static const std::string & getEmptyString()
static const UString & getEmptyUString()
virtual const std::string & getFontName() const
virtual void setTextAlign(Align _value)
virtual bool getShadow() const
virtual bool getInvertSelected() const
virtual void setViewOffset(const IntPoint &_point)
virtual IntPoint getViewOffset() const
virtual size_t getCursorPosition(const IntPoint &_point) const
virtual const Colour & getShadowColour() const
virtual void setCursorPosition(size_t _index)
virtual void setShadowColour(const Colour &_value)
IntRect getCursorRect(size_t _position) const
IntPoint getCursorPoint(size_t _position) const
virtual void setInvertSelected(bool _value)
virtual IntSize getTextSize() const
virtual void setShadow(bool _value)
virtual size_t getCursorPosition() const
virtual int getFontHeight() const
virtual void setFontHeight(int _value)
virtual IntCoord getCursorCoord(size_t _position) const
virtual void setShiftText(bool _value)
virtual void setSelectBackground(bool _normal)
virtual void setTextColour(const Colour &_value)
virtual void setVisibleCursor(bool _value)
virtual size_t getTextSelectionStart() const
virtual const Colour & getTextColour() const
virtual const UString & getCaption() const
virtual Align getTextAlign() const
virtual void setFontName(const std::string &_value)
virtual size_t getTextSelectionEnd() const
virtual bool getSelectBackground() const
virtual void setWordWrap(bool _value)
virtual void setTextSelection(size_t _start, size_t _end)
virtual void setCaption(const UString &_value)
virtual bool isVisibleCursor() const
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
types::TCoord< int > IntCoord
Definition: MyGUI_Types.h:35
types::TSize< int > IntSize
Definition: MyGUI_Types.h:29
types::TPoint< int > IntPoint
Definition: MyGUI_Types.h:26
types::TRect< int > IntRect
Definition: MyGUI_Types.h:32
static const Colour Zero
Definition: MyGUI_Colour.h:55