MyGUI: MyGUI_EditText.cpp Source File

MyGUI 3.4.2

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files
- Examples

- File List
- Globals

MyGUI_EditText.cpp
Go to the documentation of this file.
1/*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7#include "MyGUI_Precompiled.h"
8#include "MyGUI_EditText.h"
9#include "MyGUI_RenderItem.h"
10#include "MyGUI_FontManager.h"
11#include "MyGUI_RenderManager.h"
12#include "MyGUI_LanguageManager.h"
13#include "MyGUI_TextIterator.h"
14#include "MyGUI_IRenderTarget.h"
15#include "MyGUI_FontData.h"
16#include "MyGUI_CommonStateInfo.h"
17
18namespace MyGUI
19{
20
21 const size_t SIMPLETEXT_COUNT_VERTEX = 32 * VertexQuad::VertexCount;
22
23 EditText::EditText() :
24 ISubWidgetText(),
25 mEmptyView(false),
26 mCurrentColourNative(0xFFFFFFFF),
27 mInverseColourNative(0xFF000000),
28 mShadowColourNative(0x00000000),
29 mTextOutDate(false),
30 mTextAlign(Align::Default),
31 mColour(Colour::White),
32 mShadowColour(Colour::Black),
33 mAlpha(ALPHA_MAX),
34 mFont(nullptr),
35 mTexture(nullptr),
36 mFontHeight(0),
37 mBackgroundNormal(true),
38 mStartSelect(0),
39 mEndSelect(0),
40 mCursorPosition(0),
41 mVisibleCursor(false),
42 mInvertSelect(true),
43 mShadow(false),
44 mNode(nullptr),
45 mRenderItem(nullptr),
46 mCountVertex(SIMPLETEXT_COUNT_VERTEX),
47 mIsAddCursorWidth(true),
48 mShiftText(false),
49 mWordWrap(false),
50 mManualColour(false),
51 mOldWidth(0)
52 {
53 mVertexFormat = RenderManager::getInstance().getVertexFormat();
54 }
55
56 void EditText::setVisible(bool _visible)
57 {
58 if (mVisible == _visible)
59 return;
60 mVisible = _visible;
61
62 if (nullptr != mNode)
63 mNode->outOfDate(mRenderItem);
64 }
65
66 void EditText::_correctView()
67 {
68 if (nullptr != mNode)
69 mNode->outOfDate(mRenderItem);
70 }
71
72 void EditText::_setAlign(const IntSize& _oldsize)
73 {
74 if (mWordWrap)
75 {
76 // передается старая координата всегда
77 int width = mCroppedParent->getWidth();
78 if (mOldWidth != width)
79 {
80 mOldWidth = width;
81 mTextOutDate = true;
82 }
83 }
84
85 // первоначальное выравнивание
86 if (mAlign.isHStretch())
87 {
88 // растягиваем
89 mCoord.width = mCoord.width + (mCroppedParent->getWidth() - _oldsize.width);
90 mIsMargin = true; // при изменении размеров все пересчитывать
91 }
92 else if (mAlign.isRight())
93 {
94 // двигаем по правому краю
95 mCoord.left = mCoord.left + (mCroppedParent->getWidth() - _oldsize.width);
96 }
97 else if (mAlign.isHCenter())
98 {
99 // выравнивание по горизонтали без растяжения
100 mCoord.left = (mCroppedParent->getWidth() - mCoord.width) / 2;
101 }
102
103 if (mAlign.isVStretch())
104 {
105 // растягиваем
106 mCoord.height = mCoord.height + (mCroppedParent->getHeight() - _oldsize.height);
107 mIsMargin = true; // при изменении размеров все пересчитывать
108 }
109 else if (mAlign.isBottom())
110 {
111 // двигаем по нижнему краю
112 mCoord.top = mCoord.top + (mCroppedParent->getHeight() - _oldsize.height);
113 }
114 else if (mAlign.isVCenter())
115 {
116 // выравнивание по вертикали без растяжения
117 mCoord.top = (mCroppedParent->getHeight() - mCoord.height) / 2;
118 }
119
120 mCurrentCoord = mCoord;
121 _updateView();
122 }
123
124 void EditText::_updateView()
125 {
126 bool margin = _checkMargin();
127
128 mEmptyView = ((0 >= _getViewWidth()) || (0 >= _getViewHeight()));
129
130 mCurrentCoord.left = mCoord.left + mMargin.left;
131 mCurrentCoord.top = mCoord.top + mMargin.top;
132
133 // вьюпорт стал битым
134 if (margin)
135 {
136 // проверка на полный выход за границу
137 if (_checkOutside())
138 {
139 // запоминаем текущее состояние
140 mIsMargin = margin;
141
142 // обновить перед выходом
143 if (nullptr != mNode)
144 mNode->outOfDate(mRenderItem);
145 return;
146 }
147 }
148
149 // мы обрезаны или были обрезаны
150 if (mIsMargin || margin)
151 {
152 mCurrentCoord.width = _getViewWidth();
153 mCurrentCoord.height = _getViewHeight();
154 }
155
156 // запоминаем текущее состояние
157 mIsMargin = margin;
158
159 if (nullptr != mNode)
160 mNode->outOfDate(mRenderItem);
161 }
162
163 void EditText::setCaption(const UString& _value)
164 {
165 mCaption = _value;
166 mUtf32Caption = mCaption.asUTF32();
167 mTextOutDate = true;
168
169 checkVertexSize();
170
171 if (nullptr != mNode)
172 mNode->outOfDate(mRenderItem);
173 }
174
175 void EditText::checkVertexSize()
176 {
177 // reallocate if we need more vertices (extra vertices for selection * 2 and cursor)
178 size_t need = (mUtf32Caption.size() * (mShadow ? 3 : 2) + 2) * VertexQuad::VertexCount;
179 if (mCountVertex < need)
180 {
181 mCountVertex = need + SIMPLETEXT_COUNT_VERTEX;
182 if (nullptr != mRenderItem)
183 mRenderItem->reallockDrawItem(this, mCountVertex);
184 }
185 }
186
187 unsigned int EditText::getMixedNativeAlpha(float secondAlpha) const
188 {
189 return (uint8)(mAlpha * secondAlpha * 255) << 24;
190 }
191
192 const UString& EditText::getCaption() const
193 {
194 return mCaption;
195 }
196
197 void EditText::setTextColour(const Colour& _value)
198 {
199 mManualColour = true;
200 _setTextColour(_value);
201 }
202
203 void EditText::_setTextColour(const Colour& _value)
204 {
205 if (mColour == _value)
206 return;
207
208 mColour = _value;
209 mCurrentColourNative = texture_utility::toNativeColour(mColour, mVertexFormat);
210
211 mCurrentColourNative = (mCurrentColourNative & 0x00FFFFFF) | getMixedNativeAlpha(mColour.alpha);
212 mInverseColourNative = mCurrentColourNative ^ 0x00FFFFFF;
213
214 if (nullptr != mNode)
215 mNode->outOfDate(mRenderItem);
216 }
217
218 const Colour& EditText::getTextColour() const
219 {
220 return mColour;
221 }
222
223 void EditText::setAlpha(float _value)
224 {
225 if (mAlpha == _value)
226 return;
227 mAlpha = _value;
228
229 mCurrentColourNative = (mCurrentColourNative & 0x00FFFFFF) | getMixedNativeAlpha(mColour.alpha);
230 mShadowColourNative = (mShadowColourNative & 0x00FFFFFF) | getMixedNativeAlpha(mShadowColour.alpha);
231 mInverseColourNative = mCurrentColourNative ^ 0x00FFFFFF;
232
233 if (nullptr != mNode)
234 mNode->outOfDate(mRenderItem);
235 }
236
237 void EditText::setFontName(const std::string& _value)
238 {
239 mTexture = nullptr;
240 mFont = FontManager::getInstance().getByName(_value);
241 if (mFont != nullptr)
242 {
243 mTexture = mFont->getTextureFont();
244
245 // если надо, устанавливаем дефолтный размер шрифта
246 if (mFont->getDefaultHeight() != 0)
247 {
248 mFontHeight = mFont->getDefaultHeight();
249 }
250 }
251
252 mTextOutDate = true;
253
254 // если мы были приаттаченны, то удаляем себя
255 if (nullptr != mRenderItem)
256 {
257 mRenderItem->removeDrawItem(this);
258 mRenderItem = nullptr;
259 }
260
261 // если есть текстура, то приаттачиваемся
262 if (nullptr != mTexture && nullptr != mNode)
263 {
264 mRenderItem = mNode->addToRenderItem(mTexture, false, false);
265 mRenderItem->addDrawItem(this, mCountVertex);
266 }
267
268 if (nullptr != mNode)
269 mNode->outOfDate(mRenderItem);
270 }
271
272 const std::string& EditText::getFontName() const
273 {
274 return mFont->getResourceName();
275 }
276
277 void EditText::setFontHeight(int _value)
278 {
279 mFontHeight = _value;
280 mTextOutDate = true;
281
282 if (nullptr != mNode)
283 mNode->outOfDate(mRenderItem);
284 }
285
286 int EditText::getFontHeight() const
287 {
288 return mFontHeight;
289 }
290
291 void EditText::createDrawItem(ITexture* _texture, ILayerNode* _node)
292 {
293 mNode = _node;
294 // если уже есть текстура, то атачимся, актуально для смены леера
295 if (nullptr != mTexture)
296 {
297 MYGUI_ASSERT(!mRenderItem, "mRenderItem must be nullptr");
298
299 mRenderItem = mNode->addToRenderItem(mTexture, false, false);
300 mRenderItem->addDrawItem(this, mCountVertex);
301 }
302 }
303
304 void EditText::destroyDrawItem()
305 {
306 if (nullptr != mRenderItem)
307 {
308 mRenderItem->removeDrawItem(this);
309 mRenderItem = nullptr;
310 }
311 mNode = nullptr;
312 }
313
314 size_t EditText::getTextSelectionStart() const
315 {
316 return mStartSelect;
317 }
318
319 size_t EditText::getTextSelectionEnd() const
320 {
321 return mEndSelect;
322 }
323
324 void EditText::setTextSelection(size_t _start, size_t _end)
325 {
326 mStartSelect = _start;
327 mEndSelect = _end;
328
329 if (nullptr != mNode)
330 mNode->outOfDate(mRenderItem);
331 }
332
333 bool EditText::getSelectBackground() const
334 {
335 return mBackgroundNormal;
336 }
337
338 void EditText::setSelectBackground(bool _normal)
339 {
340 if (mBackgroundNormal == _normal)
341 return;
342 mBackgroundNormal = _normal;
343
344 if (nullptr != mNode)
345 mNode->outOfDate(mRenderItem);
346 }
347
348 bool EditText::isVisibleCursor() const
349 {
350 return mVisibleCursor;
351 }
352
353 void EditText::setVisibleCursor(bool _value)
354 {
355 if (mVisibleCursor == _value)
356 return;
357 mVisibleCursor = _value;
358
359 if (nullptr != mNode)
360 mNode->outOfDate(mRenderItem);
361 }
362
363 size_t EditText::getCursorPosition() const
364 {
365 return mCursorPosition;
366 }
367
368 void EditText::setCursorPosition(size_t _index)
369 {
370 if (mCursorPosition == _index)
371 return;
372 mCursorPosition = _index;
373
374 if (nullptr != mNode)
375 mNode->outOfDate(mRenderItem);
376 }
377
378 void EditText::setTextAlign(Align _value)
379 {
380 mTextAlign = _value;
381
382 if (nullptr != mNode)
383 mNode->outOfDate(mRenderItem);
384 }
385
386 Align EditText::getTextAlign() const
387 {
388 return mTextAlign;
389 }
390
391 IntSize EditText::getTextSize() const
392 {
393 // если нуно обновить, или изменились пропорции экрана
394 if (mTextOutDate)
395 updateRawData();
396
397 IntSize size = mTextView.getViewSize();
398 // плюс размер курсора
399 if (mIsAddCursorWidth)
400 size.width += 2;
401
402 if (mShadow)
403 {
404 if (!mIsAddCursorWidth)
405 size.width ++;
406 size.height ++;
407 }
408
409 return size;
410 }
411
412 const VectorLineInfo& EditText::getLineInfo() const
413 {
414 return mTextView.getData();
415 }
416
417 void EditText::setViewOffset(const IntPoint& _point)
418 {
419 mViewOffset = _point;
420
421 if (nullptr != mNode)
422 mNode->outOfDate(mRenderItem);
423 }
424
425 IntPoint EditText::getViewOffset() const
426 {
427 return mViewOffset;
428 }
429
430 size_t EditText::getCursorPosition(const IntPoint& _point) const
431 {
432 if (nullptr == mFont)
433 return 0;
434
435 if (mTextOutDate)
436 updateRawData();
437
438 IntPoint point = _point;
439 point -= mCroppedParent->getAbsolutePosition();
440 point += mViewOffset;
441 point -= mCoord.point();
442
443 return mTextView.getCursorPosition(point);
444 }
445
446 IntCoord EditText::getCursorCoord(size_t _position) const
447 {
448 if (nullptr == mFont)
449 return IntCoord();
450
451 if (mTextOutDate)
452 updateRawData();
453
454 IntPoint point = mTextView.getCursorPoint(_position);
455 point += mCroppedParent->getAbsolutePosition();
456 point -= mViewOffset;
457 point += mCoord.point();
458
459 return IntCoord(point.left, point.top, 2, mFontHeight);
460 }
461
462 void EditText::setShiftText(bool _value)
463 {
464 if (mShiftText == _value)
465 return;
466 mShiftText = _value;
467
468 if (nullptr != mNode)
469 mNode->outOfDate(mRenderItem);
470 }
471
472 void EditText::setWordWrap(bool _value)
473 {
474 mWordWrap = _value;
475 mTextOutDate = true;
476
477 if (nullptr != mNode)
478 mNode->outOfDate(mRenderItem);
479 }
480
481 void EditText::updateRawData() const
482 {
483 if (nullptr == mFont)
484 return;
485 // сбрасывам флаги
486 mTextOutDate = false;
487
488 int width = -1;
489 if (mWordWrap)
490 {
491 width = mCoord.width;
492 // обрезать слова нужно по шарине, которую мы реально используем
493 if (mIsAddCursorWidth)
494 width -= 2;
495 }
496
497 mTextView.update(mUtf32Caption, mFont, mFontHeight, mTextAlign, mVertexFormat, width);
498 }
499
500 void EditText::setStateData(IStateInfo* _data)
501 {
502 EditTextStateInfo* data = _data->castType<EditTextStateInfo>();
503 if (!mManualColour && data->getColour() != Colour::Zero)
504 _setTextColour(data->getColour());
505 setShiftText(data->getShift());
506 }
507
508 void EditText::doRender()
509 {
510 if (nullptr == mFont || !mVisible || mEmptyView)
511 return;
512
513 if (mRenderItem->getCurrentUpdate() || mTextOutDate)
514 updateRawData();
515
516 Vertex* vertex = mRenderItem->getCurrentVertexBuffer();
517
518 const RenderTargetInfo& renderTargetInfo = mRenderItem->getRenderTarget()->getInfo();
519
520 // колличество отрисованных вершин
521 size_t vertexCount = 0;
522
523 // текущие цвета
524 uint32 colour = mCurrentColourNative;
525 uint32 inverseColour = mInverseColourNative;
526 uint32 selectedColour = mInvertSelect ? inverseColour : colour | 0x00FFFFFF;
527
528 const VectorLineInfo& textViewData = mTextView.getData();
529
530 float top = (float)(-mViewOffset.top + mCoord.top);
531
532 FloatRect vertexRect;
533
534 const FloatRect& selectedUVRect = mFont->getGlyphInfo(mBackgroundNormal ? FontCodeType::Selected : FontCodeType::SelectedBack)->uvRect;
535
536 size_t index = 0;
537
538 for (VectorLineInfo::const_iterator line = textViewData.begin(); line != textViewData.end(); ++line)
539 {
540 float left = (float)(line->offset - mViewOffset.left + mCoord.left);
541
542 for (VectorCharInfo::const_iterator sim = line->symbols.begin(); sim != line->symbols.end(); ++sim)
543 {
544 if (sim->isColour())
545 {
546 colour = sim->getColour() | (colour & 0xFF000000);
547 inverseColour = colour ^ 0x00FFFFFF;
548 selectedColour = mInvertSelect ? inverseColour : colour | 0x00FFFFFF;
549 continue;
550 }
551
552 // смещение текстуры для фона
553 bool select = index >= mStartSelect && index < mEndSelect;
554
555 float fullAdvance = sim->getBearingX() + sim->getAdvance();
556
557 // Render the selection, if any, first.
558 if (select)
559 {
560 vertexRect.set(left, top, left + fullAdvance, top + (float)mFontHeight);
561
562 drawGlyph(renderTargetInfo, vertex, vertexCount, vertexRect, selectedUVRect, selectedColour);
563 }
564
565 // Render the glyph shadow, if any.
566 if (mShadow)
567 {
568 vertexRect.left = left + sim->getBearingX() + 1.0f;
569 vertexRect.top = top + sim->getBearingY() + 1.0f;
570 vertexRect.right = vertexRect.left + sim->getWidth();
571 vertexRect.bottom = vertexRect.top + sim->getHeight();
572
573 drawGlyph(renderTargetInfo, vertex, vertexCount, vertexRect, sim->getUVRect(), mShadowColourNative);
574 }
575
576 // Render the glyph itself.
577 vertexRect.left = left + sim->getBearingX();
578 vertexRect.top = top + sim->getBearingY();
579 vertexRect.right = vertexRect.left + sim->getWidth();
580 vertexRect.bottom = vertexRect.top + sim->getHeight();
581
582 drawGlyph(renderTargetInfo, vertex, vertexCount, vertexRect, sim->getUVRect(), (!select || !mInvertSelect) ? colour : inverseColour);
583
584 left += fullAdvance;
585 ++index;
586 }
587
588 top += mFontHeight;
589 ++index;
590 }
591
592 // Render the cursor, if any, last.
593 if (mVisibleCursor)
594 {
595 IntPoint point = mTextView.getCursorPoint(mCursorPosition) - mViewOffset + mCoord.point();
596 const GlyphInfo* cursorGlyph = mFont->getGlyphInfo(static_cast<Char>(FontCodeType::Cursor));
597 vertexRect.set((float)point.left, (float)point.top, (float)point.left + cursorGlyph->width, (float)(point.top + mFontHeight));
598
599 drawGlyph(renderTargetInfo, vertex, vertexCount, vertexRect, cursorGlyph->uvRect, mCurrentColourNative | 0x00FFFFFF);
600 }
601
602 // колличество реально отрисованных вершин
603 mRenderItem->setLastVertexCount(vertexCount);
604 }
605
606 void EditText::setInvertSelected(bool _value)
607 {
608 if (mInvertSelect == _value)
609 return;
610 mInvertSelect = _value;
611
612 if (nullptr != mNode)
613 mNode->outOfDate(mRenderItem);
614 }
615
616 bool EditText::getInvertSelected() const
617 {
618 return mInvertSelect;
619 }
620
621 bool EditText::getShadow() const
622 {
623 return mShadow;
624 }
625
626 void EditText::setShadow(bool _value)
627 {
628 mShadow = _value;
629 mTextOutDate = true;
630
631 checkVertexSize();
632
633 if (nullptr != mNode)
634 mNode->outOfDate(mRenderItem);
635 }
636
637 void EditText::setShadowColour(const Colour& _value)
638 {
639 mShadowColour = _value;
640 mShadowColourNative = texture_utility::toNativeColour(mShadowColour, mVertexFormat);
641
642 mShadowColourNative = (mShadowColourNative & 0x00FFFFFF) | getMixedNativeAlpha(mShadowColour.alpha);
643
644 if (nullptr != mNode)
645 mNode->outOfDate(mRenderItem);
646 }
647
648 const Colour& EditText::getShadowColour() const
649 {
650 return mShadowColour;
651 }
652
653 void EditText::drawQuad(
654 Vertex*& _vertex,
655 size_t& _vertexCount,
656 const FloatRect& _vertexRect,
657 float _vertexZ,
658 const FloatRect& _textureRect,
659 uint32 _colour) const
660 {
661 _vertex[0].x = _vertexRect.left;
662 _vertex[0].y = _vertexRect.top;
663 _vertex[0].z = _vertexZ;
664 _vertex[0].colour = _colour;
665 _vertex[0].u = _textureRect.left;
666 _vertex[0].v = _textureRect.top;
667
668 _vertex[2].x = _vertexRect.left;
669 _vertex[2].y = _vertexRect.bottom;
670 _vertex[2].z = _vertexZ;
671 _vertex[2].colour = _colour;
672 _vertex[2].u = _textureRect.left;
673 _vertex[2].v = _textureRect.bottom;
674
675 _vertex[1].x = _vertexRect.right;
676 _vertex[1].y = _vertexRect.top;
677 _vertex[1].z = _vertexZ;
678 _vertex[1].colour = _colour;
679 _vertex[1].u = _textureRect.right;
680 _vertex[1].v = _textureRect.top;
681
682 _vertex[3].x = _vertexRect.right;
683 _vertex[3].y = _vertexRect.top;
684 _vertex[3].z = _vertexZ;
685 _vertex[3].colour = _colour;
686 _vertex[3].u = _textureRect.right;
687 _vertex[3].v = _textureRect.top;
688
689 _vertex[5].x = _vertexRect.left;
690 _vertex[5].y = _vertexRect.bottom;
691 _vertex[5].z = _vertexZ;
692 _vertex[5].colour = _colour;
693 _vertex[5].u = _textureRect.left;
694 _vertex[5].v = _textureRect.bottom;
695
696 _vertex[4].x = _vertexRect.right;
697 _vertex[4].y = _vertexRect.bottom;
698 _vertex[4].z = _vertexZ;
699 _vertex[4].colour = _colour;
700 _vertex[4].u = _textureRect.right;
701 _vertex[4].v = _textureRect.bottom;
702
703 _vertex += VertexQuad::VertexCount;
704 _vertexCount += VertexQuad::VertexCount;
705 }
706
707 void EditText::drawGlyph(
708 const RenderTargetInfo& _renderTargetInfo,
709 Vertex*& _vertex,
710 size_t& _vertexCount,
711 FloatRect _vertexRect,
712 FloatRect _textureRect,
713 uint32 _colour) const
714 {
715 // символ залазиет влево
716 float leftClip = (float)mCurrentCoord.left - _vertexRect.left;
717 if (leftClip > 0.0f)
718 {
719 if ((float)mCurrentCoord.left < _vertexRect.right)
720 {
721 _textureRect.left += _textureRect.width() * leftClip / _vertexRect.width();
722 _vertexRect.left += leftClip;
723 }
724 else
725 {
726 return;
727 }
728 }
729
730 // символ залазиет вправо
731 float rightClip = _vertexRect.right - (float)mCurrentCoord.right();
732 if (rightClip > 0.0f)
733 {
734 if (_vertexRect.left < (float)mCurrentCoord.right())
735 {
736 _textureRect.right -= _textureRect.width() * rightClip / _vertexRect.width();
737 _vertexRect.right -= rightClip;
738 }
739 else
740 {
741 return;
742 }
743 }
744
745 // символ залазиет вверх
746 float topClip = (float)mCurrentCoord.top - _vertexRect.top;
747 if (topClip > 0.0f)
748 {
749 if ((float)mCurrentCoord.top < _vertexRect.bottom)
750 {
751 _textureRect.top += _textureRect.height() * topClip / _vertexRect.height();
752 _vertexRect.top += topClip;
753 }
754 else
755 {
756 return;
757 }
758 }
759
760 // символ залазиет вниз
761 float bottomClip = _vertexRect.bottom - (float)mCurrentCoord.bottom();
762 if (bottomClip > 0.0f)
763 {
764 if (_vertexRect.top < (float)mCurrentCoord.bottom())
765 {
766 _textureRect.bottom -= _textureRect.height() * bottomClip / _vertexRect.height();
767 _vertexRect.bottom -= bottomClip;
768 }
769 else
770 {
771 return;
772 }
773 }
774
775 float pix_left = mCroppedParent->getAbsoluteLeft() - _renderTargetInfo.leftOffset + _vertexRect.left;
776 float pix_top = mCroppedParent->getAbsoluteTop() - _renderTargetInfo.topOffset + (mShiftText ? 1.0f : 0.0f) + _vertexRect.top;
777
778 FloatRect vertexRect(
779 ((_renderTargetInfo.pixScaleX * pix_left + _renderTargetInfo.hOffset) * 2.0f) - 1.0f,
780 -(((_renderTargetInfo.pixScaleY * pix_top + _renderTargetInfo.vOffset) * 2.0f) - 1.0f),
781 ((_renderTargetInfo.pixScaleX * (pix_left + _vertexRect.width()) + _renderTargetInfo.hOffset) * 2.0f) - 1.0f,
782 -(((_renderTargetInfo.pixScaleY * (pix_top + _vertexRect.height()) + _renderTargetInfo.vOffset) * 2.0f) - 1.0f));
783
784 drawQuad(_vertex, _vertexCount, vertexRect, mNode->getNodeDepth(), _textureRect, _colour);
785 }
786
787} // namespace MyGUI
MyGUI_CommonStateInfo.h
MYGUI_ASSERT
#define MYGUI_ASSERT(exp, dest)
Definition MyGUI_Diagnostic.h:29
MyGUI_EditText.h
MyGUI_FontData.h
MyGUI_FontManager.h
MyGUI_IRenderTarget.h
MyGUI_LanguageManager.h
MyGUI_Precompiled.h
MyGUI_RenderItem.h
MyGUI_RenderManager.h
MyGUI_TextIterator.h
MyGUI::EditText::mBackgroundNormal
bool mBackgroundNormal
Definition MyGUI_EditText.h:155
MyGUI::EditText::setTextColour
void setTextColour(const Colour &_value) override
Definition MyGUI_EditText.cpp:197
MyGUI::EditText::mVertexFormat
VertexColourType mVertexFormat
Definition MyGUI_EditText.h:149
MyGUI::EditText::mShiftText
bool mShiftText
Definition MyGUI_EditText.h:170
MyGUI::EditText::mShadowColour
Colour mShadowColour
Definition MyGUI_EditText.h:147
MyGUI::EditText::getTextSelectionEnd
size_t getTextSelectionEnd() const override
Definition MyGUI_EditText.cpp:319
MyGUI::EditText::setFontName
void setFontName(const std::string &_value) override
Definition MyGUI_EditText.cpp:237
MyGUI::EditText::mWordWrap
bool mWordWrap
Definition MyGUI_EditText.h:171
MyGUI::EditText::setAlpha
void setAlpha(float _value) override
Definition MyGUI_EditText.cpp:223
MyGUI::EditText::mCurrentColourNative
uint32 mCurrentColourNative
Definition MyGUI_EditText.h:136
MyGUI::EditText::mStartSelect
size_t mStartSelect
Definition MyGUI_EditText.h:156
MyGUI::EditText::setSelectBackground
void setSelectBackground(bool _normal) override
Definition MyGUI_EditText.cpp:338
MyGUI::EditText::setTextSelection
void setTextSelection(size_t _start, size_t _end) override
Definition MyGUI_EditText.cpp:324
MyGUI::EditText::setWordWrap
void setWordWrap(bool _value) override
Definition MyGUI_EditText.cpp:472
MyGUI::EditText::_setAlign
void _setAlign(const IntSize &_oldsize) override
Definition MyGUI_EditText.cpp:72
MyGUI::EditText::isVisibleCursor
bool isVisibleCursor() const override
Definition MyGUI_EditText.cpp:348
MyGUI::EditText::getShadow
bool getShadow() const override
Definition MyGUI_EditText.cpp:621
MyGUI::EditText::mEmptyView
bool mEmptyView
Definition MyGUI_EditText.h:135
MyGUI::EditText::mFont
IFont * mFont
Definition MyGUI_EditText.h:151
MyGUI::EditText::getCursorCoord
IntCoord getCursorCoord(size_t _position) const override
Definition MyGUI_EditText.cpp:446
MyGUI::EditText::_correctView
void _correctView() override
Definition MyGUI_EditText.cpp:66
MyGUI::EditText::getLineInfo
virtual const VectorLineInfo & getLineInfo() const
Definition MyGUI_EditText.cpp:412
MyGUI::EditText::setInvertSelected
void setInvertSelected(bool _value) override
Definition MyGUI_EditText.cpp:606
MyGUI::EditText::mCaption
UString mCaption
Definition MyGUI_EditText.h:141
MyGUI::EditText::getTextColour
const Colour & getTextColour() const override
Definition MyGUI_EditText.cpp:218
MyGUI::EditText::setFontHeight
void setFontHeight(int _value) override
Definition MyGUI_EditText.cpp:277
MyGUI::EditText::setVisible
void setVisible(bool _value) override
Definition MyGUI_EditText.cpp:56
MyGUI::EditText::mInverseColourNative
uint32 mInverseColourNative
Definition MyGUI_EditText.h:137
MyGUI::EditText::mTextView
TextView mTextView
Definition MyGUI_EditText.h:175
MyGUI::EditText::getShadowColour
const Colour & getShadowColour() const override
Definition MyGUI_EditText.cpp:648
MyGUI::EditText::mTexture
ITexture * mTexture
Definition MyGUI_EditText.h:152
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:637
MyGUI::EditText::mNode
ILayerNode * mNode
Definition MyGUI_EditText.h:165
MyGUI::EditText::getCaption
const UString & getCaption() const override
Definition MyGUI_EditText.cpp:192
MyGUI::EditText::mTextOutDate
bool mTextOutDate
Definition MyGUI_EditText.h:143
MyGUI::EditText::mViewOffset
IntPoint mViewOffset
Definition MyGUI_EditText.h:163
MyGUI::EditText::getInvertSelected
bool getInvertSelected() const override
Definition MyGUI_EditText.cpp:616
MyGUI::EditText::setCaption
void setCaption(const UString &_value) override
Definition MyGUI_EditText.cpp:163
MyGUI::EditText::setTextAlign
void setTextAlign(Align _value) override
Definition MyGUI_EditText.cpp:378
MyGUI::EditText::mFontHeight
int mFontHeight
Definition MyGUI_EditText.h:153
MyGUI::EditText::mTextAlign
Align mTextAlign
Definition MyGUI_EditText.h:144
MyGUI::EditText::setStateData
void setStateData(IStateInfo *_data) override
Definition MyGUI_EditText.cpp:500
MyGUI::EditText::getFontHeight
int getFontHeight() const override
Definition MyGUI_EditText.cpp:286
MyGUI::EditText::getTextSelectionStart
size_t getTextSelectionStart() const override
Definition MyGUI_EditText.cpp:314
MyGUI::EditText::doRender
void doRender() override
Definition MyGUI_EditText.cpp:508
MyGUI::EditText::getViewOffset
IntPoint getViewOffset() const override
Definition MyGUI_EditText.cpp:425
MyGUI::EditText::mCountVertex
size_t mCountVertex
Definition MyGUI_EditText.h:167
MyGUI::EditText::setVisibleCursor
void setVisibleCursor(bool _value) override
Definition MyGUI_EditText.cpp:353
MyGUI::EditText::mShadow
bool mShadow
Definition MyGUI_EditText.h:161
MyGUI::EditText::getSelectBackground
bool getSelectBackground() const override
Definition MyGUI_EditText.cpp:333
MyGUI::EditText::getTextSize
IntSize getTextSize() const override
Definition MyGUI_EditText.cpp:391
MyGUI::EditText::mEndSelect
size_t mEndSelect
Definition MyGUI_EditText.h:157
MyGUI::EditText::getFontName
const std::string & getFontName() const override
Definition MyGUI_EditText.cpp:272
MyGUI::EditText::mManualColour
bool mManualColour
Definition MyGUI_EditText.h:172
MyGUI::EditText::getCursorPosition
size_t getCursorPosition() const override
Definition MyGUI_EditText.cpp:363
MyGUI::EditText::EditText
EditText()
Definition MyGUI_EditText.cpp:23
MyGUI::EditText::setViewOffset
void setViewOffset(const IntPoint &_point) override
Definition MyGUI_EditText.cpp:417
MyGUI::EditText::mOldWidth
int mOldWidth
Definition MyGUI_EditText.h:173
MyGUI::EditText::getTextAlign
Align getTextAlign() const override
Definition MyGUI_EditText.cpp:386
MyGUI::EditText::_updateView
void _updateView() override
Definition MyGUI_EditText.cpp:124
MyGUI::EditText::mInvertSelect
bool mInvertSelect
Definition MyGUI_EditText.h:160
MyGUI::EditText::mColour
Colour mColour
Definition MyGUI_EditText.h:146
MyGUI::EditText::mRenderItem
RenderItem * mRenderItem
Definition MyGUI_EditText.h:166
MyGUI::EditText::mShadowColourNative
uint32 mShadowColourNative
Definition MyGUI_EditText.h:138
MyGUI::EditText::mVisibleCursor
bool mVisibleCursor
Definition MyGUI_EditText.h:159
MyGUI::EditText::mUtf32Caption
UString::utf32string mUtf32Caption
Definition MyGUI_EditText.h:142
MyGUI::EditText::mAlpha
float mAlpha
Definition MyGUI_EditText.h:148
MyGUI::EditText::createDrawItem
void createDrawItem(ITexture *_texture, ILayerNode *_node) override
Definition MyGUI_EditText.cpp:291
MyGUI::EditText::setCursorPosition
void setCursorPosition(size_t _index) override
Definition MyGUI_EditText.cpp:368
MyGUI::EditText::setShiftText
void setShiftText(bool _shift) override
Definition MyGUI_EditText.cpp:462
MyGUI::EditText::setShadow
void setShadow(bool _value) override
Definition MyGUI_EditText.cpp:626
MyGUI::EditText::mCurrentCoord
IntCoord mCurrentCoord
Definition MyGUI_EditText.h:139
MyGUI::EditText::updateRawData
void updateRawData() const
Definition MyGUI_EditText.cpp:481
MyGUI::EditText::destroyDrawItem
void destroyDrawItem() override
Definition MyGUI_EditText.cpp:304
MyGUI::EditTextStateInfo
Definition MyGUI_CommonStateInfo.h:175
MyGUI::EditTextStateInfo::getColour
const Colour & getColour() const
Definition MyGUI_CommonStateInfo.h:185
MyGUI::EditTextStateInfo::getShift
bool getShift() const
Definition MyGUI_CommonStateInfo.h:190
MyGUI::FontManager::getByName
IFont * getByName(const std::string &_name) const
Definition MyGUI_FontManager.cpp:89
MyGUI::FontManager::getInstance
static FontManager & getInstance()
MyGUI::ICroppedRectangle::mIsMargin
bool mIsMargin
Definition MyGUI_ICroppedRectangle.h:248
MyGUI::ICroppedRectangle::mCoord
IntCoord mCoord
Definition MyGUI_ICroppedRectangle.h:245
MyGUI::ICroppedRectangle::mMargin
IntRect mMargin
Definition MyGUI_ICroppedRectangle.h:244
MyGUI::ICroppedRectangle::getAbsoluteLeft
int getAbsoluteLeft() const
Definition MyGUI_ICroppedRectangle.h:83
MyGUI::ICroppedRectangle::getAbsolutePosition
const IntPoint & getAbsolutePosition() const
Definition MyGUI_ICroppedRectangle.h:67
MyGUI::ICroppedRectangle::_checkMargin
bool _checkMargin()
Definition MyGUI_ICroppedRectangle.h:185
MyGUI::ICroppedRectangle::getWidth
int getWidth() const
Definition MyGUI_ICroppedRectangle.h:114
MyGUI::ICroppedRectangle::_checkOutside
bool _checkOutside() const
Definition MyGUI_ICroppedRectangle.h:235
MyGUI::ICroppedRectangle::getHeight
int getHeight() const
Definition MyGUI_ICroppedRectangle.h:119
MyGUI::ICroppedRectangle::mCroppedParent
ICroppedRectangle * mCroppedParent
Definition MyGUI_ICroppedRectangle.h:249
MyGUI::ICroppedRectangle::getAbsoluteTop
int getAbsoluteTop() const
Definition MyGUI_ICroppedRectangle.h:88
MyGUI::ICroppedRectangle::_getViewWidth
int _getViewWidth() const
Definition MyGUI_ICroppedRectangle.h:149
MyGUI::ICroppedRectangle::_getViewHeight
int _getViewHeight() const
Definition MyGUI_ICroppedRectangle.h:153
MyGUI::IFont::getTextureFont
virtual ITexture * getTextureFont() const =0
MyGUI::IFont::getDefaultHeight
virtual int getDefaultHeight() const =0
MyGUI::IFont::getGlyphInfo
virtual const GlyphInfo * getGlyphInfo(Char _id) const =0
MyGUI::ILayerNode
Definition MyGUI_ILayerNode.h:30
MyGUI::ILayerNode::getNodeDepth
virtual float getNodeDepth() const =0
MyGUI::ILayerNode::outOfDate
virtual void outOfDate(RenderItem *_item)=0
MyGUI::ILayerNode::addToRenderItem
virtual RenderItem * addToRenderItem(ITexture *_texture, bool _firstQueue, bool _separate)=0
MyGUI::IObject::castType
Type * castType(bool _throw=true)
Definition MyGUI_IObject.h:18
MyGUI::IRenderTarget::getInfo
virtual const RenderTargetInfo & getInfo() const =0
MyGUI::IResource::getResourceName
const std::string & getResourceName() const
Definition MyGUI_IResource.h:32
MyGUI::IStateInfo
Definition MyGUI_IStateInfo.h:18
MyGUI::ISubWidget::mAlign
Align mAlign
Definition MyGUI_ISubWidget.h:59
MyGUI::ISubWidget::mVisible
bool mVisible
Definition MyGUI_ISubWidget.h:60
MyGUI::ISubWidgetText
Definition MyGUI_ISubWidgetText.h:20
MyGUI::ITexture
Definition MyGUI_ITexture.h:28
MyGUI::RenderItem::addDrawItem
void addDrawItem(ISubWidget *_item, size_t _count)
Definition MyGUI_RenderItem.cpp:125
MyGUI::RenderItem::getCurrentUpdate
bool getCurrentUpdate() const
Definition MyGUI_RenderItem.cpp:225
MyGUI::RenderItem::getRenderTarget
IRenderTarget * getRenderTarget()
Definition MyGUI_RenderItem.cpp:240
MyGUI::RenderItem::reallockDrawItem
void reallockDrawItem(ISubWidget *_item, size_t _count)
Definition MyGUI_RenderItem.cpp:143
MyGUI::RenderItem::removeDrawItem
void removeDrawItem(ISubWidget *_item)
Definition MyGUI_RenderItem.cpp:100
MyGUI::RenderItem::getCurrentVertexBuffer
Vertex * getCurrentVertexBuffer() const
Definition MyGUI_RenderItem.cpp:230
MyGUI::RenderItem::setLastVertexCount
void setLastVertexCount(size_t _count)
Definition MyGUI_RenderItem.cpp:235
MyGUI::RenderManager::getVertexFormat
virtual VertexColourType getVertexFormat() const =0
MyGUI::RenderManager::getInstance
static RenderManager & getInstance()
MyGUI::TextView::getCursorPosition
size_t getCursorPosition(const IntPoint &_value) const
Definition MyGUI_TextView.cpp:289
MyGUI::TextView::getCursorPoint
IntPoint getCursorPoint(size_t _position) const
Definition MyGUI_TextView.cpp:332
MyGUI::TextView::update
void update(const UString::utf32string &_text, IFont *_font, int _height, Align _align, VertexColourType _format, int _maxWidth=-1)
Definition MyGUI_TextView.cpp:100
MyGUI::TextView::getData
const VectorLineInfo & getData() const
Definition MyGUI_TextView.cpp:374
MyGUI::TextView::getViewSize
const IntSize & getViewSize() const
Definition MyGUI_TextView.cpp:364
MyGUI::UString
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
Definition MyGUI_UString.h:145
MyGUI::UString::asUTF32
const utf32string & asUTF32() const
returns the current string in UTF-32 form within a utf32string
Definition MyGUI_UString.cpp:715
MyGUI::FontCodeType::Selected
@ Selected
Definition MyGUI_FontData.h:30
MyGUI::FontCodeType::Cursor
@ Cursor
Definition MyGUI_FontData.h:32
MyGUI::FontCodeType::SelectedBack
@ SelectedBack
Definition MyGUI_FontData.h:31
MyGUI::texture_utility::toNativeColour
uint32 toNativeColour(const Colour &_colour, VertexColourType _format)
Convert Colour to 32-bit representation.
Definition MyGUI_TextureUtility.cpp:68
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::uint32
uint32_t uint32
Definition MyGUI_Types.h:48
MyGUI::uint8
uint8_t uint8
Definition MyGUI_Types.h:46
MyGUI::FloatRect
types::TRect< float > FloatRect
Definition MyGUI_Types.h:34
MyGUI::Char
unsigned int Char
Definition MyGUI_Types.h:50
MyGUI::SIMPLETEXT_COUNT_VERTEX
const size_t SIMPLETEXT_COUNT_VERTEX
Definition MyGUI_EditText.cpp:21
MyGUI::IntCoord
types::TCoord< int > IntCoord
Definition MyGUI_Types.h:36
MyGUI::VectorLineInfo
std::vector< LineInfo > VectorLineInfo
Definition MyGUI_TextViewData.h:137
MyGUI::ALPHA_MAX
const float ALPHA_MAX
Definition MyGUI_Macros.h:20
MyGUI::Align
Definition MyGUI_Align.h:20
MyGUI::Align::isHStretch
bool isHStretch() const
Definition MyGUI_Align.h:69
MyGUI::Align::isVCenter
bool isVCenter() const
Definition MyGUI_Align.h:49
MyGUI::Align::isVStretch
bool isVStretch() const
Definition MyGUI_Align.h:84
MyGUI::Align::isRight
bool isRight() const
Definition MyGUI_Align.h:64
MyGUI::Align::isHCenter
bool isHCenter() const
Definition MyGUI_Align.h:44
MyGUI::Align::isBottom
bool isBottom() const
Definition MyGUI_Align.h:79
MyGUI::Colour
Definition MyGUI_Colour.h:17
MyGUI::Colour::Zero
static const Colour Zero
Definition MyGUI_Colour.h:55
MyGUI::Colour::alpha
float alpha
Definition MyGUI_Colour.h:53
MyGUI::GlyphInfo
Definition MyGUI_FontData.h:40
MyGUI::GlyphInfo::uvRect
FloatRect uvRect
Definition MyGUI_FontData.h:65
MyGUI::GlyphInfo::width
float width
Definition MyGUI_FontData.h:60
MyGUI::RenderTargetInfo
Definition MyGUI_RenderTargetInfo.h:16
MyGUI::Vertex
Definition MyGUI_VertexData.h:17
MyGUI::Vertex::y
float y
Definition MyGUI_VertexData.h:28
MyGUI::Vertex::v
float v
Definition MyGUI_VertexData.h:30
MyGUI::Vertex::x
float x
Definition MyGUI_VertexData.h:28
MyGUI::Vertex::colour
uint32 colour
Definition MyGUI_VertexData.h:29
MyGUI::Vertex::z
float z
Definition MyGUI_VertexData.h:28
MyGUI::Vertex::u
float u
Definition MyGUI_VertexData.h:30
MyGUI::VertexQuad::VertexCount
@ VertexCount
Definition MyGUI_VertexData.h:43
MyGUI::types::TCoord< int >
MyGUI::types::TCoord::height
T height
Definition MyGUI_TCoord.h:25
MyGUI::types::TCoord::right
T right() const
Definition MyGUI_TCoord.h:150
MyGUI::types::TCoord::width
T width
Definition MyGUI_TCoord.h:24
MyGUI::types::TCoord::top
T top
Definition MyGUI_TCoord.h:23
MyGUI::types::TCoord::point
TPoint< T > point() const
Definition MyGUI_TCoord.h:185
MyGUI::types::TCoord::left
T left
Definition MyGUI_TCoord.h:22
MyGUI::types::TCoord::bottom
T bottom() const
Definition MyGUI_TCoord.h:155
MyGUI::types::TPoint< int >
MyGUI::types::TPoint::left
T left
Definition MyGUI_TPoint.h:20
MyGUI::types::TPoint::top
T top
Definition MyGUI_TPoint.h:21
MyGUI::types::TRect< float >
MyGUI::types::TRect::right
T right
Definition MyGUI_TRect.h:22
MyGUI::types::TRect::set
void set(T const &_left, T const &_top, T const &_right, T const &_bottom)
Definition MyGUI_TRect.h:121
MyGUI::types::TRect::left
T left
Definition MyGUI_TRect.h:20
MyGUI::types::TRect::bottom
T bottom
Definition MyGUI_TRect.h:23
MyGUI::types::TRect::top
T top
Definition MyGUI_TRect.h:21
MyGUI::types::TSize< int >
MyGUI::types::TSize::width
T width
Definition MyGUI_TSize.h:20
MyGUI::types::TSize::height
T height
Definition MyGUI_TSize.h:21