27 mCurrentColourNative(0x00FFFFFF),
28 mInverseColourNative(0x00000000),
29 mCurrentAlphaNative(0xFF000000),
30 mShadowColourNative(0x00000000),
32 mTextAlign(
Align::Default),
34 mShadowColour(
Colour::Black),
39 mBackgroundNormal(true),
43 mVisibleCursor(false),
48 mCountVertex(SIMPLETEXT_COUNT_VERTEX),
49 mIsAddCursorWidth(true),
99 bool need_update =
true;
168 if (
nullptr !=
mNode)
184 if (
nullptr !=
mNode)
195 if (
nullptr !=
mNode)
199 void EditText::checkVertexSize()
219 _setTextColour(_value);
222 void EditText::_setTextColour(
const Colour& _value)
235 if (
nullptr !=
mNode)
255 if (
nullptr !=
mNode)
268 if (
mFont !=
nullptr)
295 if (
nullptr !=
mNode)
309 if (
nullptr !=
mNode)
356 if (
nullptr !=
mNode)
371 if (
nullptr !=
mNode)
386 if (
nullptr !=
mNode)
401 if (
nullptr !=
mNode)
409 if (
nullptr !=
mNode)
448 if (
nullptr !=
mNode)
459 if (
nullptr ==
mFont)
475 if (
nullptr ==
mFont)
495 if (
nullptr !=
mNode)
504 if (
nullptr !=
mNode)
510 if (
nullptr ==
mFont)
548 size_t vertexCount = 0;
565 for (VectorLineInfo::const_iterator line = textViewData.begin(); line != textViewData.end(); ++line)
569 for (VectorCharInfo::const_iterator sim = line->simbols.begin(); sim != line->simbols.end(); ++sim)
573 colour = sim->getColour() | (colour & 0xFF000000);
574 inverseColour = colour ^ 0x00FFFFFF;
575 selectedColour =
mInvertSelect ? inverseColour : colour | 0x00FFFFFF;
582 float fullAdvance = sim->getBearingX() + sim->getAdvance();
587 vertexRect.
set(left, top, left + fullAdvance, top + (
float)
mFontHeight);
589 drawGlyph(renderTargetInfo, vertex, vertexCount, vertexRect, selectedUVRect, selectedColour);
595 vertexRect.
left = left + sim->getBearingX() + 1.0f;
596 vertexRect.
top = top + sim->getBearingY() + 1.0f;
597 vertexRect.
right = vertexRect.
left + sim->getWidth();
598 vertexRect.
bottom = vertexRect.
top + sim->getHeight();
600 drawGlyph(renderTargetInfo, vertex, vertexCount, vertexRect, sim->getUVRect(),
mShadowColourNative);
604 vertexRect.
left = left + sim->getBearingX();
605 vertexRect.
top = top + sim->getBearingY();
606 vertexRect.
right = vertexRect.
left + sim->getWidth();
607 vertexRect.
bottom = vertexRect.
top + sim->getHeight();
609 drawGlyph(renderTargetInfo, vertex, vertexCount, vertexRect, sim->getUVRect(), (!select || !
mInvertSelect) ? colour : inverseColour);
639 if (
nullptr !=
mNode)
660 if (
nullptr !=
mNode)
673 if (
nullptr !=
mNode)
682 void EditText::drawQuad(
684 size_t& _vertexCount,
690 _vertex[0].
x = _vertexRect.
left;
691 _vertex[0].
y = _vertexRect.
top;
692 _vertex[0].
z = _vertexZ;
693 _vertex[0].
colour = _colour;
694 _vertex[0].
u = _textureRect.
left;
695 _vertex[0].
v = _textureRect.
top;
697 _vertex[2].
x = _vertexRect.
left;
698 _vertex[2].
y = _vertexRect.
bottom;
699 _vertex[2].
z = _vertexZ;
700 _vertex[2].
colour = _colour;
701 _vertex[2].
u = _textureRect.
left;
702 _vertex[2].
v = _textureRect.
bottom;
704 _vertex[1].
x = _vertexRect.
right;
705 _vertex[1].
y = _vertexRect.
top;
706 _vertex[1].
z = _vertexZ;
707 _vertex[1].
colour = _colour;
708 _vertex[1].
u = _textureRect.
right;
709 _vertex[1].
v = _textureRect.
top;
711 _vertex[3].
x = _vertexRect.
right;
712 _vertex[3].
y = _vertexRect.
top;
713 _vertex[3].
z = _vertexZ;
714 _vertex[3].
colour = _colour;
715 _vertex[3].
u = _textureRect.
right;
716 _vertex[3].
v = _textureRect.
top;
718 _vertex[5].
x = _vertexRect.
left;
719 _vertex[5].
y = _vertexRect.
bottom;
720 _vertex[5].
z = _vertexZ;
721 _vertex[5].
colour = _colour;
722 _vertex[5].
u = _textureRect.
left;
723 _vertex[5].
v = _textureRect.
bottom;
725 _vertex[4].
x = _vertexRect.
right;
726 _vertex[4].
y = _vertexRect.
bottom;
727 _vertex[4].
z = _vertexZ;
728 _vertex[4].
colour = _colour;
729 _vertex[4].
u = _textureRect.
right;
730 _vertex[4].
v = _textureRect.
bottom;
736 void EditText::drawGlyph(
737 const RenderTargetInfo& _renderTargetInfo,
739 size_t& _vertexCount,
750 _textureRect.left += _textureRect.width() * leftClip / _vertexRect.width();
751 _vertexRect.left += leftClip;
761 if (rightClip > 0.0f)
765 _textureRect.right -= _textureRect.width() * rightClip / _vertexRect.width();
766 _vertexRect.right -= rightClip;
780 _textureRect.top += _textureRect.height() * topClip / _vertexRect.height();
781 _vertexRect.top += topClip;
791 if (bottomClip > 0.0f)
795 _textureRect.bottom -= _textureRect.height() * bottomClip / _vertexRect.height();
796 _vertexRect.bottom -= bottomClip;
808 ((_renderTargetInfo.pixScaleX * pix_left + _renderTargetInfo.hOffset) * 2.0f) - 1.0f,
809 -(((_renderTargetInfo.pixScaleY * pix_top + _renderTargetInfo.vOffset) * 2.0f) - 1.0f),
810 ((_renderTargetInfo.pixScaleX * (pix_left + _vertexRect.width()) + _renderTargetInfo.hOffset) * 2.0f) - 1.0f,
811 -(((_renderTargetInfo.pixScaleY * (pix_top + _vertexRect.height()) + _renderTargetInfo.vOffset) * 2.0f) - 1.0f));
813 drawQuad(_vertex, _vertexCount, vertexRect,
mNode->
getNodeDepth(), _textureRect, _colour);
int getAbsoluteLeft() const
virtual IntPoint getViewOffset() const
uint32 mInverseColourNative
const IntSize & getViewSize() const
virtual void setShiftText(bool _shift)
virtual ITexture * getTextureFont()=0
virtual void setSelectBackground(bool _normal)
void setTextColour(const Colour &_value)
virtual void outOfDate(RenderItem *_item)=0
virtual void setCursorPosition(size_t _index)
virtual const VectorLineInfo & getLineInfo() const
virtual bool getShadow() const
void removeDrawItem(ISubWidget *_item)
virtual void setWordWrap(bool _value)
virtual void createDrawItem(ITexture *_texture, ILayerNode *_node)
void addDrawItem(ISubWidget *_item, size_t _count)
virtual IntCoord getCursorCoord(size_t _position)
int _getViewHeight() const
virtual void setTextSelection(size_t _start, size_t _end)
IRenderTarget * getRenderTarget()
__inline void convertColour(uint32 &_colour, VertexColourType _format)
virtual const std::string & getFontName() const
std::vector< LineInfo > VectorLineInfo
static RenderManager & getInstance()
virtual float getNodeDepth()=0
virtual void setVisibleCursor(bool _value)
virtual size_t getCursorPosition() const
const VectorLineInfo & getData() const
virtual void setShadow(bool _value)
const Colour & getColour() const
ICroppedRectangle * mCroppedParent
virtual VertexColourType getVertexFormat()=0
virtual void setViewOffset(const IntPoint &_point)
int getAbsoluteTop() const
VertexColourType mVertexFormat
const std::string & getResourceName() const
virtual void destroyDrawItem()
virtual const Colour & getShadowColour() const
uint32 mCurrentAlphaNative
virtual size_t getTextSelectionStart() const
types::TCoord< int > IntCoord
virtual RenderItem * addToRenderItem(ITexture *_texture, bool _firstQueue, bool _separate)=0
const size_t SIMPLETEXT_COUNT_VERTEX
virtual void setVisible(bool _value)
virtual bool isVisibleCursor() const
virtual void _updateView()
virtual int getFontHeight() const
virtual void setFontHeight(int _value)
uint32 mCurrentColourNative
Vertex * getCurrentVertexBuffer() const
void setCaption(const UString &_value)
const IntPoint & getAbsolutePosition() const
int _getViewWidth() const
const Colour & getTextColour() const
virtual size_t getTextSelectionEnd() const
void reallockDrawItem(ISubWidget *_item, size_t _count)
bool _checkOutside() const
#define MYGUI_ASSERT(exp, dest)
virtual Align getTextAlign() const
const UString & getCaption() const
const size_t VERTEX_IN_QUAD
virtual const RenderTargetInfo & getInfo()=0
uint32 toColourARGB(const Colour &_colour)
virtual void _correctView()
Type * castType(bool _throw=true)
size_t getCursorPosition(const IntPoint &_value)
void set(T const &_left, T const &_top, T const &_right, T const &_bottom)
types::TRect< float > FloatRect
virtual bool getInvertSelected() const
virtual void updateRawData()
virtual IntSize getTextSize()
virtual void setStateData(IStateInfo *_data)
IFont * getByName(const std::string &_name) const
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
IntPoint getCursorPoint(size_t _position)
virtual void _setAlign(const IntSize &_oldsize)
virtual int getDefaultHeight()=0
virtual void setInvertSelected(bool _value)
uint32 mShadowColourNative
virtual bool getSelectBackground() const
size_type size() const
Returns the number of code points in the current string.
virtual void setTextAlign(Align _value)
virtual GlyphInfo * getGlyphInfo(Char _id)=0
bool getCurrentUpdate() const
virtual void setFontName(const std::string &_value)
void setLastVertexCount(size_t _count)
void update(const UString &_text, IFont *_font, int _height, Align _align, VertexColourType _format, int _maxWidth=-1)
virtual void setShadowColour(const Colour &_value)
TPoint< T > point() const
void setAlpha(float _value)