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

Function open

src/OpenLoco/src/Ui/Windows/IndustryList.cpp:561–617  ·  view source on GitHub ↗

0x004577FF

Source from the content-addressed store, hash-verified

559
560 // 0x004577FF
561 Window* open()
562 {
563 auto window = WindowManager::bringToFront(WindowType::industryList, 0);
564 if (window != nullptr)
565 {
566 window->callOnMouseUp(Common::widx::tab_industry_list, window->widgets[Common::widx::tab_industry_list].id);
567 }
568 else
569 {
570 // 0x00457878
571 auto origin = Ui::Point(Ui::width() - IndustryList::kWindowSize.width, 30);
572
573 window = WindowManager::createWindow(
574 WindowType::industryList,
575 origin,
576 IndustryList::kWindowSize,
577 WindowFlags::viewportNoShiftPixels,
578 IndustryList::getEvents());
579
580 window->number = 0;
581 window->currentTab = 0;
582 window->frameNo = 0;
583 window->sortMode = 0;
584 window->rowCount = 0;
585 window->rowHover = -1;
586
587 Common::populateIndustryList(*window);
588
589 WindowManager::moveOtherWindowsDown(*window);
590
591 window->minWidth = IndustryList::kMinDimensions.width;
592 window->minHeight = IndustryList::kMinDimensions.height;
593 window->maxWidth = IndustryList::kMaxDimensions.width;
594 window->maxHeight = IndustryList::kMaxDimensions.height;
595 window->flags |= WindowFlags::resizable;
596
597 auto skin = ObjectManager::get<InterfaceSkinObject>();
598 window->setColour(WindowColour::primary, skin->windowTitlebarColour);
599 window->setColour(WindowColour::secondary, skin->windowColour);
600
601 // 0x00457878 end
602
603 window->width = IndustryList::kWindowSize.width;
604 window->height = IndustryList::kWindowSize.height;
605
606 window->invalidate();
607
608 window->setWidgets(IndustryList::widgets);
609 window->activatedWidgets = 0;
610 window->holdableWidgets = 0;
611
612 window->callOnResize();
613 window->callPrepareDraw();
614 window->initScrollWidgets();
615 }
616 return window;
617 }
618

Callers 1

onScrollMouseDownFunction · 0.70

Calls 12

bringToFrontFunction · 0.85
widthFunction · 0.85
populateIndustryListFunction · 0.85
moveOtherWindowsDownFunction · 0.85
callOnMouseUpMethod · 0.80
setWidgetsMethod · 0.80
callOnResizeMethod · 0.80
callPrepareDrawMethod · 0.80
initScrollWidgetsMethod · 0.80
createWindowFunction · 0.50
setColourMethod · 0.45
invalidateMethod · 0.45

Tested by

no test coverage detected