00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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
00119 void _setAlign(const IntSize& _oldsize, bool _update);
00120 void _setAlign(const IntCoord& _oldcoord, bool _update);
00121
00122 private:
00123 void _setTextColour(const Colour& _value);
00124
00125 protected:
00126 bool mEmptyView;
00127 uint32 mCurrentColour;
00128 uint32 mInverseColour;
00129 uint32 mCurrentAlpha;
00130 IntCoord mCurrentCoord;
00131
00132 UString mCaption;
00133 bool mTextOutDate;
00134 Align mTextAlign;
00135
00136 Colour mColour;
00137 float mAlpha;
00138 VertexColourType mVertexFormat;
00139
00140 IFont* mFont;
00141 ITexture* mTexture;
00142 int mFontHeight;
00143
00144 bool mBackgroundNormal;
00145 size_t mStartSelect;
00146 size_t mEndSelect;
00147 size_t mCursorPosition;
00148 bool mVisibleCursor;
00149 bool mInvertSelect;
00150
00151 IntPoint mViewOffset;
00152
00153 ILayerNode* mNode;
00154 RenderItem* mRenderItem;
00155 size_t mCountVertex;
00156 bool mIsAddCursorWidth;
00157
00158 bool mShiftText;
00159 bool mWordWrap;
00160 bool mManualColour;
00161 int mOldWidth;
00162
00163 TextView mTextView;
00164 };
00165
00166 }
00167
00168 #endif // __MYGUI_EDIT_TEXT_H__