From 4ccecd6e680727b46dc8001c778707a49960b831 Mon Sep 17 00:00:00 2001 From: mrmbernardi Date: Sun, 3 Mar 2024 18:04:09 +0100 Subject: [PATCH] Remove forwarding functions in Window.cpp (#21516) --- src/openrct2-ui/input/MouseInput.cpp | 32 +-- src/openrct2-ui/input/Shortcuts.cpp | 32 +-- src/openrct2-ui/interface/Widget.cpp | 2 +- src/openrct2-ui/interface/Window.cpp | 14 +- src/openrct2-ui/scripting/CustomWindow.cpp | 4 +- .../windows/EditorBottomToolbar.cpp | 2 +- src/openrct2-ui/windows/Finances.cpp | 4 +- src/openrct2-ui/windows/InstallTrack.cpp | 2 +- src/openrct2-ui/windows/Multiplayer.cpp | 4 +- src/openrct2-ui/windows/NewRide.cpp | 6 +- src/openrct2-ui/windows/News.cpp | 5 +- src/openrct2-ui/windows/Options.cpp | 4 +- src/openrct2-ui/windows/Park.cpp | 8 +- src/openrct2-ui/windows/RideConstruction.cpp | 228 +++++++++--------- src/openrct2-ui/windows/Scenery.cpp | 4 +- src/openrct2-ui/windows/Staff.cpp | 6 +- src/openrct2-ui/windows/StaffList.cpp | 2 +- src/openrct2-ui/windows/TextInput.cpp | 10 +- src/openrct2-ui/windows/Themes.cpp | 2 +- src/openrct2-ui/windows/Tooltip.cpp | 4 +- src/openrct2-ui/windows/TrackDesignPlace.cpp | 2 +- src/openrct2/entity/Guest.cpp | 4 +- src/openrct2/entity/Peep.cpp | 4 +- src/openrct2/interface/Viewport.cpp | 2 +- src/openrct2/interface/Window.cpp | 165 ++----------- src/openrct2/interface/Window.h | 27 --- src/openrct2/ride/Ride.cpp | 4 +- src/openrct2/ride/RideConstruction.cpp | 4 +- 28 files changed, 211 insertions(+), 376 deletions(-) diff --git a/src/openrct2-ui/input/MouseInput.cpp b/src/openrct2-ui/input/MouseInput.cpp index b31e8c2e18..80aaa68cbf 100644 --- a/src/openrct2-ui/input/MouseInput.cpp +++ b/src/openrct2-ui/input/MouseInput.cpp @@ -390,7 +390,7 @@ static void GameHandleInputMouse(const ScreenCoordsXY& screenCoords, MouseState break; } - WindowEventToolDragCall(w, gCurrentToolWidget.widget_index, screenCoords); + w->OnToolDrag(gCurrentToolWidget.widget_index, screenCoords); break; case MouseState::LeftRelease: _inputState = InputState::Reset; @@ -401,7 +401,7 @@ static void GameHandleInputMouse(const ScreenCoordsXY& screenCoords, MouseState w = WindowFindByNumber(gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number); if (w != nullptr) { - WindowEventToolUpCall(w, gCurrentToolWidget.widget_index, screenCoords); + w->OnToolUp(gCurrentToolWidget.widget_index, screenCoords); } } else if (!(_inputFlags & INPUT_FLAG_4)) @@ -482,7 +482,7 @@ static void InputWindowPositionEnd(WindowBase& w, const ScreenCoordsXY& screenCo _inputState = InputState::Normal; gTooltipCloseTimeout = 0; gTooltipWidget = _dragWidget; - WindowEventMovedCall(&w, screenCoords); + w.OnMoved(screenCoords); } static void InputWindowResizeBegin(WindowBase& w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) @@ -625,10 +625,10 @@ static void InputScrollBegin(WindowBase& w, WidgetIndex widgetIndex, const Scree _currentScrollArea = scroll_area; _currentScrollIndex = scroll_id; - WindowEventScrollSelectCall(&w, scroll_id, scroll_area); + w.OnScrollSelect(scroll_id, scroll_area); if (scroll_area == SCROLL_PART_VIEW) { - WindowEventScrollMousedownCall(&w, scroll_id, scrollCoords); + w.OnScrollMouseDown(scroll_id, scrollCoords); return; } @@ -718,7 +718,7 @@ static void InputScrollContinue(WindowBase& w, WidgetIndex widgetIndex, const Sc switch (scroll_part) { case SCROLL_PART_VIEW: - WindowEventScrollMousedragCall(&w, scroll_id, newScreenCoords); + w.OnScrollMouseDrag(scroll_id, newScreenCoords); break; case SCROLL_PART_HSCROLLBAR_LEFT: InputScrollPartUpdateHLeft(w, widgetIndex, scroll_id); @@ -938,7 +938,7 @@ static void InputWidgetOver(const ScreenCoordsXY& screenCoords, WindowBase* w, W WindowTooltipClose(); else { - WindowEventScrollMouseoverCall(w, scrollId, newScreenCoords); + w->OnScrollMouseOver(scrollId, newScreenCoords); InputUpdateTooltip(w, widgetIndex, screenCoords); } } @@ -985,7 +985,7 @@ static void InputWidgetOverFlatbuttonInvalidate() WindowBase* w = WindowFindByNumber(gHoverWidget.window_classification, gHoverWidget.window_number); if (w != nullptr) { - WindowEventOnPrepareDrawCall(w); + w->OnPrepareDraw(); if (w->widgets[gHoverWidget.widget_index].type == WindowWidgetType::FlatBtn) { WidgetInvalidateByNumber(gHoverWidget.window_classification, gHoverWidget.window_number, gHoverWidget.widget_index); @@ -1047,7 +1047,7 @@ static void InputWidgetLeft(const ScreenCoordsXY& screenCoords, WindowBase* w, W if (w != nullptr) { InputSetFlag(INPUT_FLAG_4, true); - WindowEventToolDownCall(w, gCurrentToolWidget.widget_index, screenCoords); + w->OnToolDown(gCurrentToolWidget.widget_index, screenCoords); } } break; @@ -1091,7 +1091,7 @@ static void InputWidgetLeft(const ScreenCoordsXY& screenCoords, WindowBase* w, W _clickRepeatTicks = gCurrentRealTimeTicks; WidgetInvalidateByNumber(windowClass, windowNumber, widgetIndex); - WindowEventMouseDownCall(w, widgetIndex); + w->OnMouseDown(widgetIndex); } break; } @@ -1162,13 +1162,13 @@ void ProcessMouseOver(const ScreenCoordsXY& screenCoords) break; } // Same as default but with scroll_x/y - cursorId = WindowEventCursorCall(window, widgetId, scrollCoords); + cursorId = window->OnCursor(widgetId, scrollCoords, CursorID::Arrow); if (cursorId == CursorID::Undefined) cursorId = CursorID::Arrow; break; } default: - cursorId = WindowEventCursorCall(window, widgetId, screenCoords); + cursorId = window->OnCursor(widgetId, screenCoords, CursorID::Arrow); if (cursorId == CursorID::Undefined) cursorId = CursorID::Arrow; break; @@ -1193,7 +1193,7 @@ void ProcessMouseTool(const ScreenCoordsXY& screenCoords) if (w == nullptr) ToolCancel(); else if (InputGetState() != InputState::ViewportRight) - WindowEventToolUpdateCall(w, gCurrentToolWidget.widget_index, screenCoords); + w->OnToolUpdate(gCurrentToolWidget.widget_index, screenCoords); } } @@ -1323,7 +1323,7 @@ void InputStateWidgetPressed( { if (WidgetIsHoldable(*w, widgetIndex)) { - WindowEventMouseDownCall(w, widgetIndex); + w->OnMouseDown(widgetIndex); } // Subtract initial delay from here on we want the event each third tick. @@ -1413,7 +1413,7 @@ void InputStateWidgetPressed( dropdown_index = gDropdownDefaultIndex; } } - WindowEventDropdownCall(cursor_w, cursor_widgetIndex, dropdown_index); + cursor_w->OnDropdown(cursor_widgetIndex, dropdown_index); } } } @@ -1445,7 +1445,7 @@ void InputStateWidgetPressed( break; WidgetInvalidateByNumber(cursor_w_class, cursor_w_number, widgetIndex); - WindowEventMouseUpCall(w, widgetIndex); + w->OnMouseUp(widgetIndex); return; default: diff --git a/src/openrct2-ui/input/Shortcuts.cpp b/src/openrct2-ui/input/Shortcuts.cpp index 35e3805dba..bc7f27406c 100644 --- a/src/openrct2-ui/input/Shortcuts.cpp +++ b/src/openrct2-ui/input/Shortcuts.cpp @@ -93,7 +93,7 @@ static void ShortcutRotateConstructionObject() if (w != nullptr && !WidgetIsDisabled(*w, WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON) && w->widgets[WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].type != WindowWidgetType::Empty) { - WindowEventMouseUpCall(w, WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON); + w->OnMouseUp(WC_SCENERY__WIDX_SCENERY_ROTATE_OBJECTS_BUTTON); return; } @@ -105,7 +105,7 @@ static void ShortcutRotateConstructionObject() // Check if building a maze... if (w->widgets[WC_RIDE_CONSTRUCTION__WIDX_ROTATE].tooltip != STR_RIDE_CONSTRUCTION_BUILD_MAZE_IN_THIS_DIRECTION_TIP) { - WindowEventMouseUpCall(w, WC_RIDE_CONSTRUCTION__WIDX_ROTATE); + w->OnMouseUp(WC_RIDE_CONSTRUCTION__WIDX_ROTATE); return; } } @@ -115,7 +115,7 @@ static void ShortcutRotateConstructionObject() if (w != nullptr && !WidgetIsDisabled(*w, WC_TRACK_DESIGN_LIST__WIDX_ROTATE) && w->widgets[WC_TRACK_DESIGN_LIST__WIDX_ROTATE].type != WindowWidgetType::Empty) { - WindowEventMouseUpCall(w, WC_TRACK_DESIGN_LIST__WIDX_ROTATE); + w->OnMouseUp(WC_TRACK_DESIGN_LIST__WIDX_ROTATE); return; } @@ -124,7 +124,7 @@ static void ShortcutRotateConstructionObject() if (w != nullptr && !WidgetIsDisabled(*w, WC_TRACK_DESIGN_PLACE__WIDX_ROTATE) && w->widgets[WC_TRACK_DESIGN_PLACE__WIDX_ROTATE].type != WindowWidgetType::Empty) { - WindowEventMouseUpCall(w, WC_TRACK_DESIGN_PLACE__WIDX_ROTATE); + w->OnMouseUp(WC_TRACK_DESIGN_PLACE__WIDX_ROTATE); return; } @@ -133,7 +133,7 @@ static void ShortcutRotateConstructionObject() if (w != nullptr && !WidgetIsDisabled(*w, WC_MAP__WIDX_ROTATE_90) && w->widgets[WC_MAP__WIDX_ROTATE_90].type != WindowWidgetType::Empty) { - WindowEventMouseUpCall(w, WC_MAP__WIDX_ROTATE_90); + w->OnMouseUp(WC_MAP__WIDX_ROTATE_90); return; } @@ -142,7 +142,7 @@ static void ShortcutRotateConstructionObject() if (w != nullptr && !WidgetIsDisabled(*w, WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE) && w->widgets[WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE].type != WindowWidgetType::Empty) { - WindowEventMouseUpCall(w, WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE); + w->OnMouseUp(WC_TILE_INSPECTOR__WIDX_BUTTON_ROTATE); return; } } @@ -202,7 +202,7 @@ static void ShortcutAdjustLand() if (window != nullptr) { window->Invalidate(); - WindowEventMouseUpCall(window, WC_TOP_TOOLBAR__WIDX_LAND); + window->OnMouseUp(WC_TOP_TOOLBAR__WIDX_LAND); } } } @@ -221,7 +221,7 @@ static void ShortcutAdjustWater() if (window != nullptr) { window->Invalidate(); - WindowEventMouseUpCall(window, WC_TOP_TOOLBAR__WIDX_WATER); + window->OnMouseUp(WC_TOP_TOOLBAR__WIDX_WATER); } } } @@ -240,7 +240,7 @@ static void ShortcutBuildScenery() if (window != nullptr) { window->Invalidate(); - WindowEventMouseUpCall(window, WC_TOP_TOOLBAR__WIDX_SCENERY); + window->OnMouseUp(WC_TOP_TOOLBAR__WIDX_SCENERY); } } } @@ -417,7 +417,7 @@ static void ShortcutClearScenery() if (window != nullptr) { window->Invalidate(); - WindowEventMouseUpCall(window, WC_TOP_TOOLBAR__WIDX_CLEAR_SCENERY); + window->OnMouseUp(WC_TOP_TOOLBAR__WIDX_CLEAR_SCENERY); } } } @@ -462,7 +462,7 @@ static void ShortcutOpenSceneryPicker() if (window_toolbar != nullptr) { window_toolbar->Invalidate(); - WindowEventMouseUpCall(window_toolbar, WC_TOP_TOOLBAR__WIDX_SCENERY); + window_toolbar->OnMouseUp(WC_TOP_TOOLBAR__WIDX_SCENERY); } } @@ -471,7 +471,7 @@ static void ShortcutOpenSceneryPicker() && window_scenery->widgets[WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON].type != WindowWidgetType::Empty && !gWindowSceneryEyedropperEnabled) { - WindowEventMouseUpCall(window_scenery, WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON); + window_scenery->OnMouseUp(WC_SCENERY__WIDX_SCENERY_EYEDROPPER_BUTTON); return; } } @@ -501,7 +501,7 @@ static void TileInspectorMouseUp(WidgetIndex widgetIndex) auto w = WindowFindByClass(WindowClass::TileInspector); if (w != nullptr && !WidgetIsDisabled(*w, widgetIndex) && w->widgets[widgetIndex].type != WindowWidgetType::Empty) { - WindowEventMouseUpCall(w, widgetIndex); + w->OnMouseUp(widgetIndex); } } @@ -510,7 +510,7 @@ static void TileInspectorMouseDown(WidgetIndex widgetIndex) auto w = WindowFindByClass(WindowClass::TileInspector); if (w != nullptr && !WidgetIsDisabled(*w, widgetIndex) && w->widgets[widgetIndex].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, widgetIndex); + w->OnMouseDown(widgetIndex); } } @@ -573,7 +573,7 @@ static void ShortcutIncreaseElementHeight() break; } if (action != -1 && !WidgetIsDisabled(*w, action) && w->widgets[action].type != WindowWidgetType::Empty) - WindowEventMouseDownCall(w, action); + w->OnMouseDown(action); return; } } @@ -612,7 +612,7 @@ static void ShortcutDecreaseElementHeight() break; } if (action != -1 && !WidgetIsDisabled(*w, action) && w->widgets[action].type != WindowWidgetType::Empty) - WindowEventMouseDownCall(w, action); + w->OnMouseDown(action); return; } } diff --git a/src/openrct2-ui/interface/Widget.cpp b/src/openrct2-ui/interface/Widget.cpp index 31a1167135..b3fe15bc59 100644 --- a/src/openrct2-ui/interface/Widget.cpp +++ b/src/openrct2-ui/interface/Widget.cpp @@ -726,7 +726,7 @@ static void WidgetScrollDraw(DrawPixelInfo& dpi, WindowBase& w, WidgetIndex widg // Draw the scroll contents if (scroll_dpi.width > 0 && scroll_dpi.height > 0) - WindowEventScrollDrawCall(&w, scroll_dpi, scrollIndex); + w.OnScrollDraw(scrollIndex, scroll_dpi); } static void WidgetHScrollbarDraw( diff --git a/src/openrct2-ui/interface/Window.cpp b/src/openrct2-ui/interface/Window.cpp index 1bc3333010..ab5f204842 100644 --- a/src/openrct2-ui/interface/Window.cpp +++ b/src/openrct2-ui/interface/Window.cpp @@ -10,6 +10,7 @@ #include "Window.h" #include "Theme.h" +#include "openrct2/world/Location.hpp" #include #include @@ -503,7 +504,7 @@ static bool WindowOtherWheelInput(WindowBase& w, WidgetIndex widgetIndex, int32_ return false; } - WindowEventMouseDownCall(&w, buttonWidgetIndex); + w.OnMouseDown(buttonWidgetIndex); return true; } @@ -580,7 +581,6 @@ void WindowInitScrollWidgets(WindowBase& w) { Widget* widget; int32_t widget_index, scroll_index; - int32_t width, height; widget_index = 0; scroll_index = 0; @@ -594,13 +594,11 @@ void WindowInitScrollWidgets(WindowBase& w) auto& scroll = w.scrolls[scroll_index]; scroll.flags = 0; - width = 0; - height = 0; - WindowGetScrollSize(&w, scroll_index, &width, &height); + ScreenSize scrollSize = w.OnScrollGetSize(scroll_index); scroll.h_left = 0; - scroll.h_right = width + 1; + scroll.h_right = scrollSize.width + 1; scroll.v_top = 0; - scroll.v_bottom = height + 1; + scroll.v_bottom = scrollSize.height + 1; if (widget->content & SCROLL_HORIZONTAL) scroll.flags |= HSCROLLBAR_VISIBLE; @@ -688,7 +686,7 @@ void InvalidateAllWindowsAfterInput() WindowVisitEach([](WindowBase* w) { WindowUpdateScrollWidgets(*w); WindowInvalidatePressedImageButton(*w); - WindowEventResizeCall(w); + w->OnResize(); }); } diff --git a/src/openrct2-ui/scripting/CustomWindow.cpp b/src/openrct2-ui/scripting/CustomWindow.cpp index ad4bf16a7d..c6d4d91d78 100644 --- a/src/openrct2-ui/scripting/CustomWindow.cpp +++ b/src/openrct2-ui/scripting/CustomWindow.cpp @@ -745,8 +745,8 @@ namespace OpenRCT2::Ui::Windows RefreshWidgets(); Invalidate(); - WindowEventResizeCall(this); - WindowEventOnPrepareDrawCall(this); + OnResize(); + OnPrepareDraw(); WindowInitScrollWidgets(*this); Invalidate(); diff --git a/src/openrct2-ui/windows/EditorBottomToolbar.cpp b/src/openrct2-ui/windows/EditorBottomToolbar.cpp index 9d52496352..ad5a361fec 100644 --- a/src/openrct2-ui/windows/EditorBottomToolbar.cpp +++ b/src/openrct2-ui/windows/EditorBottomToolbar.cpp @@ -201,7 +201,7 @@ private: if (w != nullptr) { // Click tab with missing object - WindowEventMouseUpCall(w, WC_EDITOR_OBJECT_SELECTION__WIDX_TAB_1 + EnumValue(missingObjectType)); + w->OnMouseUp(WC_EDITOR_OBJECT_SELECTION__WIDX_TAB_1 + EnumValue(missingObjectType)); } return false; } diff --git a/src/openrct2-ui/windows/Finances.cpp b/src/openrct2-ui/windows/Finances.cpp index 653b178d65..d612e9a3d7 100644 --- a/src/openrct2-ui/windows/Finances.cpp +++ b/src/openrct2-ui/windows/Finances.cpp @@ -468,8 +468,8 @@ public: width = WW_OTHER_TABS; height = WH_OTHER_TABS; } - WindowEventResizeCall(this); - WindowEventOnPrepareDrawCall(this); + OnResize(); + OnPrepareDraw(); WindowInitScrollWidgets(*this); diff --git a/src/openrct2-ui/windows/InstallTrack.cpp b/src/openrct2-ui/windows/InstallTrack.cpp index 12a509d186..f1cea9d926 100644 --- a/src/openrct2-ui/windows/InstallTrack.cpp +++ b/src/openrct2-ui/windows/InstallTrack.cpp @@ -128,7 +128,7 @@ public: _trackName = std::string(text); - WindowEventMouseUpCall(this, WIDX_INSTALL); + OnMouseUp(WIDX_INSTALL); } void OnPrepareDraw() override diff --git a/src/openrct2-ui/windows/Multiplayer.cpp b/src/openrct2-ui/windows/Multiplayer.cpp index 420aea93d1..328e86fdde 100644 --- a/src/openrct2-ui/windows/Multiplayer.cpp +++ b/src/openrct2-ui/windows/Multiplayer.cpp @@ -212,8 +212,8 @@ void MultiplayerWindow::SetPage(int32_t page_number) widgets = window_multiplayer_page_widgets[page]; widgets[WIDX_TITLE].text = WindowMultiplayerPageTitles[page]; - WindowEventResizeCall(this); - WindowEventOnPrepareDrawCall(this); + OnResize(); + OnPrepareDraw(); InitScrollWidgets(); Invalidate(); } diff --git a/src/openrct2-ui/windows/NewRide.cpp b/src/openrct2-ui/windows/NewRide.cpp index b72282669d..b90a39f7ba 100644 --- a/src/openrct2-ui/windows/NewRide.cpp +++ b/src/openrct2-ui/windows/NewRide.cpp @@ -905,14 +905,12 @@ private: auto& currentTabScroll = _windowNewRideTabScroll[_currentTab]; // Get maximum scroll height - int32_t scrollWidth = 0; - int32_t scrollHeight = 0; - WindowGetScrollSize(this, 0, &scrollWidth, &scrollHeight); + ScreenSize scrollSize = OnScrollGetSize(0); const Widget& listWidget = widgets[WIDX_RIDE_LIST]; const int32_t listWidgetHeight = listWidget.bottom - listWidget.top - 1; // Ensure the current tab scroll is within range - currentTabScroll = std::min(currentTabScroll, std::max(0, scrollHeight - listWidgetHeight)); + currentTabScroll = std::min(currentTabScroll, std::max(0, scrollSize.height - listWidgetHeight)); scrolls[0].v_top = currentTabScroll; WidgetScrollUpdateThumbs(*this, WIDX_RIDE_LIST); diff --git a/src/openrct2-ui/windows/News.cpp b/src/openrct2-ui/windows/News.cpp index d65b65fc88..0765f8c96f 100644 --- a/src/openrct2-ui/windows/News.cpp +++ b/src/openrct2-ui/windows/News.cpp @@ -63,10 +63,9 @@ public: WindowInitScrollWidgets(*this); _pressedNewsItemIndex = -1; - int32_t w = 0, h = 0; Widget* widget = &widgets[WIDX_SCROLL]; - WindowGetScrollSize(this, 0, &w, &h); - scrolls[0].v_top = std::max(0, h - (widget->height() - 1)); + ScreenSize scrollSize = OnScrollGetSize(0); + scrolls[0].v_top = std::max(0, scrollSize.height - (widget->height() - 1)); WidgetScrollUpdateThumbs(*this, WIDX_SCROLL); } diff --git a/src/openrct2-ui/windows/Options.cpp b/src/openrct2-ui/windows/Options.cpp index 93995d3e7b..5e7d60256e 100644 --- a/src/openrct2-ui/windows/Options.cpp +++ b/src/openrct2-ui/windows/Options.cpp @@ -2053,8 +2053,8 @@ private: widgets = window_options_page_widgets[page]; Invalidate(); - WindowEventResizeCall(this); - WindowEventOnPrepareDrawCall(this); + OnResize(); + OnPrepareDraw(); InitScrollWidgets(); Invalidate(); } diff --git a/src/openrct2-ui/windows/Park.cpp b/src/openrct2-ui/windows/Park.cpp index 6bdbd577ad..c900be1989 100644 --- a/src/openrct2-ui/windows/Park.cpp +++ b/src/openrct2-ui/windows/Park.cpp @@ -637,7 +637,7 @@ private: } // Call invalidate event - WindowEventOnPrepareDrawCall(this); + OnPrepareDraw(); focus = newFocus; @@ -1202,9 +1202,9 @@ private: SetDisabledTabs(); Invalidate(); - WindowEventResizeCall(this); - WindowEventOnPrepareDrawCall(this); - WindowEventUpdateCall(this); + OnResize(); + OnPrepareDraw(); + OnUpdate(); if (listen && viewport != nullptr) viewport->flags |= VIEWPORT_FLAG_SOUND_ON; } diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index 1df39a2bd9..4f56bbcc1d 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -2752,7 +2752,7 @@ static void CloseConstructWindowOnCompletion(const Ride& ride) } else { - WindowEventMouseUpCall(w, WIDX_ENTRANCE); + w->OnMouseUp(WIDX_ENTRANCE); } } } @@ -2774,7 +2774,7 @@ static void WindowRideConstructionDoEntranceExitCheck() { if (!RideAreAllPossibleEntrancesAndExitsBuilt(*ride).Successful) { - WindowEventMouseUpCall(w, WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE); + w->OnMouseUp(WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE); } } } @@ -3582,7 +3582,7 @@ void RideConstructionTooldownConstruct(const ScreenCoordsXY& screenCoords) break; gDisableErrorWindowSound = true; - WindowEventMouseUpCall(w, WIDX_CONSTRUCT); + w->OnMouseUp(WIDX_CONSTRUCT); gDisableErrorWindowSound = false; if (_trackPlaceCost == kMoney64Undefined) @@ -3642,20 +3642,20 @@ void WindowRideConstructionKeyboardShortcutTurnLeft() if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_VERY_SMALL); + w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); } break; case EnumValue(TrackCurve::Left): if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_SMALL); + w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); } else if ( !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_VERY_SMALL); + w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); } else { @@ -3665,19 +3665,19 @@ void WindowRideConstructionKeyboardShortcutTurnLeft() case EnumValue(TrackCurve::LeftLarge): if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE); + w->OnMouseDown(WIDX_LEFT_CURVE); } else if ( !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_SMALL); + w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); } else if ( !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_VERY_SMALL); + w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); } else { @@ -3688,23 +3688,23 @@ void WindowRideConstructionKeyboardShortcutTurnLeft() if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_LARGE); + w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); } else if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE); + w->OnMouseDown(WIDX_LEFT_CURVE); } else if ( !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_SMALL); + w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); } else if ( !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_VERY_SMALL); + w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); } else { @@ -3714,29 +3714,29 @@ void WindowRideConstructionKeyboardShortcutTurnLeft() case EnumValue(TrackCurve::RightLarge): if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_STRAIGHT); + w->OnMouseDown(WIDX_STRAIGHT); } else if ( !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_LARGE); + w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); } else if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE); + w->OnMouseDown(WIDX_LEFT_CURVE); } else if ( !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_SMALL); + w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); } else if ( !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_VERY_SMALL); + w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); } else { @@ -3747,33 +3747,33 @@ void WindowRideConstructionKeyboardShortcutTurnLeft() if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_LARGE); + w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); } else if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_STRAIGHT); + w->OnMouseDown(WIDX_STRAIGHT); } else if ( !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_LARGE); + w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); } else if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE); + w->OnMouseDown(WIDX_LEFT_CURVE); } else if ( !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_SMALL); + w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); } else if ( !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_VERY_SMALL); + w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); } else { @@ -3783,39 +3783,39 @@ void WindowRideConstructionKeyboardShortcutTurnLeft() case EnumValue(TrackCurve::RightSmall): if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE); + w->OnMouseDown(WIDX_RIGHT_CURVE); } else if ( !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_LARGE); + w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); } else if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_STRAIGHT); + w->OnMouseDown(WIDX_STRAIGHT); } else if ( !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_LARGE); + w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); } else if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE); + w->OnMouseDown(WIDX_LEFT_CURVE); } else if ( !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_SMALL); + w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); } else if ( !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_VERY_SMALL); + w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); } else { @@ -3826,43 +3826,43 @@ void WindowRideConstructionKeyboardShortcutTurnLeft() if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_SMALL); + w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); } else if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE); + w->OnMouseDown(WIDX_RIGHT_CURVE); } else if ( !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_LARGE); + w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); } else if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_STRAIGHT); + w->OnMouseDown(WIDX_STRAIGHT); } else if ( !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_LARGE); + w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); } else if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE); + w->OnMouseDown(WIDX_LEFT_CURVE); } else if ( !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_SMALL); + w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); } else if ( !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_VERY_SMALL) && w->widgets[WIDX_LEFT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_VERY_SMALL); + w->OnMouseDown(WIDX_LEFT_CURVE_VERY_SMALL); } else { @@ -3888,20 +3888,20 @@ void WindowRideConstructionKeyboardShortcutTurnRight() if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_VERY_SMALL); + w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); } break; case EnumValue(TrackCurve::Right): if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_SMALL); + w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); } else if ( !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_VERY_SMALL); + w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); } else { @@ -3911,19 +3911,19 @@ void WindowRideConstructionKeyboardShortcutTurnRight() case EnumValue(TrackCurve::RightLarge): if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE); + w->OnMouseDown(WIDX_RIGHT_CURVE); } else if ( !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_SMALL); + w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); } else if ( !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_VERY_SMALL); + w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); } else { @@ -3934,23 +3934,23 @@ void WindowRideConstructionKeyboardShortcutTurnRight() if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_LARGE); + w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); } else if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE); + w->OnMouseDown(WIDX_RIGHT_CURVE); } else if ( !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_SMALL); + w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); } else if ( !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_VERY_SMALL); + w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); } else { @@ -3960,29 +3960,29 @@ void WindowRideConstructionKeyboardShortcutTurnRight() case EnumValue(TrackCurve::LeftLarge): if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_STRAIGHT); + w->OnMouseDown(WIDX_STRAIGHT); } else if ( !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_LARGE); + w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); } else if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE); + w->OnMouseDown(WIDX_RIGHT_CURVE); } else if ( !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_SMALL); + w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); } else if ( !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_VERY_SMALL); + w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); } else { @@ -3993,33 +3993,33 @@ void WindowRideConstructionKeyboardShortcutTurnRight() if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_LARGE); + w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); } else if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_STRAIGHT); + w->OnMouseDown(WIDX_STRAIGHT); } else if ( !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_LARGE); + w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); } else if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE); + w->OnMouseDown(WIDX_RIGHT_CURVE); } else if ( !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_SMALL); + w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); } else if ( !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_VERY_SMALL); + w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); } else { @@ -4029,39 +4029,39 @@ void WindowRideConstructionKeyboardShortcutTurnRight() case EnumValue(TrackCurve::LeftSmall): if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE); + w->OnMouseDown(WIDX_LEFT_CURVE); } else if ( !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_LARGE); + w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); } else if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_STRAIGHT); + w->OnMouseDown(WIDX_STRAIGHT); } else if ( !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_LARGE); + w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); } else if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE); + w->OnMouseDown(WIDX_RIGHT_CURVE); } else if ( !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_SMALL); + w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); } else if ( !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_VERY_SMALL); + w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); } else { @@ -4072,43 +4072,43 @@ void WindowRideConstructionKeyboardShortcutTurnRight() if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE_SMALL) && w->widgets[WIDX_LEFT_CURVE_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_SMALL); + w->OnMouseDown(WIDX_LEFT_CURVE_SMALL); } else if (!WidgetIsDisabled(*w, WIDX_LEFT_CURVE) && w->widgets[WIDX_LEFT_CURVE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE); + w->OnMouseDown(WIDX_LEFT_CURVE); } else if ( !WidgetIsDisabled(*w, WIDX_LEFT_CURVE_LARGE) && w->widgets[WIDX_LEFT_CURVE_LARGE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEFT_CURVE_LARGE); + w->OnMouseDown(WIDX_LEFT_CURVE_LARGE); } else if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_STRAIGHT); + w->OnMouseDown(WIDX_STRAIGHT); } else if ( !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_LARGE) && w->widgets[WIDX_RIGHT_CURVE_LARGE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_LARGE); + w->OnMouseDown(WIDX_RIGHT_CURVE_LARGE); } else if (!WidgetIsDisabled(*w, WIDX_RIGHT_CURVE) && w->widgets[WIDX_RIGHT_CURVE].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE); + w->OnMouseDown(WIDX_RIGHT_CURVE); } else if ( !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_SMALL) && w->widgets[WIDX_RIGHT_CURVE_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_SMALL); + w->OnMouseDown(WIDX_RIGHT_CURVE_SMALL); } else if ( !WidgetIsDisabled(*w, WIDX_RIGHT_CURVE_VERY_SMALL) && w->widgets[WIDX_RIGHT_CURVE_VERY_SMALL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_RIGHT_CURVE_VERY_SMALL); + w->OnMouseDown(WIDX_RIGHT_CURVE_VERY_SMALL); } else { @@ -4130,23 +4130,23 @@ void WindowRideConstructionKeyboardShortcutUseTrackDefault() if (!WidgetIsDisabled(*w, WIDX_STRAIGHT) && w->widgets[WIDX_STRAIGHT].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_STRAIGHT); + w->OnMouseDown(WIDX_STRAIGHT); } if (!WidgetIsDisabled(*w, WIDX_LEVEL) && w->widgets[WIDX_LEVEL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEVEL); + w->OnMouseDown(WIDX_LEVEL); } if (!WidgetIsDisabled(*w, WIDX_CHAIN_LIFT) && w->widgets[WIDX_CHAIN_LIFT].type != WindowWidgetType::Empty && _currentTrackLiftHill & CONSTRUCTION_LIFT_HILL_SELECTED) { - WindowEventMouseDownCall(w, WIDX_CHAIN_LIFT); + w->OnMouseDown(WIDX_CHAIN_LIFT); } if (!WidgetIsDisabled(*w, WIDX_BANK_STRAIGHT) && w->widgets[WIDX_BANK_STRAIGHT].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_BANK_STRAIGHT); + w->OnMouseDown(WIDX_BANK_STRAIGHT); } } @@ -4165,20 +4165,20 @@ void WindowRideConstructionKeyboardShortcutSlopeDown() && w->widgets[WIDX_SLOPE_UP_STEEP].image.GetIndex() == SPR_RIDE_CONSTRUCTION_VERTICAL_DROP && w->widgets[WIDX_SLOPE_UP_STEEP].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_SLOPE_UP_STEEP); + w->OnMouseDown(WIDX_SLOPE_UP_STEEP); } break; case TrackPitch::Down25: if (!WidgetIsDisabled(*w, WIDX_SLOPE_DOWN_STEEP) && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_SLOPE_DOWN_STEEP); + w->OnMouseDown(WIDX_SLOPE_DOWN_STEEP); } break; case TrackPitch::None: if (!WidgetIsDisabled(*w, WIDX_SLOPE_DOWN) && w->widgets[WIDX_SLOPE_DOWN].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_SLOPE_DOWN); + w->OnMouseDown(WIDX_SLOPE_DOWN); } else if ( IsTrackEnabled(TRACK_SLOPE_VERTICAL) @@ -4190,7 +4190,7 @@ void WindowRideConstructionKeyboardShortcutSlopeDown() !WidgetIsDisabled(*w, WIDX_SLOPE_DOWN_STEEP) && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_SLOPE_DOWN_STEEP); + w->OnMouseDown(WIDX_SLOPE_DOWN_STEEP); } else { @@ -4200,17 +4200,17 @@ void WindowRideConstructionKeyboardShortcutSlopeDown() case TrackPitch::Up25: if (!WidgetIsDisabled(*w, WIDX_LEVEL) && w->widgets[WIDX_LEVEL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEVEL); + w->OnMouseDown(WIDX_LEVEL); } else if (!WidgetIsDisabled(*w, WIDX_SLOPE_DOWN) && w->widgets[WIDX_SLOPE_DOWN].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_SLOPE_DOWN); + w->OnMouseDown(WIDX_SLOPE_DOWN); } else if ( !WidgetIsDisabled(*w, WIDX_SLOPE_DOWN_STEEP) && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_SLOPE_DOWN_STEEP); + w->OnMouseDown(WIDX_SLOPE_DOWN_STEEP); } else { @@ -4220,15 +4220,15 @@ void WindowRideConstructionKeyboardShortcutSlopeDown() case TrackPitch::Up60: if (!WidgetIsDisabled(*w, WIDX_SLOPE_UP) && w->widgets[WIDX_SLOPE_UP].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_SLOPE_UP); + w->OnMouseDown(WIDX_SLOPE_UP); } else if (!WidgetIsDisabled(*w, WIDX_LEVEL) && w->widgets[WIDX_LEVEL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEVEL); + w->OnMouseDown(WIDX_LEVEL); } else if (!WidgetIsDisabled(*w, WIDX_SLOPE_DOWN) && w->widgets[WIDX_SLOPE_DOWN].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_SLOPE_DOWN); + w->OnMouseDown(WIDX_SLOPE_DOWN); } else if ( IsTrackEnabled(TRACK_SLOPE_VERTICAL) @@ -4240,7 +4240,7 @@ void WindowRideConstructionKeyboardShortcutSlopeDown() !WidgetIsDisabled(*w, WIDX_SLOPE_DOWN_STEEP) && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_SLOPE_DOWN_STEEP); + w->OnMouseDown(WIDX_SLOPE_DOWN_STEEP); } else { @@ -4252,7 +4252,7 @@ void WindowRideConstructionKeyboardShortcutSlopeDown() && w->widgets[WIDX_SLOPE_DOWN_STEEP].image.GetIndex() == SPR_RIDE_CONSTRUCTION_VERTICAL_RISE && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_SLOPE_UP_STEEP); + w->OnMouseDown(WIDX_SLOPE_UP_STEEP); } break; default: @@ -4275,19 +4275,19 @@ void WindowRideConstructionKeyboardShortcutSlopeUp() && w->widgets[WIDX_SLOPE_DOWN_STEEP].image.GetIndex() == SPR_RIDE_CONSTRUCTION_VERTICAL_RISE && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_SLOPE_DOWN_STEEP); + w->OnMouseDown(WIDX_SLOPE_DOWN_STEEP); } break; case TrackPitch::Up25: if (!WidgetIsDisabled(*w, WIDX_SLOPE_UP_STEEP) && w->widgets[WIDX_SLOPE_UP_STEEP].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_SLOPE_UP_STEEP); + w->OnMouseDown(WIDX_SLOPE_UP_STEEP); } break; case TrackPitch::None: if (!WidgetIsDisabled(*w, WIDX_SLOPE_UP) && w->widgets[WIDX_SLOPE_UP].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_SLOPE_UP); + w->OnMouseDown(WIDX_SLOPE_UP); } else if ( IsTrackEnabled(TRACK_SLOPE_VERTICAL) @@ -4298,7 +4298,7 @@ void WindowRideConstructionKeyboardShortcutSlopeUp() else if ( !WidgetIsDisabled(*w, WIDX_SLOPE_UP_STEEP) && w->widgets[WIDX_SLOPE_UP_STEEP].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_SLOPE_UP_STEEP); + w->OnMouseDown(WIDX_SLOPE_UP_STEEP); } else { @@ -4308,16 +4308,16 @@ void WindowRideConstructionKeyboardShortcutSlopeUp() case TrackPitch::Down25: if (!WidgetIsDisabled(*w, WIDX_LEVEL) && w->widgets[WIDX_LEVEL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEVEL); + w->OnMouseDown(WIDX_LEVEL); } else if (!WidgetIsDisabled(*w, WIDX_SLOPE_UP) && w->widgets[WIDX_SLOPE_UP].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_SLOPE_UP); + w->OnMouseDown(WIDX_SLOPE_UP); } else if ( !WidgetIsDisabled(*w, WIDX_SLOPE_UP_STEEP) && w->widgets[WIDX_SLOPE_UP_STEEP].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_SLOPE_UP_STEEP); + w->OnMouseDown(WIDX_SLOPE_UP_STEEP); } else { @@ -4327,15 +4327,15 @@ void WindowRideConstructionKeyboardShortcutSlopeUp() case TrackPitch::Down60: if (!WidgetIsDisabled(*w, WIDX_SLOPE_DOWN) && w->widgets[WIDX_SLOPE_DOWN].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_SLOPE_DOWN); + w->OnMouseDown(WIDX_SLOPE_DOWN); } else if (!WidgetIsDisabled(*w, WIDX_LEVEL) && w->widgets[WIDX_LEVEL].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_LEVEL); + w->OnMouseDown(WIDX_LEVEL); } else if (!WidgetIsDisabled(*w, WIDX_SLOPE_UP) && w->widgets[WIDX_SLOPE_UP].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_SLOPE_UP); + w->OnMouseDown(WIDX_SLOPE_UP); } else if ( IsTrackEnabled(TRACK_SLOPE_VERTICAL) @@ -4346,7 +4346,7 @@ void WindowRideConstructionKeyboardShortcutSlopeUp() else if ( !WidgetIsDisabled(*w, WIDX_SLOPE_UP_STEEP) && w->widgets[WIDX_SLOPE_UP_STEEP].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_SLOPE_UP_STEEP); + w->OnMouseDown(WIDX_SLOPE_UP_STEEP); } else { @@ -4358,7 +4358,7 @@ void WindowRideConstructionKeyboardShortcutSlopeUp() && w->widgets[WIDX_SLOPE_UP_STEEP].image.GetIndex() == SPR_RIDE_CONSTRUCTION_VERTICAL_DROP && w->widgets[WIDX_SLOPE_DOWN_STEEP].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_SLOPE_DOWN_STEEP); + w->OnMouseDown(WIDX_SLOPE_DOWN_STEEP); } break; default: @@ -4374,7 +4374,7 @@ void WindowRideConstructionKeyboardShortcutChainLiftToggle() return; } - WindowEventMouseDownCall(w, WIDX_CHAIN_LIFT); + w->OnMouseDown(WIDX_CHAIN_LIFT); } void WindowRideConstructionKeyboardShortcutBankLeft() @@ -4391,17 +4391,17 @@ void WindowRideConstructionKeyboardShortcutBankLeft() case TrackRoll::None: if (!WidgetIsDisabled(*w, WIDX_BANK_LEFT) && w->widgets[WIDX_BANK_LEFT].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_BANK_LEFT); + w->OnMouseDown(WIDX_BANK_LEFT); } break; case TrackRoll::Right: if (!WidgetIsDisabled(*w, WIDX_BANK_STRAIGHT) && w->widgets[WIDX_BANK_STRAIGHT].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_BANK_STRAIGHT); + w->OnMouseDown(WIDX_BANK_STRAIGHT); } else if (!WidgetIsDisabled(*w, WIDX_BANK_LEFT) && w->widgets[WIDX_BANK_LEFT].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_BANK_LEFT); + w->OnMouseDown(WIDX_BANK_LEFT); } else { @@ -4427,17 +4427,17 @@ void WindowRideConstructionKeyboardShortcutBankRight() case TrackRoll::None: if (!WidgetIsDisabled(*w, WIDX_BANK_RIGHT) && w->widgets[WIDX_BANK_RIGHT].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_BANK_RIGHT); + w->OnMouseDown(WIDX_BANK_RIGHT); } break; case TrackRoll::Left: if (!WidgetIsDisabled(*w, WIDX_BANK_STRAIGHT) && w->widgets[WIDX_BANK_STRAIGHT].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_BANK_STRAIGHT); + w->OnMouseDown(WIDX_BANK_STRAIGHT); } else if (!WidgetIsDisabled(*w, WIDX_BANK_RIGHT) && w->widgets[WIDX_BANK_RIGHT].type != WindowWidgetType::Empty) { - WindowEventMouseDownCall(w, WIDX_BANK_RIGHT); + w->OnMouseDown(WIDX_BANK_RIGHT); } else { @@ -4458,7 +4458,7 @@ void WindowRideConstructionKeyboardShortcutPreviousTrack() return; } - WindowEventMouseUpCall(w, WIDX_PREVIOUS_SECTION); + w->OnMouseUp(WIDX_PREVIOUS_SECTION); } void WindowRideConstructionKeyboardShortcutNextTrack() @@ -4470,7 +4470,7 @@ void WindowRideConstructionKeyboardShortcutNextTrack() return; } - WindowEventMouseUpCall(w, WIDX_NEXT_SECTION); + w->OnMouseUp(WIDX_NEXT_SECTION); } void WindowRideConstructionKeyboardShortcutBuildCurrent() @@ -4481,7 +4481,7 @@ void WindowRideConstructionKeyboardShortcutBuildCurrent() return; } - WindowEventMouseUpCall(w, WIDX_CONSTRUCT); + w->OnMouseUp(WIDX_CONSTRUCT); } void WindowRideConstructionKeyboardShortcutDemolishCurrent() @@ -4492,7 +4492,7 @@ void WindowRideConstructionKeyboardShortcutDemolishCurrent() return; } - WindowEventMouseUpCall(w, WIDX_DEMOLISH); + w->OnMouseUp(WIDX_DEMOLISH); } static void WindowRideConstructionMouseUpDemolishNextPiece(const CoordsXYZD& piecePos, int32_t type) diff --git a/src/openrct2-ui/windows/Scenery.cpp b/src/openrct2-ui/windows/Scenery.cpp index 82b2ce0c57..28c38cfb13 100644 --- a/src/openrct2-ui/windows/Scenery.cpp +++ b/src/openrct2-ui/windows/Scenery.cpp @@ -322,7 +322,7 @@ public: height = min_height; Invalidate(); // HACK: For some reason invalidate has not been called - WindowEventOnPrepareDrawCall(this); + OnPrepareDraw(); ContentUpdateScroll(); } @@ -332,7 +332,7 @@ public: height = max_height; Invalidate(); // HACK: For some reason invalidate has not been called - WindowEventOnPrepareDrawCall(this); + OnPrepareDraw(); ContentUpdateScroll(); } diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index b720629f3f..0be54eae8a 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -1095,8 +1095,8 @@ private: RemoveViewport(); Invalidate(); - WindowEventResizeCall(this); - WindowEventOnPrepareDrawCall(this); + OnResize(); + OnPrepareDraw(); InitScrollWidgets(); ViewportInit(); Invalidate(); @@ -1159,7 +1159,7 @@ private: viewport_flags |= VIEWPORT_FLAG_GRIDLINES; } - WindowEventOnPrepareDrawCall(this); + OnPrepareDraw(); focus = tempFocus; diff --git a/src/openrct2-ui/windows/StaffList.cpp b/src/openrct2-ui/windows/StaffList.cpp index 2aa55093bd..97d2f555a4 100644 --- a/src/openrct2-ui/windows/StaffList.cpp +++ b/src/openrct2-ui/windows/StaffList.cpp @@ -463,7 +463,7 @@ public: { ToolCancel(); auto* staffWindow = WindowStaffOpen(closestStaffMember); - WindowEventDropdownCall(staffWindow, WC_PEEP__WIDX_PATROL, 0); + staffWindow->OnDropdown(WC_PEEP__WIDX_PATROL, 0); } else { diff --git a/src/openrct2-ui/windows/TextInput.cpp b/src/openrct2-ui/windows/TextInput.cpp index c6dea3ad2b..b2e4639156 100644 --- a/src/openrct2-ui/windows/TextInput.cpp +++ b/src/openrct2-ui/windows/TextInput.cpp @@ -327,11 +327,13 @@ private: { if (HasParentWindow()) { - auto w = GetParentWindow(); - if (w != nullptr) + if (hasValue) { - auto value = hasValue ? _buffer.data() : nullptr; - WindowEventTextinputCall(w, _parentWidget.widget_index, value); + auto w = GetParentWindow(); + if (w != nullptr) + { + w->OnTextInput(_parentWidget.widget_index, _buffer); + } } } else diff --git a/src/openrct2-ui/windows/Themes.cpp b/src/openrct2-ui/windows/Themes.cpp index 9b778f30fd..25bfb7928f 100644 --- a/src/openrct2-ui/windows/Themes.cpp +++ b/src/openrct2-ui/windows/Themes.cpp @@ -488,7 +488,7 @@ public: _selected_tab = static_cast(newSelectedTab); scrolls[0].v_top = 0; frame_no = 0; - WindowEventResizeCall(this); + OnResize(); Invalidate(); break; case WIDX_THEMES_PRESETS_DROPDOWN: diff --git a/src/openrct2-ui/windows/Tooltip.cpp b/src/openrct2-ui/windows/Tooltip.cpp index b114d00710..cb9fd93b61 100644 --- a/src/openrct2-ui/windows/Tooltip.cpp +++ b/src/openrct2-ui/windows/Tooltip.cpp @@ -169,7 +169,7 @@ void WindowTooltipOpen(WindowBase* widgetWindow, WidgetIndex widgetIndex, const return; auto widget = &widgetWindow->widgets[widgetIndex]; - WindowEventOnPrepareDrawCall(widgetWindow); + widgetWindow->OnPrepareDraw(); OpenRCT2String result; if (widget->flags & WIDGET_FLAGS::TOOLTIP_IS_STRING) @@ -192,7 +192,7 @@ void WindowTooltipOpen(WindowBase* widgetWindow, WidgetIndex widgetIndex, const gTooltipWidget.window_classification = widgetWindow->classification; gTooltipWidget.window_number = widgetWindow->number; gTooltipWidget.widget_index = widgetIndex; - result = WindowEventTooltipCall(widgetWindow, widgetIndex, stringId); + result = widgetWindow->OnTooltip(widgetIndex, stringId); if (result.str == STR_NONE) return; } diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index b8f73b0454..57f0785c38 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -250,7 +250,7 @@ public: { RideInitialiseConstructionWindow(*getRide); auto wnd = WindowFindByClass(WindowClass::RideConstruction); - WindowEventMouseUpCall(wnd, WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE); + wnd->OnMouseUp(WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE); } } } diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index f73432fdd6..02f04eabbf 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -1433,7 +1433,7 @@ void Guest::CheckCantFindRide() if (w != nullptr) { - WindowEventOnPrepareDrawCall(w); + w->OnPrepareDraw(); } WindowInvalidateByNumber(WindowClass::Peep, Id); @@ -3119,7 +3119,7 @@ static void PeepLeavePark(Guest* peep) WindowBase* w = WindowFindByNumber(WindowClass::Peep, peep->Id); if (w != nullptr) - WindowEventOnPrepareDrawCall(w); + w->OnPrepareDraw(); WindowInvalidateByNumber(WindowClass::Peep, peep->Id); } diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index ec4966ed6e..3c16a9645e 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -25,7 +25,7 @@ #include "../entity/Balloon.h" #include "../entity/EntityRegistry.h" #include "../entity/EntityTweener.h" -#include "../interface/Window.h" +#include "../interface/Window_internal.h" #include "../localisation/Formatter.h" #include "../localisation/Formatting.h" #include "../localisation/Localisation.h" @@ -556,7 +556,7 @@ void PeepWindowStateUpdate(Peep* peep) { WindowBase* w = WindowFindByNumber(WindowClass::Peep, peep->Id.ToUnderlying()); if (w != nullptr) - WindowEventOnPrepareDrawCall(w); + w->OnPrepareDraw(); if (peep->Is()) { diff --git a/src/openrct2/interface/Viewport.cpp b/src/openrct2/interface/Viewport.cpp index bc6701c459..026cb67a09 100644 --- a/src/openrct2/interface/Viewport.cpp +++ b/src/openrct2/interface/Viewport.cpp @@ -565,7 +565,7 @@ static void ViewportSetUndergroundFlag(int32_t underground, WindowBase* window, */ void ViewportUpdatePosition(WindowBase* window) { - WindowEventResizeCall(window); + window->OnResize(); Viewport* viewport = window->viewport; if (viewport == nullptr) diff --git a/src/openrct2/interface/Window.cpp b/src/openrct2/interface/Window.cpp index 93514266ff..52dac802eb 100644 --- a/src/openrct2/interface/Window.cpp +++ b/src/openrct2/interface/Window.cpp @@ -114,7 +114,7 @@ void WindowVisitEach(std::function func) void WindowDispatchUpdateAll() { // gTooltipNotShownTicks++; - WindowVisitEach([&](WindowBase* w) { WindowEventUpdateCall(w); }); + WindowVisitEach([&](WindowBase* w) { w->OnUpdate(); }); } void WindowUpdateAllViewports() @@ -140,7 +140,7 @@ void WindowUpdateAll() { gWindowUpdateTicks = gCurrentRealTimeTicks + kGameUpdateFPS; - WindowVisitEach([](WindowBase* w) { WindowEventPeriodicUpdateCall(w); }); + WindowVisitEach([](WindowBase* w) { w->OnPeriodicUpdate(); }); } // Border flash invalidation @@ -218,7 +218,7 @@ void WindowSetWindowLimit(int32_t value) */ void WindowClose(WindowBase& w) { - WindowEventCloseCall(&w); + w.OnClose(); // Remove viewport w.RemoveViewport(); @@ -427,7 +427,7 @@ WindowBase* WindowFindFromPoint(const ScreenCoordsXY& screenCoords) WidgetIndex WindowFindWidgetFromPoint(WindowBase& w, const ScreenCoordsXY& screenCoords) { // Invalidate the window - WindowEventOnPrepareDrawCall(&w); + w.OnPrepareDraw(); // Find the widget at point x, y WidgetIndex widget_index = -1; @@ -589,9 +589,10 @@ void WindowUpdateScrollWidgets(WindowBase& w) continue; auto& scroll = w.scrolls[scrollIndex]; - width = 0; - height = 0; - WindowGetScrollSize(&w, scrollIndex, &width, &height); + ScreenSize scrollSize = w.OnScrollGetSize(scrollIndex); + width = scrollSize.width; + height = scrollSize.height; + if (height == 0) { scroll.v_top = 0; @@ -894,7 +895,7 @@ void WindowScrollToLocation(WindowBase& w, const CoordsXYZ& coords) */ static void call_event_viewport_rotate_on_all_windows() { - WindowVisitEach([](WindowBase* w) { WindowEventViewportRotateCall(w); }); + WindowVisitEach([](WindowBase* w) { w->OnViewportRotate(); }); } /** @@ -1241,7 +1242,7 @@ static void WindowDrawSingle(DrawPixelInfo& dpi, WindowBase& w, int32_t left, in // Invalidate modifies the window colours so first get the correct // colour before setting the global variables for the string painting - WindowEventOnPrepareDrawCall(&w); + w.OnPrepareDraw(); // Text colouring gCurrentWindowColours[0] = NOT_TRANSLUCENT(w.colours[0]); @@ -1249,7 +1250,7 @@ static void WindowDrawSingle(DrawPixelInfo& dpi, WindowBase& w, int32_t left, in gCurrentWindowColours[2] = NOT_TRANSLUCENT(w.colours[2]); gCurrentWindowColours[3] = NOT_TRANSLUCENT(w.colours[3]); - WindowEventOnDrawCall(&w, copy); + w.OnDraw(copy); } /** @@ -1300,8 +1301,8 @@ void WindowResize(WindowBase& w, int32_t dw, int32_t dh) w.width = std::clamp(w.width + dw, w.min_width, w.max_width); w.height = std::clamp(w.height + dh, w.min_height, w.max_height); - WindowEventResizeCall(&w); - WindowEventOnPrepareDrawCall(&w); + w.OnResize(); + w.OnPrepareDraw(); // Update scroll widgets for (auto& scroll : w.scrolls) @@ -1393,143 +1394,11 @@ void ToolCancel() // Abort tool event WindowBase* w = WindowFindByNumber(gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number); if (w != nullptr) - WindowEventToolAbortCall(w, gCurrentToolWidget.widget_index); + w->OnToolAbort(gCurrentToolWidget.widget_index); } } } -void WindowEventCloseCall(WindowBase* w) -{ - w->OnClose(); -} - -void WindowEventMouseUpCall(WindowBase* w, WidgetIndex widgetIndex) -{ - w->OnMouseUp(widgetIndex); -} - -void WindowEventResizeCall(WindowBase* w) -{ - w->OnResize(); -} - -void WindowEventMouseDownCall(WindowBase* w, WidgetIndex widgetIndex) -{ - w->OnMouseDown(widgetIndex); -} - -void WindowEventDropdownCall(WindowBase* w, WidgetIndex widgetIndex, int32_t dropdownIndex) -{ - w->OnDropdown(widgetIndex, dropdownIndex); -} - -void WindowEventUpdateCall(WindowBase* w) -{ - w->OnUpdate(); -} - -void WindowEventPeriodicUpdateCall(WindowBase* w) -{ - w->OnPeriodicUpdate(); -} - -void WindowEventToolUpdateCall(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) -{ - w->OnToolUpdate(widgetIndex, screenCoords); -} - -void WindowEventToolDownCall(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) -{ - w->OnToolDown(widgetIndex, screenCoords); -} - -void WindowEventToolDragCall(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) -{ - w->OnToolDrag(widgetIndex, screenCoords); -} - -void WindowEventToolUpCall(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) -{ - w->OnToolUp(widgetIndex, screenCoords); -} - -void WindowEventToolAbortCall(WindowBase* w, WidgetIndex widgetIndex) -{ - w->OnToolAbort(widgetIndex); -} - -void WindowGetScrollSize(WindowBase* w, int32_t scrollIndex, int32_t* width, int32_t* height) -{ - auto size = w->OnScrollGetSize(scrollIndex); - if (width != nullptr) - *width = size.width; - if (height != nullptr) - *height = size.height; -} - -void WindowEventScrollMousedownCall(WindowBase* w, int32_t scrollIndex, const ScreenCoordsXY& screenCoords) -{ - w->OnScrollMouseDown(scrollIndex, screenCoords); -} - -void WindowEventScrollMousedragCall(WindowBase* w, int32_t scrollIndex, const ScreenCoordsXY& screenCoords) -{ - w->OnScrollMouseDrag(scrollIndex, screenCoords); -} - -void WindowEventScrollMouseoverCall(WindowBase* w, int32_t scrollIndex, const ScreenCoordsXY& screenCoords) -{ - w->OnScrollMouseOver(scrollIndex, screenCoords); -} - -void WindowEventTextinputCall(WindowBase* w, WidgetIndex widgetIndex, const char* text) -{ - if (text != nullptr) - { - w->OnTextInput(widgetIndex, text); - } -} - -void WindowEventViewportRotateCall(WindowBase* w) -{ - w->OnViewportRotate(); -} - -void WindowEventScrollSelectCall(WindowBase* w, int32_t scrollIndex, int32_t scrollAreaType) -{ - w->OnScrollSelect(scrollIndex, scrollAreaType); -} - -OpenRCT2String WindowEventTooltipCall(WindowBase* w, const WidgetIndex widgetIndex, const StringId fallback) -{ - return w->OnTooltip(widgetIndex, fallback); -} - -CursorID WindowEventCursorCall(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) -{ - return w->OnCursor(widgetIndex, screenCoords, CursorID::Arrow); -} - -void WindowEventMovedCall(WindowBase* w, const ScreenCoordsXY& screenCoords) -{ - w->OnMoved(screenCoords); -} - -void WindowEventOnPrepareDrawCall(WindowBase* w) -{ - w->OnPrepareDraw(); -} - -void WindowEventOnDrawCall(WindowBase* w, DrawPixelInfo& dpi) -{ - w->OnDraw(dpi); -} - -void WindowEventScrollDrawCall(WindowBase* w, DrawPixelInfo& dpi, int32_t scrollIndex) -{ - w->OnScrollDraw(scrollIndex, dpi); -} - /** * * rct2: 0x006ED710 @@ -1874,10 +1743,6 @@ void WindowCancelTextbox() if (gUsingWidgetTextBox) { WindowBase* w = WindowFindByNumber(gCurrentTextBox.window.classification, gCurrentTextBox.window.number); - if (w != nullptr) - { - WindowEventTextinputCall(w, gCurrentTextBox.widget_index, nullptr); - } gCurrentTextBox.window.classification = WindowClass::Null; gCurrentTextBox.window.number = 0; ContextStopTextInput(); @@ -1904,7 +1769,7 @@ void WindowUpdateTextbox() gTextBoxFrameNo = 0; WindowBase* w = WindowFindByNumber(gCurrentTextBox.window.classification, gCurrentTextBox.window.number); WidgetInvalidate(*w, gCurrentTextBox.widget_index); - WindowEventTextinputCall(w, gCurrentTextBox.widget_index, gTextBoxInput.c_str()); + w->OnTextInput(gCurrentTextBox.widget_index, gTextBoxInput); } } diff --git a/src/openrct2/interface/Window.h b/src/openrct2/interface/Window.h index 86cc0ea8c2..556292be1b 100644 --- a/src/openrct2/interface/Window.h +++ b/src/openrct2/interface/Window.h @@ -616,33 +616,6 @@ void RideConstructionToolupdateEntranceExit(const ScreenCoordsXY& screenCoords); void RideConstructionToolupdateConstruct(const ScreenCoordsXY& screenCoords); void RideConstructionTooldownConstruct(const ScreenCoordsXY& screenCoords); -void WindowEventCloseCall(WindowBase* w); -void WindowEventMouseUpCall(WindowBase* w, WidgetIndex widgetIndex); -void WindowEventResizeCall(WindowBase* w); -void WindowEventMouseDownCall(WindowBase* w, WidgetIndex widgetIndex); -void WindowEventDropdownCall(WindowBase* w, WidgetIndex widgetIndex, int32_t dropdownIndex); -void WindowEventUnknown05Call(WindowBase* w); -void WindowEventUpdateCall(WindowBase* w); -void WindowEventPeriodicUpdateCall(WindowBase* w); -void WindowEventToolUpdateCall(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords); -void WindowEventToolDownCall(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords); -void WindowEventToolDragCall(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords); -void WindowEventToolUpCall(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords); -void WindowEventToolAbortCall(WindowBase* w, WidgetIndex widgetIndex); -void WindowGetScrollSize(WindowBase* w, int32_t scrollIndex, int32_t* width, int32_t* height); -void WindowEventScrollMousedownCall(WindowBase* w, int32_t scrollIndex, const ScreenCoordsXY& screenCoords); -void WindowEventScrollMousedragCall(WindowBase* w, int32_t scrollIndex, const ScreenCoordsXY& screenCoords); -void WindowEventScrollMouseoverCall(WindowBase* w, int32_t scrollIndex, const ScreenCoordsXY& screenCoords); -void WindowEventTextinputCall(WindowBase* w, WidgetIndex widgetIndex, const char* text); -void WindowEventViewportRotateCall(WindowBase* w); -void WindowEventScrollSelectCall(WindowBase* w, int32_t scrollIndex, int32_t scrollAreaType); -OpenRCT2String WindowEventTooltipCall(WindowBase* w, const WidgetIndex widgetIndex, const StringId fallback); -CursorID WindowEventCursorCall(WindowBase* w, WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords); -void WindowEventMovedCall(WindowBase* w, const ScreenCoordsXY& screenCoords); -void WindowEventOnPrepareDrawCall(WindowBase* w); -void WindowEventOnDrawCall(WindowBase* w, DrawPixelInfo& dpi); -void WindowEventScrollDrawCall(WindowBase* w, DrawPixelInfo& dpi, int32_t scrollIndex); - void InvalidateAllWindowsAfterInput(); void TextinputCancel(); diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 9b8746528b..db11761041 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -31,7 +31,7 @@ #include "../entity/EntityRegistry.h" #include "../entity/Peep.h" #include "../entity/Staff.h" -#include "../interface/Window.h" +#include "../interface/Window_internal.h" #include "../localisation/Date.h" #include "../localisation/Formatter.h" #include "../localisation/Formatting.h" @@ -3968,7 +3968,7 @@ void Ride::ConstructMissingEntranceOrExit() const w = WindowFindByClass(WindowClass::RideConstruction); if (w != nullptr) - WindowEventMouseUpCall(w, entranceOrExit); + w->OnMouseUp(entranceOrExit); } } diff --git a/src/openrct2/ride/RideConstruction.cpp b/src/openrct2/ride/RideConstruction.cpp index 64ca3022f4..e7591c482e 100644 --- a/src/openrct2/ride/RideConstruction.cpp +++ b/src/openrct2/ride/RideConstruction.cpp @@ -22,7 +22,7 @@ #include "../entity/EntityList.h" #include "../entity/EntityRegistry.h" #include "../entity/Staff.h" -#include "../interface/Window.h" +#include "../interface/Window_internal.h" #include "../localisation/Date.h" #include "../localisation/Formatter.h" #include "../localisation/Localisation.h" @@ -239,7 +239,7 @@ void RideClearForConstruction(Ride& ride) auto w = WindowFindByNumber(WindowClass::Ride, ride.id.ToUnderlying()); if (w != nullptr) - WindowEventResizeCall(w); + w->OnResize(); } /**