1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 23:04:36 +01:00
Files
OpenRCT2/src/openrct2/interface/Window_internal.cpp
Duncan 43562a6899 Window Class Refactor: Invention List Drag (#17415)
* Start working on drag

* Finish moving invention drag into window class

* Refactor drag item into a window variable

* Remove rct2 comment
2022-06-30 10:25:18 +01:00

44 lines
953 B
C++

#include "Window_internal.h"
#include "../entity/EntityList.h"
#include "../entity/EntityRegistry.h"
#include "Cursors.h"
#include "Viewport.h"
void rct_window::SetLocation(const CoordsXYZ& coords)
{
window_scroll_to_location(this, coords);
flags &= ~WF_SCROLLING_TO_LOCATION;
}
void rct_window::ScrollToViewport()
{
if (viewport == nullptr || !focus.has_value())
return;
CoordsXYZ newCoords = focus.value().GetPos();
auto mainWindow = window_get_main();
if (mainWindow != nullptr)
window_scroll_to_location(mainWindow, newCoords);
}
void rct_window::Invalidate()
{
gfx_set_dirty_blocks({ windowPos, windowPos + ScreenCoordsXY{ width, height } });
}
void rct_window::RemoveViewport()
{
if (viewport == nullptr)
return;
viewport_remove(viewport);
viewport = nullptr;
}
CursorID rct_window::OnCursor(rct_widgetindex, const ScreenCoordsXY&, CursorID)
{
return CursorID::Arrow;
}