00001 00007 /* 00008 This file is part of MyGUI. 00009 00010 MyGUI is free software: you can redistribute it and/or modify 00011 it under the terms of the GNU Lesser General Public License as published by 00012 the Free Software Foundation, either version 3 of the License, or 00013 (at your option) any later version. 00014 00015 MyGUI is distributed in the hope that it will be useful, 00016 but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 GNU Lesser General Public License for more details. 00019 00020 You should have received a copy of the GNU Lesser General Public License 00021 along with MyGUI. If not, see <http://www.gnu.org/licenses/>. 00022 */ 00023 #ifndef __MYGUI_I_SUB_WIDGET_TEXT_H__ 00024 #define __MYGUI_I_SUB_WIDGET_TEXT_H__ 00025 00026 #include "MyGUI_Prerequest.h" 00027 #include "MyGUI_Common.h" 00028 #include "MyGUI_ISubWidget.h" 00029 #include "MyGUI_Colour.h" 00030 00031 namespace MyGUI 00032 { 00033 00034 class MYGUI_EXPORT ISubWidgetText : public ISubWidget 00035 { 00036 MYGUI_RTTI_DERIVED( ISubWidgetText ); 00037 00038 public: 00039 virtual ~ISubWidgetText() { } 00040 00042 virtual size_t getTextSelectionStart() { return 0; } 00044 virtual size_t getTextSelectionEnd() { return 0; } 00046 virtual void setTextSelection(size_t _start, size_t _end) { } 00047 00048 // интенсивность выделенного текста 00049 virtual bool getSelectBackground() { return true; } 00050 virtual void setSelectBackground(bool _normal) { } 00051 00052 // нужно ли инвертировать выделение 00053 virtual bool getInvertSelected() { return true; } 00054 virtual void setInvertSelected(bool _value) { } 00055 00056 // управление видимостью курсора 00057 virtual bool isVisibleCursor() { return false; } 00058 virtual void setVisibleCursor(bool _value) { } 00059 00060 // управление положением курсора 00061 virtual size_t getCursorPosition() { return 0; } 00062 virtual void setCursorPosition(size_t _index) { } 00063 00064 virtual void setWordWrap(bool _value) { } 00065 00066 // возвращает положение курсора по произвольному положению 00067 // позиция абсолютная, без учета смещений 00068 virtual size_t getCursorPosition(const IntPoint& _point) { return 0; } 00069 00070 // возвращает положение курсора в обсолютных координатах 00071 virtual IntCoord getCursorCoord(size_t _position) { return IntCoord(); } 00072 00073 // возвращает положение курсора в обсолютных координатах 00074 IntPoint getCursorPoint(size_t _position) 00075 { 00076 const IntCoord& coord = getCursorCoord(_position); 00077 return IntPoint(coord.left + coord.width / 2, coord.top + coord.height / 2); 00078 } 00079 00080 // возвращает положение курсора в обсолютных координатах 00081 IntRect getCursorRect(size_t _position) 00082 { 00083 const IntCoord& coord = getCursorCoord(_position); 00084 return IntRect(coord.left, coord.top, coord.left + coord.width, coord.top + coord.height); 00085 } 00086 00087 // возвращает размер текста в пикселях 00088 virtual IntSize getTextSize() { return IntSize(); } 00089 00090 // устанавливает смещение текста в пикселях 00091 virtual void setViewOffset(const IntPoint& _point) { } 00092 virtual IntPoint getViewOffset() { return IntPoint(); } 00093 00094 virtual void setCaption(const UString& _value) { } 00095 virtual const UString& getCaption() { static UString caption; return caption; } 00096 00097 virtual void setTextColour(const Colour& _value) { } 00098 virtual const Colour& getTextColour() { return Colour::Zero; } 00099 00100 virtual void setFontName(const std::string& _value) { } 00101 virtual const std::string& getFontName() { static std::string name; return name; } 00102 00103 virtual void setFontHeight(int _value) { } 00104 virtual int getFontHeight() { return 0; } 00105 00106 virtual void setTextAlign(Align _value) { } 00107 virtual Align getTextAlign() { return Align::Default; } 00108 00109 virtual void setShiftText(bool _value) { } 00110 00111 }; 00112 00113 } // namespace MyGUI 00114 00115 #endif // __MYGUI_I_SUB_WIDGET_TEXT_H__