| 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 | { |
nothing calls this directly
no test coverage detected