Go to the documentation of this file.
26 mCurrentColourNative(0xFFFFFFFF),
27 mInverseColourNative(0xFF000000),
28 mShadowColourNative(0x00000000),
30 mTextAlign(
Align::Default),
32 mShadowColour(
Colour::Black),
37 mBackgroundNormal(true),
41 mVisibleCursor(false),
47 mIsAddCursorWidth(true),
86 bool need_update =
true;
155 if (
nullptr !=
mNode)
171 if (
nullptr !=
mNode)
182 if (
nullptr !=
mNode)
186 void EditText::checkVertexSize()
198 unsigned int EditText::getMixedNativeAlpha(
float secondAlpha)
211 _setTextColour(_value);
214 void EditText::_setTextColour(
const Colour& _value)
227 if (
nullptr !=
mNode)
246 if (
nullptr !=
mNode)
254 if (
mFont !=
nullptr)
281 if (
nullptr !=
mNode)
295 if (
nullptr !=
mNode)
342 if (
nullptr !=
mNode)
357 if (
nullptr !=
mNode)
372 if (
nullptr !=
mNode)
387 if (
nullptr !=
mNode)
395 if (
nullptr !=
mNode)
434 if (
nullptr !=
mNode)
445 if (
nullptr ==
mFont)
461 if (
nullptr ==
mFont)
481 if (
nullptr !=
mNode)
490 if (
nullptr !=
mNode)
496 if (
nullptr ==
mFont)
534 size_t vertexCount = 0;
551 for (VectorLineInfo::const_iterator line = textViewData.begin(); line != textViewData.end(); ++line)
555 for (VectorCharInfo::const_iterator sim = line->simbols.begin(); sim != line->simbols.end(); ++sim)
559 colour = sim->getColour() | (colour & 0xFF000000);
560 inverseColour = colour ^ 0x00FFFFFF;
561 selectedColour =
mInvertSelect ? inverseColour : colour | 0x00FFFFFF;
568 float fullAdvance = sim->getBearingX() + sim->getAdvance();
573 vertexRect.
set(left, top, left + fullAdvance, top + (
float)
mFontHeight);
575 drawGlyph(renderTargetInfo, vertex, vertexCount, vertexRect, selectedUVRect, selectedColour);
581 vertexRect.
left = left + sim->getBearingX() + 1.0f;
582 vertexRect.
top = top + sim->getBearingY() + 1.0f;
583 vertexRect.
right = vertexRect.
left + sim->getWidth();
584 vertexRect.
bottom = vertexRect.
top + sim->getHeight();
586 drawGlyph(renderTargetInfo, vertex, vertexCount, vertexRect, sim->getUVRect(),
mShadowColourNative);
590 vertexRect.
left = left + sim->getBearingX();
591 vertexRect.
top = top + sim->getBearingY();
592 vertexRect.
right = vertexRect.
left + sim->getWidth();
593 vertexRect.
bottom = vertexRect.
top + sim->getHeight();
595 drawGlyph(renderTargetInfo, vertex, vertexCount, vertexRect, sim->getUVRect(), (!select || !
mInvertSelect) ? colour : inverseColour);
625 if (
nullptr !=
mNode)
646 if (
nullptr !=
mNode)
659 if (
nullptr !=
mNode)
668 void EditText::drawQuad(
670 size_t& _vertexCount,
676 _vertex[0].
x = _vertexRect.
left;
677 _vertex[0].
y = _vertexRect.
top;
678 _vertex[0].
z = _vertexZ;
679 _vertex[0].
colour = _colour;
680 _vertex[0].
u = _textureRect.
left;
681 _vertex[0].
v = _textureRect.
top;
683 _vertex[2].
x = _vertexRect.
left;
684 _vertex[2].
y = _vertexRect.
bottom;
685 _vertex[2].
z = _vertexZ;
686 _vertex[2].
colour = _colour;
687 _vertex[2].
u = _textureRect.
left;
688 _vertex[2].
v = _textureRect.
bottom;
690 _vertex[1].
x = _vertexRect.
right;
691 _vertex[1].
y = _vertexRect.
top;
692 _vertex[1].
z = _vertexZ;
693 _vertex[1].
colour = _colour;
694 _vertex[1].
u = _textureRect.
right;
695 _vertex[1].
v = _textureRect.
top;
697 _vertex[3].
x = _vertexRect.
right;
698 _vertex[3].
y = _vertexRect.
top;
699 _vertex[3].
z = _vertexZ;
700 _vertex[3].
colour = _colour;
701 _vertex[3].
u = _textureRect.
right;
702 _vertex[3].
v = _textureRect.
top;
704 _vertex[5].
x = _vertexRect.
left;
705 _vertex[5].
y = _vertexRect.
bottom;
706 _vertex[5].
z = _vertexZ;
707 _vertex[5].
colour = _colour;
708 _vertex[5].
u = _textureRect.
left;
709 _vertex[5].
v = _textureRect.
bottom;
711 _vertex[4].
x = _vertexRect.
right;
712 _vertex[4].
y = _vertexRect.
bottom;
713 _vertex[4].
z = _vertexZ;
714 _vertex[4].
colour = _colour;
715 _vertex[4].
u = _textureRect.
right;
716 _vertex[4].
v = _textureRect.
bottom;
722 void EditText::drawGlyph(
723 const RenderTargetInfo& _renderTargetInfo,
725 size_t& _vertexCount,
736 _textureRect.left += _textureRect.width() * leftClip / _vertexRect.width();
737 _vertexRect.left += leftClip;
747 if (rightClip > 0.0f)
751 _textureRect.right -= _textureRect.width() * rightClip / _vertexRect.width();
752 _vertexRect.right -= rightClip;
766 _textureRect.top += _textureRect.height() * topClip / _vertexRect.height();
767 _vertexRect.top += topClip;
777 if (bottomClip > 0.0f)
781 _textureRect.bottom -= _textureRect.height() * bottomClip / _vertexRect.height();
782 _vertexRect.bottom -= bottomClip;
794 ((_renderTargetInfo.pixScaleX * pix_left + _renderTargetInfo.hOffset) * 2.0f) - 1.0f,
795 -(((_renderTargetInfo.pixScaleY * pix_top + _renderTargetInfo.vOffset) * 2.0f) - 1.0f),
796 ((_renderTargetInfo.pixScaleX * (pix_left + _vertexRect.width()) + _renderTargetInfo.hOffset) * 2.0f) - 1.0f,
797 -(((_renderTargetInfo.pixScaleY * (pix_top + _vertexRect.height()) + _renderTargetInfo.vOffset) * 2.0f) - 1.0f));
799 drawQuad(_vertex, _vertexCount, vertexRect,
mNode->
getNodeDepth(), _textureRect, _colour);
const IntSize & getViewSize() const
void setShadowColour(const Colour &_value) override
static RenderManager & getInstance()
void setFontName(const std::string &_value) override
void setLastVertexCount(size_t _count)
size_t getTextSelectionStart() const override
bool isVisibleCursor() const override
int getFontHeight() const override
void update(const UString &_text, IFont *_font, int _height, Align _align, VertexColourType _format, int _maxWidth=-1)
void reallockDrawItem(ISubWidget *_item, size_t _count)
void createDrawItem(ITexture *_texture, ILayerNode *_node) override
virtual GlyphInfo * getGlyphInfo(Char _id)=0
const IntPoint & getAbsolutePosition() const
size_t getCursorPosition() const override
void convertColour(uint32 &_colour, VertexColourType _format)
int _getViewHeight() const
void setShiftText(bool _shift) override
void set(T const &_left, T const &_top, T const &_right, T const &_bottom)
int getAbsoluteTop() const
void _correctView() override
bool getSelectBackground() const override
virtual RenderItem * addToRenderItem(ITexture *_texture, bool _firstQueue, bool _separate)=0
const Colour & getShadowColour() const override
IntSize getTextSize() override
bool getInvertSelected() const override
virtual void outOfDate(RenderItem *_item)=0
const Colour & getTextColour() const override
types::TCoord< int > IntCoord
int getAbsoluteLeft() const
virtual const VectorLineInfo & getLineInfo() const
void setTextColour(const Colour &_value) override
const VectorLineInfo & getData() const
virtual ITexture * getTextureFont()=0
const std::string & getResourceName() const
virtual float getNodeDepth()=0
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
bool _checkOutside() const
VertexColourType mVertexFormat
void setCursorPosition(size_t _index) override
IntCoord getCursorCoord(size_t _position) override
ICroppedRectangle * mCroppedParent
void _updateView() override
const size_t SIMPLETEXT_COUNT_VERTEX
uint32 mCurrentColourNative
virtual const RenderTargetInfo & getInfo()=0
#define MYGUI_ASSERT(exp, dest)
Type * castType(bool _throw=true)
IntPoint getViewOffset() const override
const UString & getCaption() const override
IFont * getByName(const std::string &_name) const
IRenderTarget * getRenderTarget()
types::TRect< float > FloatRect
void setFontHeight(int _value) override
uint32 mShadowColourNative
void destroyDrawItem() override
void setViewOffset(const IntPoint &_point) override
size_t getCursorPosition(const IntPoint &_value)
virtual int getDefaultHeight()=0
size_type size() const
Returns the number of code points in the current string.
void setCaption(const UString &_value) override
Align getTextAlign() const override
IntPoint getCursorPoint(size_t _position)
TPoint< T > point() const
void setWordWrap(bool _value) override
void setAlpha(float _value) override
virtual void updateRawData()
void removeDrawItem(ISubWidget *_item)
int _getViewWidth() const
virtual VertexColourType getVertexFormat()=0
size_t getTextSelectionEnd() const override
void addDrawItem(ISubWidget *_item, size_t _count)
void _setAlign(const IntSize &_oldsize) override
void setSelectBackground(bool _normal) override
void setInvertSelected(bool _value) override
Vertex * getCurrentVertexBuffer() const
bool getCurrentUpdate() const
void setTextSelection(size_t _start, size_t _end) override
void setTextAlign(Align _value) override
uint32 mInverseColourNative
std::vector< LineInfo > VectorLineInfo
void setShadow(bool _value) override
const Colour & getColour() const
void setStateData(IStateInfo *_data) override
uint32 toColourARGB(const Colour &_colour)
void setVisibleCursor(bool _value) override
bool getShadow() const override
void setVisible(bool _value) override
const std::string & getFontName() const override