MyGUI  3.0.1
MyGUI_EditText.h
Go to the documentation of this file.
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_EDIT_TEXT_H__
00024 #define __MYGUI_EDIT_TEXT_H__
00025 
00026 #include "MyGUI_Prerequest.h"
00027 #include "MyGUI_XmlDocument.h"
00028 #include "MyGUI_Types.h"
00029 #include "MyGUI_ISubWidgetText.h"
00030 #include "MyGUI_IFont.h"
00031 #include "MyGUI_ResourceSkin.h"
00032 #include "MyGUI_RenderFormat.h"
00033 #include "MyGUI_TextView.h"
00034 
00035 namespace MyGUI
00036 {
00037 
00038     class RenderItem;
00039 
00040     class MYGUI_EXPORT EditText : public ISubWidgetText
00041     {
00042         MYGUI_RTTI_DERIVED( EditText )
00043 
00044     public:
00045         EditText();
00046         virtual ~EditText();
00047 
00048         virtual void setVisible(bool _value);
00049 
00050         // обновляет все данные связанные с тектом
00051         virtual void updateRawData();
00052 
00053         // метод для отрисовки себя
00054         virtual void doRender();
00055 
00056         void setCaption(const UString& _value);
00057         const UString& getCaption();
00058 
00059         void setTextColour(const Colour& _value);
00060         const Colour& getTextColour();
00061 
00062         void setAlpha(float _value);
00063         float getAlpha();
00064 
00065         virtual void setFontName(const std::string& _value);
00066         virtual const std::string& getFontName();
00067 
00068         virtual void setFontHeight(int _value);
00069         virtual int getFontHeight();
00070 
00071         virtual void createDrawItem(ITexture* _texture, ILayerNode * _node);
00072         virtual void destroyDrawItem();
00073 
00074         virtual void setTextAlign(Align _value);
00075         virtual Align getTextAlign();
00076 
00077         virtual size_t getTextSelectionStart();
00078         virtual size_t getTextSelectionEnd();
00079         virtual void setTextSelection(size_t _start, size_t _end);
00080 
00081         virtual bool getSelectBackground();
00082         virtual void setSelectBackground(bool _normal);
00083 
00084         virtual bool isVisibleCursor();
00085         virtual void setVisibleCursor(bool _value);
00086 
00088         virtual bool getInvertSelected() { return mInvertSelect; }
00092         virtual void setInvertSelected(bool _value);
00093 
00094         virtual size_t getCursorPosition();
00095         virtual void setCursorPosition(size_t _index);
00096 
00097         virtual IntSize getTextSize();
00098 
00099         // устанавливает смещение текста в пикселях
00100         virtual void setViewOffset(const IntPoint& _point);
00101         virtual IntPoint getViewOffset();
00102 
00103         // возвращает положение курсора по произвольному положению
00104         virtual size_t getCursorPosition(const IntPoint& _point);
00105 
00106         // возвращает положение курсора в обсолютных координатах
00107         virtual IntCoord getCursorCoord(size_t _position);
00108 
00109         void setShiftText(bool _shift);
00110 
00111         void setWordWrap(bool _value);
00112 
00113         virtual void setStateData(IStateInfo * _data);
00114 
00115         void _updateView();
00116         void _correctView();
00117 
00118     /*internal:*/
00119         void _setAlign(const IntSize& _oldsize, bool _update);
00120         void _setAlign(const IntCoord& _oldcoord, bool _update);
00121 
00122     protected:
00123         bool mEmptyView;
00124         uint32 mCurrentColour;
00125         uint32 mInverseColour;
00126         uint32 mCurrentAlpha;
00127         IntCoord mCurrentCoord;
00128 
00129         UString mCaption;
00130         bool mTextOutDate;
00131         Align mTextAlign;
00132 
00133         Colour mColour;
00134         float mAlpha;
00135         VertexColourType mVertexFormat;
00136 
00137         IFont* mFont;
00138         ITexture* mTexture;
00139         int mFontHeight;
00140 
00141         bool mBackgroundNormal;
00142         size_t mStartSelect;
00143         size_t mEndSelect;
00144         size_t mCursorPosition;
00145         bool mVisibleCursor;
00146         bool mInvertSelect;
00147 
00148         IntPoint mViewOffset; // смещение текста
00149 
00150         ILayerNode* mNode;
00151         RenderItem* mRenderItem;
00152         size_t mCountVertex;
00153         bool mIsAddCursorWidth;
00154 
00155         bool mShiftText;
00156         bool mWordWrap;
00157         int mOldWidth;
00158 
00159         TextView mTextView;
00160     };
00161 
00162 } // namespace MyGUI
00163 
00164 #endif // __MYGUI_EDIT_TEXT_H__