MyGUI_EditText.h
Go to the documentation of this file.
/*
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
* Distributed under the MIT License
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
*/
#ifndef MYGUI_EDIT_TEXT_H_
#define MYGUI_EDIT_TEXT_H_
#include "MyGUI_Prerequest.h"
#include "MyGUI_XmlDocument.h"
#include "MyGUI_Types.h"
#include "MyGUI_ISubWidgetText.h"
#include "MyGUI_IFont.h"
#include "MyGUI_ResourceSkin.h"
#include "MyGUI_RenderFormat.h"
#include "MyGUI_TextView.h"
#include "MyGUI_VertexData.h"
namespace MyGUI
{
class RenderItem;
class MYGUI_EXPORT EditText : public ISubWidgetText
{
MYGUI_RTTI_DERIVED(EditText)
public:
EditText();
void setVisible(bool _visible) override;
// use in const methods, but actually might update object
void updateRawData() const;
// метод для отрисовки себя
void doRender() override;
void setCaption(const UString& _value) override;
const UString& getCaption() const override;
void setTextColour(const Colour& _value) override;
const Colour& getTextColour() const override;
void setAlpha(float _value) override;
void setFontName(std::string_view _value) override;
std::string_view getFontName() const override;
void setFontHeight(int _value) override;
int getFontHeight() const override;
void createDrawItem(ITexture* _texture, ILayerNode* _node) override;
void destroyDrawItem() override;
void setTextAlign(Align _value) override;
Align getTextAlign() const override;
size_t getTextSelectionStart() const override;
size_t getTextSelectionEnd() const override;
void setTextSelection(size_t _start, size_t _end) override;
bool getSelectBackground() const override;
void setSelectBackground(bool _normal) override;
bool isVisibleCursor() const override;
void setVisibleCursor(bool _value) override;
bool getInvertSelected() const override;
void setInvertSelected(bool _value) override;
size_t getCursorPosition() const override;
void setCursorPosition(size_t _index) override;
IntSize getTextSize() const override;
// устанавливает смещение текста в пикселях
void setViewOffset(const IntPoint& _point) override;
IntPoint getViewOffset() const override;
// возвращает положение курсора по произвольному положению
size_t getCursorPosition(const IntPoint& _point) const override;
// возвращает положение курсора в обсолютных координатах
IntCoord getCursorCoord(size_t _position) const override;
bool getShadow() const override;
void setShadow(bool _value) override;
void setShiftText(bool _value) override;
void setWordWrap(bool _value) override;
void setStateData(IStateInfo* _data) override;
void setShadowColour(const Colour& _value) override;
const Colour& getShadowColour() const override;
/*internal:*/
void _updateView() override;
void _correctView() override;
void _setAlign(const IntSize& _oldsize) override;
virtual const VectorLineInfo& getLineInfo() const;
private:
void _setTextColour(const Colour& _value);
void checkVertexSize();
unsigned int getMixedNativeAlpha(float secondAlpha) const;
void drawQuad(
Vertex*& _vertex,
size_t& _vertexCount,
const FloatRect& _vertexRect,
float _vertexZ,
const FloatRect& _textureRect,
uint32 _colour) const;
void drawGlyph(
const RenderTargetInfo& renderTargetInfo,
Vertex*& _vertex,
size_t& _vertexCount,
FloatRect _vertexRect,
FloatRect _textureRect,
uint32 _colour) const;
protected:
bool mEmptyView{false};
uint32 mCurrentColourNative{0xFFFFFFFF};
uint32 mInverseColourNative{0xFF000000};
uint32 mShadowColourNative{0x00000000};
IntCoord mCurrentCoord;
UString mCaption;
UString::utf32string mUtf32Caption;
mutable bool mTextOutDate{false};
Align mTextAlign{Align::Default};
Colour mColour{Colour::White};
Colour mShadowColour{Colour::Black};
float mAlpha{ALPHA_MAX};
VertexColourType mVertexFormat;
IFont* mFont{nullptr};
ITexture* mTexture{nullptr};
int mFontHeight{0};
int mCustomFontHeight = 0;
bool mBackgroundNormal{true};
size_t mStartSelect{0};
size_t mEndSelect{0};
size_t mCursorPosition{0};
bool mVisibleCursor{false};
bool mInvertSelect{true};
bool mShadow{false};
IntPoint mViewOffset; // смещение текста
ILayerNode* mNode{nullptr};
RenderItem* mRenderItem{nullptr};
size_t mCountVertex;
bool mIsAddCursorWidth{true};
bool mShiftText{false};
bool mWordWrap{false};
bool mManualColour{false};
int mOldWidth{0};
mutable TextView mTextView;
};
} // namespace MyGUI
#endif // MYGUI_EDIT_TEXT_H_
MyGUI_IFont.h
MyGUI_ISubWidgetText.h
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition MyGUI_Platform.h:77
MyGUI_Prerequest.h
MYGUI_RTTI_DERIVED
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition MyGUI_RTTI.h:69
MyGUI_RenderFormat.h
MyGUI_ResourceSkin.h
MyGUI_TextView.h
MyGUI_Types.h
MyGUI_VertexData.h
MyGUI_XmlDocument.h
MyGUI::EditText::mBackgroundNormal
bool mBackgroundNormal
Definition MyGUI_EditText.h:155
MyGUI::EditText::setTextColour
void setTextColour(const Colour &_value) override
Definition MyGUI_EditText.cpp:170
MyGUI::EditText::mVertexFormat
VertexColourType mVertexFormat
Definition MyGUI_EditText.h:148
MyGUI::EditText::mCustomFontHeight
int mCustomFontHeight
Definition MyGUI_EditText.h:153
MyGUI::EditText::mShiftText
bool mShiftText
Definition MyGUI_EditText.h:170
MyGUI::EditText::mShadowColour
Colour mShadowColour
Definition MyGUI_EditText.h:146
MyGUI::EditText::getTextSelectionEnd
size_t getTextSelectionEnd() const override
Definition MyGUI_EditText.cpp:296
MyGUI::EditText::mWordWrap
bool mWordWrap
Definition MyGUI_EditText.h:171
MyGUI::EditText::setAlpha
void setAlpha(float _value) override
Definition MyGUI_EditText.cpp:196
MyGUI::EditText::mCurrentColourNative
uint32 mCurrentColourNative
Definition MyGUI_EditText.h:135
MyGUI::EditText::mStartSelect
size_t mStartSelect
Definition MyGUI_EditText.h:156
MyGUI::EditText::setFontName
void setFontName(std::string_view _value) override
Definition MyGUI_EditText.cpp:210
MyGUI::EditText::setSelectBackground
void setSelectBackground(bool _normal) override
Definition MyGUI_EditText.cpp:315
MyGUI::EditText::setTextSelection
void setTextSelection(size_t _start, size_t _end) override
Definition MyGUI_EditText.cpp:301
MyGUI::EditText::setWordWrap
void setWordWrap(bool _value) override
Definition MyGUI_EditText.cpp:449
MyGUI::EditText::_setAlign
void _setAlign(const IntSize &_oldsize) override
Definition MyGUI_EditText.cpp:45
MyGUI::EditText::isVisibleCursor
bool isVisibleCursor() const override
Definition MyGUI_EditText.cpp:325
MyGUI::EditText::getShadow
bool getShadow() const override
Definition MyGUI_EditText.cpp:615
MyGUI::EditText::mEmptyView
bool mEmptyView
Definition MyGUI_EditText.h:134
MyGUI::EditText::mFont
IFont * mFont
Definition MyGUI_EditText.h:150
MyGUI::EditText::getCursorCoord
IntCoord getCursorCoord(size_t _position) const override
Definition MyGUI_EditText.cpp:423
MyGUI::EditText::_correctView
void _correctView() override
Definition MyGUI_EditText.cpp:39
MyGUI::EditText::setVisible
void setVisible(bool _visible) override
Definition MyGUI_EditText.cpp:29
MyGUI::EditText::getLineInfo
virtual const VectorLineInfo & getLineInfo() const
Definition MyGUI_EditText.cpp:389
MyGUI::EditText::setInvertSelected
void setInvertSelected(bool _value) override
Definition MyGUI_EditText.cpp:600
MyGUI::EditText::mCaption
UString mCaption
Definition MyGUI_EditText.h:140
MyGUI::EditText::getTextColour
const Colour & getTextColour() const override
Definition MyGUI_EditText.cpp:191
MyGUI::EditText::setFontHeight
void setFontHeight(int _value) override
Definition MyGUI_EditText.cpp:250
MyGUI::EditText::mInverseColourNative
uint32 mInverseColourNative
Definition MyGUI_EditText.h:136
MyGUI::EditText::mTextView
TextView mTextView
Definition MyGUI_EditText.h:175
MyGUI::EditText::getShadowColour
const Colour & getShadowColour() const override
Definition MyGUI_EditText.cpp:642
MyGUI::EditText::mTexture
ITexture * mTexture
Definition MyGUI_EditText.h:151
MyGUI::EditText::mCursorPosition
size_t mCursorPosition
Definition MyGUI_EditText.h:158
MyGUI::EditText::mIsAddCursorWidth
bool mIsAddCursorWidth
Definition MyGUI_EditText.h:168
MyGUI::EditText::setShadowColour
void setShadowColour(const Colour &_value) override
Definition MyGUI_EditText.cpp:631
MyGUI::EditText::mNode
ILayerNode * mNode
Definition MyGUI_EditText.h:165
MyGUI::EditText::getCaption
const UString & getCaption() const override
Definition MyGUI_EditText.cpp:165
MyGUI::EditText::mTextOutDate
bool mTextOutDate
Definition MyGUI_EditText.h:142
MyGUI::EditText::mViewOffset
IntPoint mViewOffset
Definition MyGUI_EditText.h:163
MyGUI::EditText::getInvertSelected
bool getInvertSelected() const override
Definition MyGUI_EditText.cpp:610
MyGUI::EditText::setCaption
void setCaption(const UString &_value) override
Definition MyGUI_EditText.cpp:136
MyGUI::EditText::setTextAlign
void setTextAlign(Align _value) override
Definition MyGUI_EditText.cpp:355
MyGUI::EditText::mFontHeight
int mFontHeight
Definition MyGUI_EditText.h:152
MyGUI::EditText::mTextAlign
Align mTextAlign
Definition MyGUI_EditText.h:143
MyGUI::EditText::setStateData
void setStateData(IStateInfo *_data) override
Definition MyGUI_EditText.cpp:477
MyGUI::EditText::getFontHeight
int getFontHeight() const override
Definition MyGUI_EditText.cpp:263
MyGUI::EditText::getTextSelectionStart
size_t getTextSelectionStart() const override
Definition MyGUI_EditText.cpp:291
MyGUI::EditText::doRender
void doRender() override
Definition MyGUI_EditText.cpp:485
MyGUI::EditText::getViewOffset
IntPoint getViewOffset() const override
Definition MyGUI_EditText.cpp:402
MyGUI::EditText::mCountVertex
size_t mCountVertex
Definition MyGUI_EditText.h:167
MyGUI::EditText::setVisibleCursor
void setVisibleCursor(bool _value) override
Definition MyGUI_EditText.cpp:330
MyGUI::EditText::getFontName
std::string_view getFontName() const override
Definition MyGUI_EditText.cpp:245
MyGUI::EditText::mShadow
bool mShadow
Definition MyGUI_EditText.h:161
MyGUI::EditText::getSelectBackground
bool getSelectBackground() const override
Definition MyGUI_EditText.cpp:310
MyGUI::EditText::getTextSize
IntSize getTextSize() const override
Definition MyGUI_EditText.cpp:368
MyGUI::EditText::mEndSelect
size_t mEndSelect
Definition MyGUI_EditText.h:157
MyGUI::EditText::mManualColour
bool mManualColour
Definition MyGUI_EditText.h:172
MyGUI::EditText::getCursorPosition
size_t getCursorPosition() const override
Definition MyGUI_EditText.cpp:340
MyGUI::EditText::EditText
EditText()
Definition MyGUI_EditText.cpp:23
MyGUI::EditText::setViewOffset
void setViewOffset(const IntPoint &_point) override
Definition MyGUI_EditText.cpp:394
MyGUI::EditText::mOldWidth
int mOldWidth
Definition MyGUI_EditText.h:173
MyGUI::EditText::getTextAlign
Align getTextAlign() const override
Definition MyGUI_EditText.cpp:363
MyGUI::EditText::_updateView
void _updateView() override
Definition MyGUI_EditText.cpp:97
MyGUI::EditText::mInvertSelect
bool mInvertSelect
Definition MyGUI_EditText.h:160
MyGUI::EditText::mColour
Colour mColour
Definition MyGUI_EditText.h:145
MyGUI::EditText::mRenderItem
RenderItem * mRenderItem
Definition MyGUI_EditText.h:166
MyGUI::EditText::setShiftText
void setShiftText(bool _value) override
Definition MyGUI_EditText.cpp:439
MyGUI::EditText::mShadowColourNative
uint32 mShadowColourNative
Definition MyGUI_EditText.h:137
MyGUI::EditText::mVisibleCursor
bool mVisibleCursor
Definition MyGUI_EditText.h:159
MyGUI::EditText::mUtf32Caption
UString::utf32string mUtf32Caption
Definition MyGUI_EditText.h:141
MyGUI::EditText::mAlpha
float mAlpha
Definition MyGUI_EditText.h:147
MyGUI::EditText::createDrawItem
void createDrawItem(ITexture *_texture, ILayerNode *_node) override
Definition MyGUI_EditText.cpp:268
MyGUI::EditText::setCursorPosition
void setCursorPosition(size_t _index) override
Definition MyGUI_EditText.cpp:345
MyGUI::EditText::setShadow
void setShadow(bool _value) override
Definition MyGUI_EditText.cpp:620
MyGUI::EditText::mCurrentCoord
IntCoord mCurrentCoord
Definition MyGUI_EditText.h:138
MyGUI::EditText::updateRawData
void updateRawData() const
Definition MyGUI_EditText.cpp:458
MyGUI::EditText::destroyDrawItem
void destroyDrawItem() override
Definition MyGUI_EditText.cpp:281
MyGUI::IFont
Definition MyGUI_IFont.h:21
MyGUI::ILayerNode
Definition MyGUI_ILayerNode.h:29
MyGUI::IStateInfo
Definition MyGUI_IStateInfo.h:17
MyGUI::ISubWidgetText
Definition MyGUI_ISubWidgetText.h:19
MyGUI::ITexture
Definition MyGUI_ITexture.h:28
MyGUI::RenderItem
Definition MyGUI_RenderItem.h:23
MyGUI::TextView
Definition MyGUI_TextView.h:19
MyGUI::UString
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
Definition MyGUI_UString.h:144
MyGUI::UString::utf32string
std::basic_string< unicode_char > utf32string
string type used for returning UTF-32 formatted data
Definition MyGUI_UString.h:177
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::uint32
uint32_t uint32
Definition MyGUI_Types.h:48
MyGUI::VectorLineInfo
std::vector< LineInfo > VectorLineInfo
Definition MyGUI_TextViewData.h:129
MyGUI::ALPHA_MAX
constexpr float ALPHA_MAX
Definition MyGUI_Macros.h:20
MyGUI::IntPoint
types::TPoint< int > IntPoint
Definition MyGUI_Types.h:27
MyGUI::FloatRect
types::TRect< float > FloatRect
Definition MyGUI_Types.h:34
MyGUI::IntCoord
types::TCoord< int > IntCoord
Definition MyGUI_Types.h:36
MyGUI::IntSize
types::TSize< int > IntSize
Definition MyGUI_Types.h:30
MyGUI::Align
Definition MyGUI_Align.h:20
MyGUI::Align::Default
@ Default
Definition MyGUI_Align.h:36
MyGUI::Colour
Definition MyGUI_Colour.h:17
MyGUI::Colour::White
static const Colour White
Definition MyGUI_Colour.h:55
MyGUI::Colour::Black
static const Colour Black
Definition MyGUI_Colour.h:54
MyGUI::RenderTargetInfo
Definition MyGUI_RenderTargetInfo.h:16
MyGUI::VertexColourType
Definition MyGUI_RenderFormat.h:16
MyGUI::Vertex
Definition MyGUI_VertexData.h:17