MyGUI: MyGUI_ItemBox.cpp Source File

MyGUI 3.4.3

MyGUI_ItemBox.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_ItemBox.h"
9#include "MyGUI_Button.h"
10#include "MyGUI_ScrollBar.h"
11#include "MyGUI_ResourceSkin.h"
12#include "MyGUI_InputManager.h"
13#include "MyGUI_Gui.h"
14#include "MyGUI_WidgetManager.h"
15
16namespace MyGUI
17{
18
19 ItemBox::ItemBox()
20 {
21 mChangeContentByResize = true;
22 }
23
24 void ItemBox::initialiseOverride()
25 {
26 Base::initialiseOverride();
27
28 // FIXME нам нужен фокус клавы
29 setNeedKeyFocus(true);
30
31 mDragLayer = "DragAndDrop";
32
33 if (isUserString("DragLayer"))
34 mDragLayer = getUserString("DragLayer");
35
36 assignWidget(mScrollViewClient, "Client");
37 if (getClientWidget() != nullptr)
38 {
39 getClientWidget()->eventMouseWheel += newDelegate(this, &ItemBox::notifyMouseWheel);
40 getClientWidget()->eventMouseButtonPressed += newDelegate(this, &ItemBox::notifyMouseButtonPressed);
41 getClientWidget()->eventMouseButtonReleased += newDelegate(this, &ItemBox::notifyMouseButtonReleased);
42 }
43
45 assignWidget(mVScroll, "VScroll");
46 if (mVScroll != nullptr)
47 {
48 mVScroll->eventScrollChangePosition += newDelegate(this, &ItemBox::notifyScrollChangePosition);
49 }
50
52 assignWidget(mHScroll, "HScroll");
53 if (mHScroll != nullptr)
54 {
55 mHScroll->eventScrollChangePosition += newDelegate(this, &ItemBox::notifyScrollChangePosition);
56 }
57
58 // подписываем клиент для драгэндропа
59 if (getClientWidget() != nullptr)
60 getClientWidget()->_setContainer(this);
61
62 requestItemSize();
63
64 updateScrollSize();
65 updateScrollPosition();
66 }
67
68 void ItemBox::shutdownOverride()
69 {
70 mVScroll = nullptr;
71 mHScroll = nullptr;
72
73 Base::shutdownOverride();
74 }
75
76 void ItemBox::setPosition(const IntPoint& _point)
77 {
78 Base::setPosition(_point);
79 }
80
81 void ItemBox::setSize(const IntSize& _size)
82 {
83 Base::setSize(_size);
84 updateFromResize();
85 }
86
87 void ItemBox::setCoord(const IntCoord& _coord)
88 {
89 Base::setCoord(_coord);
90 updateFromResize();
91 }
92
93 void ItemBox::requestItemSize()
94 {
95 IntCoord coord(0, 0, 1, 1);
96
97 // спрашиваем размер иконок
98 requestCoordItem(this, coord, false);
99
100 mSizeItem = coord.size();
101 MYGUI_ASSERT(
102 (mSizeItem.width > 0 && mSizeItem.height > 0),
103 "(mSizeItem.width > 0 && mSizeItem.height > 0) at requestCoordWidgetItem");
104 }
105
106 void ItemBox::updateFromResize()
107 {
108 requestItemSize();
109
110 updateScrollSize();
111 updateScrollPosition();
112
113 _updateAllVisible(true);
114 _resetContainer(true);
115 }
116
117 void ItemBox::_updateAllVisible(bool _redraw)
118 {
119 int count_visible = 0;
120 if (mAlignVert)
121 {
122 count_visible = (_getClientWidget()->getHeight() / mSizeItem.height) + 2;
123 }
124 else
125 {
126 count_visible = (_getClientWidget()->getWidth() / mSizeItem.width) + 2;
127 }
128
129 size_t start = (mFirstVisibleIndex * mCountItemInLine);
130 size_t count = (count_visible * mCountItemInLine) + start;
131
132 size_t index = 0;
133 for (size_t pos = start; pos < count; ++pos, ++index)
134 {
135 // дальше нет айтемов
136 if (pos >= mItemsInfo.size())
137 break;
138
139 Widget* item = getItemWidget(index);
140 if (mAlignVert)
141 {
142 item->setPosition(
143 ((int)index % mCountItemInLine) * mSizeItem.width - mContentPosition.left,
144 (((int)index / mCountItemInLine) * mSizeItem.height) - mFirstOffsetIndex);
145 }
146 else
147 {
148 item->setPosition(
149 (((int)index / mCountItemInLine) * mSizeItem.width) - mFirstOffsetIndex,
150 ((int)index % mCountItemInLine) * mSizeItem.height - mContentPosition.top);
151 }
152
153 item->setSize(mSizeItem);
154 item->setVisible(true);
155
156 if (_redraw)
157 {
158 IBDrawItemInfo data(pos, mIndexSelect, mIndexActive, mIndexAccept, mIndexRefuse, true, false);
159 requestDrawItem(this, item, data);
160 }
161 }
162
163 // все виджеты еще есть, то их надо бы скрыть
164 while (index < mVectorItems.size())
165 {
166 mVectorItems[index]->setVisible(false);
167 index++;
168 }
169 }
170
171 Widget* ItemBox::getItemWidget(size_t _index)
172 {
173 // еще нет такого виджета, нуно создать
174 if (_index == mVectorItems.size())
175 {
176 requestItemSize();
177
178 Widget* item = _getClientWidget()->createWidget<Widget>(
179 "Default",
180 IntCoord(0, 0, mSizeItem.width, mSizeItem.height),
181 Align::Default);
182
183 // вызываем запрос на создание виджета
184 requestCreateWidgetItem(this, item);
185
186 item->eventMouseWheel += newDelegate(this, &ItemBox::notifyMouseWheel);
187 item->eventRootMouseChangeFocus += newDelegate(this, &ItemBox::notifyRootMouseChangeFocus);
188 item->eventMouseButtonPressed += newDelegate(this, &ItemBox::notifyMouseButtonPressed);
189 item->eventMouseButtonReleased += newDelegate(this, &ItemBox::notifyMouseButtonReleased);
190 item->eventMouseButtonDoubleClick += newDelegate(this, &ItemBox::notifyMouseButtonDoubleClick);
191 item->eventMouseDrag += newDelegate(this, &ItemBox::notifyMouseDrag);
192 item->_setContainer(this);
193 item->eventKeyButtonPressed += newDelegate(this, &ItemBox::notifyKeyButtonPressed);
194 item->eventKeyButtonReleased += newDelegate(this, &ItemBox::notifyKeyButtonReleased);
195
196 item->_setInternalData((size_t)mVectorItems.size());
197
198 mVectorItems.push_back(item);
199 }
200
201 // запрашивать только последовательно
202 MYGUI_ASSERT_RANGE(_index, mVectorItems.size(), "ItemBox::getItemWidget");
203
204 return mVectorItems[_index];
205 }
206
207 void ItemBox::onMouseWheel(int _rel)
208 {
209 notifyMouseWheel(nullptr, _rel);
210
211 Base::onMouseWheel(_rel);
212 }
213
214 void ItemBox::onKeySetFocus(Widget* _old)
215 {
216 mIsFocus = true;
217
218 Base::onKeySetFocus(_old);
219 }
220
221 void ItemBox::onKeyLostFocus(Widget* _new)
222 {
223 mIsFocus = false;
224
225 Base::onKeyLostFocus(_new);
226 }
227
228 void ItemBox::resetCurrentActiveItem()
229 {
230 // сбрасываем старую подсветку
231 if (mIndexActive != ITEM_NONE)
232 {
233 size_t start = (size_t)(mFirstVisibleIndex * mCountItemInLine);
234 size_t index = mIndexActive;
235 mIndexActive = ITEM_NONE;
236
237 // если видим, то обновляем
238 if ((mIndexActive >= start) && (mIndexActive < (start + mVectorItems.size())))
239 {
240 IBDrawItemInfo data(index, mIndexSelect, mIndexActive, mIndexAccept, mIndexRefuse, false, false);
241
242 requestDrawItem(this, mVectorItems[mIndexActive - start], data);
243 }
244 }
245 }
246
247 void ItemBox::findCurrentActiveItem()
248 {
249 MYGUI_DEBUG_ASSERT(mIndexActive == ITEM_NONE, "use : resetCurrentActiveItem() before findCurrentActiveItem()");
250
251 const IntPoint& point = InputManager::getInstance().getMousePositionByLayer();
252
253 // сначала проверяем клиентскую зону
254 const IntRect& rect = _getClientWidget()->getAbsoluteRect();
255 if ((point.left < rect.left) || (point.left > rect.right) || (point.top < rect.top) ||
256 (point.top > rect.bottom))
257 {
258 return;
259 }
260
261 for (const auto& item : mVectorItems)
262 {
263 const IntRect& abs_rect = item->getAbsoluteRect();
264 if ((point.left >= abs_rect.left) && (point.left <= abs_rect.right) && (point.top >= abs_rect.top) &&
265 (point.top <= abs_rect.bottom))
266 {
267 size_t index = calcIndexByWidget(item);
268 // при переборе индекс может быть больше, так как может создасться сколько угодно
269 if (index < mItemsInfo.size())
270 {
271 mIndexActive = index;
272 IBDrawItemInfo data(index, mIndexSelect, mIndexActive, mIndexAccept, mIndexRefuse, false, false);
273
274 requestDrawItem(this, item, data);
275 }
276
277 break;
278 }
279 }
280 }
281
282 size_t ItemBox::_getItemIndex(Widget* _item) const
283 {
284 if (_item == _getClientWidget())
285 return ITEM_NONE;
286 size_t index = calcIndexByWidget(_item);
287 if (index < mItemsInfo.size())
288 return index;
289 return ITEM_NONE;
290 }
291
292 void ItemBox::_setContainerItemInfo(size_t _index, bool _set, bool _accept)
293 {
294 if (_index == ITEM_NONE)
295 return;
296 MYGUI_ASSERT_RANGE(_index, mItemsInfo.size(), "ItemBox::_setContainerItemInfo");
297
298 mIndexAccept = (_set && _accept) ? _index : ITEM_NONE;
299 mIndexRefuse = (_set && !_accept) ? _index : ITEM_NONE;
300
301 size_t start = (size_t)(mFirstVisibleIndex * mCountItemInLine);
302 if ((_index >= start) && (_index < (start + mVectorItems.size())))
303 {
304 IBDrawItemInfo data(_index, mIndexSelect, mIndexActive, mIndexAccept, mIndexRefuse, false, false);
305 requestDrawItem(this, mVectorItems[_index - start], data);
306 }
307 }
308
309 void ItemBox::setItemDataAt(size_t _index, Any _data)
310 {
311 MYGUI_ASSERT_RANGE(_index, mItemsInfo.size(), "ItemBox::setItemData");
312 mItemsInfo[_index].data = std::move(_data);
313
314 size_t start = (size_t)(mFirstVisibleIndex * mCountItemInLine);
315 if ((_index >= start) && (_index < (start + mVectorItems.size())))
316 {
317 IBDrawItemInfo data(_index, mIndexSelect, mIndexActive, mIndexAccept, mIndexRefuse, true, false);
318 requestDrawItem(this, mVectorItems[_index - start], data);
319 }
320
321 _resetContainer(true);
322 }
323
324 void ItemBox::insertItemAt(size_t _index, Any _data, bool update)
325 {
326 MYGUI_ASSERT_RANGE_INSERT(_index, mItemsInfo.size(), "ItemBox::insertItemAt");
327 if (_index == ITEM_NONE)
328 _index = mItemsInfo.size();
329
330 _resetContainer(false);
331 resetCurrentActiveItem();
332
333 mItemsInfo.insert(mItemsInfo.begin() + _index, ItemDataInfo(_data));
334
335 // расчитываем новый индекс выделения
336 if (mIndexSelect != ITEM_NONE)
337 {
338 if (mIndexSelect >= _index)
339 {
340 mIndexSelect++;
341 }
342 }
343
344 if (update)
345 {
346 updateScrollSize();
347 updateScrollPosition();
348
349 findCurrentActiveItem();
350
351 _updateAllVisible(true);
352 }
353 }
354
355 void ItemBox::removeItemAt(size_t _index, bool update)
356 {
357 MYGUI_ASSERT_RANGE(_index, mItemsInfo.size(), "ItemBox::removeItemAt");
358
359 _resetContainer(false);
360 resetCurrentActiveItem();
361
362 mItemsInfo.erase(mItemsInfo.begin() + _index);
363
364 // расчитываем новый индекс выделения
365 if (mIndexSelect != ITEM_NONE)
366 {
367 if (mItemsInfo.empty())
368 {
369 mIndexSelect = ITEM_NONE;
370 }
371 else if ((mIndexSelect > _index) || (mIndexSelect == mItemsInfo.size()))
372 {
373 mIndexSelect--;
374 }
375 }
376
377 if (update)
378 {
379 updateScrollSize();
380 updateScrollPosition();
381
382 findCurrentActiveItem();
383
384 _updateAllVisible(true);
385 }
386 }
387
388 void ItemBox::removeAllItems()
389 {
390 if (mItemsInfo.empty())
391 return;
392 _resetContainer(false);
393
394 mItemsInfo.clear();
395
396 mIndexSelect = ITEM_NONE;
397 mIndexActive = ITEM_NONE;
398
399 updateScrollSize();
400 updateScrollPosition();
401
402 _updateAllVisible(true);
403 }
404
405 void ItemBox::redrawItemAt(size_t _index)
406 {
407 MYGUI_ASSERT_RANGE(_index, mItemsInfo.size(), "ItemBox::redrawItemAt");
408
409 size_t start = (size_t)(mFirstVisibleIndex * mCountItemInLine);
410 if ((_index >= start) && (_index < (start + mVectorItems.size())))
411 {
412 IBDrawItemInfo data(_index, mIndexSelect, mIndexActive, mIndexAccept, mIndexRefuse, true, false);
413 requestDrawItem(this, mVectorItems[_index - start], data);
414 }
415 }
416
417 void ItemBox::setIndexSelected(size_t _index)
418 {
419 MYGUI_ASSERT_RANGE_AND_NONE(_index, mItemsInfo.size(), "ItemBox::setIndexSelected");
420 if (_index == mIndexSelect)
421 return;
422
423 size_t start = (size_t)(mFirstVisibleIndex * mCountItemInLine);
424
425 // сбрасываем старое выделение
426 if (mIndexSelect != ITEM_NONE)
427 {
428 size_t index = mIndexSelect;
429 mIndexSelect = ITEM_NONE;
430
431 if ((index >= start) && (index < (start + mVectorItems.size())))
432 {
433 IBDrawItemInfo data(index, mIndexSelect, mIndexActive, mIndexAccept, mIndexRefuse, false, false);
434 requestDrawItem(this, mVectorItems[index - start], data);
435 }
436 }
437
438 mIndexSelect = _index;
439 if (mIndexSelect != ITEM_NONE)
440 {
441 if ((_index >= start) && (_index < (start + mVectorItems.size())))
442 {
443 IBDrawItemInfo data(_index, mIndexSelect, mIndexActive, mIndexAccept, mIndexRefuse, false, false);
444 requestDrawItem(this, mVectorItems[_index - start], data);
445 }
446 }
447 }
448
449 void ItemBox::notifyMouseButtonDoubleClick(Widget* _sender)
450 {
451 size_t index = getIndexByWidget(_sender);
452
453 eventSelectItemAccept(this, index);
454 }
455
456 void ItemBox::setVerticalAlignment(bool _vert)
457 {
458 if (mAlignVert == _vert)
459 return;
460 mAlignVert = _vert;
461
462 mCountItemInLine = -1;
463 updateFromResize();
464 }
465
466 void ItemBox::notifyKeyButtonPressed(Widget* _sender, KeyCode _key, Char _char)
467 {
468 eventNotifyItem(this, IBNotifyItemData(getIndexByWidget(_sender), IBNotifyItemData::KeyPressed, _key, _char));
469 }
470
471 void ItemBox::notifyKeyButtonReleased(Widget* _sender, KeyCode _key)
472 {
473 eventNotifyItem(this, IBNotifyItemData(getIndexByWidget(_sender), IBNotifyItemData::KeyReleased, _key));
474 }
475
476 size_t ItemBox::getIndexByWidget(Widget* _widget) const
477 {
478 MYGUI_ASSERT(_widget, "ItemBox::getIndexByWidget : Widget == nullptr");
479 if (_widget == _getClientWidget())
480 return ITEM_NONE;
481 MYGUI_ASSERT(_widget->getParent() == _getClientWidget(), "ItemBox::getIndexByWidget : Widget is not child");
482
483 size_t index = calcIndexByWidget(_widget);
484 MYGUI_ASSERT_RANGE(index, mItemsInfo.size(), "ItemBox::getIndexByWidget");
485
486 return index;
487 }
488
489 size_t ItemBox::_getContainerIndex(const IntPoint& _point) const
490 {
491 for (const auto& item : mVectorItems)
492 {
493 if (item->getVisible())
494 {
495 if (item->getAbsoluteRect().inside(_point))
496 {
497 return getIndexByWidget(item);
498 }
499 }
500 }
501 return ITEM_NONE;
502 }
503
504 void ItemBox::_resetContainer(bool _update)
505 {
506 // обязательно у базового
507 Base::_resetContainer(_update);
508
509 if (!_update)
510 {
511 WidgetManager& instance = WidgetManager::getInstance();
512 for (auto& vectorItem : mVectorItems)
513 {
514 instance.unlinkFromUnlinkers(vectorItem);
515 }
516 }
517 }
518
519 Widget* ItemBox::getWidgetByIndex(size_t _index)
520 {
521 for (const auto& vectorItem : mVectorItems)
522 {
523 if (vectorItem->getVisible())
524 {
525 size_t index = getIndexByWidget(vectorItem);
526
527 if (index == _index)
528 return vectorItem;
529 }
530 }
531 return nullptr;
532 }
533
534 void ItemBox::onMouseButtonPressed(int _left, int _top, MouseButton _id)
535 {
536 Base::onMouseButtonPressed(_left, _top, _id);
537 }
538
539 void ItemBox::onMouseButtonReleased(int _left, int _top, MouseButton _id)
540 {
541 Base::onMouseButtonReleased(_left, _top, _id);
542 }
543
544 void ItemBox::onMouseDrag(int _left, int _top, MouseButton _id)
545 {
546 Base::onMouseDrag(_left, _top, _id);
547 }
548
549 void ItemBox::removeDropItems()
550 {
551 if (mItemDrag)
552 mItemDrag->setVisible(false);
553 }
554
555 void ItemBox::updateDropItems()
556 {
557 if (nullptr == mItemDrag)
558 {
559 // спрашиваем размер иконок
560 IntCoord coord;
561
562 requestCoordItem(this, coord, true);
563
564 mPointDragOffset = coord.point();
565
566 // создаем и запрашиваем детей
567 mItemDrag = Gui::getInstance().createWidget<Widget>(
568 "Default",
569 IntCoord(0, 0, coord.width, coord.height),
570 Align::Default,
571 mDragLayer);
572 requestCreateWidgetItem(this, mItemDrag);
573 }
574
575 const IntPoint& point = InputManager::getInstance().getMousePosition();
576
577 mItemDrag->setPosition(
578 point.left - mClickInWidget.left + mPointDragOffset.left,
579 point.top - mClickInWidget.top + mPointDragOffset.top);
580 mItemDrag->setVisible(true);
581 }
582
583 void ItemBox::updateDropItemsState(const DDWidgetState& _state)
584 {
585 IBDrawItemInfo data;
586 data.drop_accept = _state.accept;
587 data.drop_refuse = _state.refuse;
588
589 data.select = false;
590 data.active = false;
591
592 data.index = mDropSenderIndex;
593 data.update = _state.update;
594 data.drag = true;
595
596 requestDrawItem(this, mItemDrag, data);
597 }
598
599 void ItemBox::notifyMouseDrag(Widget* _sender, int _left, int _top, MouseButton _id)
600 {
601 mouseDrag(_id);
602 }
603
604 void ItemBox::notifyMouseButtonPressed(Widget* _sender, int _left, int _top, MouseButton _id)
605 {
606 mouseButtonPressed(_id);
607
608 if (MouseButton::Left == _id)
609 {
610 size_t old = mIndexSelect;
611
612 if (_sender == _getClientWidget())
613 {
614 // сбрасываем выделение
615 setIndexSelected(ITEM_NONE);
616 }
617 else
618 {
619 // индекс отправителя
620 mDropSenderIndex = getIndexByWidget(_sender);
621
622 // выделенный елемент
623 setIndexSelected(mDropSenderIndex);
624 }
625
626 // смещение внутри виджета, куда кликнули мышкой
627 mClickInWidget =
628 InputManager::getInstance().getLastPressedPosition(MouseButton::Left) - _sender->getAbsolutePosition();
629
630 // отсылаем событие
631 eventMouseItemActivate(this, mIndexSelect);
632 // смену позиции отсылаем только при реальном изменении
633 if (old != mIndexSelect)
634 eventChangeItemPosition(this, mIndexSelect);
635 }
636
637 eventNotifyItem(
638 this,
639 IBNotifyItemData(getIndexByWidget(_sender), IBNotifyItemData::MousePressed, _left, _top, _id));
640 }
641
642 void ItemBox::notifyMouseButtonReleased(Widget* _sender, int _left, int _top, MouseButton _id)
643 {
644 bool needEvent = !mStartDrop;
645 mouseButtonReleased(_id);
646
647 if (needEvent)
648 eventNotifyItem(
649 this,
650 IBNotifyItemData(getIndexByWidget(_sender), IBNotifyItemData::MouseReleased, _left, _top, _id));
651 }
652
653 void ItemBox::notifyRootMouseChangeFocus(Widget* _sender, bool _focus)
654 {
655 size_t index = calcIndexByWidget(_sender);
656 if (_focus)
657 {
658 MYGUI_ASSERT_RANGE(index, mItemsInfo.size(), "ItemBox::notifyRootMouseChangeFocus");
659
660 // сбрасываем старый
661 if (mIndexActive != ITEM_NONE)
662 {
663 size_t old_index = mIndexActive;
664 mIndexActive = ITEM_NONE;
665 IBDrawItemInfo data(old_index, mIndexSelect, mIndexActive, mIndexAccept, mIndexRefuse, false, false);
666 requestDrawItem(this, mVectorItems[old_index - (mFirstVisibleIndex * mCountItemInLine)], data);
667 }
668
669 mIndexActive = index;
670 IBDrawItemInfo data(index, mIndexSelect, mIndexActive, mIndexAccept, mIndexRefuse, false, false);
671 requestDrawItem(this, mVectorItems[*_sender->_getInternalData<size_t>()], data);
672 }
673 else
674 {
675 // при сбросе виджет может быть уже скрыт, и соответсвенно отсутсвовать индекс
676 // сбрасываем индекс, только если мы и есть актив
677 if (index < mItemsInfo.size() && mIndexActive == index)
678 {
679 mIndexActive = ITEM_NONE;
680 IBDrawItemInfo data(index, mIndexSelect, mIndexActive, mIndexAccept, mIndexRefuse, false, false);
681 requestDrawItem(this, mVectorItems[*_sender->_getInternalData<size_t>()], data);
682 }
683 }
684 }
685
686 void ItemBox::updateMetrics()
687 {
688 if (mAlignVert)
689 {
690 // колличество айтемов на одной строке
691 mCountItemInLine = _getClientWidget()->getWidth() / mSizeItem.width;
692 }
693 else
694 {
695 // колличество айтемов на одной строке
696 mCountItemInLine = _getClientWidget()->getHeight() / mSizeItem.height;
697 }
698
699 if (1 > mCountItemInLine)
700 mCountItemInLine = 1;
701
702 // колличество строк
703 mCountLines = int(mItemsInfo.size() / mCountItemInLine);
704 if (0 != (mItemsInfo.size() % mCountItemInLine))
705 mCountLines++;
706
707 if (mAlignVert)
708 {
709 mContentSize.width = (mSizeItem.width * mCountItemInLine);
710 mContentSize.height = (mSizeItem.height * mCountLines);
711 }
712 else
713 {
714 mContentSize.width = (mSizeItem.width * mCountLines);
715 mContentSize.height = (mSizeItem.height * mCountItemInLine);
716 }
717 }
718
719 void ItemBox::notifyScrollChangePosition(ScrollBar* _sender, size_t _index)
720 {
721 if (_sender == mVScroll)
722 {
723 mContentPosition.top = (int)_index;
724 }
725 else if (_sender == mHScroll)
726 {
727 mContentPosition.left = (int)_index;
728 }
729
730 setContentPosition(mContentPosition);
731 }
732
733 void ItemBox::notifyMouseWheel(Widget* _sender, int _rel)
734 {
735 if (mAlignVert)
736 {
737 if (mContentSize.height <= 0)
738 return;
739
740 int offset = mContentPosition.top;
741 if (_rel < 0)
742 offset += mSizeItem.height;
743 else
744 offset -= mSizeItem.height;
745
746 if (mContentSize.height <= _getClientWidget()->getHeight())
747 offset = 0;
748 else if (offset >= mContentSize.height - _getClientWidget()->getHeight())
749 offset = mContentSize.height - _getClientWidget()->getHeight();
750 else if (offset < 0)
751 offset = 0;
752
753 if (mContentPosition.top == offset)
754 return;
755
756 // сбрасываем старую подсветку
757 // так как при прокрутке, мышь может находиться над окном
758 resetCurrentActiveItem();
759
760 mContentPosition.top = offset;
761 }
762 else
763 {
764 if (mContentSize.width <= 0)
765 return;
766
767 int offset = mContentPosition.left;
768 if (_rel < 0)
769 offset += mSizeItem.width;
770 else
771 offset -= mSizeItem.width;
772
773 if (mContentSize.width <= _getClientWidget()->getWidth())
774 offset = 0;
775 else if (offset >= mContentSize.width - _getClientWidget()->getWidth())
776 offset = mContentSize.width - _getClientWidget()->getWidth();
777 else if (offset < 0)
778 offset = 0;
779
780 if (mContentPosition.left == offset)
781 return;
782
783 // сбрасываем старую подсветку
784 // так как при прокрутке, мышь может находиться над окном
785 resetCurrentActiveItem();
786
787 mContentPosition.left = offset;
788 }
789
790 setContentPosition(mContentPosition);
791
792 // заново ищем и подсвечиваем айтем
793 if (!mNeedDrop)
794 findCurrentActiveItem();
795
796 if (nullptr != mVScroll)
797 mVScroll->setScrollPosition(mContentPosition.top);
798 if (nullptr != mHScroll)
799 mHScroll->setScrollPosition(mContentPosition.left);
800 }
801
802 void ItemBox::setContentPosition(const IntPoint& _point)
803 {
804 mContentPosition = _point;
805
806 int old = mFirstVisibleIndex;
807
808 if (mAlignVert)
809 {
810 mFirstVisibleIndex = mContentPosition.top / mSizeItem.height;
811 mFirstOffsetIndex = mContentPosition.top % mSizeItem.height;
812 }
813 else
814 {
815 mFirstVisibleIndex = mContentPosition.left / mSizeItem.width;
816 mFirstOffsetIndex = mContentPosition.left % mSizeItem.width;
817 }
818
819 _updateAllVisible(old != mFirstVisibleIndex);
820 _resetContainer(true);
821 }
822
823 void ItemBox::redrawAllItems()
824 {
825 _updateAllVisible(true);
826 }
827
828 void ItemBox::resetDrag()
829 {
830 endDrop(true);
831 }
832
833 size_t ItemBox::calcIndexByWidget(Widget* _widget) const
834 {
835 return *_widget->_getInternalData<size_t>() + (mFirstVisibleIndex * mCountItemInLine);
836 }
837
838 IntSize ItemBox::getContentSize() const
839 {
840 return mContentSize;
841 }
842
843 IntPoint ItemBox::getContentPosition() const
844 {
845 return mContentPosition;
846 }
847
848 IntSize ItemBox::getViewSize() const
849 {
850 return _getClientWidget()->getSize();
851 }
852
853 void ItemBox::eraseContent()
854 {
855 updateMetrics();
856 }
857
858 size_t ItemBox::getHScrollPage() const
859 {
860 return mSizeItem.width;
861 }
862
863 size_t ItemBox::getVScrollPage() const
864 {
865 return mSizeItem.height;
866 }
867
868 Align ItemBox::getContentAlign() const
869 {
870 return Align::Default;
871 }
872
873 size_t ItemBox::getItemCount() const
874 {
875 return mItemsInfo.size();
876 }
877
878 void ItemBox::addItem(Any _data, bool update)
879 {
880 insertItemAt(ITEM_NONE, _data, update);
881 }
882
883 size_t ItemBox::getIndexSelected() const
884 {
885 return mIndexSelect;
886 }
887
888 void ItemBox::clearIndexSelected()
889 {
890 setIndexSelected(ITEM_NONE);
891 }
892
893 void ItemBox::clearItemDataAt(size_t _index)
894 {
895 setItemDataAt(_index, Any::Null);
896 }
897
898 bool ItemBox::getVerticalAlignment() const
899 {
900 return mAlignVert;
901 }
902
903 Widget* ItemBox::getWidgetDrag() const
904 {
905 return mItemDrag;
906 }
907
908 void ItemBox::setVisibleVScroll(bool _value)
909 {
910 mVisibleVScroll = _value;
911 updateFromResize();
912 }
913
914 void ItemBox::setVisibleHScroll(bool _value)
915 {
916 mVisibleHScroll = _value;
917 updateFromResize();
918 }
919
920 bool ItemBox::isVisibleVScroll() const
921 {
922 return mVisibleVScroll;
923 }
924
925 bool ItemBox::isVisibleHScroll() const
926 {
927 return mVisibleHScroll;
928 }
929
930 void ItemBox::setPropertyOverride(std::string_view _key, std::string_view _value)
931 {
933 if (_key == "VerticalAlignment")
934 setVerticalAlignment(utility::parseValue<bool>(_value));
935
937 else if (_key == "VisibleVScroll")
938 setVisibleVScroll(utility::parseValue<bool>(_value));
939
941 else if (_key == "VisibleHScroll")
942 setVisibleHScroll(utility::parseValue<bool>(_value));
943
944 else
945 {
946 Base::setPropertyOverride(_key, _value);
947 return;
948 }
949
950 eventChangeProperty(this, _key, _value);
951 }
952
953 void ItemBox::setViewOffset(const IntPoint& _value)
954 {
955 if (mAlignVert)
956 {
957 if (mContentSize.height <= 0)
958 return;
959
960 int offset = _value.top;
961
962 if (mContentSize.height <= _getClientWidget()->getHeight())
963 offset = 0;
964 else if (offset >= mContentSize.height - _getClientWidget()->getHeight())
965 offset = mContentSize.height - _getClientWidget()->getHeight();
966 else if (offset < 0)
967 offset = 0;
968
969 if (mContentPosition.top == offset)
970 return;
971
972 // сбрасываем старую подсветку
973 // так как при прокрутке, мышь может находиться над окном
974 resetCurrentActiveItem();
975
976 mContentPosition.top = offset;
977 }
978 else
979 {
980 if (mContentSize.width <= 0)
981 return;
982
983 int offset = _value.left;
984
985 if (mContentSize.width <= _getClientWidget()->getWidth())
986 offset = 0;
987 else if (offset >= mContentSize.width - _getClientWidget()->getWidth())
988 offset = mContentSize.width - _getClientWidget()->getWidth();
989 else if (offset < 0)
990 offset = 0;
991
992 if (mContentPosition.left == offset)
993 return;
994
995 // сбрасываем старую подсветку
996 // так как при прокрутке, мышь может находиться над окном
997 resetCurrentActiveItem();
998
999 mContentPosition.left = offset;
1000 }
1001
1002 setContentPosition(mContentPosition);
1003
1004 // заново ищем и подсвечиваем айтем
1005 if (!mNeedDrop)
1006 findCurrentActiveItem();
1007
1008 if (nullptr != mVScroll)
1009 mVScroll->setScrollPosition(mContentPosition.top);
1010 if (nullptr != mHScroll)
1011 mHScroll->setScrollPosition(mContentPosition.left);
1012 }
1013
1014 IntPoint ItemBox::getViewOffset() const
1015 {
1016 return getContentPosition();
1017 }
1018
1019 void ItemBox::onKeyButtonPressed(KeyCode _key, Char _char)
1020 {
1021 Base::onKeyButtonPressed(_key, _char);
1022
1023 eventNotifyItem(this, IBNotifyItemData(ITEM_NONE, IBNotifyItemData::KeyPressed, _key, _char));
1024 }
1025
1026 void ItemBox::onKeyButtonReleased(KeyCode _key)
1027 {
1028 Base::onKeyButtonReleased(_key);
1029
1030 eventNotifyItem(this, IBNotifyItemData(ITEM_NONE, IBNotifyItemData::KeyReleased, _key));
1031 }
1032
1033} // namespace MyGUI
MyGUI_Button.h
MYGUI_ASSERT
#define MYGUI_ASSERT(exp, dest)
Definition MyGUI_Diagnostic.h:31
MYGUI_DEBUG_ASSERT
#define MYGUI_DEBUG_ASSERT(exp, dest)
Definition MyGUI_Diagnostic.h:62
MYGUI_ASSERT_RANGE_INSERT
#define MYGUI_ASSERT_RANGE_INSERT(index, size, owner)
Definition MyGUI_Diagnostic.h:50
MYGUI_ASSERT_RANGE
#define MYGUI_ASSERT_RANGE(index, size, owner)
Definition MyGUI_Diagnostic.h:44
MYGUI_ASSERT_RANGE_AND_NONE
#define MYGUI_ASSERT_RANGE_AND_NONE(index, size, owner)
Definition MyGUI_Diagnostic.h:46
MyGUI_Gui.h
MyGUI_InputManager.h
MyGUI_ItemBox.h
MyGUI_Precompiled.h
MyGUI_ResourceSkin.h
MyGUI_ScrollBar.h
MyGUI_WidgetManager.h
MyGUI::Any
Definition MyGUI_Any.h:56
MyGUI::Any::Null
static const Any Null
Definition MyGUI_Any.h:58
MyGUI::DDContainer::mDropSenderIndex
size_t mDropSenderIndex
Definition MyGUI_DDContainer.h:131
MyGUI::DDContainer::mouseButtonPressed
void mouseButtonPressed(MouseButton _id)
Definition MyGUI_DDContainer.cpp:39
MyGUI::DDContainer::mStartDrop
bool mStartDrop
Definition MyGUI_DDContainer.h:125
MyGUI::DDContainer::mClickInWidget
IntPoint mClickInWidget
Definition MyGUI_DDContainer.h:137
MyGUI::DDContainer::mouseButtonReleased
void mouseButtonReleased(MouseButton _id)
Definition MyGUI_DDContainer.cpp:59
MyGUI::DDContainer::mNeedDrop
bool mNeedDrop
Definition MyGUI_DDContainer.h:124
MyGUI::DDContainer::mouseDrag
void mouseDrag(MouseButton _id)
Definition MyGUI_DDContainer.cpp:67
MyGUI::DDContainer::endDrop
void endDrop(bool _reset)
Definition MyGUI_DDContainer.cpp:184
MyGUI::Gui::createWidget
T * createWidget(std::string_view _skin, const IntCoord &_coord, Align _align, std::string_view _layer, std::string_view _name={})
Definition MyGUI_Gui.h:98
MyGUI::Gui::getInstance
static Gui & getInstance()
Definition MyGUI_Gui.cpp:34
MyGUI::ICroppedRectangle::getAbsolutePosition
const IntPoint & getAbsolutePosition() const
Definition MyGUI_ICroppedRectangle.h:62
MyGUI::ICroppedRectangle::getWidth
int getWidth() const
Definition MyGUI_ICroppedRectangle.h:113
MyGUI::ICroppedRectangle::getHeight
int getHeight() const
Definition MyGUI_ICroppedRectangle.h:118
MyGUI::ICroppedRectangle::getAbsoluteRect
IntRect getAbsoluteRect() const
Definition MyGUI_ICroppedRectangle.h:67
MyGUI::ICroppedRectangle::getSize
IntSize getSize() const
Definition MyGUI_ICroppedRectangle.h:51
MyGUI::InputManager::getLastPressedPosition
const IntPoint & getLastPressedPosition(MouseButton _id) const
Definition MyGUI_InputManager.cpp:648
MyGUI::InputManager::getMousePosition
const IntPoint & getMousePosition() const
Definition MyGUI_InputManager.cpp:657
MyGUI::InputManager::getInstance
static InputManager & getInstance()
MyGUI::InputManager::getMousePositionByLayer
IntPoint getMousePositionByLayer() const
Definition MyGUI_InputManager.cpp:606
MyGUI::ItemBox::onMouseButtonPressed
void onMouseButtonPressed(int _left, int _top, MouseButton _id) override
Definition MyGUI_ItemBox.cpp:534
MyGUI::ItemBox::onKeyButtonPressed
void onKeyButtonPressed(KeyCode _key, Char _char) override
Definition MyGUI_ItemBox.cpp:1019
MyGUI::ItemBox::clearItemDataAt
void clearItemDataAt(size_t _index)
Clear an item data at a specified position.
Definition MyGUI_ItemBox.cpp:893
MyGUI::ItemBox::notifyMouseDrag
void notifyMouseDrag(Widget *_sender, int _left, int _top, MouseButton _id)
Definition MyGUI_ItemBox.cpp:599
MyGUI::ItemBox::setVisibleHScroll
void setVisibleHScroll(bool _value)
Definition MyGUI_ItemBox.cpp:914
MyGUI::ItemBox::getIndexByWidget
size_t getIndexByWidget(Widget *_widget) const
Definition MyGUI_ItemBox.cpp:476
MyGUI::ItemBox::notifyMouseButtonReleased
void notifyMouseButtonReleased(Widget *_sender, int _left, int _top, MouseButton _id)
Definition MyGUI_ItemBox.cpp:642
MyGUI::ItemBox::getItemCount
size_t getItemCount() const
Get number of items.
Definition MyGUI_ItemBox.cpp:873
MyGUI::ItemBox::requestDrawItem
EventHandle_ItemBoxPtrWidgetPtrCIBCellDrawInfoRef requestDrawItem
Definition MyGUI_ItemBox.h:164
MyGUI::ItemBox::getViewOffset
IntPoint getViewOffset() const
Definition MyGUI_ItemBox.cpp:1014
MyGUI::ItemBox::notifyMouseWheel
void notifyMouseWheel(Widget *_sender, int _rel)
Definition MyGUI_ItemBox.cpp:733
MyGUI::ItemBox::updateFromResize
void updateFromResize()
Definition MyGUI_ItemBox.cpp:106
MyGUI::ItemBox::shutdownOverride
void shutdownOverride() override
Definition MyGUI_ItemBox.cpp:68
MyGUI::ItemBox::setVisibleVScroll
void setVisibleVScroll(bool _value)
Definition MyGUI_ItemBox.cpp:908
MyGUI::ItemBox::removeItemAt
void removeItemAt(size_t _index, bool update=true)
Remove item at a specified position.
Definition MyGUI_ItemBox.cpp:355
MyGUI::ItemBox::notifyMouseButtonDoubleClick
void notifyMouseButtonDoubleClick(Widget *_sender)
Definition MyGUI_ItemBox.cpp:449
MyGUI::ItemBox::getVerticalAlignment
bool getVerticalAlignment() const
Definition MyGUI_ItemBox.cpp:898
MyGUI::ItemBox::isVisibleHScroll
bool isVisibleHScroll() const
Definition MyGUI_ItemBox.cpp:925
MyGUI::ItemBox::onKeySetFocus
void onKeySetFocus(Widget *_old) override
Definition MyGUI_ItemBox.cpp:214
MyGUI::ItemBox::redrawItemAt
void redrawItemAt(size_t _index)
Redraw at a specified position.
Definition MyGUI_ItemBox.cpp:405
MyGUI::ItemBox::setCoord
void setCoord(const IntCoord &_coord) override
Definition MyGUI_ItemBox.cpp:87
MyGUI::ItemBox::onMouseWheel
void onMouseWheel(int _rel) override
Definition MyGUI_ItemBox.cpp:207
MyGUI::ItemBox::onKeyButtonReleased
void onKeyButtonReleased(KeyCode _key) override
Definition MyGUI_ItemBox.cpp:1026
MyGUI::ItemBox::getWidgetDrag
Widget * getWidgetDrag() const
Definition MyGUI_ItemBox.cpp:903
MyGUI::ItemBox::notifyScrollChangePosition
void notifyScrollChangePosition(ScrollBar *_sender, size_t _index)
Definition MyGUI_ItemBox.cpp:719
MyGUI::ItemBox::setViewOffset
void setViewOffset(const IntPoint &_value)
Definition MyGUI_ItemBox.cpp:953
MyGUI::ItemBox::getItemWidget
Widget * getItemWidget(size_t _index)
Definition MyGUI_ItemBox.cpp:171
MyGUI::ItemBox::ItemBox
ItemBox()
Definition MyGUI_ItemBox.cpp:19
MyGUI::ItemBox::setIndexSelected
void setIndexSelected(size_t _index)
Select specified _index.
Definition MyGUI_ItemBox.cpp:417
MyGUI::ItemBox::setVerticalAlignment
void setVerticalAlignment(bool _vert)
Definition MyGUI_ItemBox.cpp:456
MyGUI::ItemBox::redrawAllItems
void redrawAllItems()
Redraw all items.
Definition MyGUI_ItemBox.cpp:823
MyGUI::ItemBox::initialiseOverride
void initialiseOverride() override
Definition MyGUI_ItemBox.cpp:24
MyGUI::ItemBox::resetCurrentActiveItem
void resetCurrentActiveItem()
Definition MyGUI_ItemBox.cpp:228
MyGUI::ItemBox::onMouseDrag
void onMouseDrag(int _left, int _top, MouseButton _id) override
Definition MyGUI_ItemBox.cpp:544
MyGUI::ItemBox::onKeyLostFocus
void onKeyLostFocus(Widget *_new) override
Definition MyGUI_ItemBox.cpp:221
MyGUI::ItemBox::insertItemAt
void insertItemAt(size_t _index, Any _data=Any::Null, bool update=true)
Insert an item into a array at a specified position.
Definition MyGUI_ItemBox.cpp:324
MyGUI::ItemBox::_getContainerIndex
size_t _getContainerIndex(const IntPoint &_point) const override
Definition MyGUI_ItemBox.cpp:489
MyGUI::ItemBox::getViewSize
IntSize getViewSize() const override
Definition MyGUI_ItemBox.cpp:848
MyGUI::ItemBox::notifyMouseButtonPressed
void notifyMouseButtonPressed(Widget *_sender, int _left, int _top, MouseButton _id)
Definition MyGUI_ItemBox.cpp:604
MyGUI::ItemBox::setPropertyOverride
void setPropertyOverride(std::string_view _key, std::string_view _value) override
Definition MyGUI_ItemBox.cpp:930
MyGUI::ItemBox::eventMouseItemActivate
EventHandle_ItemBoxPtrSizeT eventMouseItemActivate
Definition MyGUI_ItemBox.h:185
MyGUI::ItemBox::updateMetrics
void updateMetrics()
Definition MyGUI_ItemBox.cpp:686
MyGUI::ItemBox::requestCreateWidgetItem
EventHandle_ItemBoxPtrWidgetPtr requestCreateWidgetItem
Definition MyGUI_ItemBox.h:148
MyGUI::ItemBox::resetDrag
void resetDrag()
Definition MyGUI_ItemBox.cpp:828
MyGUI::ItemBox::eventSelectItemAccept
EventHandle_ItemBoxPtrSizeT eventSelectItemAccept
Definition MyGUI_ItemBox.h:171
MyGUI::ItemBox::notifyKeyButtonReleased
void notifyKeyButtonReleased(Widget *_sender, KeyCode _key)
Definition MyGUI_ItemBox.cpp:471
MyGUI::ItemBox::setItemDataAt
void setItemDataAt(size_t _index, Any _data)
Replace an item data at a specified position.
Definition MyGUI_ItemBox.cpp:309
MyGUI::ItemBox::getWidgetByIndex
Widget * getWidgetByIndex(size_t _index)
Definition MyGUI_ItemBox.cpp:519
MyGUI::ItemBox::updateDropItems
void updateDropItems() override
Definition MyGUI_ItemBox.cpp:555
MyGUI::ItemBox::_getItemIndex
size_t _getItemIndex(Widget *_item) const override
Definition MyGUI_ItemBox.cpp:282
MyGUI::ItemBox::_updateAllVisible
void _updateAllVisible(bool _redraw)
Definition MyGUI_ItemBox.cpp:117
MyGUI::ItemBox::updateDropItemsState
void updateDropItemsState(const DDWidgetState &_state) override
Definition MyGUI_ItemBox.cpp:583
MyGUI::ItemBox::getIndexSelected
size_t getIndexSelected() const
Get index of selected item (ITEM_NONE if none selected)
Definition MyGUI_ItemBox.cpp:883
MyGUI::ItemBox::_resetContainer
void _resetContainer(bool _update) override
Definition MyGUI_ItemBox.cpp:504
MyGUI::ItemBox::notifyRootMouseChangeFocus
void notifyRootMouseChangeFocus(Widget *_sender, bool _focus)
Definition MyGUI_ItemBox.cpp:653
MyGUI::ItemBox::findCurrentActiveItem
void findCurrentActiveItem()
Definition MyGUI_ItemBox.cpp:247
MyGUI::ItemBox::setSize
void setSize(const IntSize &_size) override
Definition MyGUI_ItemBox.cpp:81
MyGUI::ItemBox::onMouseButtonReleased
void onMouseButtonReleased(int _left, int _top, MouseButton _id) override
Definition MyGUI_ItemBox.cpp:539
MyGUI::ItemBox::removeAllItems
void removeAllItems()
Remove all items.
Definition MyGUI_ItemBox.cpp:388
MyGUI::ItemBox::notifyKeyButtonPressed
void notifyKeyButtonPressed(Widget *_sender, KeyCode _key, Char _char)
Definition MyGUI_ItemBox.cpp:466
MyGUI::ItemBox::removeDropItems
void removeDropItems() override
Definition MyGUI_ItemBox.cpp:549
MyGUI::ItemBox::_setContainerItemInfo
void _setContainerItemInfo(size_t _index, bool _set, bool _accept) override
Definition MyGUI_ItemBox.cpp:292
MyGUI::ItemBox::setPosition
void setPosition(const IntPoint &_point) override
Definition MyGUI_ItemBox.cpp:76
MyGUI::ItemBox::isVisibleVScroll
bool isVisibleVScroll() const
Definition MyGUI_ItemBox.cpp:920
MyGUI::ItemBox::clearIndexSelected
void clearIndexSelected()
Clear item selection.
Definition MyGUI_ItemBox.cpp:888
MyGUI::ItemBox::addItem
void addItem(Any _data=Any::Null, bool update=true)
Add an item to the end of a array.
Definition MyGUI_ItemBox.cpp:878
MyGUI::ItemBox::requestCoordItem
EventHandle_ItemBoxPtrIntCoordRefBool requestCoordItem
Definition MyGUI_ItemBox.h:156
MyGUI::ItemBox::eventNotifyItem
EventHandle_ItemBoxPtrCIBNotifyCellDataRef eventNotifyItem
Definition MyGUI_ItemBox.h:192
MyGUI::ItemBox::eventChangeItemPosition
EventHandle_ItemBoxPtrSizeT eventChangeItemPosition
Definition MyGUI_ItemBox.h:178
MyGUI::ScrollBar
widget description should be here.
Definition MyGUI_ScrollBar.h:24
MyGUI::ScrollViewBase::mHScroll
ScrollBar * mHScroll
Definition MyGUI_ScrollViewBase.h:44
MyGUI::ScrollViewBase::getHScrollPage
virtual size_t getHScrollPage() const
Definition MyGUI_ScrollViewBase.cpp:334
MyGUI::ScrollViewBase::updateScrollPosition
void updateScrollPosition()
Definition MyGUI_ScrollViewBase.cpp:234
MyGUI::ScrollViewBase::mScrollViewClient
Widget * mScrollViewClient
Definition MyGUI_ScrollViewBase.h:45
MyGUI::ScrollViewBase::mVisibleVScroll
bool mVisibleVScroll
Definition MyGUI_ScrollViewBase.h:48
MyGUI::ScrollViewBase::getContentPosition
virtual IntPoint getContentPosition() const
Definition MyGUI_ScrollViewBase.cpp:320
MyGUI::ScrollViewBase::mChangeContentByResize
bool mChangeContentByResize
Definition MyGUI_ScrollViewBase.h:54
MyGUI::ScrollViewBase::mVisibleHScroll
bool mVisibleHScroll
Definition MyGUI_ScrollViewBase.h:47
MyGUI::ScrollViewBase::getContentAlign
virtual Align getContentAlign() const
Definition MyGUI_ScrollViewBase.cpp:344
MyGUI::ScrollViewBase::getContentSize
virtual IntSize getContentSize() const
Definition MyGUI_ScrollViewBase.cpp:315
MyGUI::ScrollViewBase::updateScrollSize
void updateScrollSize()
Definition MyGUI_ScrollViewBase.cpp:14
MyGUI::ScrollViewBase::mVScroll
ScrollBar * mVScroll
Definition MyGUI_ScrollViewBase.h:43
MyGUI::ScrollViewBase::eraseContent
virtual void eraseContent()
Definition MyGUI_ScrollViewBase.cpp:349
MyGUI::ScrollViewBase::getVScrollPage
virtual size_t getVScrollPage() const
Definition MyGUI_ScrollViewBase.cpp:339
MyGUI::UserData::isUserString
bool isUserString(std::string_view _key) const
Definition MyGUI_WidgetUserData.cpp:44
MyGUI::UserData::getUserString
std::string_view getUserString(std::string_view _key) const
Definition MyGUI_WidgetUserData.cpp:20
MyGUI::UserData::_setInternalData
void _setInternalData(Any _data)
Definition MyGUI_WidgetUserData.cpp:59
MyGUI::UserData::_getInternalData
ValueType * _getInternalData(bool _throw=true) const
Definition MyGUI_WidgetUserData.h:54
MyGUI::Widget
widget description should be here.
Definition MyGUI_Widget.h:40
MyGUI::Widget::getParent
Widget * getParent() const
Definition MyGUI_Widget.cpp:1352
MyGUI::Widget::setSize
void setSize(const IntSize &_size) override
Definition MyGUI_Widget.cpp:693
MyGUI::Widget::eventChangeProperty
EventHandle_WidgetStringString eventChangeProperty
Definition MyGUI_Widget.h:324
MyGUI::Widget::setVisible
virtual void setVisible(bool _value)
Definition MyGUI_Widget.cpp:1022
MyGUI::Widget::setPosition
void setPosition(const IntPoint &_point) override
Definition MyGUI_Widget.cpp:676
MyGUI::Widget::getClientWidget
Widget * getClientWidget()
Definition MyGUI_Widget.cpp:1367
MyGUI::Widget::assignWidget
void assignWidget(T *&_widget, std::string_view _name)
Definition MyGUI_Widget.h:413
MyGUI::Widget::createWidget
T * createWidget(std::string_view _skin, const IntCoord &_coord, Align _align, std::string_view _name={})
Definition MyGUI_Widget.h:94
MyGUI::Widget::_setContainer
void _setContainer(Widget *_value)
Definition MyGUI_Widget.cpp:1387
MyGUI::Widget::_getClientWidget
Widget * _getClientWidget()
If there is client widget return it, otherwise return this.
Definition MyGUI_Widget.cpp:1196
MyGUI::WidgetInput::eventMouseButtonDoubleClick
EventHandle_WidgetVoid eventMouseButtonDoubleClick
Definition MyGUI_WidgetInput.h:174
MyGUI::WidgetInput::eventMouseButtonReleased
EventHandle_WidgetIntIntButton eventMouseButtonReleased
Definition MyGUI_WidgetInput.h:162
MyGUI::WidgetInput::setNeedKeyFocus
void setNeedKeyFocus(bool _value)
Definition MyGUI_WidgetInput.cpp:142
MyGUI::WidgetInput::eventMouseButtonPressed
EventHandle_WidgetIntIntButton eventMouseButtonPressed
Definition MyGUI_WidgetInput.h:153
MyGUI::WidgetInput::eventKeyButtonPressed
EventHandle_WidgetKeyCodeChar eventKeyButtonPressed
Definition MyGUI_WidgetInput.h:196
MyGUI::WidgetInput::eventRootMouseChangeFocus
EventHandle_WidgetBool eventRootMouseChangeFocus
Definition MyGUI_WidgetInput.h:211
MyGUI::WidgetInput::eventMouseDrag
EventPairAddParameter< EventHandle_WidgetIntInt, EventHandle_WidgetIntIntButton > eventMouseDrag
Definition MyGUI_WidgetInput.h:129
MyGUI::WidgetInput::eventMouseWheel
EventHandle_WidgetInt eventMouseWheel
Definition MyGUI_WidgetInput.h:144
MyGUI::WidgetInput::eventKeyButtonReleased
EventHandle_WidgetKeyCode eventKeyButtonReleased
Definition MyGUI_WidgetInput.h:203
MyGUI::WidgetManager
Definition MyGUI_WidgetManager.h:21
MyGUI::WidgetManager::getInstance
static WidgetManager & getInstance()
MyGUI::WidgetManager::unlinkFromUnlinkers
void unlinkFromUnlinkers(Widget *_widget)
Definition MyGUI_WidgetManager.cpp:152
MyGUI::utility::parseValue
T parseValue(std::string_view _value)
Definition MyGUI_StringUtility.h:60
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::IntRect
types::TRect< int > IntRect
Definition MyGUI_Types.h:33
MyGUI::IntPoint
types::TPoint< int > IntPoint
Definition MyGUI_Types.h:27
MyGUI::Char
unsigned int Char
Definition MyGUI_Types.h:50
MyGUI::ITEM_NONE
constexpr size_t ITEM_NONE
Definition MyGUI_Macros.h:19
MyGUI::IntCoord
types::TCoord< int > IntCoord
Definition MyGUI_Types.h:36
MyGUI::IntSize
types::TSize< int > IntSize
Definition MyGUI_Types.h:30
MyGUI::newDelegate
delegates::DelegateFunction< Args... > * newDelegate(void(*_func)(Args... args))
Definition MyGUI_Delegate.h:100
MyGUI::Align
Definition MyGUI_Align.h:20
MyGUI::Align::Default
@ Default
Definition MyGUI_Align.h:36
MyGUI::DDWidgetState
Definition MyGUI_DDItemInfo.h:100
MyGUI::DDWidgetState::update
bool update
Definition MyGUI_DDItemInfo.h:109
MyGUI::DDWidgetState::accept
bool accept
Definition MyGUI_DDItemInfo.h:111
MyGUI::DDWidgetState::refuse
bool refuse
Definition MyGUI_DDItemInfo.h:113
MyGUI::IBDrawItemInfo
Definition MyGUI_IBItemInfo.h:21
MyGUI::IBDrawItemInfo::index
size_t index
Definition MyGUI_IBItemInfo.h:52
MyGUI::IBDrawItemInfo::drop_refuse
bool drop_refuse
Definition MyGUI_IBItemInfo.h:64
MyGUI::IBDrawItemInfo::select
bool select
Definition MyGUI_IBItemInfo.h:56
MyGUI::IBDrawItemInfo::update
bool update
Definition MyGUI_IBItemInfo.h:54
MyGUI::IBDrawItemInfo::drag
bool drag
Definition MyGUI_IBItemInfo.h:60
MyGUI::IBDrawItemInfo::drop_accept
bool drop_accept
Definition MyGUI_IBItemInfo.h:62
MyGUI::IBDrawItemInfo::active
bool active
Definition MyGUI_IBItemInfo.h:58
MyGUI::IBNotifyItemData
Definition MyGUI_IBItemInfo.h:68
MyGUI::IBNotifyItemData::KeyReleased
@ KeyReleased
Definition MyGUI_IBItemInfo.h:74
MyGUI::IBNotifyItemData::KeyPressed
@ KeyPressed
Definition MyGUI_IBItemInfo.h:73
MyGUI::IBNotifyItemData::MousePressed
@ MousePressed
Definition MyGUI_IBItemInfo.h:71
MyGUI::IBNotifyItemData::MouseReleased
@ MouseReleased
Definition MyGUI_IBItemInfo.h:72
MyGUI::ItemBox::ItemDataInfo
Definition MyGUI_ItemBox.h:202
MyGUI::KeyCode
Definition MyGUI_KeyCode.h:16
MyGUI::MouseButton
Definition MyGUI_MouseButton.h:16
MyGUI::MouseButton::Left
@ Left
Definition MyGUI_MouseButton.h:21
MyGUI::types::TCoord::height
T height
Definition MyGUI_TCoord.h:23
MyGUI::types::TCoord::width
T width
Definition MyGUI_TCoord.h:22
MyGUI::types::TCoord::point
TPoint< T > point() const
Definition MyGUI_TCoord.h:160
MyGUI::types::TPoint::left
T left
Definition MyGUI_TPoint.h:19
MyGUI::types::TPoint::top
T top
Definition MyGUI_TPoint.h:20
MyGUI::types::TRect::right
T right
Definition MyGUI_TRect.h:21
MyGUI::types::TRect::left
T left
Definition MyGUI_TRect.h:19
MyGUI::types::TRect::bottom
T bottom
Definition MyGUI_TRect.h:22
MyGUI::types::TRect::top
T top
Definition MyGUI_TRect.h:20
MyGUI::types::TSize::width
T width
Definition MyGUI_TSize.h:19
MyGUI::types::TSize::height
T height
Definition MyGUI_TSize.h:20