Flutter Engine
FlutterMouseCursorPlugin.mm File Reference
#import <objc/message.h>
#import "FlutterMouseCursorPlugin.h"
#import "flutter/shell/platform/darwin/common/framework/Headers/FlutterCodecs.h"

Go to the source code of this file.

Functions

static NSCursor * GetCursorForKind (NSString *kind)
 

Variables

static NSString *const kMouseCursorChannel = @"@"flutter/mousecursor"
 
static NSString *const kActivateSystemCursorMethod = @"@"activateSystemCursor"
 
static NSString *const kKindKey = @"@"kind"
 
static NSString *const kKindValueNone = @"@"none"
 
static NSDictionary * systemCursors
 
NSMutableDictionary * cachedSystemCursors
 

Function Documentation

◆ GetCursorForKind()

static NSCursor* GetCursorForKind ( NSString *  kind)
static

Maps a Flutter's constant to a platform's cursor object.

Returns the arrow cursor for unknown constants, including kSystemShapeNone.

Definition at line 24 of file FlutterMouseCursorPlugin.mm.

References systemCursors.

24  {
25  // The following mapping must be kept in sync with Flutter framework's
26  // mouse_cursor.dart
27 
28  if (systemCursors == nil) {
29  systemCursors = @{
30  @"alias" : [NSCursor dragLinkCursor],
31  @"basic" : [NSCursor arrowCursor],
32  @"click" : [NSCursor pointingHandCursor],
33  @"contextMenu" : [NSCursor contextualMenuCursor],
34  @"copy" : [NSCursor dragCopyCursor],
35  @"disappearing" : [NSCursor disappearingItemCursor],
36  @"forbidden" : [NSCursor operationNotAllowedCursor],
37  @"grab" : [NSCursor openHandCursor],
38  @"grabbing" : [NSCursor closedHandCursor],
39  @"noDrop" : [NSCursor operationNotAllowedCursor],
40  @"precise" : [NSCursor crosshairCursor],
41  @"text" : [NSCursor IBeamCursor],
42  @"resizeColumn" : [NSCursor resizeLeftRightCursor],
43  @"resizeDown" : [NSCursor resizeDownCursor],
44  @"resizeLeft" : [NSCursor resizeLeftCursor],
45  @"resizeLeftRight" : [NSCursor resizeLeftRightCursor],
46  @"resizeRight" : [NSCursor resizeRightCursor],
47  @"resizeRow" : [NSCursor resizeUpDownCursor],
48  @"resizeUp" : [NSCursor resizeUpCursor],
49  @"resizeUpDown" : [NSCursor resizeUpDownCursor],
50  @"verticalText" : [NSCursor IBeamCursorForVerticalLayout],
51  };
52  }
53  NSCursor* result = [systemCursors objectForKey:kind];
54  if (result == nil)
55  return [NSCursor arrowCursor];
56  return result;
57 }
static NSDictionary * systemCursors

Variable Documentation

◆ cachedSystemCursors

NSMutableDictionary* cachedSystemCursors

Definition at line 97 of file FlutterMouseCursorPlugin.mm.

◆ kActivateSystemCursorMethod

NSString* const kActivateSystemCursorMethod = @"@"activateSystemCursor"
static

Definition at line 12 of file FlutterMouseCursorPlugin.mm.

◆ kKindKey

NSString* const kKindKey = @"@"kind"
static

Definition at line 13 of file FlutterMouseCursorPlugin.mm.

◆ kKindValueNone

NSString* const kKindValueNone = @"@"none"
static

Definition at line 15 of file FlutterMouseCursorPlugin.mm.

◆ kMouseCursorChannel

NSString* const kMouseCursorChannel = @"@"flutter/mousecursor"
static

Definition at line 10 of file FlutterMouseCursorPlugin.mm.

◆ systemCursors

NSDictionary* systemCursors
static

Definition at line 17 of file FlutterMouseCursorPlugin.mm.

Referenced by GetCursorForKind().