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

Method initScrollWidgets

src/OpenLoco/src/Ui/Window.cpp:482–516  ·  view source on GitHub ↗

0x004CA17F

Source from the content-addressed store, hash-verified

480
481 // 0x004CA17F
482 void Window::initScrollWidgets()
483 {
484 uint32_t s = 0;
485 WidgetIndex_t widx = -1;
486 for (auto& widget : widgets)
487 {
488 widx++;
489
490 if (widget.type != WidgetType::scrollview)
491 {
492 continue;
493 }
494
495 this->scrollAreas[s].flags = ScrollFlags::none;
496
497 int32_t scrollWidth = 0, scrollHeight = 0;
498 this->callGetScrollSize(s, scrollWidth, scrollHeight);
499 this->scrollAreas[s].contentOffsetX = 0;
500 this->scrollAreas[s].contentWidth = scrollWidth + 1;
501 this->scrollAreas[s].contentOffsetY = 0;
502 this->scrollAreas[s].contentHeight = scrollHeight + 1;
503
504 if (widget.content & Scrollbars::horizontal)
505 {
506 this->scrollAreas[s].flags |= Ui::ScrollFlags::hscrollbarVisible;
507 }
508 if (widget.content & Scrollbars::vertical)
509 {
510 this->scrollAreas[s].flags |= Ui::ScrollFlags::vscrollbarVisible;
511 }
512
513 Ui::ScrollView::updateThumbs(*this, widx);
514 s++;
515 }
516 }
517
518 int8_t Window::getScrollDataIndex(WidgetIndex_t targetIndex)
519 {

Callers 15

openFunction · 0.80
openFunction · 0.80
openFunction · 0.80
openFunction · 0.80
onMouseDownFunction · 0.80
openFunction · 0.80
openFunction · 0.80
switchTabFunction · 0.80
openFunction · 0.80
switchTabWidgetsFunction · 0.80
switchTabFunction · 0.80
openFunction · 0.80

Calls 2

callGetScrollSizeMethod · 0.95
updateThumbsFunction · 0.85

Tested by 1

openFunction · 0.64