2019-03-31 17:09:10 -03:00
|
|
|
#include <WindowServer/WSCursor.h>
|
2019-04-01 21:34:09 -03:00
|
|
|
#include <WindowServer/WSWindowManager.h>
|
2019-03-31 17:09:10 -03:00
|
|
|
|
2019-06-21 13:37:47 -03:00
|
|
|
WSCursor::WSCursor(NonnullRefPtr<GraphicsBitmap>&& bitmap, const Point& hotspot)
|
2019-03-31 17:09:10 -03:00
|
|
|
: m_bitmap(move(bitmap))
|
|
|
|
|
, m_hotspot(hotspot)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WSCursor::~WSCursor()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-21 13:37:47 -03:00
|
|
|
NonnullRefPtr<WSCursor> WSCursor::create(NonnullRefPtr<GraphicsBitmap>&& bitmap)
|
2019-03-31 17:09:10 -03:00
|
|
|
{
|
|
|
|
|
return adopt(*new WSCursor(move(bitmap), bitmap->rect().center()));
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-21 13:37:47 -03:00
|
|
|
NonnullRefPtr<WSCursor> WSCursor::create(NonnullRefPtr<GraphicsBitmap>&& bitmap, const Point& hotspot)
|
2019-03-31 17:09:10 -03:00
|
|
|
{
|
|
|
|
|
return adopt(*new WSCursor(move(bitmap), hotspot));
|
|
|
|
|
}
|
2019-03-31 18:52:02 -03:00
|
|
|
|
2019-06-21 13:37:47 -03:00
|
|
|
RefPtr<WSCursor> WSCursor::create(WSStandardCursor standard_cursor)
|
2019-03-31 18:52:02 -03:00
|
|
|
{
|
|
|
|
|
switch (standard_cursor) {
|
|
|
|
|
case WSStandardCursor::None:
|
|
|
|
|
return nullptr;
|
|
|
|
|
case WSStandardCursor::Arrow:
|
2019-04-01 21:34:09 -03:00
|
|
|
return WSWindowManager::the().arrow_cursor();
|
2019-03-31 18:52:02 -03:00
|
|
|
case WSStandardCursor::IBeam:
|
2019-04-01 21:34:09 -03:00
|
|
|
return WSWindowManager::the().i_beam_cursor();
|
|
|
|
|
case WSStandardCursor::ResizeHorizontal:
|
|
|
|
|
return WSWindowManager::the().resize_horizontally_cursor();
|
|
|
|
|
case WSStandardCursor::ResizeVertical:
|
|
|
|
|
return WSWindowManager::the().resize_vertically_cursor();
|
2019-05-02 20:38:24 -03:00
|
|
|
case WSStandardCursor::ResizeDiagonalTLBR:
|
|
|
|
|
return WSWindowManager::the().resize_diagonally_tlbr_cursor();
|
|
|
|
|
case WSStandardCursor::ResizeDiagonalBLTR:
|
|
|
|
|
return WSWindowManager::the().resize_diagonally_bltr_cursor();
|
2019-10-10 16:35:12 -03:00
|
|
|
case WSStandardCursor::Hand:
|
|
|
|
|
return WSWindowManager::the().hand_cursor();
|
2019-03-31 18:52:02 -03:00
|
|
|
}
|
|
|
|
|
ASSERT_NOT_REACHED();
|
|
|
|
|
}
|