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

Function stateNormalHover

src/OpenLoco/src/Input/MouseInput.cpp:1136–1244  ·  view source on GitHub ↗

0x004C8098

Source from the content-addressed store, hash-verified

1134
1135 // 0x004C8098
1136 static void stateNormalHover(int32_t x, int32_t y, Ui::Window* window, Ui::Widget* widget, Ui::WidgetIndex_t widgetIndex)
1137 {
1138 Ui::WindowType windowType = Ui::WindowType::undefined;
1139 Ui::WindowNumber_t windowNumber = 0;
1140
1141 if (window != nullptr)
1142 {
1143 windowType = window->type;
1144 windowNumber = window->number;
1145 }
1146
1147 if (windowType != _hoverWindowType || windowNumber != _hoverWindowNumber || widgetIndex != _hoverWidgetIdx)
1148 {
1149 widgetOverFlatbuttonInvalidate();
1150 _hoverWindowType = windowType;
1151 _hoverWindowNumber = windowNumber;
1152 _hoverWidgetIdx = widgetIndex;
1153 widgetOverFlatbuttonInvalidate();
1154 }
1155
1156 if (window != nullptr && widgetIndex != kWidgetIndexNull)
1157 {
1158 if (!window->isDisabled(widgetIndex))
1159 {
1160 window->callOnMouseHover(widgetIndex, window->widgets[widgetIndex].id);
1161 }
1162 }
1163
1164 StringId tooltipStringId = StringIds::null;
1165 if (window != nullptr && widgetIndex != kWidgetIndexNull)
1166 {
1167 if (widget->type == Ui::WidgetType::scrollview)
1168 {
1169 auto res = Ui::ScrollView::getPart(*window, widget, x, y);
1170
1171 if (res.area == Ui::ScrollPart::none)
1172 {
1173 }
1174 else if (res.area == Ui::ScrollPart::view)
1175 {
1176 window->callScrollMouseOver(res.scrollviewLoc.x, res.scrollviewLoc.y, static_cast<uint8_t>(res.index));
1177 }
1178 else
1179 {
1180 tooltipStringId = kScrollWidgetTooltips.at(res.area);
1181 if (Ui::ToolTip::getWindowType() != Ui::WindowType::undefined)
1182 {
1183 if (tooltipStringId != Ui::ToolTip::getCurrentStringId())
1184 {
1185 Ui::Windows::ToolTip::closeAndReset();
1186 }
1187 }
1188 }
1189 }
1190 }
1191
1192 if (Ui::ToolTip::getWindowType() != Ui::WindowType::undefined)
1193 {

Callers 1

stateNormalFunction · 0.85

Calls 15

getPartFunction · 0.85
getWindowTypeFunction · 0.85
getCurrentStringIdFunction · 0.85
closeAndResetFunction · 0.85
getWindowNumberFunction · 0.85
getWidgetIndexFunction · 0.85
getTimeSinceLastTickFunction · 0.85
setTooltipTimeoutFunction · 0.85
getNotShownTicksFunction · 0.85
getTooltipMouseLocationFunction · 0.85
setTooltipMouseLocationFunction · 0.85

Tested by

no test coverage detected