Flutter Engine
The Flutter Engine
Instance Methods | Class Methods | Properties | List of all members
FlutterMouseCursorPlugin Class Reference

#import <FlutterMouseCursorPlugin.h>

Inheritance diagram for FlutterMouseCursorPlugin:
<FlutterPlugin> <FlutterApplicationLifeCycleDelegate> <FlutterAppLifecycleDelegate>

Instance Methods

(instancetype) - init [implementation]
 
(FlutterError *) - activateSystemCursor: [implementation]
 
(void) - displayCursorObject: [implementation]
 
(void) - handleMethodCall:result: [implementation]
 
- Instance Methods inherited from <FlutterPlugin>
(void) - handleMethodCall:result:
 
(void) - detachFromEngineForRegistrar:
 
(void) - handleMethodCall:result:
 
- Instance Methods inherited from <FlutterApplicationLifeCycleDelegate>
(BOOL- application:didFinishLaunchingWithOptions:
 
(BOOL- application:willFinishLaunchingWithOptions:
 
(void) - applicationDidBecomeActive:
 
(void) - applicationWillResignActive:
 
(void) - applicationDidEnterBackground:
 
(void) - applicationWillEnterForeground:
 
(void) - applicationWillTerminate:
 
(void) - application:didRegisterUserNotificationSettings:
 
(void) - application:didRegisterForRemoteNotificationsWithDeviceToken:
 
(void) - application:didFailToRegisterForRemoteNotificationsWithError:
 
(BOOL- application:didReceiveRemoteNotification:fetchCompletionHandler:
 
(void) - application:didReceiveLocalNotification:
 
(BOOL- application:openURL:options:
 
(BOOL- application:handleOpenURL:
 
(BOOL- application:openURL:sourceApplication:annotation:
 
(BOOL- application:performActionForShortcutItem:completionHandler:
 
(BOOL- application:handleEventsForBackgroundURLSession:completionHandler:
 
(BOOL- application:performFetchWithCompletionHandler:
 
(BOOL- application:continueUserActivity:restorationHandler:
 
- Instance Methods inherited from <FlutterAppLifecycleDelegate>
(void) - handleWillFinishLaunching:
 
(void) - handleDidFinishLaunching:
 
(void) - handleWillBecomeActive:
 
(void) - handleDidBecomeActive:
 
(void) - handleWillResignActive:
 
(void) - handleDidResignActive:
 
(void) - handleWillHide:
 
(void) - handleDidHide:
 
(void) - handleWillUnhide:
 
(void) - handleDidUnhide:
 
(void) - handleDidChangeScreenParameters:
 
(void) - handleDidChangeOcclusionState:
 
(BOOL- handleOpenURLs:
 
(void) - handleWillTerminate:
 

Class Methods

(void) + registerWithRegistrar:delegate:
 
(NSCursor *) + cursorFromKind: [implementation]
 
(void) + registerWithRegistrar: [implementation]
 
(void) + registerWithRegistrar:delegate: [implementation]
 
- Class Methods inherited from <FlutterPlugin>
(void) + registerWithRegistrar:
 
(void) + setPluginRegistrantCallback:
 
(void) + registerWithRegistrar:
 

Properties

id< FlutterMouseCursorPluginDelegatedelegate [implementation]
 

Detailed Description

A plugin to handle mouse cursor.

Responsible for bridging the native macOS mouse cursor system with the Flutter framework mouse cursor classes, via system channels.

Definition at line 23 of file FlutterMouseCursorPlugin.h.

Method Documentation

◆ activateSystemCursor:

- (FlutterError *) activateSystemCursor: (nonnull NSDictionary *)  arguments
implementation

Handles the method call that activates a system cursor.

Returns a FlutterError if the arguments can not be recognized. Otherwise returns nil.

Definition at line 96 of file FlutterMouseCursorPlugin.mm.

106 :(nonnull NSDictionary*)arguments {
107 NSString* kindArg = arguments[kKindKey];
108 if (!kindArg) {
109 return [FlutterError errorWithCode:@"error"
110 message:@"Missing argument"
111 details:@"Missing argument while trying to activate system cursor"];
112 }
113
114 NSCursor* cursorObject = [FlutterMouseCursorPlugin cursorFromKind:kindArg];
115 [self displayCursorObject:cursorObject];
116 return nil;
117}
instancetype errorWithCode:message:details:(NSString *code,[message] NSString *_Nullable message,[details] id _Nullable details)
NSCursor * cursorFromKind:(NSString *kind)

◆ cursorFromKind:

+ (NSCursor *) cursorFromKind: (NSString*)  kind
implementation

Definition at line 96 of file FlutterMouseCursorPlugin.mm.

124 :(NSString*)kind {
125 NSCursor* cachedValue = [cachedSystemCursors objectForKey:kind];
126 if (!cachedValue) {
127 cachedValue = GetCursorForKind(kind);
128 [cachedSystemCursors setValue:cachedValue forKey:kind];
129 }
130 return cachedValue;
131}
static NSCursor * GetCursorForKind(NSString *kind)

◆ displayCursorObject:

- (void) displayCursorObject: (nonnull NSCursor *)  cursorObject
implementation

Displays the specified cursor.

Unhides the cursor before displaying the cursor, and updates internal states.

Definition at line 96 of file FlutterMouseCursorPlugin.mm.

119 :(nonnull NSCursor*)cursorObject {
120 [cursorObject set];
121 [self.delegate didUpdateMouseCursor:cursorObject];
122}

◆ handleMethodCall:result:

- (void) handleMethodCall: (FlutterMethodCall *)  call
result: (FlutterResult result 
implementation

Handles all method calls from Flutter.

Reimplemented from <FlutterPlugin>.

Definition at line 96 of file FlutterMouseCursorPlugin.mm.

149 NSString* method = call.method;
150 if ([method isEqualToString:kActivateSystemCursorMethod]) {
151 result([self activateSystemCursor:call.arguments]);
152 } else {
154 }
155}
void(^ FlutterResult)(id _Nullable result)
FLUTTER_DARWIN_EXPORT NSObject const * FlutterMethodNotImplemented
static NSString *const kActivateSystemCursorMethod
GAsyncResult * result
def call(args)
Definition: dom.py:159

◆ init

- (instancetype) init
implementation

Definition at line 96 of file FlutterMouseCursorPlugin.mm.

98 {
99 self = [super init];
100 if (self) {
101 cachedSystemCursors = [NSMutableDictionary dictionary];
102 }
103 return self;
104}
NSMutableDictionary * cachedSystemCursors

◆ registerWithRegistrar:

+ (void) registerWithRegistrar: (id< FlutterPluginRegistrar >)  registrar
implementation

Creates an instance of the plugin to register with |registrar| using the desired FlutterPluginRegistrar methods.

Reimplemented from <FlutterPlugin>.

Definition at line 96 of file FlutterMouseCursorPlugin.mm.

135 :(id<FlutterPluginRegistrar>)registrar {
136 [self registerWithRegistrar:registrar delegate:nil];
137}

◆ registerWithRegistrar:delegate: [1/2]

+ (void) registerWithRegistrar: (id<FlutterPluginRegistrar>)  registrar
delegate: (id<FlutterMouseCursorPluginDelegate>)  delegate 
implementation

Definition at line 96 of file FlutterMouseCursorPlugin.mm.

139 :(id<FlutterPluginRegistrar>)registrar
140 delegate:(id<FlutterMouseCursorPluginDelegate>)delegate {
142 binaryMessenger:registrar.messenger];
144 instance.delegate = delegate;
145 [registrar addMethodCallDelegate:instance channel:channel];
146}
VkInstance instance
Definition: main.cc:48
instancetype methodChannelWithName:binaryMessenger:(NSString *name,[binaryMessenger] NSObject< FlutterBinaryMessenger > *messenger)
id< FlutterMouseCursorPluginDelegate > delegate

◆ registerWithRegistrar:delegate: [2/2]

+ (void) registerWithRegistrar: (nonnull id< FlutterPluginRegistrar >)  registrar
delegate: (nullable id< FlutterMouseCursorPluginDelegate >)  delegate 

Property Documentation

◆ delegate

- (id<FlutterMouseCursorPluginDelegate>) delegate
readwritenonatomicweakimplementation

Definition at line 67 of file FlutterMouseCursorPlugin.mm.


The documentation for this class was generated from the following files: