MyGUI 3.2.0

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

- File List
- Globals

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