MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / updateScrollWidgets

Method updateScrollWidgets

src/OpenLoco/src/Ui/Window.cpp:436–479  ·  view source on GitHub ↗

0x004CA115

Source from the content-addressed store, hash-verified

434
435 // 0x004CA115
436 void Window::updateScrollWidgets()
437 {
438 uint32_t s = 0;
439 WidgetIndex_t widx = -1;
440 for (auto& widget : widgets)
441 {
442 widx++;
443 if (widget.type != WidgetType::scrollview)
444 {
445 continue;
446 }
447
448 int32_t scrollWidth = 0, scrollHeight = 0;
449 this->callGetScrollSize(s, scrollWidth, scrollHeight);
450
451 bool invalidate = false;
452
453 if (widget.content & Scrollbars::horizontal)
454 {
455 if (this->scrollAreas[s].contentWidth != scrollWidth + 1)
456 {
457 this->scrollAreas[s].contentWidth = scrollWidth + 1;
458 invalidate = true;
459 }
460 }
461
462 if (widget.content & Scrollbars::vertical)
463 {
464 if (this->scrollAreas[s].contentHeight != scrollHeight + 1)
465 {
466 this->scrollAreas[s].contentHeight = scrollHeight + 1;
467 invalidate = true;
468 }
469 }
470
471 if (invalidate)
472 {
473 Ui::ScrollView::updateThumbs(*this, widx);
474 this->invalidate();
475 }
476
477 s++;
478 }
479 }
480
481 // 0x004CA17F
482 void Window::initScrollWidgets()

Callers 3

scrollToLatestDataFunction · 0.80
stateResizingFunction · 0.80

Calls 3

callGetScrollSizeMethod · 0.95
invalidateMethod · 0.95
updateThumbsFunction · 0.85

Tested by

no test coverage detected