| 259 | } |
| 260 | |
| 261 | void ListBox::updateScroll() |
| 262 | { |
| 263 | mRangeIndex = (mHeightLine * (int)mItemsInfo.size()) - _getClientWidget()->getHeight(); |
| 264 | |
| 265 | if (mWidgetScroll == nullptr) |
| 266 | return; |
| 267 | |
| 268 | if ((!mNeedVisibleScroll) || (mRangeIndex < 1) || (mWidgetScroll->getLeft() <= _getClientWidget()->getLeft())) |
| 269 | { |
| 270 | if (mWidgetScroll->getVisible()) |
| 271 | { |
| 272 | mWidgetScroll->setVisible(false); |
| 273 | // увеличиваем клиентскую зону на ширину скрола |
| 274 | if (getClientWidget() != nullptr) |
| 275 | getClientWidget()->setSize( |
| 276 | getClientWidget()->getWidth() + mWidgetScroll->getWidth(), |
| 277 | getClientWidget()->getHeight()); |
| 278 | } |
| 279 | } |
| 280 | else if (!mWidgetScroll->getVisible()) |
| 281 | { |
| 282 | if (getClientWidget() != nullptr) |
| 283 | getClientWidget()->setSize( |
| 284 | getClientWidget()->getWidth() - mWidgetScroll->getWidth(), |
| 285 | getClientWidget()->getHeight()); |
| 286 | mWidgetScroll->setVisible(true); |
| 287 | } |
| 288 | |
| 289 | mWidgetScroll->setScrollRange(mRangeIndex + 1); |
| 290 | mWidgetScroll->setScrollViewPage(_getClientWidget()->getHeight()); |
| 291 | if (!mItemsInfo.empty()) |
| 292 | mWidgetScroll->setTrackSize( |
| 293 | mWidgetScroll->getLineSize() * _getClientWidget()->getHeight() / mHeightLine / (int)mItemsInfo.size()); |
| 294 | } |
| 295 | |
| 296 | void ListBox::updateLine(bool _reset) |
| 297 | { |
nothing calls this directly
no test coverage detected