mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 10:08:10 +00:00
LibGfx: Move StandardCursor enum to LibGfx
This enum existed both in LibGUI and WindowServer which was silly and error-prone.
This commit is contained in:
parent
c063a02979
commit
0f9be82826
23 changed files with 127 additions and 111 deletions
|
@ -610,7 +610,7 @@ OwnPtr<Messages::WindowServer::SetWindowOverrideCursorResponse> ClientConnection
|
|||
return nullptr;
|
||||
}
|
||||
auto& window = *(*it).value;
|
||||
window.set_override_cursor(Cursor::create((StandardCursor)message.cursor_type()));
|
||||
window.set_override_cursor(Cursor::create((Gfx::StandardCursor)message.cursor_type()));
|
||||
Compositor::the().invalidate_cursor();
|
||||
return make<Messages::WindowServer::SetWindowOverrideCursorResponse>();
|
||||
}
|
||||
|
|
|
@ -49,36 +49,36 @@ NonnullRefPtr<Cursor> Cursor::create(NonnullRefPtr<Gfx::Bitmap>&& bitmap, const
|
|||
return adopt(*new Cursor(move(bitmap), hotspot));
|
||||
}
|
||||
|
||||
RefPtr<Cursor> Cursor::create(StandardCursor standard_cursor)
|
||||
RefPtr<Cursor> Cursor::create(Gfx::StandardCursor standard_cursor)
|
||||
{
|
||||
switch (standard_cursor) {
|
||||
case StandardCursor::None:
|
||||
case Gfx::StandardCursor::None:
|
||||
return nullptr;
|
||||
case StandardCursor::Arrow:
|
||||
case Gfx::StandardCursor::Arrow:
|
||||
return WindowManager::the().arrow_cursor();
|
||||
case StandardCursor::IBeam:
|
||||
case Gfx::StandardCursor::IBeam:
|
||||
return WindowManager::the().i_beam_cursor();
|
||||
case StandardCursor::ResizeHorizontal:
|
||||
case Gfx::StandardCursor::ResizeHorizontal:
|
||||
return WindowManager::the().resize_horizontally_cursor();
|
||||
case StandardCursor::ResizeVertical:
|
||||
case Gfx::StandardCursor::ResizeVertical:
|
||||
return WindowManager::the().resize_vertically_cursor();
|
||||
case StandardCursor::ResizeDiagonalTLBR:
|
||||
case Gfx::StandardCursor::ResizeDiagonalTLBR:
|
||||
return WindowManager::the().resize_diagonally_tlbr_cursor();
|
||||
case StandardCursor::ResizeDiagonalBLTR:
|
||||
case Gfx::StandardCursor::ResizeDiagonalBLTR:
|
||||
return WindowManager::the().resize_diagonally_bltr_cursor();
|
||||
case StandardCursor::ResizeColumn:
|
||||
case Gfx::StandardCursor::ResizeColumn:
|
||||
return WindowManager::the().resize_column_cursor();
|
||||
case StandardCursor::ResizeRow:
|
||||
case Gfx::StandardCursor::ResizeRow:
|
||||
return WindowManager::the().resize_row_cursor();
|
||||
case StandardCursor::Hand:
|
||||
case Gfx::StandardCursor::Hand:
|
||||
return WindowManager::the().hand_cursor();
|
||||
case StandardCursor::Help:
|
||||
case Gfx::StandardCursor::Help:
|
||||
return WindowManager::the().help_cursor();
|
||||
case StandardCursor::Drag:
|
||||
case Gfx::StandardCursor::Drag:
|
||||
return WindowManager::the().drag_cursor();
|
||||
case StandardCursor::Move:
|
||||
case Gfx::StandardCursor::Move:
|
||||
return WindowManager::the().move_cursor();
|
||||
case StandardCursor::Wait:
|
||||
case Gfx::StandardCursor::Wait:
|
||||
return WindowManager::the().wait_cursor();
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
|
|
|
@ -27,31 +27,15 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/StandardCursor.h>
|
||||
|
||||
namespace WindowServer {
|
||||
|
||||
enum class StandardCursor {
|
||||
None = 0,
|
||||
Arrow,
|
||||
IBeam,
|
||||
ResizeHorizontal,
|
||||
ResizeVertical,
|
||||
ResizeDiagonalTLBR,
|
||||
ResizeDiagonalBLTR,
|
||||
ResizeColumn,
|
||||
ResizeRow,
|
||||
Hand,
|
||||
Help,
|
||||
Drag,
|
||||
Move,
|
||||
Wait,
|
||||
};
|
||||
|
||||
class Cursor : public RefCounted<Cursor> {
|
||||
public:
|
||||
static NonnullRefPtr<Cursor> create(NonnullRefPtr<Gfx::Bitmap>&&, const Gfx::IntPoint& hotspot);
|
||||
static NonnullRefPtr<Cursor> create(NonnullRefPtr<Gfx::Bitmap>&&);
|
||||
static RefPtr<Cursor> create(StandardCursor);
|
||||
static RefPtr<Cursor> create(Gfx::StandardCursor);
|
||||
~Cursor();
|
||||
|
||||
Gfx::IntPoint hotspot() const { return m_hotspot; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue