5 #import <objc/message.h>
29 NSImage* image = [[NSImage alloc] initWithSize:NSMakeSize(1, 1)];
30 return [[NSCursor alloc] initWithImage:image hotSpot:NSMakePoint(0, 0)];
35 @"alias" : [NSCursor dragLinkCursor],
36 @"basic" : [NSCursor arrowCursor],
37 @"click" : [NSCursor pointingHandCursor],
38 @"contextMenu" : [NSCursor contextualMenuCursor],
39 @"copy" : [NSCursor dragCopyCursor],
40 @"disappearing" : [NSCursor disappearingItemCursor],
41 @"forbidden" : [NSCursor operationNotAllowedCursor],
42 @"grab" : [NSCursor openHandCursor],
43 @"grabbing" : [NSCursor closedHandCursor],
44 @"noDrop" : [NSCursor operationNotAllowedCursor],
45 @"precise" : [NSCursor crosshairCursor],
46 @"text" : [NSCursor IBeamCursor],
47 @"resizeColumn" : [NSCursor resizeLeftRightCursor],
48 @"resizeDown" : [NSCursor resizeDownCursor],
49 @"resizeLeft" : [NSCursor resizeLeftCursor],
50 @"resizeLeftRight" : [NSCursor resizeLeftRightCursor],
51 @"resizeRight" : [NSCursor resizeRightCursor],
52 @"resizeRow" : [NSCursor resizeUpDownCursor],
53 @"resizeUp" : [NSCursor resizeUpCursor],
54 @"resizeUpDown" : [NSCursor resizeUpDownCursor],
55 @"verticalText" : [NSCursor IBeamCursorForVerticalLayout],
60 return [NSCursor arrowCursor];
67 @property(nonatomic, weak) id<FlutterMouseCursorPluginDelegate> delegate;
75 - (
FlutterError*)activateSystemCursor:(nonnull NSDictionary*)arguments;
83 - (void)displayCursorObject:(nonnull NSCursor*)cursorObject;
94 #pragma mark - Private
98 - (instancetype)init {
106 - (
FlutterError*)activateSystemCursor:(nonnull NSDictionary*)arguments {
107 NSString* kindArg = arguments[kKindKey];
111 details:@"Missing argument while trying to activate system cursor"];
115 [
self displayCursorObject:cursorObject];
119 - (void)displayCursorObject:(nonnull NSCursor*)cursorObject {
121 [
self.delegate didUpdateMouseCursor:cursorObject];
124 + (NSCursor*)cursorFromKind:(NSString*)kind {
125 NSCursor* cachedValue = [cachedSystemCursors objectForKey:kind];
128 [cachedSystemCursors setValue:cachedValue forKey:kind];
133 #pragma mark - FlutterPlugin implementation
136 [
self registerWithRegistrar:registrar delegate:nil];
144 instance.delegate = delegate;
149 NSString* method = call.
method;
151 result([
self activateSystemCursor:call.
arguments]);