MyGUI  3.0.1
MyGUI_ISubWidgetText.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_I_SUB_WIDGET_TEXT_H__
24 #define __MYGUI_I_SUB_WIDGET_TEXT_H__
25 
26 #include "MyGUI_Prerequest.h"
27 #include "MyGUI_ISubWidget.h"
28 #include "MyGUI_Colour.h"
29 
30 namespace MyGUI
31 {
32 
34  {
36 
37  public:
38  virtual ~ISubWidgetText() { }
39 
41  virtual size_t getTextSelectionStart() { return 0; }
43  virtual size_t getTextSelectionEnd() { return 0; }
45  virtual void setTextSelection(size_t _start, size_t _end) { }
46 
47  // интенсивность выделенного текста
48  virtual bool getSelectBackground() { return true; }
49  virtual void setSelectBackground(bool _normal) { }
50 
51  // нужно ли инвертировать выделение
52  virtual bool getInvertSelected() { return true; }
53  virtual void setInvertSelected(bool _value) { }
54 
55  // управление видимостью курсора
56  virtual bool isVisibleCursor() { return false; }
57  virtual void setVisibleCursor(bool _value) { }
58 
59  // управление положением курсора
60  virtual size_t getCursorPosition() { return 0; }
61  virtual void setCursorPosition(size_t _index) { }
62 
63  virtual void setWordWrap(bool _value) { }
64 
65  // возвращает положение курсора по произвольному положению
66  // позиция абсолютная, без учета смещений
67  virtual size_t getCursorPosition(const IntPoint& _point) { return 0; }
68 
69  // возвращает положение курсора в обсолютных координатах
70  virtual IntCoord getCursorCoord(size_t _position) { return IntCoord(); }
71 
72  // возвращает положение курсора в обсолютных координатах
73  IntPoint getCursorPoint(size_t _position)
74  {
75  const IntCoord& coord = getCursorCoord(_position);
76  return IntPoint(coord.left + coord.width / 2, coord.top + coord.height / 2);
77  }
78 
79  // возвращает положение курсора в обсолютных координатах
80  IntRect getCursorRect(size_t _position)
81  {
82  const IntCoord& coord = getCursorCoord(_position);
83  return IntRect(coord.left, coord.top, coord.left + coord.width, coord.top + coord.height);
84  }
85 
86  // возвращает размер текста в пикселях
87  virtual IntSize getTextSize() { return IntSize(); }
88 
89  // устанавливает смещение текста в пикселях
90  virtual void setViewOffset(const IntPoint& _point) { }
91  virtual IntPoint getViewOffset() { return IntPoint(); }
92 
93  virtual void setCaption(const UString& _value) { }
94  virtual const UString& getCaption() { static UString caption; return caption; }
95 
96  virtual void setTextColour(const Colour& _value) { }
97  virtual const Colour& getTextColour() { return Colour::Zero; }
98 
99  virtual void setFontName(const std::string& _value) { }
100  virtual const std::string& getFontName() { static std::string name; return name; }
101 
102  virtual void setFontHeight(int _value) { }
103  virtual int getFontHeight() { return 0; }
104 
105  virtual void setTextAlign(Align _value) { }
106  virtual Align getTextAlign() { return Align::Default; }
107 
108  virtual void setShiftText(bool _value) { }
109 
110  };
111 
112 } // namespace MyGUI
113 
114 #endif // __MYGUI_I_SUB_WIDGET_TEXT_H__