MyGUI: MyGUI_EditBox.cpp Source File

MyGUI 3.4.2

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

- File List
- Globals

MyGUI_EditBox.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_EditBox.h"
9#include "MyGUI_Gui.h"
10#include "MyGUI_ResourceSkin.h"
11#include "MyGUI_SkinManager.h"
12#include "MyGUI_InputManager.h"
13#include "MyGUI_ClipboardManager.h"
14#include "MyGUI_PointerManager.h"
15#include "MyGUI_ISubWidgetText.h"
16#include "MyGUI_ScrollBar.h"
17
18#include <cctype>
19
20namespace MyGUI
21{
22
23 enum class EditCommand {
24 Unknown, LoseFocus, ErasePrevious, EraseNext, Cut, Paste, Copy,
25 NewLine, AcceptEntry,
26 MoveLeft, MoveRight, MoveUp, MoveDown,
27 MoveLeftWord, MoveRightWord,
28 MoveLineBeginning, MoveLineEnd,
29 MoveTextBeginning, MoveTextEnd,
30 MovePageUp, MovePageDown,
31 SelectAll,
32 Undo, Redo
33 };
34
35 const float EDIT_CURSOR_TIMER = 0.7f;
36 const float EDIT_ACTION_MOUSE_TIMER = 0.05f;
37 const int EDIT_CURSOR_MAX_POSITION = 100000;
38 const int EDIT_CURSOR_MIN_POSITION = -100000;
39 const size_t EDIT_MAX_UNDO = 128;
40 const size_t EDIT_DEFAULT_MAX_TEXT_LENGTH = 2048;
41 const float EDIT_OFFSET_HORZ_CURSOR = 10.0f; // дополнительное смещение для курсора
42 const int EDIT_ACTION_MOUSE_ZONE = 1500; // область для восприятия мыши за пределом эдита
43 const std::string EDIT_CLIPBOARD_TYPE_TEXT = "Text";
44 const int EDIT_MOUSE_WHEEL = 50; // область для восприятия мыши за пределом эдита
45
46 EditBox::EditBox() :
47 mIsPressed(false),
48 mIsFocus(false),
49 mCursorActive(false),
50 mCursorTimer(0),
51 mActionMouseTimer(0),
52 mCursorPosition(0),
53 mTextLength(0),
54 mStartSelect(ITEM_NONE),
55 mEndSelect(0),
56 mMouseLeftPressed(false),
57 mModeReadOnly(false),
58 mModePassword(false),
59 mModeMultiline(false),
60 mModeStatic(false),
61 mModeWordWrap(false),
62 mTabPrinting(false),
63 mCharPassword('*'),
64 mOverflowToTheLeft(false),
65 mMaxTextLength(EDIT_DEFAULT_MAX_TEXT_LENGTH),
66 mClientText(nullptr)
67 {
68 mChangeContentByResize = true;
69 }
70
71 void EditBox::initialiseOverride()
72 {
73 Base::initialiseOverride();
74
75 mOriginalPointer = getPointer();
76
77 // FIXME нам нужен фокус клавы
78 setNeedKeyFocus(true);
79
80 assignWidget(mScrollViewClient, "Client");
81 if (getClientWidget() != nullptr)
82 {
83 getClientWidget()->eventMouseSetFocus += newDelegate(this, &EditBox::notifyMouseSetFocus);
84 getClientWidget()->eventMouseLostFocus += newDelegate(this, &EditBox::notifyMouseLostFocus);
85 getClientWidget()->eventMouseButtonPressed += newDelegate(this, &EditBox::notifyMousePressed);
86 getClientWidget()->eventMouseButtonReleased += newDelegate(this, &EditBox::notifyMouseReleased);
87 getClientWidget()->eventMouseDrag += newDelegate(this, &EditBox::notifyMouseDrag);
88 getClientWidget()->eventMouseButtonDoubleClick += newDelegate(this, &EditBox::notifyMouseButtonDoubleClick);
89 getClientWidget()->eventMouseWheel += newDelegate(this, &EditBox::notifyMouseWheel);
90 }
91
93 assignWidget(mVScroll, "VScroll");
94 if (mVScroll != nullptr)
95 {
96 mVScroll->eventScrollChangePosition += newDelegate(this, &EditBox::notifyScrollChangePosition);
97 }
98
100 assignWidget(mHScroll, "HScroll");
101 if (mHScroll != nullptr)
102 {
103 mHScroll->eventScrollChangePosition += newDelegate(this, &EditBox::notifyScrollChangePosition);
104 }
105
106 mClientText = getSubWidgetText();
107 if (getClientWidget() != nullptr)
108 {
109 ISubWidgetText* text = getClientWidget()->getSubWidgetText();
110 if (text)
111 mClientText = text;
112 }
113
114 updateScrollSize();
115
116 // первоначальная инициализация курсора
117 if (mClientText != nullptr)
118 mClientText->setCursorPosition(mCursorPosition);
119
120 updateSelectText();
121 }
122
123 void EditBox::shutdownOverride()
124 {
125 mScrollViewClient = nullptr;
126 mClientText = nullptr;
127 mVScroll = nullptr;
128 mHScroll = nullptr;
129
130 Base::shutdownOverride();
131 }
132
133 void EditBox::notifyMouseSetFocus(Widget* _sender, Widget* _old)
134 {
135 if ((_old == getClientWidget()) || (mIsFocus))
136 return;
137
138 mIsFocus = true;
139 updateEditState();
140 }
141
142 void EditBox::notifyMouseLostFocus(Widget* _sender, Widget* _new)
143 {
144 if ((_new == getClientWidget()) || (!mIsFocus))
145 return;
146
147 mIsFocus = false;
148 updateEditState();
149 }
150
151 void EditBox::notifyMousePressed(Widget* _sender, int _left, int _top, MouseButton _id)
152 {
153 if (mClientText == nullptr)
154 return;
155
156 // в статике все недоступно
157 if (mModeStatic)
158 return;
159
160 IntPoint point = InputManager::getInstance().getLastPressedPosition(MouseButton::Left);
161 mCursorPosition = mClientText->getCursorPosition(point);
162 mClientText->setCursorPosition(mCursorPosition);
163 mClientText->setVisibleCursor(true);
164 mCursorTimer = 0;
165 updateSelectText();
166
167 if (_id == MouseButton::Left)
168 mMouseLeftPressed = true;
169 }
170
171 void EditBox::notifyMouseReleased(Widget* _sender, int _left, int _top, MouseButton _id)
172 {
173 // сбрасываем всегда
174 mMouseLeftPressed = false;
175 }
176
177 void EditBox::notifyMouseDrag(Widget* _sender, int _left, int _top, MouseButton _id)
178 {
179 if (_id != MouseButton::Left)
180 return;
181
182 if (mClientText == nullptr)
183 return;
184
185 // в статике все недоступно
186 if (mModeStatic)
187 return;
188
189 // останавливаем курсор
190 mClientText->setVisibleCursor(true);
191
192 // сбрасываем все таймеры
193 mCursorTimer = 0;
194 mActionMouseTimer = 0;
195
196 size_t old = mCursorPosition;
197 IntPoint point(_left, _top);
198 mCursorPosition = mClientText->getCursorPosition(point);
199
200 if (old != mCursorPosition)
201 {
202 mClientText->setCursorPosition(mCursorPosition);
203
204 if (mStartSelect == ITEM_NONE)
205 mStartSelect = old;
206
207 mEndSelect = (size_t)mCursorPosition;
208 if (mStartSelect > mEndSelect)
209 mClientText->setTextSelection(mEndSelect, mStartSelect);
210 else
211 mClientText->setTextSelection(mStartSelect, mEndSelect);
212
213 updateViewWithCursor();
214 }
215 }
216
217 void EditBox::notifyMouseButtonDoubleClick(Widget* _sender)
218 {
219 if (mClientText == nullptr)
220 return;
221
222 // в статике все недоступно
223 if (mModeStatic)
224 return;
225
226 const IntPoint& lastPressed = InputManager::getInstance().getLastPressedPosition(MouseButton::Left);
227
228 size_t cursorPosition = mClientText->getCursorPosition(lastPressed);
229 mStartSelect = cursorPosition;
230 mEndSelect = cursorPosition;
231
232 UString::utf32string text = this->getOnlyText().asUTF32();
233 UString::utf32string::reverse_iterator iterBack = text.rend() - cursorPosition;
234 UString::utf32string::iterator iterForw = text.begin() + cursorPosition;
235
236 while (iterBack != text.rend())
237 {
238 if (((*iterBack) < 256) && (ispunct(*iterBack) || isspace(*iterBack)))
239 break;
240 ++iterBack;
241 mStartSelect--;
242 }
243 while (iterForw != text.end())
244 {
245 if (((*iterForw) < 256) && (ispunct(*iterForw) || isspace(*iterForw)))
246 break;
247 ++iterForw;
248 mEndSelect++;
249 }
250
251 mClientText->setCursorPosition(mEndSelect);
252 mClientText->setTextSelection(mStartSelect, mEndSelect);
253 }
254
255 void EditBox::onMouseDrag(int _left, int _top, MouseButton _id)
256 {
257 notifyMouseDrag(nullptr, _left, _top, _id);
258
259 Base::onMouseDrag(_left, _top, _id);
260 }
261
262 void EditBox::onKeySetFocus(Widget* _old)
263 {
264 if (!mIsPressed)
265 {
266 mIsPressed = true;
267 updateEditState();
268
269 if (!mModeStatic)
270 {
271 if (mClientText != nullptr)
272 {
273 mCursorActive = true;
274 Gui::getInstance().eventFrameStart += newDelegate(this, &EditBox::frameEntered);
275 mClientText->setVisibleCursor(true);
276 mClientText->setSelectBackground(true);
277 mCursorTimer = 0;
278 }
279 }
280 }
281
282 Base::onKeySetFocus(_old);
283 }
284
285 void EditBox::onKeyLostFocus(Widget* _new)
286 {
287 if (mIsPressed)
288 {
289 mIsPressed = false;
290 updateEditState();
291
292 if (mClientText != nullptr)
293 {
294 mCursorActive = false;
295 Gui::getInstance().eventFrameStart -= newDelegate(this, &EditBox::frameEntered);
296 mClientText->setVisibleCursor(false);
297 mClientText->setSelectBackground(false);
298 }
299 }
300
301 Base::onKeyLostFocus(_new);
302 }
303
304 static bool isWhitespace(const UString::code_point& c) {
305 return c == ' ' || c == '\t';
306 }
307
308 static EditCommand ToEditCommand(KeyCode key, const InputManager& input) {
309#if MYGUI_PLATFORM == MYGUI_PLATFORM_LINUX || MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32
310 switch (key.getValue()) {
311 case KeyCode::Escape: return EditCommand::LoseFocus;
312 case KeyCode::Backspace: return EditCommand::ErasePrevious;
313 case KeyCode::Delete: return input.isShiftPressed() ? EditCommand::Cut : EditCommand::EraseNext;
314 case KeyCode::Insert: return input.isShiftPressed() ? EditCommand::Paste : (input.isControlPressed() ? EditCommand::Copy : EditCommand::Unknown);
315 case KeyCode::Return:
316 case KeyCode::NumpadEnter: return input.isControlPressed() ? EditCommand::AcceptEntry : EditCommand::NewLine;
317 case KeyCode::ArrowLeft: return input.isControlPressed() ? EditCommand::MoveLeftWord : EditCommand::MoveLeft;
318 case KeyCode::ArrowRight: return input.isControlPressed() ? EditCommand::MoveRightWord : EditCommand::MoveRight;
319 case KeyCode::ArrowUp: return EditCommand::MoveUp;
320 case KeyCode::ArrowDown: return EditCommand::MoveDown;
321 case KeyCode::Home: return input.isControlPressed() ? EditCommand::MoveTextBeginning : EditCommand::MoveLineBeginning;
322 case KeyCode::End: return input.isControlPressed() ? EditCommand::MoveTextEnd : EditCommand::MoveLineEnd;
323 case KeyCode::PageUp: return EditCommand::MovePageUp;
324 case KeyCode::PageDown: return EditCommand::MovePageDown;
325 }
326 if (input.isControlPressed()) {
327 switch (key.getValue()) {
328 case KeyCode::C: return EditCommand::Copy;
329 case KeyCode::V: return EditCommand::Paste;
330 case KeyCode::X: return EditCommand::Cut;
331 case KeyCode::Z: return EditCommand::Undo;
332 case KeyCode::Y: return EditCommand::Redo;
333 case KeyCode::A: return EditCommand::SelectAll;
334 }
335 }
336#elif MYGUI_PLATFORM == MYGUI_PLATFORM_APPLE
337 switch (key.getValue()) {
338 case KeyCode::Escape: return EditCommand::LoseFocus;
339 case KeyCode::Backspace: return EditCommand::ErasePrevious;
340 case KeyCode::Delete: return EditCommand::EraseNext;
341 case KeyCode::Return:
342 case KeyCode::NumpadEnter: return input.isMetaPressed() ? EditCommand::AcceptEntry : EditCommand::NewLine;
343 case KeyCode::ArrowLeft: {
344 if (input.isAltPressed()) return EditCommand::MoveLeftWord;
345 if (input.isMetaPressed() || input.isControlPressed()) return EditCommand::MoveLineBeginning;
346 return EditCommand::MoveLeft;
347 }
348 case KeyCode::ArrowRight: {
349 if (input.isAltPressed()) return EditCommand::MoveRightWord;
350 if (input.isMetaPressed() || input.isControlPressed()) return EditCommand::MoveLineEnd;
351 return EditCommand::MoveRight;
352 }
353 case KeyCode::ArrowUp: return input.isMetaPressed() ? EditCommand::MoveTextBeginning : EditCommand::MoveUp;
354 case KeyCode::ArrowDown: return input.isMetaPressed() ? EditCommand::MoveTextEnd : EditCommand::MoveDown;
355 case KeyCode::Home: return input.isMetaPressed() ? EditCommand::MoveTextBeginning : EditCommand::MoveLineBeginning;
356 case KeyCode::End: return input.isMetaPressed() ? EditCommand::MoveTextEnd : EditCommand::MoveLineEnd;
357 case KeyCode::PageUp: return EditCommand::MovePageUp;
358 case KeyCode::PageDown: return EditCommand::MovePageDown;
359 }
360 if (input.isMetaPressed()) {
361 switch (key.getValue()) {
362 case KeyCode::C: return EditCommand::Copy;
363 case KeyCode::V: return EditCommand::Paste;
364 case KeyCode::X: return EditCommand::Cut;
365 case KeyCode::Z: return input.isShiftPressed() ? EditCommand::Redo : EditCommand::Undo;
366 case KeyCode::A: return EditCommand::SelectAll;
367 }
368 }
369#endif
370 return EditCommand::Unknown;
371 }
372
373 void EditBox::onKeyButtonPressed(KeyCode _key, Char _char)
374 {
375 if (mClientText == nullptr || getClientWidget() == nullptr)
376 {
377 Base::onKeyButtonPressed(_key, _char);
378 return;
379 }
380
381 // в статическом режиме ничего не доступно
382 if (mModeStatic)
383 {
384 Base::onKeyButtonPressed(_key, _char);
385 return;
386 }
387
388 InputManager& input = InputManager::getInstance();
389
390 mClientText->setVisibleCursor(true);
391 mCursorTimer = 0.0f;
392
393 auto editCmd = ToEditCommand(_key, input);
394
395 if (editCmd == EditCommand::LoseFocus)
396 {
397 InputManager::getInstance().setKeyFocusWidget(nullptr);
398 }
399 else if (editCmd == EditCommand::ErasePrevious)
400 {
401 // если нуно то удаляем выделенный текст
402 if (!mModeReadOnly)
403 {
404 // сбрасываем повтор
405 commandResetRedo();
406
407 if (!deleteTextSelect(true))
408 {
409 // прыгаем на одну назад и удаляем
410 if (mCursorPosition != 0)
411 {
412 mCursorPosition--;
413 eraseText(mCursorPosition, 1, true);
414 }
415 }
416 // отсылаем событие о изменении
417 eventEditTextChange(this);
418 }
419
420 }
421 else if (editCmd == EditCommand::Cut)
422 {
423 // сбрасываем повтор
424 commandResetRedo();
425
426 commandCut();
427 }
428 else if (editCmd == EditCommand::EraseNext)
429 {
430 if (!mModeReadOnly)
431 {
432 // сбрасываем повтор
433 commandResetRedo();
434
435 // если нуно то удаляем выделенный текст
436 if (!deleteTextSelect(true))
437 {
438 if (mCursorPosition != mTextLength)
439 {
440 eraseText(mCursorPosition, 1, true);
441 }
442 }
443 // отсылаем событие о изменении
444 eventEditTextChange(this);
445 }
446
447 }
448 else if (editCmd == EditCommand::Paste)
449 {
450 // сбрасываем повтор
451 commandResetRedo();
452
453 commandPast();
454 }
455 else if (editCmd == EditCommand::Copy)
456 {
457 commandCopy();
458 }
459 else if (editCmd == EditCommand::Cut)
460 {
461 commandResetRedo();
462
463 commandCut();
464 }
465 else if (editCmd == EditCommand::Undo)
466 {
467 commandUndo();
468 }
469 else if (editCmd == EditCommand::Redo)
470 {
471 commandRedo();
472 }
473 else if (editCmd == EditCommand::SelectAll)
474 {
475 setTextSelection(0, mTextLength);
476 }
477 else if (editCmd == EditCommand::NewLine)
478 {
479 // работаем только в режиме редактирования
480 if (!mModeReadOnly)
481 {
482 if (mModeMultiline)
483 {
484 // сбрасываем повтор
485 commandResetRedo();
486
487 // попытка объединения двух комманд
488 size_t size = mVectorUndoChangeInfo.size();
489 // непосредственно операции
490 deleteTextSelect(true);
491 insertText(TextIterator::getTextNewLine(), mCursorPosition, true);
492 // проверяем на возможность объединения
493 if ((size + 2) == mVectorUndoChangeInfo.size())
494 commandMerge();
495 // отсылаем событие о изменении
496 eventEditTextChange(this);
497 }
498 // при сингл лайн и и мульти+сонтрол шлем эвент
499 else
500 {
501 eventEditSelectAccept(this);
502 }
503 }
504
505 }
506 else if (editCmd == EditCommand::AcceptEntry)
507 {
508 eventEditSelectAccept(this);
509 }
510 else if (editCmd == EditCommand::MoveRight || editCmd == EditCommand::MoveRightWord)
511 {
512 if ((mCursorPosition) < mTextLength)
513 {
514 if (editCmd == EditCommand::MoveRightWord)
515 {
516 if (mModePassword)
517 {
518 mCursorPosition = mTextLength;
519 }
520 else
521 {
522 const UString& text = getRealString();
523 while (mCursorPosition < mTextLength && isWhitespace(text[mCursorPosition]))
524 {
525 mCursorPosition ++;
526 }
527 while (mCursorPosition < mTextLength && !isWhitespace(text[mCursorPosition]))
528 {
529 mCursorPosition ++;
530 }
531 }
532 }
533 else
534 {
535 mCursorPosition ++;
536 }
537 mClientText->setCursorPosition(mCursorPosition);
538 updateSelectText();
539 }
540 // сбрасываем выделение
541 else if (isTextSelection() && !input.isShiftPressed())
542 {
543 resetSelect();
544 }
545
546 }
547 else if (editCmd == EditCommand::MoveLeft || editCmd == EditCommand::MoveLeftWord)
548 {
549 if (mCursorPosition != 0)
550 {
551 if (editCmd == EditCommand::MoveLeftWord)
552 {
553 if (mModePassword)
554 {
555 mCursorPosition = 0;
556 }
557 else
558 {
559 const UString& text = getRealString();
560 while (mCursorPosition > 0 && isWhitespace(text[mCursorPosition - 1]))
561 {
562 mCursorPosition --;
563 }
564 while (mCursorPosition > 0 && !isWhitespace(text[mCursorPosition - 1]))
565 {
566 mCursorPosition --;
567 }
568 }
569 }
570 else
571 {
572 mCursorPosition --;
573 }
574 mClientText->setCursorPosition(mCursorPosition);
575 updateSelectText();
576 }
577 // сбрасываем выделение
578 else if (isTextSelection() && !input.isShiftPressed())
579 {
580 resetSelect();
581 }
582
583 }
584 else if (editCmd == EditCommand::MoveUp)
585 {
586 IntPoint point = mClientText->getCursorPoint(mCursorPosition);
587 point.top -= mClientText->getFontHeight();
588 size_t old = mCursorPosition;
589 mCursorPosition = mClientText->getCursorPosition(point);
590 // самая верхняя строчка
591 if (old == mCursorPosition)
592 {
593 if (mCursorPosition != 0)
594 {
595 mCursorPosition = 0;
596 mClientText->setCursorPosition(mCursorPosition);
597 updateSelectText();
598 }
599 // сбрасываем выделение
600 else if (isTextSelection() && !input.isShiftPressed())
601 {
602 resetSelect();
603 }
604 }
605 else
606 {
607 mClientText->setCursorPosition(mCursorPosition);
608 updateSelectText();
609 }
610
611 }
612 else if (editCmd == EditCommand::MoveDown)
613 {
614 IntPoint point = mClientText->getCursorPoint(mCursorPosition);
615 point.top += mClientText->getFontHeight();
616 size_t old = mCursorPosition;
617 mCursorPosition = mClientText->getCursorPosition(point);
618 // самая нижняя строчка
619 if (old == mCursorPosition)
620 {
621 if (mCursorPosition != mTextLength)
622 {
623 mCursorPosition = mTextLength;
624 mClientText->setCursorPosition(mCursorPosition);
625 updateSelectText();
626 }
627 // сбрасываем выделение
628 else if (isTextSelection() && !input.isShiftPressed())
629 {
630 resetSelect();
631 }
632 }
633 else
634 {
635 mClientText->setCursorPosition(mCursorPosition);
636 updateSelectText();
637 }
638
639 }
640 else if (editCmd == EditCommand::MoveLineBeginning)
641 {
642 IntPoint point = mClientText->getCursorPoint(mCursorPosition);
643 point.left = EDIT_CURSOR_MIN_POSITION;
644 size_t old = mCursorPosition;
645 mCursorPosition = mClientText->getCursorPosition(point);
646 if (old != mCursorPosition)
647 {
648 mClientText->setCursorPosition(mCursorPosition);
649 updateSelectText();
650 }
651 else if (isTextSelection() && !input.isShiftPressed())
652 {
653 resetSelect();
654 }
655 }
656 else if (editCmd == EditCommand::MoveTextBeginning)
657 {
658 if (0 != mCursorPosition)
659 {
660 mCursorPosition = 0;
661 mClientText->setCursorPosition(mCursorPosition);
662 updateSelectText();
663 }
664 else if (isTextSelection() && !input.isShiftPressed())
665 {
666 resetSelect();
667 }
668 }
669 else if (editCmd == EditCommand::MoveLineEnd)
670 {
671 IntPoint point = mClientText->getCursorPoint(mCursorPosition);
672 point.left = EDIT_CURSOR_MAX_POSITION;
673 size_t old = mCursorPosition;
674 mCursorPosition = mClientText->getCursorPosition(point);
675 if (old != mCursorPosition)
676 {
677 mClientText->setCursorPosition(mCursorPosition);
678 updateSelectText();
679 }
680 else if (isTextSelection() && !input.isShiftPressed())
681 {
682 resetSelect();
683 }
684 }
685 else if (editCmd == EditCommand::MoveTextEnd)
686 {
687 if (mTextLength != mCursorPosition)
688 {
689 mCursorPosition = mTextLength;
690 mClientText->setCursorPosition(mCursorPosition);
691 updateSelectText();
692 }
693 else if (isTextSelection() && !input.isShiftPressed())
694 {
695 resetSelect();
696 }
697 }
698 else if (editCmd == EditCommand::MovePageUp)
699 {
700 // на размер окна, но не меньше одной строки
701 IntPoint point = mClientText->getCursorPoint(mCursorPosition);
702 point.top -= (getClientWidget()->getHeight() > mClientText->getFontHeight()) ? getClientWidget()->getHeight() : mClientText->getFontHeight();
703 size_t old = mCursorPosition;
704 mCursorPosition = mClientText->getCursorPosition(point);
705 // самая верхняя строчка
706 if (old == mCursorPosition)
707 {
708 if (mCursorPosition != 0)
709 {
710 mCursorPosition = 0;
711 mClientText->setCursorPosition(mCursorPosition);
712 updateSelectText();
713 }
714 // сбрасываем выделение
715 else if (isTextSelection() && !input.isShiftPressed())
716 {
717 resetSelect();
718 }
719 }
720 else
721 {
722 mClientText->setCursorPosition(mCursorPosition);
723 updateSelectText();
724 }
725 }
726 else if (editCmd == EditCommand::MovePageDown)
727 {
728 // на размер окна, но не меньше одной строки
729 IntPoint point = mClientText->getCursorPoint(mCursorPosition);
730 point.top += (getClientWidget()->getHeight() > mClientText->getFontHeight()) ? getClientWidget()->getHeight() : mClientText->getFontHeight();
731 size_t old = mCursorPosition;
732 mCursorPosition = mClientText->getCursorPosition(point);
733 // самая нижняя строчка
734 if (old == mCursorPosition)
735 {
736 if (mCursorPosition != mTextLength)
737 {
738 mCursorPosition = mTextLength;
739 mClientText->setCursorPosition(mCursorPosition);
740 updateSelectText();
741 }
742 // сбрасываем выделение
743 else if (isTextSelection() && !input.isShiftPressed())
744 {
745 resetSelect();
746 }
747 }
748 else
749 {
750 mClientText->setCursorPosition(mCursorPosition);
751 updateSelectText();
752 }
753 }
754 else if ((_key == KeyCode::LeftShift) || (_key == KeyCode::RightShift))
755 {
756 // для правильно выделения
757 if (mStartSelect == ITEM_NONE)
758 {
759 mStartSelect = mEndSelect = mCursorPosition;
760 }
761 }
762 else {
763 // если не нажат контрл, то обрабатываем как текст
764 if (!mModeReadOnly && _char != 0)
765 {
766 // сбрасываем повтор
767 commandResetRedo();
768
769 // таб только если нужно
770 if (_char != '\t' || mTabPrinting)
771 {
772 // попытка объединения двух комманд
773 size_t size = mVectorUndoChangeInfo.size();
774 // непосредственно операции
775 deleteTextSelect(true);
776 insertText(TextIterator::getTextCharInfo(_char), mCursorPosition, true);
777 // проверяем на возможность объединения
778 if ((size + 2) == mVectorUndoChangeInfo.size())
779 commandMerge();
780 // отсылаем событие о изменении
781 eventEditTextChange(this);
782 }
783 }
784 }
785
786 Base::onKeyButtonPressed(_key, _char);
787 }
788
789 void EditBox::frameEntered(float _frame)
790 {
791 if (mClientText == nullptr)
792 return;
793
794 // в статике все недоступно
795 if (mModeStatic)
796 return;
797
798 if (mCursorActive)
799 {
800 mCursorTimer += _frame;
801
802 if (mCursorTimer > EDIT_CURSOR_TIMER)
803 {
804 mClientText->setVisibleCursor(!mClientText->isVisibleCursor());
805 while (mCursorTimer > EDIT_CURSOR_TIMER)
806 mCursorTimer -= EDIT_CURSOR_TIMER;
807 }
808 }
809
810 // сдвигаем курсор по положению мыши
811 if (mMouseLeftPressed)
812 {
813 mActionMouseTimer += _frame;
814
815 if (mActionMouseTimer > EDIT_ACTION_MOUSE_TIMER)
816 {
817 IntPoint mouse = InputManager::getInstance().getMousePositionByLayer();
818 const IntRect& view = getClientWidget()->getAbsoluteRect();
819 mouse.left -= view.left;
820 mouse.top -= view.top;
821 IntPoint point;
822
823 bool action = false;
824
825 // вверх на одну строчку
826 if ((mouse.top < 0) && (mouse.top > -EDIT_ACTION_MOUSE_ZONE))
827 {
828 if ((mouse.left > 0) && (mouse.left <= getClientWidget()->getWidth()))
829 {
830 point = mClientText->getCursorPoint(mCursorPosition);
831 point.top -= mClientText->getFontHeight();
832 action = true;
833 }
834 }
835 // вниз на одну строчку
836 else if ((mouse.top > getClientWidget()->getHeight()) && (mouse.top < (getClientWidget()->getHeight() + EDIT_ACTION_MOUSE_ZONE)))
837 {
838 if ((mouse.left > 0) && (mouse.left <= getClientWidget()->getWidth()))
839 {
840 point = mClientText->getCursorPoint(mCursorPosition);
841 point.top += mClientText->getFontHeight();
842 action = true;
843 }
844 }
845
846 // влево на небольшое расстояние
847 if ((mouse.left < 0) && (mouse.left > -EDIT_ACTION_MOUSE_ZONE))
848 {
849 point = mClientText->getCursorPoint(mCursorPosition);
850 point.left -= (int)EDIT_OFFSET_HORZ_CURSOR;
851 action = true;
852 }
853 // вправо на небольшое расстояние
854 else if ((mouse.left > getClientWidget()->getWidth()) && (mouse.left < (getClientWidget()->getWidth() + EDIT_ACTION_MOUSE_ZONE)))
855 {
856 point = mClientText->getCursorPoint(mCursorPosition);
857 point.left += (int)EDIT_OFFSET_HORZ_CURSOR;
858 action = true;
859 }
860
861 if (action)
862 {
863 size_t old = mCursorPosition;
864 mCursorPosition = mClientText->getCursorPosition(point);
865
866 if (old != mCursorPosition)
867 {
868 mClientText->setCursorPosition(mCursorPosition);
869
870 if (mStartSelect == ITEM_NONE)
871 mStartSelect = old;
872
873 mEndSelect = (size_t)mCursorPosition;
874 if (mStartSelect > mEndSelect)
875 mClientText->setTextSelection(mEndSelect, mStartSelect);
876 else
877 mClientText->setTextSelection(mStartSelect, mEndSelect);
878
879 // пытаемся показать курсор
880 updateViewWithCursor();
881 }
882 }
883 // если в зону не попадает то сбрасываем
884 else
885 {
886 mActionMouseTimer = 0;
887 }
888
889 while (mActionMouseTimer > EDIT_ACTION_MOUSE_TIMER)
890 mActionMouseTimer -= EDIT_ACTION_MOUSE_TIMER;
891 }
892
893 } // if (mMouseLeftPressed)
894 }
895
896 void EditBox::setTextCursor(size_t _index)
897 {
898 // сбрасываем выделение
899 resetSelect();
900
901 // новая позиция
902 if (_index > mTextLength)
903 _index = mTextLength;
904
905 if (mCursorPosition == _index)
906 return;
907
908 mCursorPosition = _index;
909
910 // обновляем по позиции
911 if (mClientText != nullptr)
912 mClientText->setCursorPosition(mCursorPosition);
913
914 updateSelectText();
915 }
916
917 void EditBox::setTextSelection(size_t _start, size_t _end)
918 {
919 if (_start > mTextLength)
920 _start = mTextLength;
921 if (_end > mTextLength)
922 _end = mTextLength;
923
924 mStartSelect = _start;
925 mEndSelect = _end;
926
927 if (mClientText != nullptr)
928 {
929 if (mStartSelect > mEndSelect)
930 mClientText->setTextSelection(mEndSelect, mStartSelect);
931 else
932 mClientText->setTextSelection(mStartSelect, mEndSelect);
933 }
934
935 if (mCursorPosition == mEndSelect)
936 return;
937 // курсор на конец выделения
938 mCursorPosition = mEndSelect;
939
940 // обновляем по позиции
941 if (mClientText != nullptr)
942 mClientText->setCursorPosition(mCursorPosition);
943 }
944
945 bool EditBox::deleteTextSelect(bool _history)
946 {
947 if (!isTextSelection())
948 return false;
949
950 // начало и конец выделения
951 size_t start = getTextSelectionStart();
952 size_t end = getTextSelectionEnd();
953
954 eraseText(start, end - start, _history);
955
956 return true;
957 }
958
959 void EditBox::resetSelect()
960 {
961 if (mStartSelect != ITEM_NONE)
962 {
963 mStartSelect = ITEM_NONE;
964 if (mClientText != nullptr)
965 mClientText->setTextSelection(0, 0);
966 }
967 }
968
969 void EditBox::commandPosition(size_t _undo, size_t _redo, size_t _length, VectorChangeInfo* _info)
970 {
971 if (_info != nullptr)
972 _info->push_back(TextCommandInfo(_undo, _redo, _length));
973 }
974
975 void EditBox::commandMerge()
976 {
977 if (mVectorUndoChangeInfo.size() < 2)
978 return; // на всякий
979 // сохраняем последние набор отмен
980 VectorChangeInfo info = mVectorUndoChangeInfo.back();
981 mVectorUndoChangeInfo.pop_back();
982
983 // объединяем последовательности
984 for (VectorChangeInfo::iterator iter = info.begin(); iter != info.end(); ++iter)
985 {
986 mVectorUndoChangeInfo.back().push_back((*iter));
987 }
988 }
989
990 bool EditBox::commandUndo()
991 {
992 if (mVectorUndoChangeInfo.empty())
993 return false;
994
995 resetSelect();
996
997 // save last undo info
998 VectorChangeInfo info = mVectorUndoChangeInfo.back();
999 // move undo info to redo
1000 mVectorUndoChangeInfo.pop_back();
1001 mVectorRedoChangeInfo.push_back(info);
1002
1003 UString::utf32string text = getRealString().asUTF32();
1004
1005 // apply undo
1006 for (VectorChangeInfo::const_reverse_iterator iter = info.rbegin(); iter != info.rend(); ++iter)
1007 {
1008 const auto& change = *iter;
1009 switch (change.type)
1010 {
1011 case TextCommandInfo::COMMAND_INSERT:
1012 text.erase(change.start, change.text.size());
1013 break;
1014 case TextCommandInfo::COMMAND_ERASE:
1015 text.insert(change.start, change.text);
1016 break;
1017 case TextCommandInfo::COMMAND_POSITION:
1018 mCursorPosition = change.undo;
1019 mTextLength = change.length;
1020 break;
1021 }
1022 }
1023
1024 setRealString(UString(text));
1025
1026 // restore cursor position
1027 if (mClientText != nullptr)
1028 mClientText->setCursorPosition(mCursorPosition);
1029 updateSelectText();
1030
1031 eventEditTextChange(this);
1032
1033 return true;
1034 }
1035
1036 bool EditBox::commandRedo()
1037 {
1038 if (mVectorRedoChangeInfo.empty())
1039 return false;
1040
1041 // сбрасываем выделение
1042 resetSelect();
1043
1044 // save last undo info
1045 VectorChangeInfo info = mVectorRedoChangeInfo.back();
1046 // move redo info to undo
1047 mVectorRedoChangeInfo.pop_back();
1048 mVectorUndoChangeInfo.push_back(info);
1049
1050 UString::utf32string text = getRealString().asUTF32();
1051
1052 // apply redo
1053 for (const auto& change : info)
1054 {
1055 switch (change.type)
1056 {
1057 case TextCommandInfo::COMMAND_INSERT:
1058 text.insert(change.start, change.text);
1059 break;
1060 case TextCommandInfo::COMMAND_ERASE:
1061 text.erase(change.start, change.text.size());
1062 break;
1063 case TextCommandInfo::COMMAND_POSITION:
1064 mCursorPosition = change.redo;
1065 mTextLength = change.length;
1066 break;
1067 }
1068
1069 }
1070
1071 setRealString(UString(text));
1072
1073 // restore cursor position
1074 if (mClientText != nullptr)
1075 mClientText->setCursorPosition(mCursorPosition);
1076 updateSelectText();
1077
1078 eventEditTextChange(this);
1079
1080 return true;
1081 }
1082
1083 void EditBox::saveInHistory(VectorChangeInfo* _info)
1084 {
1085 if (_info == nullptr)
1086 return;
1087 // если нет информации об изменении
1088 if ( _info->empty())
1089 return;
1090 if ((_info->size() == 1) && (_info->back().type == TextCommandInfo::COMMAND_POSITION))
1091 return;
1092
1093 mVectorUndoChangeInfo.push_back(*_info);
1094 // проверяем на максимальный размер
1095 if (mVectorUndoChangeInfo.size() > EDIT_MAX_UNDO)
1096 mVectorUndoChangeInfo.pop_front();
1097 }
1098
1099 // возвращает текст
1100 UString EditBox::getTextInterval(size_t _start, size_t _count) const
1101 {
1102 // подстраховка
1103 if (_start > mTextLength) _start = mTextLength;
1104 // конец диапазона
1105 size_t end = _start + _count;
1106
1107 // итератор нашей строки
1108 TextIterator iterator(getRealString());
1109
1110 // дефолтный цвет
1111 UString colour = mClientText == nullptr ? "" : TextIterator::convertTagColour(mClientText->getTextColour());
1112
1113 // нужно ли вставлять цвет
1114 bool need_colour = true;
1115
1116 // цикл прохода по строке
1117 while (iterator.moveNext())
1118 {
1119 // текущаяя позиция
1120 size_t pos = iterator.getPosition();
1121
1122 // еще рано
1123 if (pos < _start)
1124 {
1125 // берем цвет из позиции и запоминаем
1126 iterator.getTagColour(colour);
1127
1128 continue;
1129 }
1130
1131 // проверяем на надобность начального тега
1132 else if (pos == _start)
1133 {
1134 need_colour = ! iterator.getTagColour(colour);
1135 // сохраняем место откуда начинается
1136 iterator.saveStartPoint();
1137
1138 }
1139
1140 // а теперь просто до конца диапазона
1141 else if (pos == end)
1142 break;
1143
1144 }
1145
1146 // возвращаем строку
1147 if (need_colour)
1148 return colour + iterator.getFromStart();
1149 return iterator.getFromStart();
1150 }
1151
1152 // выделяет цветом диапазон
1153 void EditBox::_setTextColour(size_t _start, size_t _count, const Colour& _colour, bool _history)
1154 {
1155 // история изменений
1156 VectorChangeInfo* history = nullptr;
1157 if (_history)
1158 history = new VectorChangeInfo();
1159
1160 // конец диапазона
1161 size_t end = _start + _count;
1162
1163 // итератор нашей строки
1164 TextIterator iterator(getRealString(), history);
1165
1166 // дефолтный цвет
1167 UString colour = mClientText == nullptr ? "" : TextIterator::convertTagColour(mClientText->getTextColour());
1168
1169 // цикл прохода по строке
1170 while (iterator.moveNext())
1171 {
1172 // текущаяя позиция
1173 size_t pos = iterator.getPosition();
1174
1175 // берем цвет из позиции и запоминаем
1176 iterator.getTagColour(colour);
1177
1178 // еще рано
1179 if (pos < _start)
1180 continue;
1181
1182 // ставим начальный тег
1183 else if (pos == _start)
1184 iterator.setTagColour(_colour);
1185
1186 // внутри диапазона очищаем все
1187 else if (pos < end)
1188 iterator.clearTagColour();
1189
1190 // на конец ставим последний найденный или дефолтный
1191 else if (pos == end)
1192 {
1193 iterator.setTagColour(colour);
1194 // и выходим из цикла
1195 break;
1196 }
1197
1198 }
1199
1200 // сохраняем позицию для восстановления курсора
1201 commandPosition(_start, _start + _count, mTextLength, history);
1202
1203 // запоминаем в историю
1204 if (_history)
1205 {
1206 saveInHistory(history);
1207 delete history;
1208 }
1209 // сбрасываем историю
1210 else
1211 commandResetHistory();
1212
1213 // и возвращаем строку на место
1214 setRealString(iterator.getText());
1215 }
1216
1217 void EditBox::setTextSelectColour(const Colour& _colour, bool _history)
1218 {
1219 // нужно выделение
1220 if ( !isTextSelection())
1221 return;
1222 // начало и конец выделения
1223 size_t start = getTextSelectionStart();
1224 size_t end = getTextSelectionEnd();
1225 _setTextColour(start, end - start, _colour, _history);
1226 }
1227
1228 UString EditBox::getTextSelection() const
1229 {
1230 if ( !isTextSelection())
1231 return "";
1232 size_t start = getTextSelectionStart();
1233 size_t end = getTextSelectionEnd();
1234 return getTextInterval(start, end - start);
1235 }
1236
1237 void EditBox::setEditPassword(bool _password)
1238 {
1239 if (mModePassword == _password)
1240 return;
1241 mModePassword = _password;
1242
1243 if (mModePassword)
1244 {
1245 if (mClientText != nullptr)
1246 {
1247 mPasswordText = mClientText->getCaption();
1248 mClientText->setCaption(UString(mTextLength, '*'));
1249 }
1250 }
1251 else
1252 {
1253 if (mClientText != nullptr)
1254 {
1255 mClientText->setCaption(mPasswordText);
1256 mPasswordText.clear();
1257 }
1258 }
1259 // обновляем по размерам
1260 updateView();
1261 // сбрасываем историю
1262 commandResetHistory();
1263 }
1264
1265 void EditBox::setText(const UString& _caption, bool _history)
1266 {
1267 // сбрасываем выделение
1268 resetSelect();
1269
1270 // история изменений
1271 VectorChangeInfo* history = nullptr;
1272 if (_history)
1273 history = new VectorChangeInfo();
1274
1275 // итератор нашей строки
1276 TextIterator iterator(getRealString(), history);
1277
1278 // вставляем текст
1279 iterator.setText(_caption, mModeMultiline || mModeWordWrap);
1280
1281 if (mOverflowToTheLeft)
1282 {
1283 iterator.cutMaxLengthFromBeginning(mMaxTextLength);
1284 }
1285 else
1286 {
1287 // обрезаем по максимальной длинне
1288 iterator.cutMaxLength(mMaxTextLength);
1289 }
1290
1291 // запоминаем размер строки
1292 size_t old = mTextLength;
1293 // новая позиция и положение на конец вставки
1294 mCursorPosition = mTextLength = iterator.getSize();
1295
1296 // сохраняем позицию для восстановления курсора
1297 commandPosition(0, mTextLength, old, history);
1298
1299 // запоминаем в историю
1300 if (_history)
1301 {
1302 saveInHistory(history);
1303 delete history;
1304 }
1305 // сбрасываем историю
1306 else
1307 commandResetHistory();
1308
1309 // и возвращаем строку на место
1310 setRealString(iterator.getText());
1311
1312 // обновляем по позиции
1313 if (mClientText != nullptr)
1314 mClientText->setCursorPosition(mCursorPosition);
1315 updateSelectText();
1316 }
1317
1318 void EditBox::insertText(const UString& _text, size_t _start, bool _history)
1319 {
1320 // сбрасываем выделение
1321 resetSelect();
1322
1323 // если строка пустая, или размер максимален
1324 if (_text.empty())
1325 return;
1326
1327 if ((mOverflowToTheLeft == false) && (mTextLength == mMaxTextLength))
1328 return;
1329
1330 // история изменений
1331 VectorChangeInfo* history = nullptr;
1332 if (_history)
1333 history = new VectorChangeInfo();
1334
1335 // итератор нашей строки
1336 TextIterator iterator(getRealString(), history);
1337
1338 // дефолтный цвет
1339 UString colour = mClientText == nullptr ? "" : TextIterator::convertTagColour(mClientText->getTextColour());
1340 // нужен ли тег текста
1341 // потом переделать через TextIterator чтобы отвязать понятие тег от эдита
1342 bool need_colour = ( (_text.size() > 6) && (_text[0] == L'#') && (_text[1] != L'#') );
1343
1344 // цикл прохода по строке
1345 while (iterator.moveNext())
1346 {
1347 // текущаяя позиция
1348 size_t pos = iterator.getPosition();
1349
1350 // текущий цвет
1351 if (need_colour)
1352 iterator.getTagColour(colour);
1353
1354 // если дошли то выходим
1355 if (pos == _start)
1356 break;
1357 }
1358
1359 // если нужен цвет то вставляем
1360 if (need_colour)
1361 iterator.setTagColour(colour);
1362
1363 // а теперь вставляем строку
1364 iterator.insertText(_text, mModeMultiline || mModeWordWrap);
1365
1366 if (mOverflowToTheLeft)
1367 {
1368 iterator.cutMaxLengthFromBeginning(mMaxTextLength);
1369 }
1370 else
1371 {
1372 // обрезаем по максимальной длинне
1373 iterator.cutMaxLength(mMaxTextLength);
1374 }
1375
1376 // запоминаем размер строки
1377 size_t old = mTextLength;
1378 // новая позиция и положение на конец вставки
1379 mTextLength = iterator.getSize();
1380 mCursorPosition += mTextLength - old;
1381
1382 // сохраняем позицию для восстановления курсора
1383 commandPosition(_start, _start + mTextLength - old, old, history);
1384
1385 // запоминаем в историю
1386 if (_history)
1387 {
1388 saveInHistory(history);
1389 delete history;
1390 }
1391 // сбрасываем историю
1392 else
1393 commandResetHistory();
1394
1395 // и возвращаем строку на место
1396 setRealString(iterator.getText());
1397
1398 // обновляем по позиции
1399 if (mClientText != nullptr)
1400 mClientText->setCursorPosition(mCursorPosition);
1401 updateSelectText();
1402 }
1403
1404 void EditBox::eraseText(size_t _start, size_t _count, bool _history)
1405 {
1406 // чета маловато
1407 if (_count == 0)
1408 return;
1409
1410 // сбрасываем выделение
1411 resetSelect();
1412
1413 // история изменений
1414 VectorChangeInfo* history = nullptr;
1415 if (_history)
1416 history = new VectorChangeInfo();
1417
1418 // итератор нашей строки
1419 TextIterator iterator(getRealString(), history);
1420
1421 // дефолтный цвет
1422 UString colour;
1423 // конец диапазона
1424 size_t end = _start + _count;
1425 bool need_colour = false;
1426
1427 // цикл прохода по строке
1428 while (iterator.moveNext())
1429 {
1430 // текущаяя позиция
1431 size_t pos = iterator.getPosition();
1432
1433 // еще рано
1434 if (pos < _start)
1435 {
1436 // берем цвет из позиции и запоминаем
1437 iterator.getTagColour(colour);
1438 continue;
1439 }
1440
1441 // сохраняем место откуда начинается
1442 else if (pos == _start)
1443 {
1444 // если до диапазона был цвет, то нужно закрыть тег
1445 if (!colour.empty())
1446 {
1447 need_colour = true;
1448 colour.clear();
1449 }
1450 // берем цвет из позиции и запоминаем
1451 iterator.getTagColour(colour);
1452 iterator.saveStartPoint();
1453 }
1454
1455 // внутри диапазона
1456 else if (pos < end)
1457 {
1458 // берем цвет из позиции и запоминаем
1459 iterator.getTagColour(colour);
1460 }
1461
1462 // окончание диапазона
1463 else if (pos == end)
1464 {
1465 // нужно ставить тег или нет
1466 if (!colour.empty())
1467 need_colour = true;
1468 if (iterator.getTagColour(colour))
1469 need_colour = false;
1470
1471 break;
1472 }
1473
1474 }
1475
1476 // удаляем диапазон
1477 iterator.eraseFromStart();
1478 // и вставляем последний цвет
1479 if (need_colour)
1480 iterator.setTagColour(colour);
1481
1482 // сохраняем позицию для восстановления курсора
1483 commandPosition(_start + _count, _start, mTextLength, history);
1484
1485 // на месте удаленного
1486 mCursorPosition = _start;
1487 mTextLength -= _count;
1488
1489 // запоминаем в историю
1490 if (_history)
1491 {
1492 saveInHistory(history);
1493 delete history;
1494 }
1495 // сбрасываем историю
1496 else
1497 commandResetHistory();
1498
1499 // и возвращаем строку на место
1500 setRealString(iterator.getText());
1501
1502 // обновляем по позиции
1503 if (mClientText != nullptr)
1504 mClientText->setCursorPosition(mCursorPosition);
1505 updateSelectText();
1506 }
1507
1508 void EditBox::commandCut()
1509 {
1510 // вырезаем в буфер обмена
1511 if (isTextSelection() && (!mModePassword))
1512 {
1513 ClipboardManager::getInstance().setClipboardData(EDIT_CLIPBOARD_TYPE_TEXT, getTextSelection());
1514 if (!mModeReadOnly)
1515 {
1516 deleteTextSelect(true);
1517 // отсылаем событие о изменении
1518 eventEditTextChange(this);
1519 }
1520 }
1521 else
1522 ClipboardManager::getInstance().clearClipboardData(EDIT_CLIPBOARD_TYPE_TEXT);
1523 }
1524
1525 void EditBox::commandCopy()
1526 {
1527 // копируем в буфер обмена
1528 if (isTextSelection() && (!mModePassword))
1529 ClipboardManager::getInstance().setClipboardData(EDIT_CLIPBOARD_TYPE_TEXT, getTextSelection());
1530 else
1531 ClipboardManager::getInstance().clearClipboardData(EDIT_CLIPBOARD_TYPE_TEXT);
1532 }
1533
1534 void EditBox::commandPast()
1535 {
1536 // копируем из буфера обмена
1537 std::string clipboard = ClipboardManager::getInstance().getClipboardData(EDIT_CLIPBOARD_TYPE_TEXT);
1538 if ((!mModeReadOnly) && (!clipboard.empty()))
1539 {
1540 // попытка объединения двух комманд
1541 size_t size = mVectorUndoChangeInfo.size();
1542 // непосредственно операции
1543 deleteTextSelect(true);
1544 insertText(clipboard, mCursorPosition, true);
1545 // проверяем на возможность объединения
1546 if ((size + 2) == mVectorUndoChangeInfo.size())
1547 commandMerge();
1548 // отсылаем событие о изменении
1549 eventEditTextChange(this);
1550 }
1551 }
1552
1553 const UString& EditBox::getRealString() const
1554 {
1555 if (mModePassword)
1556 return mPasswordText;
1557 else if (mClientText == nullptr)
1558 return mPasswordText;
1559
1560 return mClientText->getCaption();
1561 }
1562
1563 void EditBox::setRealString(const UString& _caption)
1564 {
1565 if (mModePassword)
1566 {
1567 mPasswordText = _caption;
1568 if (mClientText != nullptr)
1569 mClientText->setCaption(UString(mTextLength, (UString::code_point)mCharPassword));
1570 }
1571 else
1572 {
1573 if (mClientText != nullptr)
1574 mClientText->setCaption(_caption);
1575 }
1576 }
1577
1578 void EditBox::setPasswordChar(Char _char)
1579 {
1580 mCharPassword = _char;
1581 if (mModePassword)
1582 {
1583 if (mClientText != nullptr)
1584 mClientText->setCaption(UString(mTextLength, (UString::code_point)mCharPassword));
1585 }
1586 }
1587
1588 void EditBox::updateEditState()
1589 {
1590 if (!getInheritedEnabled())
1591 {
1592 _setWidgetState("disabled");
1593 }
1594 else if (mIsPressed)
1595 {
1596 if (mIsFocus)
1597 _setWidgetState("pushed");
1598 else
1599 _setWidgetState("normal_checked");
1600 }
1601 else if (mIsFocus)
1602 {
1603 _setWidgetState("highlighted");
1604 }
1605 else
1606 {
1607 _setWidgetState("normal");
1608 }
1609 }
1610
1611 void EditBox::setPosition(const IntPoint& _point)
1612 {
1613 Base::setPosition(_point);
1614 }
1615
1616 void EditBox::eraseView()
1617 {
1618 // если перенос, то сбрасываем размер текста
1619 if (mModeWordWrap)
1620 {
1621 if (mClientText != nullptr)
1622 mClientText->setWordWrap(true);
1623 }
1624
1625 updateView();
1626 }
1627
1628 void EditBox::setSize(const IntSize& _size)
1629 {
1630 Base::setSize(_size);
1631
1632 eraseView();
1633 }
1634
1635 void EditBox::setCoord(const IntCoord& _coord)
1636 {
1637 Base::setCoord(_coord);
1638
1639 eraseView();
1640 }
1641
1642 void EditBox::setCaption(const UString& _value)
1643 {
1644 setText(_value, false);
1645 }
1646
1647 const UString& EditBox::getCaption() const
1648 {
1649 return getRealString();
1650 }
1651
1652 void EditBox::updateSelectText()
1653 {
1654 if (!mModeStatic)
1655 {
1656 InputManager& input = InputManager::getInstance();
1657 if ((input.isShiftPressed()) && (mStartSelect != ITEM_NONE))
1658 {
1659 // меняем выделение
1660 mEndSelect = (size_t)mCursorPosition;
1661 if (mClientText != nullptr)
1662 {
1663 if (mStartSelect > mEndSelect)
1664 mClientText->setTextSelection(mEndSelect, mStartSelect);
1665 else
1666 mClientText->setTextSelection(mStartSelect, mEndSelect);
1667 }
1668
1669 }
1670 else if (mStartSelect != ITEM_NONE)
1671 {
1672 // сбрасываем шифт
1673 mStartSelect = ITEM_NONE;
1674 if (mClientText != nullptr)
1675 mClientText->setTextSelection(0, 0);
1676 }
1677 }
1678
1679 // пытаемся показать курсор
1680 updateViewWithCursor();
1681 }
1682
1683 void EditBox::setTextAlign(Align _value)
1684 {
1685 Base::setTextAlign(_value);
1686
1687 if (mClientText != nullptr)
1688 mClientText->setTextAlign(_value);
1689
1690 // так как мы сами рулим смещениями
1691 updateView();
1692 }
1693
1694 void EditBox::setTextColour(const Colour& _value)
1695 {
1696 Base::setTextColour(_value);
1697
1698 if (mClientText != nullptr)
1699 mClientText->setTextColour(_value);
1700 }
1701
1702 IntCoord EditBox::getTextRegion() const
1703 {
1704 if (mClientText != nullptr)
1705 return mClientText->getCoord();
1706 return Base::getTextRegion();
1707 }
1708
1709 IntSize EditBox::getTextSize() const
1710 {
1711 if (mClientText != nullptr)
1712 return mClientText->getTextSize();
1713 return Base::getTextSize();
1714 }
1715
1716 void EditBox::notifyScrollChangePosition(ScrollBar* _sender, size_t _position)
1717 {
1718 if (mClientText == nullptr)
1719 return;
1720
1721 if (_sender == mVScroll)
1722 {
1723 IntPoint point = mClientText->getViewOffset();
1724 point.top = _position;
1725 mClientText->setViewOffset(point);
1726 }
1727 else if (_sender == mHScroll)
1728 {
1729 IntPoint point = mClientText->getViewOffset();
1730 point.left = _position;
1731 mClientText->setViewOffset(point);
1732 }
1733 }
1734
1735 void EditBox::notifyMouseWheel(Widget* _sender, int _rel)
1736 {
1737 if (mClientText == nullptr)
1738 return;
1739
1740 if (mVRange != 0)
1741 {
1742 IntPoint point = mClientText->getViewOffset();
1743 int offset = point.top;
1744 if (_rel < 0)
1745 offset += EDIT_MOUSE_WHEEL;
1746 else
1747 offset -= EDIT_MOUSE_WHEEL;
1748
1749 if (offset < 0)
1750 offset = 0;
1751 else if (offset > (int)mVRange)
1752 offset = mVRange;
1753
1754 if (offset != point.top)
1755 {
1756 point.top = offset;
1757 if (mVScroll != nullptr)
1758 mVScroll->setScrollPosition(offset);
1759 mClientText->setViewOffset(point);
1760 }
1761 }
1762 else if (mHRange != 0)
1763 {
1764 IntPoint point = mClientText->getViewOffset();
1765 int offset = point.left;
1766 if (_rel < 0)
1767 offset += EDIT_MOUSE_WHEEL;
1768 else
1769 offset -= EDIT_MOUSE_WHEEL;
1770
1771 if (offset < 0)
1772 offset = 0;
1773 else if (offset > (int)mHRange)
1774 offset = mHRange;
1775
1776 if (offset != point.left)
1777 {
1778 point.left = offset;
1779 if (mHScroll != nullptr)
1780 mHScroll->setScrollPosition(offset);
1781 mClientText->setViewOffset(point);
1782 }
1783 }
1784 }
1785
1786 void EditBox::setEditWordWrap(bool _value)
1787 {
1788 mModeWordWrap = _value;
1789 if (mClientText != nullptr)
1790 mClientText->setWordWrap(mModeWordWrap);
1791
1792 eraseView();
1793 }
1794
1795 void EditBox::setFontName(const std::string& _value)
1796 {
1797 Base::setFontName(_value);
1798
1799 if (mClientText != nullptr)
1800 mClientText->setFontName(_value);
1801
1802 eraseView();
1803 }
1804
1805 void EditBox::setFontHeight(int _value)
1806 {
1807 Base::setFontHeight(_value);
1808
1809 if (mClientText != nullptr)
1810 mClientText->setFontHeight(_value);
1811
1812 eraseView();
1813 }
1814
1815 int EditBox::getFontHeight() const
1816 {
1817 return (nullptr == mClientText) ? 0 : mClientText->getFontHeight();
1818 }
1819
1820 void EditBox::updateView()
1821 {
1822 updateScrollSize();
1823 updateScrollPosition();
1824 }
1825
1826 void EditBox::updateViewWithCursor()
1827 {
1828 updateScrollSize();
1829 updateCursorPosition();
1830 updateScrollPosition();
1831 }
1832
1833 void EditBox::updateCursorPosition()
1834 {
1835 if (mClientText == nullptr || getClientWidget() == nullptr)
1836 return;
1837
1838 // размер контекста текста
1839 IntSize textSize = mClientText->getTextSize();
1840
1841 // текущее смещение контекста текста
1842 IntPoint point = mClientText->getViewOffset();
1843 // расчетное смещение
1844 IntPoint offset = point;
1845
1846 // абсолютные координаты курсора
1847 IntRect cursor = mClientText->getCursorRect(mCursorPosition);
1848 cursor.right ++;
1849
1850 // абсолютные координаты вью
1851 const IntRect& view = getClientWidget()->getAbsoluteRect();
1852
1853 // проверяем и показываем курсор
1854 if (!view.inside(cursor))
1855 {
1856 // горизонтальное смещение
1857 if (textSize.width > view.width())
1858 {
1859 if (cursor.left < view.left)
1860 {
1861 offset.left = point.left - (view.left - cursor.left);
1862 // добавляем смещение, только если курсор не перепрыгнет
1863 if ((float(view.width()) - EDIT_OFFSET_HORZ_CURSOR) > EDIT_OFFSET_HORZ_CURSOR)
1864 offset.left -= int(EDIT_OFFSET_HORZ_CURSOR);
1865 }
1866 else if (cursor.right > view.right)
1867 {
1868 offset.left = point.left + (cursor.right - view.right);
1869 // добавляем смещение, только если курсор не перепрыгнет
1870 if ((float(view.width()) - EDIT_OFFSET_HORZ_CURSOR) > EDIT_OFFSET_HORZ_CURSOR)
1871 offset.left += int(EDIT_OFFSET_HORZ_CURSOR);
1872 }
1873 }
1874
1875 // вертикальное смещение
1876 if (textSize.height > view.height())
1877 {
1878 int delta = 0;
1879 if (cursor.height() > view.height())
1880 {
1881 // if text is bigger than edit height then place it in center
1882 delta = ((cursor.bottom - view.bottom) - (view.top - cursor.top)) / 2;
1883 }
1884 else if (cursor.top < view.top)
1885 {
1886 delta = - (view.top - cursor.top);
1887 }
1888 else if (cursor.bottom > view.bottom)
1889 {
1890 delta = (cursor.bottom - view.bottom);
1891 }
1892 offset.top = point.top + delta;
1893 }
1894
1895 }
1896
1897 if (offset != point)
1898 {
1899 mClientText->setViewOffset(offset);
1900 // обновить скролы
1901 if (mVScroll != nullptr)
1902 mVScroll->setScrollPosition(offset.top);
1903 if (mHScroll != nullptr)
1904 mHScroll->setScrollPosition(offset.left);
1905 }
1906 }
1907
1908 void EditBox::setContentPosition(const IntPoint& _point)
1909 {
1910 if (mClientText != nullptr)
1911 mClientText->setViewOffset(_point);
1912 }
1913
1914 IntSize EditBox::getViewSize() const
1915 {
1916 if (mClientText != nullptr)
1917 return mClientText->getSize();
1918 return ScrollViewBase::getViewSize();
1919 }
1920
1921 IntSize EditBox::getContentSize() const
1922 {
1923 if (mClientText != nullptr)
1924 return mClientText->getTextSize();
1925 return ScrollViewBase::getContentSize();
1926 }
1927
1928 size_t EditBox::getVScrollPage() const
1929 {
1930 if (mClientText != nullptr)
1931 return (size_t)mClientText->getFontHeight();
1932 return ScrollViewBase::getVScrollPage();
1933 }
1934
1935 size_t EditBox::getHScrollPage() const
1936 {
1937 if (mClientText != nullptr)
1938 return (size_t)mClientText->getFontHeight();
1939 return ScrollViewBase::getHScrollPage();
1940 }
1941
1942 IntPoint EditBox::getContentPosition() const
1943 {
1944 if (mClientText != nullptr)
1945 return mClientText->getViewOffset();
1946 return ScrollViewBase::getContentPosition();
1947 }
1948
1949 Align EditBox::getContentAlign() const
1950 {
1951 if (mClientText != nullptr)
1952 return mClientText->getTextAlign();
1953 return ScrollViewBase::getContentAlign();
1954 }
1955
1956 void EditBox::setTextIntervalColour(size_t _start, size_t _count, const Colour& _colour)
1957 {
1958 _setTextColour(_start, _count, _colour, false);
1959 }
1960
1961 size_t EditBox::getTextSelectionStart() const
1962 {
1963 return (mStartSelect == ITEM_NONE) ? ITEM_NONE : (mStartSelect > mEndSelect ? mEndSelect : mStartSelect);
1964 }
1965
1966 size_t EditBox::getTextSelectionEnd() const
1967 {
1968 return (mStartSelect == ITEM_NONE) ? ITEM_NONE : (mStartSelect > mEndSelect ? mStartSelect : mEndSelect);
1969 }
1970
1971 bool EditBox::isTextSelection() const
1972 {
1973 return (mStartSelect != ITEM_NONE) && (mStartSelect != mEndSelect);
1974 }
1975
1976 void EditBox::deleteTextSelection()
1977 {
1978 deleteTextSelect(false);
1979 }
1980
1981 void EditBox::setTextSelectionColour(const Colour& _colour)
1982 {
1983 setTextSelectColour(_colour, false);
1984 }
1985
1986 size_t EditBox::getTextSelectionLength() const
1987 {
1988 return mEndSelect - mStartSelect;
1989 }
1990
1991 void EditBox::setOnlyText(const UString& _text)
1992 {
1993 setText(TextIterator::toTagsString(_text), false);
1994 }
1995
1996 UString EditBox::getOnlyText() const
1997 {
1998 return TextIterator::getOnlyText(getRealString());
1999 }
2000
2001 void EditBox::insertText(const UString& _text, size_t _index)
2002 {
2003 insertText(_text, _index, false);
2004 }
2005
2006 void EditBox::addText(const UString& _text)
2007 {
2008 insertText(_text, ITEM_NONE, false);
2009 }
2010
2011 void EditBox::eraseText(size_t _start, size_t _count)
2012 {
2013 eraseText(_start, _count, false);
2014 }
2015
2016 void EditBox::setEditReadOnly(bool _value)
2017 {
2018 mModeReadOnly = _value;
2019 // сбрасываем историю
2020 commandResetHistory();
2021 }
2022
2023 void EditBox::setEditMultiLine(bool _value)
2024 {
2025 mModeMultiline = _value;
2026 // на всякий, для убирания переносов
2027 if (!mModeMultiline)
2028 {
2029 setText(getRealString(), false);
2030 }
2031 // обновляем по размерам
2032 else
2033 {
2034 updateView();
2035 }
2036 // сбрасываем историю
2037 commandResetHistory();
2038 }
2039
2040 void EditBox::setEditStatic(bool _value)
2041 {
2042 mModeStatic = _value;
2043 resetSelect();
2044
2045 if (getClientWidget() != nullptr)
2046 {
2047 if (mModeStatic)
2048 getClientWidget()->setPointer("");
2049 else
2050 getClientWidget()->setPointer(mOriginalPointer);
2051 }
2052 }
2053
2054 void EditBox::setPasswordChar(const UString& _value)
2055 {
2056 if (!_value.empty())
2057 setPasswordChar(_value[0]);
2058 }
2059
2060 void EditBox::setVisibleVScroll(bool _value)
2061 {
2062 mVisibleVScroll = _value;
2063 updateView();
2064 }
2065
2066 void EditBox::setVisibleHScroll(bool _value)
2067 {
2068 mVisibleHScroll = _value;
2069 updateView();
2070 }
2071
2072 size_t EditBox::getVScrollRange() const
2073 {
2074 return mVRange + 1;
2075 }
2076
2077 size_t EditBox::getVScrollPosition() const
2078 {
2079 return mClientText == nullptr ? 0 : mClientText->getViewOffset().top;
2080 }
2081
2082 void EditBox::setVScrollPosition(size_t _index)
2083 {
2084 if (mClientText == nullptr)
2085 return;
2086
2087 if (_index > mVRange)
2088 _index = mVRange;
2089
2090 IntPoint point = mClientText->getViewOffset();
2091 point.top = _index;
2092
2093 mClientText->setViewOffset(point);
2094 // обновить скролы
2095 if (mVScroll != nullptr)
2096 mVScroll->setScrollPosition(point.top);
2097 }
2098
2099 size_t EditBox::getHScrollRange() const
2100 {
2101 return mHRange + 1;
2102 }
2103
2104 size_t EditBox::getHScrollPosition() const
2105 {
2106 return mClientText == nullptr ? 0 : mClientText->getViewOffset().left;
2107 }
2108
2109 void EditBox::setHScrollPosition(size_t _index)
2110 {
2111 if (mClientText == nullptr)
2112 return;
2113
2114 if (_index > mHRange)
2115 _index = mHRange;
2116
2117 IntPoint point = mClientText->getViewOffset();
2118 point.left = _index;
2119
2120 mClientText->setViewOffset(point);
2121 // обновить скролы
2122 if (mHScroll != nullptr)
2123 mHScroll->setScrollPosition(point.left);
2124 }
2125
2126 bool EditBox::getInvertSelected() const
2127 {
2128 return mClientText == nullptr ? false : mClientText->getInvertSelected();
2129 }
2130
2131 void EditBox::setInvertSelected(bool _value)
2132 {
2133 if (mClientText != nullptr)
2134 mClientText->setInvertSelected(_value);
2135 }
2136
2137 void EditBox::setPropertyOverride(const std::string& _key, const std::string& _value)
2138 {
2140 if (_key == "CursorPosition")
2141 setTextCursor(utility::parseValue<size_t>(_value));
2142
2144 else if (_key == "TextSelect")
2145 setTextSelection(utility::parseValue< types::TSize<size_t> >(_value).width, utility::parseValue< types::TSize<size_t> >(_value).height);
2146
2148 else if (_key == "ReadOnly")
2149 setEditReadOnly(utility::parseValue<bool>(_value));
2150
2152 else if (_key == "Password")
2153 setEditPassword(utility::parseValue<bool>(_value));
2154
2156 else if (_key == "MultiLine")
2157 setEditMultiLine(utility::parseValue<bool>(_value));
2158
2160 else if (_key == "PasswordChar")
2161 setPasswordChar(_value);
2162
2164 else if (_key == "MaxTextLength")
2165 setMaxTextLength(utility::parseValue<size_t>(_value));
2166
2168 else if (_key == "OverflowToTheLeft")
2169 setOverflowToTheLeft(utility::parseValue<bool>(_value));
2170
2172 else if (_key == "Static")
2173 setEditStatic(utility::parseValue<bool>(_value));
2174
2176 else if (_key == "VisibleVScroll")
2177 setVisibleVScroll(utility::parseValue<bool>(_value));
2178
2180 else if (_key == "VisibleHScroll")
2181 setVisibleHScroll(utility::parseValue<bool>(_value));
2182
2184 else if (_key == "WordWrap")
2185 setEditWordWrap(utility::parseValue<bool>(_value));
2186
2188 else if (_key == "TabPrinting")
2189 setTabPrinting(utility::parseValue<bool>(_value));
2190
2192 else if (_key == "InvertSelected")
2193 setInvertSelected(utility::parseValue<bool>(_value));
2194
2195 else
2196 {
2197 Base::setPropertyOverride(_key, _value);
2198 return;
2199 }
2200
2201 eventChangeProperty(this, _key, _value);
2202 }
2203
2204 size_t EditBox::getTextCursor() const
2205 {
2206 return mCursorPosition;
2207 }
2208
2209 size_t EditBox::getTextLength() const
2210 {
2211 return mTextLength;
2212 }
2213
2214 void EditBox::setOverflowToTheLeft(bool _value)
2215 {
2216 mOverflowToTheLeft = _value;
2217 }
2218
2219 bool EditBox::getOverflowToTheLeft() const
2220 {
2221 return mOverflowToTheLeft;
2222 }
2223
2224 void EditBox::setMaxTextLength(size_t _value)
2225 {
2226 mMaxTextLength = _value;
2227 }
2228
2229 size_t EditBox::getMaxTextLength() const
2230 {
2231 return mMaxTextLength;
2232 }
2233
2234 bool EditBox::getEditReadOnly() const
2235 {
2236 return mModeReadOnly;
2237 }
2238
2239 bool EditBox::getEditPassword() const
2240 {
2241 return mModePassword;
2242 }
2243
2244 bool EditBox::getEditMultiLine() const
2245 {
2246 return mModeMultiline;
2247 }
2248
2249 bool EditBox::getEditStatic() const
2250 {
2251 return mModeStatic;
2252 }
2253
2254 Char EditBox::getPasswordChar() const
2255 {
2256 return mCharPassword;
2257 }
2258
2259 bool EditBox::getEditWordWrap() const
2260 {
2261 return mModeWordWrap;
2262 }
2263
2264 void EditBox::setTabPrinting(bool _value)
2265 {
2266 mTabPrinting = _value;
2267 }
2268
2269 bool EditBox::getTabPrinting() const
2270 {
2271 return mTabPrinting;
2272 }
2273
2274 bool EditBox::isVisibleVScroll() const
2275 {
2276 return mVisibleVScroll;
2277 }
2278
2279 bool EditBox::isVisibleHScroll() const
2280 {
2281 return mVisibleHScroll;
2282 }
2283
2284 void EditBox::commandResetRedo()
2285 {
2286 mVectorRedoChangeInfo.clear();
2287 }
2288
2289 void EditBox::commandResetHistory()
2290 {
2291 mVectorRedoChangeInfo.clear();
2292 mVectorUndoChangeInfo.clear();
2293 }
2294
2295 void EditBox::setTextShadowColour(const Colour& _value)
2296 {
2297 Base::setTextShadowColour(_value);
2298
2299 if (mClientText != nullptr)
2300 mClientText->setShadowColour(_value);
2301 }
2302
2303 void EditBox::setTextShadow(bool _value)
2304 {
2305 Base::setTextShadow(_value);
2306
2307 if (mClientText != nullptr)
2308 mClientText->setShadow(_value);
2309 }
2310
2311} // namespace MyGUI
MyGUI_ClipboardManager.h
MyGUI_EditBox.h
MyGUI_Gui.h
MyGUI_ISubWidgetText.h
MyGUI_InputManager.h
MyGUI_PointerManager.h
MyGUI_Precompiled.h
MyGUI_ResourceSkin.h
MyGUI_ScrollBar.h
MyGUI_SkinManager.h
MyGUI::ClipboardManager::getInstance
static ClipboardManager & getInstance()
MyGUI::ClipboardManager::clearClipboardData
void clearClipboardData(const std::string &_type)
Definition MyGUI_ClipboardManager.cpp:65
MyGUI::ClipboardManager::setClipboardData
void setClipboardData(const std::string &_type, const std::string &_data)
Definition MyGUI_ClipboardManager.cpp:58
MyGUI::ClipboardManager::getClipboardData
std::string getClipboardData(const std::string &_type) const
Definition MyGUI_ClipboardManager.cpp:71
MyGUI::EditBox::mVectorUndoChangeInfo
DequeUndoRedoInfo mVectorUndoChangeInfo
Definition MyGUI_EditBox.h:361
MyGUI::EditBox::setFontHeight
void setFontHeight(int _value) override
Definition MyGUI_EditBox.cpp:1805
MyGUI::EditBox::insertText
void insertText(const UString &_text, size_t _index=ITEM_NONE)
Definition MyGUI_EditBox.cpp:2001
MyGUI::EditBox::setCoord
void setCoord(const IntCoord &_value) override
Definition MyGUI_EditBox.cpp:1635
MyGUI::EditBox::deleteTextSelection
void deleteTextSelection()
Definition MyGUI_EditBox.cpp:1976
MyGUI::EditBox::getTextLength
size_t getTextLength() const
Definition MyGUI_EditBox.cpp:2209
MyGUI::EditBox::setMaxTextLength
void setMaxTextLength(size_t _value)
Sets the max amount of text allowed in the edit field.
Definition MyGUI_EditBox.cpp:2224
MyGUI::EditBox::getVScrollRange
size_t getVScrollRange() const
Definition MyGUI_EditBox.cpp:2072
MyGUI::EditBox::getVScrollPosition
size_t getVScrollPosition() const
Definition MyGUI_EditBox.cpp:2077
MyGUI::EditBox::getTextRegion
IntCoord getTextRegion() const override
Definition MyGUI_EditBox.cpp:1702
MyGUI::EditBox::setTextShadow
void setTextShadow(bool _value) override
Definition MyGUI_EditBox.cpp:2303
MyGUI::EditBox::mTabPrinting
bool mTabPrinting
Definition MyGUI_EditBox.h:372
MyGUI::EditBox::setPasswordChar
void setPasswordChar(Char _value)
Definition MyGUI_EditBox.cpp:1578
MyGUI::EditBox::mClientText
ISubWidgetText * mClientText
Definition MyGUI_EditBox.h:385
MyGUI::EditBox::notifyMouseSetFocus
void notifyMouseSetFocus(Widget *_sender, Widget *_old)
Definition MyGUI_EditBox.cpp:133
MyGUI::EditBox::mModeMultiline
bool mModeMultiline
Definition MyGUI_EditBox.h:368
MyGUI::EditBox::getCaption
const UString & getCaption() const override
Definition MyGUI_EditBox.cpp:1647
MyGUI::EditBox::isVisibleVScroll
bool isVisibleVScroll() const
Definition MyGUI_EditBox.cpp:2274
MyGUI::EditBox::mOverflowToTheLeft
bool mOverflowToTheLeft
Definition MyGUI_EditBox.h:382
MyGUI::EditBox::mMaxTextLength
size_t mMaxTextLength
Definition MyGUI_EditBox.h:383
MyGUI::EditBox::setOnlyText
void setOnlyText(const UString &_value)
Definition MyGUI_EditBox.cpp:1991
MyGUI::EditBox::getFontHeight
int getFontHeight() const override
Definition MyGUI_EditBox.cpp:1815
MyGUI::EditBox::setTextSelection
void setTextSelection(size_t _start, size_t _end)
Definition MyGUI_EditBox.cpp:917
MyGUI::EditBox::getEditStatic
bool getEditStatic() const
Definition MyGUI_EditBox.cpp:2249
MyGUI::EditBox::eraseText
void eraseText(size_t _start, size_t _count=1)
Definition MyGUI_EditBox.cpp:2011
MyGUI::EditBox::notifyMouseDrag
void notifyMouseDrag(Widget *_sender, int _left, int _top, MouseButton _id)
Definition MyGUI_EditBox.cpp:177
MyGUI::EditBox::updateView
void updateView()
Definition MyGUI_EditBox.cpp:1820
MyGUI::EditBox::setEditStatic
void setEditStatic(bool _value)
Definition MyGUI_EditBox.cpp:2040
MyGUI::EditBox::mPasswordText
UString mPasswordText
Definition MyGUI_EditBox.h:375
MyGUI::EditBox::getTextSelectionStart
size_t getTextSelectionStart() const
Definition MyGUI_EditBox.cpp:1961
MyGUI::EditBox::setEditMultiLine
void setEditMultiLine(bool _value)
Definition MyGUI_EditBox.cpp:2023
MyGUI::EditBox::shutdownOverride
void shutdownOverride() override
Definition MyGUI_EditBox.cpp:123
MyGUI::EditBox::eventEditTextChange
EventPair< EventHandle_WidgetVoid, EventHandle_EditPtr > eventEditTextChange
Definition MyGUI_EditBox.h:251
MyGUI::EditBox::mMouseLeftPressed
bool mMouseLeftPressed
Definition MyGUI_EditBox.h:364
MyGUI::EditBox::notifyMouseReleased
void notifyMouseReleased(Widget *_sender, int _left, int _top, MouseButton _id)
Definition MyGUI_EditBox.cpp:171
MyGUI::EditBox::setPosition
void setPosition(const IntPoint &_value) override
Definition MyGUI_EditBox.cpp:1611
MyGUI::EditBox::getTextCursor
size_t getTextCursor() const
Definition MyGUI_EditBox.cpp:2204
MyGUI::EditBox::getEditPassword
bool getEditPassword() const
Definition MyGUI_EditBox.cpp:2239
MyGUI::EditBox::mCursorTimer
float mCursorTimer
Definition MyGUI_EditBox.h:348
MyGUI::EditBox::setTabPrinting
void setTabPrinting(bool _value)
Definition MyGUI_EditBox.cpp:2264
MyGUI::EditBox::mIsFocus
bool mIsFocus
Definition MyGUI_EditBox.h:345
MyGUI::EditBox::getPasswordChar
Char getPasswordChar() const
Definition MyGUI_EditBox.cpp:2254
MyGUI::EditBox::getEditMultiLine
bool getEditMultiLine() const
Definition MyGUI_EditBox.cpp:2244
MyGUI::EditBox::onMouseDrag
void onMouseDrag(int _left, int _top, MouseButton _id) override
Definition MyGUI_EditBox.cpp:255
MyGUI::EditBox::mCharPassword
Char mCharPassword
Definition MyGUI_EditBox.h:380
MyGUI::EditBox::getTextSize
IntSize getTextSize() const override
Definition MyGUI_EditBox.cpp:1709
MyGUI::EditBox::setFontName
void setFontName(const std::string &_value) override
Definition MyGUI_EditBox.cpp:1795
MyGUI::EditBox::isVisibleHScroll
bool isVisibleHScroll() const
Definition MyGUI_EditBox.cpp:2279
MyGUI::EditBox::setEditWordWrap
void setEditWordWrap(bool _value)
Definition MyGUI_EditBox.cpp:1786
MyGUI::EditBox::mVectorRedoChangeInfo
DequeUndoRedoInfo mVectorRedoChangeInfo
Definition MyGUI_EditBox.h:362
MyGUI::EditBox::getHScrollRange
size_t getHScrollRange() const
Definition MyGUI_EditBox.cpp:2099
MyGUI::EditBox::setPropertyOverride
void setPropertyOverride(const std::string &_key, const std::string &_value) override
Definition MyGUI_EditBox.cpp:2137
MyGUI::EditBox::onKeyButtonPressed
void onKeyButtonPressed(KeyCode _key, Char _char) override
Definition MyGUI_EditBox.cpp:373
MyGUI::EditBox::updateViewWithCursor
void updateViewWithCursor()
Definition MyGUI_EditBox.cpp:1826
MyGUI::EditBox::setTextColour
void setTextColour(const Colour &_value) override
Definition MyGUI_EditBox.cpp:1694
MyGUI::EditBox::setVisibleVScroll
void setVisibleVScroll(bool _value)
Definition MyGUI_EditBox.cpp:2060
MyGUI::EditBox::setHScrollPosition
void setHScrollPosition(size_t _index)
Definition MyGUI_EditBox.cpp:2109
MyGUI::EditBox::setTextShadowColour
void setTextShadowColour(const Colour &_value) override
Definition MyGUI_EditBox.cpp:2295
MyGUI::EditBox::mOriginalPointer
std::string mOriginalPointer
Definition MyGUI_EditBox.h:378
MyGUI::EditBox::notifyMouseLostFocus
void notifyMouseLostFocus(Widget *_sender, Widget *_new)
Definition MyGUI_EditBox.cpp:142
MyGUI::EditBox::onKeyLostFocus
void onKeyLostFocus(Widget *_new) override
Definition MyGUI_EditBox.cpp:285
MyGUI::EditBox::setCaption
void setCaption(const UString &_value) override
Definition MyGUI_EditBox.cpp:1642
MyGUI::EditBox::mEndSelect
size_t mEndSelect
Definition MyGUI_EditBox.h:358
MyGUI::EditBox::notifyMouseButtonDoubleClick
void notifyMouseButtonDoubleClick(Widget *_sender)
Definition MyGUI_EditBox.cpp:217
MyGUI::EditBox::setVisibleHScroll
void setVisibleHScroll(bool _value)
Definition MyGUI_EditBox.cpp:2066
MyGUI::EditBox::setTextSelectionColour
void setTextSelectionColour(const Colour &_value)
Definition MyGUI_EditBox.cpp:1981
MyGUI::EditBox::EditBox
EditBox()
Definition MyGUI_EditBox.cpp:46
MyGUI::EditBox::getEditReadOnly
bool getEditReadOnly() const
Definition MyGUI_EditBox.cpp:2234
MyGUI::EditBox::notifyScrollChangePosition
void notifyScrollChangePosition(ScrollBar *_sender, size_t _position)
Definition MyGUI_EditBox.cpp:1716
MyGUI::EditBox::setEditPassword
void setEditPassword(bool _value)
Definition MyGUI_EditBox.cpp:1237
MyGUI::EditBox::eraseView
void eraseView()
Definition MyGUI_EditBox.cpp:1616
MyGUI::EditBox::getTextSelectionLength
size_t getTextSelectionLength() const
Definition MyGUI_EditBox.cpp:1986
MyGUI::EditBox::mTextLength
size_t mTextLength
Definition MyGUI_EditBox.h:354
MyGUI::EditBox::getTextInterval
UString getTextInterval(size_t _start, size_t _count) const
Definition MyGUI_EditBox.cpp:1100
MyGUI::EditBox::getTextSelection
UString getTextSelection() const
Definition MyGUI_EditBox.cpp:1228
MyGUI::EditBox::isTextSelection
bool isTextSelection() const
Definition MyGUI_EditBox.cpp:1971
MyGUI::EditBox::setOverflowToTheLeft
void setOverflowToTheLeft(bool _value)
Sets if surplus characters should push characters off the left side rather than ignored.
Definition MyGUI_EditBox.cpp:2214
MyGUI::EditBox::mStartSelect
size_t mStartSelect
Definition MyGUI_EditBox.h:357
MyGUI::EditBox::setSize
void setSize(const IntSize &_value) override
Definition MyGUI_EditBox.cpp:1628
MyGUI::EditBox::getEditWordWrap
bool getEditWordWrap() const
Definition MyGUI_EditBox.cpp:2259
MyGUI::EditBox::getHScrollPosition
size_t getHScrollPosition() const
Definition MyGUI_EditBox.cpp:2104
MyGUI::EditBox::addText
void addText(const UString &_text)
Definition MyGUI_EditBox.cpp:2006
MyGUI::EditBox::getTextSelectionEnd
size_t getTextSelectionEnd() const
Definition MyGUI_EditBox.cpp:1966
MyGUI::EditBox::mIsPressed
bool mIsPressed
Definition MyGUI_EditBox.h:343
MyGUI::EditBox::setInvertSelected
void setInvertSelected(bool _value)
Definition MyGUI_EditBox.cpp:2131
MyGUI::EditBox::setVScrollPosition
void setVScrollPosition(size_t _index)
Definition MyGUI_EditBox.cpp:2082
MyGUI::EditBox::getTabPrinting
bool getTabPrinting() const
Definition MyGUI_EditBox.cpp:2269
MyGUI::EditBox::getOnlyText
UString getOnlyText() const
Definition MyGUI_EditBox.cpp:1996
MyGUI::EditBox::notifyMouseWheel
void notifyMouseWheel(Widget *_sender, int _rel)
Definition MyGUI_EditBox.cpp:1735
MyGUI::EditBox::mActionMouseTimer
float mActionMouseTimer
Definition MyGUI_EditBox.h:349
MyGUI::EditBox::getInvertSelected
bool getInvertSelected() const
Definition MyGUI_EditBox.cpp:2126
MyGUI::EditBox::mModeWordWrap
bool mModeWordWrap
Definition MyGUI_EditBox.h:370
MyGUI::EditBox::mModePassword
bool mModePassword
Definition MyGUI_EditBox.h:367
MyGUI::EditBox::eventEditSelectAccept
EventPair< EventHandle_WidgetVoid, EventHandle_EditPtr > eventEditSelectAccept
Definition MyGUI_EditBox.h:245
MyGUI::EditBox::mModeStatic
bool mModeStatic
Definition MyGUI_EditBox.h:369
MyGUI::EditBox::setTextAlign
void setTextAlign(Align _value) override
Definition MyGUI_EditBox.cpp:1683
MyGUI::EditBox::mModeReadOnly
bool mModeReadOnly
Definition MyGUI_EditBox.h:366
MyGUI::EditBox::getOverflowToTheLeft
bool getOverflowToTheLeft() const
Returns true if surplus characters will be pushed off the left rather than ignored.
Definition MyGUI_EditBox.cpp:2219
MyGUI::EditBox::mCursorActive
bool mCursorActive
Definition MyGUI_EditBox.h:347
MyGUI::EditBox::setTextIntervalColour
void setTextIntervalColour(size_t _start, size_t _count, const Colour &_colour)
Definition MyGUI_EditBox.cpp:1956
MyGUI::EditBox::getMaxTextLength
size_t getMaxTextLength() const
Gets the max amount of text allowed in the edit field.
Definition MyGUI_EditBox.cpp:2229
MyGUI::EditBox::setEditReadOnly
void setEditReadOnly(bool _value)
Definition MyGUI_EditBox.cpp:2016
MyGUI::EditBox::mCursorPosition
size_t mCursorPosition
Definition MyGUI_EditBox.h:352
MyGUI::EditBox::onKeySetFocus
void onKeySetFocus(Widget *_old) override
Definition MyGUI_EditBox.cpp:262
MyGUI::EditBox::notifyMousePressed
void notifyMousePressed(Widget *_sender, int _left, int _top, MouseButton _id)
Definition MyGUI_EditBox.cpp:151
MyGUI::EditBox::initialiseOverride
void initialiseOverride() override
Definition MyGUI_EditBox.cpp:71
MyGUI::EditBox::setTextCursor
void setTextCursor(size_t _index)
Definition MyGUI_EditBox.cpp:896
MyGUI::Gui::getInstance
static Gui & getInstance()
Definition MyGUI_Gui.cpp:34
MyGUI::Gui::eventFrameStart
EventHandle_FrameEventDelegate eventFrameStart
Definition MyGUI_Gui.h:150
MyGUI::ICroppedRectangle::getWidth
int getWidth() const
Definition MyGUI_ICroppedRectangle.h:114
MyGUI::ICroppedRectangle::getHeight
int getHeight() const
Definition MyGUI_ICroppedRectangle.h:119
MyGUI::ICroppedRectangle::getCoord
const IntCoord & getCoord() const
Definition MyGUI_ICroppedRectangle.h:61
MyGUI::ICroppedRectangle::getAbsoluteRect
IntRect getAbsoluteRect() const
Definition MyGUI_ICroppedRectangle.h:72
MyGUI::ICroppedRectangle::getSize
IntSize getSize() const
Definition MyGUI_ICroppedRectangle.h:56
MyGUI::ISubWidgetText
Definition MyGUI_ISubWidgetText.h:20
MyGUI::ISubWidgetText::getInvertSelected
virtual bool getInvertSelected() const
Definition MyGUI_ISubWidgetText.h:48
MyGUI::ISubWidgetText::setTextColour
virtual void setTextColour(const Colour &)
Definition MyGUI_ISubWidgetText.h:127
MyGUI::ISubWidgetText::getViewOffset
virtual IntPoint getViewOffset() const
Definition MyGUI_ISubWidgetText.h:116
MyGUI::ISubWidgetText::getTextColour
virtual const Colour & getTextColour() const
Definition MyGUI_ISubWidgetText.h:128
MyGUI::ISubWidgetText::getCaption
virtual const UString & getCaption() const
Definition MyGUI_ISubWidgetText.h:122
MyGUI::ISubWidgetText::setTextAlign
virtual void setTextAlign(Align)
Definition MyGUI_ISubWidgetText.h:145
MyGUI::ISubWidgetText::getCursorRect
IntRect getCursorRect(size_t _position) const
Definition MyGUI_ISubWidgetText.h:102
MyGUI::ISubWidgetText::setFontName
virtual void setFontName(const std::string &)
Definition MyGUI_ISubWidgetText.h:133
MyGUI::ISubWidgetText::getCursorPoint
IntPoint getCursorPoint(size_t _position) const
Definition MyGUI_ISubWidgetText.h:95
MyGUI::ISubWidgetText::setCaption
virtual void setCaption(const UString &)
Definition MyGUI_ISubWidgetText.h:121
MyGUI::ISubWidgetText::getTextSize
virtual IntSize getTextSize() const
Definition MyGUI_ISubWidgetText.h:109
MyGUI::ISubWidgetText::setShadowColour
virtual void setShadowColour(const Colour &)
Definition MyGUI_ISubWidgetText.h:153
MyGUI::ISubWidgetText::setWordWrap
virtual void setWordWrap(bool)
Definition MyGUI_ISubWidgetText.h:79
MyGUI::ISubWidgetText::setCursorPosition
virtual void setCursorPosition(size_t)
Definition MyGUI_ISubWidgetText.h:77
MyGUI::ISubWidgetText::setFontHeight
virtual void setFontHeight(int)
Definition MyGUI_ISubWidgetText.h:139
MyGUI::ISubWidgetText::getCursorPosition
virtual size_t getCursorPosition() const
Definition MyGUI_ISubWidgetText.h:72
MyGUI::ISubWidgetText::getFontHeight
virtual int getFontHeight() const
Definition MyGUI_ISubWidgetText.h:140
MyGUI::ISubWidgetText::setInvertSelected
virtual void setInvertSelected(bool)
Definition MyGUI_ISubWidgetText.h:53
MyGUI::ISubWidgetText::setVisibleCursor
virtual void setVisibleCursor(bool)
Definition MyGUI_ISubWidgetText.h:69
MyGUI::ISubWidgetText::setTextSelection
virtual void setTextSelection(size_t, size_t)
Definition MyGUI_ISubWidgetText.h:37
MyGUI::ISubWidgetText::getTextAlign
virtual Align getTextAlign() const
Definition MyGUI_ISubWidgetText.h:146
MyGUI::ISubWidgetText::setSelectBackground
virtual void setSelectBackground(bool)
Definition MyGUI_ISubWidgetText.h:45
MyGUI::ISubWidgetText::setViewOffset
virtual void setViewOffset(const IntPoint &)
Definition MyGUI_ISubWidgetText.h:115
MyGUI::ISubWidgetText::setShadow
virtual void setShadow(bool)
Definition MyGUI_ISubWidgetText.h:61
MyGUI::ISubWidgetText::isVisibleCursor
virtual bool isVisibleCursor() const
Definition MyGUI_ISubWidgetText.h:64
MyGUI::InputManager
Definition MyGUI_InputManager.h:30
MyGUI::InputManager::isAltPressed
bool isAltPressed() const
Definition MyGUI_InputManager.cpp:686
MyGUI::InputManager::getLastPressedPosition
const IntPoint & getLastPressedPosition(MouseButton _id) const
Definition MyGUI_InputManager.cpp:657
MyGUI::InputManager::isShiftPressed
bool isShiftPressed() const
Definition MyGUI_InputManager.cpp:681
MyGUI::InputManager::setKeyFocusWidget
void setKeyFocusWidget(Widget *_widget)
Definition MyGUI_InputManager.cpp:401
MyGUI::InputManager::isMetaPressed
bool isMetaPressed() const
Definition MyGUI_InputManager.cpp:691
MyGUI::InputManager::isControlPressed
bool isControlPressed() const
Definition MyGUI_InputManager.cpp:676
MyGUI::InputManager::getInstance
static InputManager & getInstance()
MyGUI::InputManager::getMousePositionByLayer
IntPoint getMousePositionByLayer() const
Definition MyGUI_InputManager.cpp:615
MyGUI::MemberObsolete< EditBox >::deleteTextSelect
void deleteTextSelect()
Definition MyGUI_BackwardCompatibility.cpp:176
MyGUI::ScrollBar
widget description should be here.
Definition MyGUI_ScrollBar.h:26
MyGUI::ScrollBar::eventScrollChangePosition
EventHandle_ScrollBarPtrSizeT eventScrollChangePosition
Definition MyGUI_ScrollBar.h:127
MyGUI::ScrollBar::setScrollPosition
void setScrollPosition(size_t _value)
Definition MyGUI_ScrollBar.cpp:350
MyGUI::ScrollViewBase::getViewSize
virtual IntSize getViewSize() const
Definition MyGUI_ScrollViewBase.cpp:323
MyGUI::ScrollViewBase::mHScroll
ScrollBar * mHScroll
Definition MyGUI_ScrollViewBase.h:45
MyGUI::ScrollViewBase::mVRange
size_t mVRange
Definition MyGUI_ScrollViewBase.h:51
MyGUI::ScrollViewBase::getHScrollPage
virtual size_t getHScrollPage() const
Definition MyGUI_ScrollViewBase.cpp:328
MyGUI::ScrollViewBase::updateScrollPosition
void updateScrollPosition()
Definition MyGUI_ScrollViewBase.cpp:230
MyGUI::ScrollViewBase::mHRange
size_t mHRange
Definition MyGUI_ScrollViewBase.h:52
MyGUI::ScrollViewBase::mScrollViewClient
Widget * mScrollViewClient
Definition MyGUI_ScrollViewBase.h:46
MyGUI::ScrollViewBase::mVisibleVScroll
bool mVisibleVScroll
Definition MyGUI_ScrollViewBase.h:49
MyGUI::ScrollViewBase::getContentPosition
virtual IntPoint getContentPosition() const
Definition MyGUI_ScrollViewBase.cpp:314
MyGUI::ScrollViewBase::mChangeContentByResize
bool mChangeContentByResize
Definition MyGUI_ScrollViewBase.h:55
MyGUI::ScrollViewBase::mVisibleHScroll
bool mVisibleHScroll
Definition MyGUI_ScrollViewBase.h:48
MyGUI::ScrollViewBase::getContentAlign
virtual Align getContentAlign() const
Definition MyGUI_ScrollViewBase.cpp:338
MyGUI::ScrollViewBase::getContentSize
virtual IntSize getContentSize() const
Definition MyGUI_ScrollViewBase.cpp:309
MyGUI::ScrollViewBase::updateScrollSize
void updateScrollSize()
Definition MyGUI_ScrollViewBase.cpp:26
MyGUI::ScrollViewBase::mVScroll
ScrollBar * mVScroll
Definition MyGUI_ScrollViewBase.h:44
MyGUI::ScrollViewBase::getVScrollPage
virtual size_t getVScrollPage() const
Definition MyGUI_ScrollViewBase.cpp:333
MyGUI::SkinItem::getSubWidgetText
ISubWidgetText * getSubWidgetText() const
Definition MyGUI_SkinItem.cpp:155
MyGUI::TextIterator
Definition MyGUI_TextIterator.h:19
MyGUI::TextIterator::getOnlyText
static UString getOnlyText(const UString &_text)
Definition MyGUI_TextIterator.cpp:205
MyGUI::TextIterator::getTextNewLine
static UString getTextNewLine()
Definition MyGUI_TextIterator.cpp:560
MyGUI::TextIterator::getTextCharInfo
static UString getTextCharInfo(Char _char)
Definition MyGUI_TextIterator.cpp:337
MyGUI::TextIterator::moveNext
bool moveNext()
Definition MyGUI_TextIterator.cpp:33
MyGUI::TextIterator::getFromStart
UString getFromStart() const
Definition MyGUI_TextIterator.cpp:293
MyGUI::TextIterator::convertTagColour
static UString convertTagColour(const Colour &_colour)
Definition MyGUI_TextIterator.cpp:345
MyGUI::TextIterator::saveStartPoint
bool saveStartPoint()
Definition MyGUI_TextIterator.cpp:286
MyGUI::TextIterator::toTagsString
static UString toTagsString(const UString &_text)
Definition MyGUI_TextIterator.cpp:358
MyGUI::TextIterator::getPosition
size_t getPosition() const
Definition MyGUI_TextIterator.cpp:545
MyGUI::TextIterator::getTagColour
bool getTagColour(UString &_colour) const
Definition MyGUI_TextIterator.cpp:110
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::UString::clear
void clear()
deletes all of the elements in the string
Definition MyGUI_UString.cpp:653
MyGUI::UString::utf32string
std::basic_string< unicode_char > utf32string
string type used for returning UTF-32 formatted data
Definition MyGUI_UString.h:178
MyGUI::UString::code_point
uint16 code_point
a single UTF-16 code point
Definition MyGUI_UString.h:170
MyGUI::UString::empty
bool empty() const
returns true if the string has no elements, false otherwise
Definition MyGUI_UString.cpp:633
MyGUI::Widget
widget description should be here.
Definition MyGUI_Widget.h:37
MyGUI::Widget::getInheritedEnabled
bool getInheritedEnabled() const
Definition MyGUI_Widget.cpp:1335
MyGUI::Widget::eventChangeProperty
EventHandle_WidgetStringString eventChangeProperty
Definition MyGUI_Widget.h:268
MyGUI::Widget::_setWidgetState
bool _setWidgetState(const std::string &_value)
Definition MyGUI_Widget.cpp:374
MyGUI::Widget::assignWidget
void assignWidget(T *&_widget, const std::string &_name)
Definition MyGUI_Widget.h:336
MyGUI::Widget::getClientWidget
Widget * getClientWidget()
Definition MyGUI_Widget.cpp:1290
MyGUI::WidgetInput::eventMouseButtonDoubleClick
EventHandle_WidgetVoid eventMouseButtonDoubleClick
Definition MyGUI_WidgetInput.h:175
MyGUI::WidgetInput::setPointer
void setPointer(const std::string &_value)
Definition MyGUI_WidgetInput.cpp:142
MyGUI::WidgetInput::eventMouseButtonReleased
EventHandle_WidgetIntIntButton eventMouseButtonReleased
Definition MyGUI_WidgetInput.h:163
MyGUI::WidgetInput::getPointer
const std::string & getPointer() const
Definition MyGUI_WidgetInput.cpp:147
MyGUI::WidgetInput::setNeedKeyFocus
void setNeedKeyFocus(bool _value)
Definition MyGUI_WidgetInput.cpp:152
MyGUI::WidgetInput::eventMouseButtonPressed
EventHandle_WidgetIntIntButton eventMouseButtonPressed
Definition MyGUI_WidgetInput.h:154
MyGUI::WidgetInput::eventMouseSetFocus
EventHandle_WidgetWidget eventMouseSetFocus
Definition MyGUI_WidgetInput.h:122
MyGUI::WidgetInput::eventMouseLostFocus
EventHandle_WidgetWidget eventMouseLostFocus
Definition MyGUI_WidgetInput.h:115
MyGUI::WidgetInput::eventMouseDrag
EventPairAddParameter< EventHandle_WidgetIntInt, EventHandle_WidgetIntIntButton > eventMouseDrag
Definition MyGUI_WidgetInput.h:130
MyGUI::WidgetInput::eventMouseWheel
EventHandle_WidgetInt eventMouseWheel
Definition MyGUI_WidgetInput.h:145
MyGUI::utility::parseValue
T parseValue(const std::string &_value)
Definition MyGUI_StringUtility.h:112
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::EDIT_MOUSE_WHEEL
const int EDIT_MOUSE_WHEEL
Definition MyGUI_EditBox.cpp:44
MyGUI::IntRect
types::TRect< int > IntRect
Definition MyGUI_Types.h:33
MyGUI::EDIT_CURSOR_MIN_POSITION
const int EDIT_CURSOR_MIN_POSITION
Definition MyGUI_EditBox.cpp:38
MyGUI::IntPoint
types::TPoint< int > IntPoint
Definition MyGUI_Types.h:27
MyGUI::EDIT_CLIPBOARD_TYPE_TEXT
const std::string EDIT_CLIPBOARD_TYPE_TEXT
Definition MyGUI_EditBox.cpp:43
MyGUI::VectorChangeInfo
std::vector< TextCommandInfo > VectorChangeInfo
Definition MyGUI_TextChangeHistory.h:58
MyGUI::EDIT_MAX_UNDO
const size_t EDIT_MAX_UNDO
Definition MyGUI_EditBox.cpp:39
MyGUI::EDIT_CURSOR_MAX_POSITION
const int EDIT_CURSOR_MAX_POSITION
Definition MyGUI_EditBox.cpp:37
MyGUI::Char
unsigned int Char
Definition MyGUI_Types.h:50
MyGUI::EDIT_CURSOR_TIMER
const float EDIT_CURSOR_TIMER
Definition MyGUI_EditBox.cpp:35
MyGUI::EditCommand
EditCommand
Definition MyGUI_EditBox.cpp:23
MyGUI::EditCommand::NewLine
@ NewLine
MyGUI::EditCommand::Undo
@ Undo
MyGUI::EditCommand::LoseFocus
@ LoseFocus
MyGUI::EditCommand::Paste
@ Paste
MyGUI::EditCommand::ErasePrevious
@ ErasePrevious
MyGUI::EditCommand::MovePageUp
@ MovePageUp
MyGUI::EditCommand::MoveTextEnd
@ MoveTextEnd
MyGUI::EditCommand::Redo
@ Redo
MyGUI::EditCommand::MoveLineBeginning
@ MoveLineBeginning
MyGUI::EditCommand::Copy
@ Copy
MyGUI::EditCommand::AcceptEntry
@ AcceptEntry
MyGUI::EditCommand::MoveRightWord
@ MoveRightWord
MyGUI::EditCommand::SelectAll
@ SelectAll
MyGUI::EditCommand::MoveRight
@ MoveRight
MyGUI::EditCommand::Unknown
@ Unknown
MyGUI::EditCommand::MoveDown
@ MoveDown
MyGUI::EditCommand::EraseNext
@ EraseNext
MyGUI::EditCommand::MoveUp
@ MoveUp
MyGUI::EditCommand::MoveTextBeginning
@ MoveTextBeginning
MyGUI::EditCommand::MoveLineEnd
@ MoveLineEnd
MyGUI::EditCommand::MoveLeftWord
@ MoveLeftWord
MyGUI::EditCommand::MoveLeft
@ MoveLeft
MyGUI::EditCommand::Cut
@ Cut
MyGUI::EditCommand::MovePageDown
@ MovePageDown
MyGUI::ToEditCommand
static EditCommand ToEditCommand(KeyCode key, const InputManager &input)
Definition MyGUI_EditBox.cpp:308
MyGUI::IntSize
types::TSize< int > IntSize
Definition MyGUI_Types.h:30
MyGUI::EDIT_OFFSET_HORZ_CURSOR
const float EDIT_OFFSET_HORZ_CURSOR
Definition MyGUI_EditBox.cpp:41
MyGUI::isWhitespace
static bool isWhitespace(const UString::code_point &c)
Definition MyGUI_EditBox.cpp:304
MyGUI::ITEM_NONE
const size_t ITEM_NONE
Definition MyGUI_Macros.h:18
MyGUI::newDelegate
delegates::DelegateFunction< Args... > * newDelegate(void(*_func)(Args... args))
Definition MyGUI_Delegate.h:99
MyGUI::EDIT_ACTION_MOUSE_TIMER
const float EDIT_ACTION_MOUSE_TIMER
Definition MyGUI_EditBox.cpp:36
MyGUI::EDIT_ACTION_MOUSE_ZONE
const int EDIT_ACTION_MOUSE_ZONE
Definition MyGUI_EditBox.cpp:42
MyGUI::EDIT_DEFAULT_MAX_TEXT_LENGTH
const size_t EDIT_DEFAULT_MAX_TEXT_LENGTH
Definition MyGUI_EditBox.cpp:40
MyGUI::Align
Definition MyGUI_Align.h:20
MyGUI::Colour
Definition MyGUI_Colour.h:17
MyGUI::KeyCode
Definition MyGUI_KeyCode.h:16
MyGUI::KeyCode::getValue
int getValue() const
Definition MyGUI_KeyCode.h:202
MyGUI::KeyCode::Delete
@ Delete
Definition MyGUI_KeyCode.h:148
MyGUI::KeyCode::Home
@ Home
Definition MyGUI_KeyCode.h:139
MyGUI::KeyCode::Backspace
@ Backspace
Definition MyGUI_KeyCode.h:33
MyGUI::KeyCode::A
@ A
Definition MyGUI_KeyCode.h:49
MyGUI::KeyCode::ArrowRight
@ ArrowRight
Definition MyGUI_KeyCode.h:143
MyGUI::KeyCode::PageUp
@ PageUp
Definition MyGUI_KeyCode.h:141
MyGUI::KeyCode::LeftShift
@ LeftShift
Definition MyGUI_KeyCode.h:61
MyGUI::KeyCode::Y
@ Y
Definition MyGUI_KeyCode.h:40
MyGUI::KeyCode::End
@ End
Definition MyGUI_KeyCode.h:144
MyGUI::KeyCode::Escape
@ Escape
Definition MyGUI_KeyCode.h:20
MyGUI::KeyCode::NumpadEnter
@ NumpadEnter
Definition MyGUI_KeyCode.h:125
MyGUI::KeyCode::X
@ X
Definition MyGUI_KeyCode.h:64
MyGUI::KeyCode::RightShift
@ RightShift
Definition MyGUI_KeyCode.h:73
MyGUI::KeyCode::Insert
@ Insert
Definition MyGUI_KeyCode.h:147
MyGUI::KeyCode::ArrowDown
@ ArrowDown
Definition MyGUI_KeyCode.h:145
MyGUI::KeyCode::ArrowUp
@ ArrowUp
Definition MyGUI_KeyCode.h:140
MyGUI::KeyCode::V
@ V
Definition MyGUI_KeyCode.h:66
MyGUI::KeyCode::ArrowLeft
@ ArrowLeft
Definition MyGUI_KeyCode.h:142
MyGUI::KeyCode::Return
@ Return
Definition MyGUI_KeyCode.h:47
MyGUI::KeyCode::C
@ C
Definition MyGUI_KeyCode.h:65
MyGUI::KeyCode::Z
@ Z
Definition MyGUI_KeyCode.h:63
MyGUI::KeyCode::PageDown
@ PageDown
Definition MyGUI_KeyCode.h:146
MyGUI::MouseButton
Definition MyGUI_MouseButton.h:16
MyGUI::MouseButton::Left
@ Left
Definition MyGUI_MouseButton.h:21
MyGUI::TextCommandInfo::COMMAND_POSITION
@ COMMAND_POSITION
Definition MyGUI_TextChangeHistory.h:23
MyGUI::TextCommandInfo::COMMAND_INSERT
@ COMMAND_INSERT
Definition MyGUI_TextChangeHistory.h:24
MyGUI::TextCommandInfo::COMMAND_ERASE
@ COMMAND_ERASE
Definition MyGUI_TextChangeHistory.h:25
MyGUI::types::TCoord< int >
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< int >
MyGUI::types::TRect::right
T right
Definition MyGUI_TRect.h:22
MyGUI::types::TRect::height
T height() const
Definition MyGUI_TRect.h:111
MyGUI::types::TRect::inside
bool inside(const TRect< T > &_value) const
Definition MyGUI_TRect.h:141
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::width
T width() const
Definition MyGUI_TRect.h:106
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