42 mCurrentColourNative(0x00FFFFFF),
43 mInverseColourNative(0x00000000),
44 mCurrentAlphaNative(0xFF000000),
45 mShadowColourNative(0x00000000),
47 mTextAlign(
Align::Default),
49 mShadowColour(
Colour::Black),
54 mBackgroundNormal(true),
58 mVisibleCursor(false),
64 mIsAddCursorWidth(true),
114 bool need_update =
true;
183 if (
nullptr !=
mNode)
199 if (
nullptr !=
mNode)
210 if (
nullptr !=
mNode)
214 void EditText::checkVertexSize()
234 _setTextColour(_value);
237 void EditText::_setTextColour(
const Colour& _value)
250 if (
nullptr !=
mNode)
270 if (
nullptr !=
mNode)
283 if (
mFont !=
nullptr)
323 if (
nullptr !=
mNode)
370 if (
nullptr !=
mNode)
385 if (
nullptr !=
mNode)
400 if (
nullptr !=
mNode)
415 if (
nullptr !=
mNode)
423 if (
nullptr !=
mNode)
457 if (
nullptr !=
mNode)
468 if (
nullptr ==
mFont)
484 if (
nullptr ==
mFont)
504 if (
nullptr !=
mNode)
513 if (
nullptr !=
mNode)
519 if (
nullptr ==
mFont)
557 size_t vertexCount = 0;
574 for (VectorLineInfo::const_iterator line = textViewData.begin(); line != textViewData.end(); ++line)
578 for (VectorCharInfo::const_iterator sim = line->simbols.begin(); sim != line->simbols.end(); ++sim)
582 colour = sim->getColour() | (colour & 0xFF000000);
583 inverseColour = colour ^ 0x00FFFFFF;
584 selectedColour =
mInvertSelect ? inverseColour : colour | 0x00FFFFFF;
591 float fullAdvance = sim->getBearingX() + sim->getAdvance();
596 vertexRect.
set(left, top, left + fullAdvance, top + (
float)
mFontHeight);
598 drawGlyph(renderTargetInfo, vertex, vertexCount, vertexRect, selectedUVRect, selectedColour);
604 vertexRect.
left = left + sim->getBearingX() + 1.0f;
605 vertexRect.
top = top + sim->getBearingY() + 1.0f;
606 vertexRect.
right = vertexRect.
left + sim->getWidth();
607 vertexRect.
bottom = vertexRect.
top + sim->getHeight();
609 drawGlyph(renderTargetInfo, vertex, vertexCount, vertexRect, sim->getUVRect(),
mShadowColourNative);
613 vertexRect.
left = left + sim->getBearingX();
614 vertexRect.
top = top + sim->getBearingY();
615 vertexRect.
right = vertexRect.
left + sim->getWidth();
616 vertexRect.
bottom = vertexRect.
top + sim->getHeight();
618 drawGlyph(renderTargetInfo, vertex, vertexCount, vertexRect, sim->getUVRect(), (!select || !
mInvertSelect) ? colour : inverseColour);
648 if (
nullptr !=
mNode)
669 if (
nullptr !=
mNode)
682 if (
nullptr !=
mNode)
691 void EditText::drawQuad(
693 size_t& _vertexCount,
699 _vertex[0].
x = _vertexRect.
left;
700 _vertex[0].
y = _vertexRect.
top;
701 _vertex[0].
z = _vertexZ;
702 _vertex[0].
colour = _colour;
703 _vertex[0].
u = _textureRect.
left;
704 _vertex[0].
v = _textureRect.
top;
706 _vertex[1].
x = _vertexRect.
left;
707 _vertex[1].
y = _vertexRect.
bottom;
708 _vertex[1].
z = _vertexZ;
709 _vertex[1].
colour = _colour;
710 _vertex[1].
u = _textureRect.
left;
711 _vertex[1].
v = _textureRect.
bottom;
713 _vertex[2].
x = _vertexRect.
right;
714 _vertex[2].
y = _vertexRect.
top;
715 _vertex[2].
z = _vertexZ;
716 _vertex[2].
colour = _colour;
717 _vertex[2].
u = _textureRect.
right;
718 _vertex[2].
v = _textureRect.
top;
720 _vertex[3].
x = _vertexRect.
right;
721 _vertex[3].
y = _vertexRect.
top;
722 _vertex[3].
z = _vertexZ;
723 _vertex[3].
colour = _colour;
724 _vertex[3].
u = _textureRect.
right;
725 _vertex[3].
v = _textureRect.
top;
727 _vertex[4].
x = _vertexRect.
left;
728 _vertex[4].
y = _vertexRect.
bottom;
729 _vertex[4].
z = _vertexZ;
730 _vertex[4].
colour = _colour;
731 _vertex[4].
u = _textureRect.
left;
732 _vertex[4].
v = _textureRect.
bottom;
734 _vertex[5].
x = _vertexRect.
right;
735 _vertex[5].
y = _vertexRect.
bottom;
736 _vertex[5].
z = _vertexZ;
737 _vertex[5].
colour = _colour;
738 _vertex[5].
u = _textureRect.
right;
739 _vertex[5].
v = _textureRect.
bottom;
745 void EditText::drawGlyph(
746 const RenderTargetInfo& _renderTargetInfo,
748 size_t& _vertexCount,
759 _textureRect.left += _textureRect.width() * leftClip / _vertexRect.width();
760 _vertexRect.left += leftClip;
770 if (rightClip > 0.0f)
774 _textureRect.right -= _textureRect.width() * rightClip / _vertexRect.width();
775 _vertexRect.right -= rightClip;
789 _textureRect.top += _textureRect.height() * topClip / _vertexRect.height();
790 _vertexRect.top += topClip;
800 if (bottomClip > 0.0f)
804 _textureRect.bottom -= _textureRect.height() * bottomClip / _vertexRect.height();
805 _vertexRect.bottom -= bottomClip;
817 ((_renderTargetInfo.pixScaleX * pix_left + _renderTargetInfo.hOffset) * 2.0f) - 1.0f,
818 -(((_renderTargetInfo.pixScaleY * pix_top + _renderTargetInfo.vOffset) * 2.0f) - 1.0f),
819 ((_renderTargetInfo.pixScaleX * (pix_left + _vertexRect.width()) + _renderTargetInfo.hOffset) * 2.0f) - 1.0f,
820 -(((_renderTargetInfo.pixScaleY * (pix_top + _vertexRect.height()) + _renderTargetInfo.vOffset) * 2.0f) - 1.0f));
822 drawQuad(_vertex, _vertexCount, vertexRect, _renderTargetInfo.maximumDepth, _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 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 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)