procedure TPlatformWin.SetCursor(const ACursor: TCursor);
const
CustomCursorMap: array [crSizeAll .. crNone] of PChar = (
nil, nil, nil, nil, nil, IDC_SQLWAIT, IDC_MULTIDRAG, nil, nil, IDC_NODROP, IDC_DRAG, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil);
CursorMap: array [crSizeAll .. crNone] of PChar = (
IDC_SIZEALL, IDC_HAND, IDC_HELP, IDC_APPSTARTING, IDC_NO, nil, nil, IDC_SIZENS, IDC_SIZEWE, nil, nil, IDC_WAIT,
IDC_UPARROW, IDC_SIZEWE, IDC_SIZENWSE, IDC_SIZENS, IDC_SIZENESW, IDC_SIZEALL, IDC_IBEAM, IDC_CROSS, IDC_ARROW, nil);
function IsDefaultOrInvalidCursor(const ACursor: TCursor): Boolean;
begin
Result := (ACursor = crDefault) or not InRange(ACursor, crSizeAll, crNone);
end;
var
NewCursor: HCURSOR;
begin
if not FDragAndDropActive then
begin
// We don't set cursor by default, when we create window. So we should use crArrow cursor by default.
if IsDefaultOrInvalidCursor(ACursor) and not (csDesigning in Application.ComponentState) then
FCursor := crArrow
else
FCursor := ACursor;
if InRange(FCursor, crSizeAll, crNone) then
begin
if CustomCursorMap[FCursor] <> nil then
NewCursor := LoadCursorW(HInstance, CustomCursorMap[FCursor])
else
NewCursor := LoadCursorW(0, CursorMap[FCursor]);
Winapi.Windows.SetCursor(NewCursor);
end;
end;
end;
function TPlatformWin.GetCursor: TCursor;
begin
Result := FCursor;
end;