* * rct2: 0x006E95F9 */
| 1032 | * rct2: 0x006E95F9 |
| 1033 | */ |
| 1034 | static void InputWidgetLeft(const ScreenCoordsXY& screenCoords, WindowBase* w, WidgetIndex widgetIndex) |
| 1035 | { |
| 1036 | WindowClass windowClass = WindowClass::null; |
| 1037 | WindowNumber windowNumber = 0; |
| 1038 | |
| 1039 | if (w != nullptr) |
| 1040 | { |
| 1041 | windowClass = w->classification; |
| 1042 | windowNumber = w->number; |
| 1043 | } |
| 1044 | |
| 1045 | auto* windowMgr = GetWindowManager(); |
| 1046 | windowMgr->CloseByClass(WindowClass::error); |
| 1047 | windowMgr->CloseByClass(WindowClass::tooltip); |
| 1048 | |
| 1049 | // Window might have changed position in the list, therefore find it again |
| 1050 | w = windowMgr->FindByNumber(windowClass, windowNumber); |
| 1051 | if (w == nullptr) |
| 1052 | return; |
| 1053 | |
| 1054 | w = windowMgr->BringToFront(*w); |
| 1055 | if (widgetIndex == kWidgetIndexNull) |
| 1056 | return; |
| 1057 | |
| 1058 | if (windowClass != GetCurrentTextBox().window.classification || windowNumber != GetCurrentTextBox().window.number |
| 1059 | || widgetIndex != GetCurrentTextBox().widgetIndex) |
| 1060 | { |
| 1061 | WindowCancelTextbox(); |
| 1062 | } |
| 1063 | |
| 1064 | const auto& widget = w->widgets[widgetIndex]; |
| 1065 | |
| 1066 | switch (widget.type) |
| 1067 | { |
| 1068 | case WidgetType::frame: |
| 1069 | case WidgetType::resize: |
| 1070 | if (w->canBeResized() |
| 1071 | && (screenCoords.x >= w->windowPos.x + w->width - 19 && screenCoords.y >= w->windowPos.y + w->height - 19)) |
| 1072 | InputWindowResizeBegin(*w, widgetIndex, screenCoords); |
| 1073 | break; |
| 1074 | case WidgetType::viewport: |
| 1075 | _inputState = InputState::viewportLeft; |
| 1076 | gInputDragLast = screenCoords; |
| 1077 | _dragWidget.windowClassification = windowClass; |
| 1078 | _dragWidget.windowNumber = windowNumber; |
| 1079 | if (gInputFlags.has(InputFlag::toolActive)) |
| 1080 | { |
| 1081 | w = windowMgr->FindByNumber(gCurrentToolWidget.windowClassification, gCurrentToolWidget.windowNumber); |
| 1082 | if (w != nullptr) |
| 1083 | { |
| 1084 | gInputFlags.set(InputFlag::leftMousePressed); |
| 1085 | w->onToolDown(gCurrentToolWidget.widgetIndex, screenCoords); |
| 1086 | } |
| 1087 | } |
| 1088 | break; |
| 1089 | case WidgetType::caption: |
| 1090 | InputWindowPositionBegin(*w, widgetIndex, screenCoords); |
| 1091 | break; |
no test coverage detected