5#import <objc/message.h>
8#import "flutter/shell/platform/darwin/common/framework/Headers/FlutterCodecs.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;
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];
149 NSString* method =
call.method;
void(^ FlutterResult)(id _Nullable result)
FLUTTER_DARWIN_EXPORT NSObject const * FlutterMethodNotImplemented
static NSString *const kActivateSystemCursorMethod
static NSString *const kMouseCursorChannel
NSMutableDictionary * cachedSystemCursors
static NSString *const kKindValueNone
static NSDictionary * systemCursors
static NSCursor * GetCursorForKind(NSString *kind)
static NSString *const kKindKey
instancetype errorWithCode:message:details:(NSString *code,[message] NSString *_Nullable message,[details] id _Nullable details)
instancetype methodChannelWithName:binaryMessenger:(NSString *name,[binaryMessenger] NSObject< FlutterBinaryMessenger > *messenger)
NSCursor * cursorFromKind:(NSString *kind)
id< FlutterMouseCursorPluginDelegate > delegate
sk_sp< const SkImage > image
void addMethodCallDelegate:channel:(NSObject< FlutterPlugin > *delegate,[channel] FlutterMethodChannel *channel)