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 18 class MYGUI_EXPORT ISubWidgetText : 19 public ISubWidget 20 { MYGUI_RTTI_DERIVED(ISubWidgetText)21 MYGUI_RTTI_DERIVED( ISubWidgetText ) 22 23 public: 24 /** Get index of start of selection */ 25 virtual size_t getTextSelectionStart() const 26 { 27 return 0; 28 } 29 30 /** Get index of end of selection */ getTextSelectionEnd()31 virtual size_t getTextSelectionEnd() const 32 { 33 return 0; 34 } 35 36 /** Set text selection */ setTextSelection(size_t _start,size_t _end)37 virtual void setTextSelection(size_t _start, size_t _end) { } 38 39 // интенсивность выделенного текста getSelectBackground()40 virtual bool getSelectBackground() const 41 { 42 return true; 43 } 44 setSelectBackground(bool _normal)45 virtual void setSelectBackground(bool _normal) { } 46 47 // нужно ли инвертировать выделение getInvertSelected()48 virtual bool getInvertSelected() const 49 { 50 return true; 51 } 52 setInvertSelected(bool _value)53 virtual void setInvertSelected(bool _value) { } 54 55 // нужно ли показывать тень getShadow()56 virtual bool getShadow() const 57 { 58 return false; 59 } 60 setShadow(bool _value)61 virtual void setShadow(bool _value) { } 62 63 // управление видимостью курсора isVisibleCursor()64 virtual bool isVisibleCursor() const 65 { 66 return false; 67 } 68 setVisibleCursor(bool _value)69 virtual void setVisibleCursor(bool _value) { } 70 71 // управление положением курсора getCursorPosition()72 virtual size_t getCursorPosition() const 73 { 74 return 0; 75 } 76 setCursorPosition(size_t _index)77 virtual void setCursorPosition(size_t _index) { } 78 setWordWrap(bool _value)79 virtual void setWordWrap(bool _value) { } 80 81 // возвращает положение курсора по произвольному положению 82 // позиция абсолютная, без учета смещений getCursorPosition(const IntPoint & _point)83 virtual size_t getCursorPosition(const IntPoint& _point) /*const*/ 84 { 85 return 0; 86 } 87 88 // возвращает положение курсора в обсолютных координатах getCursorCoord(size_t _position)89 virtual IntCoord getCursorCoord(size_t _position) /*const*/ 90 { 91 return IntCoord(); 92 } 93 94 // возвращает положение курсора в обсолютных координатах getCursorPoint(size_t _position)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 // возвращает положение курсора в обсолютных координатах getCursorRect(size_t _position)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 // возвращает размер текста в пикселях getTextSize()109 virtual IntSize getTextSize() /*const*/ 110 { 111 return IntSize(); 112 } 113 114 // устанавливает смещение текста в пикселях setViewOffset(const IntPoint & _point)115 virtual void setViewOffset(const IntPoint& _point) { } getViewOffset()116 virtual IntPoint getViewOffset() const 117 { 118 return IntPoint(); 119 } 120 setCaption(const UString & _value)121 virtual void setCaption(const UString& _value) { } getCaption()122 virtual const UString& getCaption() const 123 { 124 return Constants::getEmptyUString(); 125 } 126 setTextColour(const Colour & _value)127 virtual void setTextColour(const Colour& _value) { } getTextColour()128 virtual const Colour& getTextColour() const 129 { 130 return Colour::Zero; 131 } 132 setFontName(const std::string & _value)133 virtual void setFontName(const std::string& _value) { } getFontName()134 virtual const std::string& getFontName() const 135 { 136 return Constants::getEmptyString(); 137 } 138 setFontHeight(int _value)139 virtual void setFontHeight(int _value) { } getFontHeight()140 virtual int getFontHeight() const 141 { 142 return 0; 143 } 144 setTextAlign(Align _value)145 virtual void setTextAlign(Align _value) { } getTextAlign()146 virtual Align getTextAlign() const 147 { 148 return Align::Default; 149 } 150 setShiftText(bool _value)151 virtual void setShiftText(bool _value) { } 152 setShadowColour(const Colour & _value)153 virtual void setShadowColour(const Colour& _value) { } getShadowColour()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_ 164