ladybird/Servers/WindowServer/WSCursor.cpp
Andreas Kling 6673284b06 LibGUI: Switch to a resizing cursor when hovering or using a GSplitter.
Also expose the various standard cursors on WSWindowManager so they can
be reused by the override mechanism.
2019-04-02 02:34:09 +02:00

40 lines
1.1 KiB
C++

#include <WindowServer/WSCursor.h>
#include <WindowServer/WSWindowManager.h>
WSCursor::WSCursor(Retained<GraphicsBitmap>&& bitmap, const Point& hotspot)
: m_bitmap(move(bitmap))
, m_hotspot(hotspot)
{
}
WSCursor::~WSCursor()
{
}
Retained<WSCursor> WSCursor::create(Retained<GraphicsBitmap>&& bitmap)
{
return adopt(*new WSCursor(move(bitmap), bitmap->rect().center()));
}
Retained<WSCursor> WSCursor::create(Retained<GraphicsBitmap>&& bitmap, const Point& hotspot)
{
return adopt(*new WSCursor(move(bitmap), hotspot));
}
RetainPtr<WSCursor> WSCursor::create(WSStandardCursor standard_cursor)
{
switch (standard_cursor) {
case WSStandardCursor::None:
return nullptr;
case WSStandardCursor::Arrow:
return WSWindowManager::the().arrow_cursor();
case WSStandardCursor::IBeam:
return WSWindowManager::the().i_beam_cursor();
case WSStandardCursor::ResizeHorizontal:
return WSWindowManager::the().resize_horizontally_cursor();
case WSStandardCursor::ResizeVertical:
return WSWindowManager::the().resize_vertically_cursor();
}
ASSERT_NOT_REACHED();
}