mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-11 09:18:05 +03:00
6673284b06
Also expose the various standard cursors on WSWindowManager so they can be reused by the override mechanism.
40 lines
1.1 KiB
C++
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();
|
|
}
|