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

Function open

src/OpenLoco/src/Ui/Windows/DebugWindow.cpp:89–133  ·  view source on GitHub ↗

0x0043B26C

Source from the content-addressed store, hash-verified

87
88 // 0x0043B26C
89 Window* open()
90 {
91 if (auto* wnd = WindowManager::bringToFront(WindowType::debug); wnd != nullptr)
92 {
93 return wnd;
94 }
95
96 auto window = WindowManager::createWindowCentred(
97 WindowType::debug,
98 kWindowSize,
99 WindowFlags::none,
100 getEvents());
101
102 window->setWidgets(_widgets);
103 // window->disabledWidgets = 1U << widx::tab_3;
104 window->initScrollWidgets();
105
106 auto getWidgetById = [&](Window& window, const WidgetId id) -> Widget& {
107 for (auto& widget : window.widgets)
108 {
109 if (widget.id == id)
110 {
111 return widget;
112 }
113 }
114 throw std::runtime_error("Widget not found");
115 };
116
117 auto& chkbox2 = getWidgetById(*window, widx::checkbox_2);
118 chkbox2.activated = true;
119
120 auto& chkbox3 = getWidgetById(*window, widx::checkbox_3);
121 chkbox3.activated = false;
122 chkbox3.disabled = true;
123
124 auto& chkbox4 = getWidgetById(*window, widx::checkbox_4);
125 chkbox4.activated = true;
126 chkbox4.disabled = true;
127
128 const auto interface = ObjectManager::get<InterfaceSkinObject>();
129 window->setColour(WindowColour::primary, interface->windowTitlebarColour);
130 window->setColour(WindowColour::secondary, interface->windowOptionsColour);
131
132 return window;
133 }
134
135 // 0x0043B4AF
136 static void onMouseUp(Ui::Window& window, const WidgetIndex_t widgetIndex, [[maybe_unused]] const WidgetId id)

Callers

nothing calls this directly

Calls 5

bringToFrontFunction · 0.85
createWindowCentredFunction · 0.85
setWidgetsMethod · 0.80
initScrollWidgetsMethod · 0.80
setColourMethod · 0.45

Tested by

no test coverage detected