Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Instance Methods | Class Methods | Properties | List of all members
FlutterUndoManagerPlugin Class Reference

#include <FlutterUndoManagerPlugin.h>

Inheritance diagram for FlutterUndoManagerPlugin:

Instance Methods

(instancetype) - NS_UNAVAILABLE
 
(instancetype) - initWithDelegate:
 
(void) - handleMethodCall:result:
 
(void) - dealloc [implementation]
 
(void) - resetUndoManager [implementation]
 
(void) - registerUndoWithDirection: [implementation]
 
(void) - registerRedo [implementation]
 
(void) - setUndoState: [implementation]
 

Class Methods

(instancetype) + NS_UNAVAILABLE
 

Properties

id< FlutterUndoManagerDelegateundoManagerDelegate [implementation]
 

Detailed Description

Definition at line 13 of file FlutterUndoManagerPlugin.h.

Method Documentation

◆ dealloc

- (void) dealloc
implementation

Definition at line 15 of file FlutterUndoManagerPlugin.mm.

30 {
31 [_undoManagerDelegate.undoManager removeAllActionsWithTarget:self];
32}

◆ handleMethodCall:result:

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

Definition at line 15 of file FlutterUndoManagerPlugin.mm.

35 NSString* method = call.method;
36 id args = call.arguments;
37 if ([method isEqualToString:kSetUndoStateMethod]) {
38 [self setUndoState:args];
39 result(nil);
40 } else {
42 }
43}
void(^ FlutterResult)(id _Nullable result)
FLUTTER_DARWIN_EXPORT NSObject const * FlutterMethodNotImplemented
static NSString *const kSetUndoStateMethod
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
GAsyncResult * result
call(args)
Definition dom.py:159

◆ initWithDelegate:

- (instancetype) initWithDelegate: (id<FlutterUndoManagerDelegate>)  NS_DESIGNATED_INITIALIZER

Definition at line 15 of file FlutterUndoManagerPlugin.mm.

20 :(id<FlutterUndoManagerDelegate>)undoManagerDelegate {
21 self = [super init];
22
23 if (self) {
24 _undoManagerDelegate = undoManagerDelegate;
25 }
26
27 return self;
28}
id< FlutterUndoManagerDelegate > undoManagerDelegate

◆ NS_UNAVAILABLE [1/2]

- (instancetype) NS_UNAVAILABLE

◆ NS_UNAVAILABLE [2/2]

+ (instancetype) NS_UNAVAILABLE

◆ registerRedo

- (void) registerRedo
implementation

Definition at line 15 of file FlutterUndoManagerPlugin.mm.

66 {
67 NSUndoManager* undoManager = self.undoManagerDelegate.undoManager;
68 [undoManager beginUndoGrouping];
69 [undoManager registerUndoWithTarget:self
70 handler:^(id target) {
71 // Register undo with opposite direction.
72 [target registerUndoWithDirection:FlutterUndoRedoDirectionRedo];
73 }];
74 [undoManager endUndoGrouping];
75 [undoManager undo];
76}

◆ registerUndoWithDirection:

- (void) registerUndoWithDirection: (FlutterUndoRedoDirection)  direction
implementation

Definition at line 15 of file FlutterUndoManagerPlugin.mm.

49 :(FlutterUndoRedoDirection)direction {
50 NSUndoManager* undoManager = self.undoManagerDelegate.undoManager;
51 [undoManager beginUndoGrouping];
52 [undoManager registerUndoWithTarget:self
53 handler:^(FlutterUndoManagerPlugin* target) {
54 // Register undo with opposite direction.
55 FlutterUndoRedoDirection newDirection =
56 (direction == FlutterUndoRedoDirectionRedo)
57 ? FlutterUndoRedoDirectionUndo
58 : FlutterUndoRedoDirectionRedo;
59 [target registerUndoWithDirection:newDirection];
60 // Invoke method on delegate.
61 [target.undoManagerDelegate handleUndoWithDirection:direction];
62 }];
63 [undoManager endUndoGrouping];
64}

◆ resetUndoManager

- (void) resetUndoManager
implementation

Definition at line 15 of file FlutterUndoManagerPlugin.mm.

45 {
46 [self.undoManagerDelegate.undoManager removeAllActionsWithTarget:self];
47}

◆ setUndoState:

- (void) setUndoState: (NSDictionary*)  dictionary
implementation

Definition at line 15 of file FlutterUndoManagerPlugin.mm.

78 :(NSDictionary*)dictionary {
79 NSUndoManager* undoManager = self.undoManagerDelegate.undoManager;
80 BOOL groupsByEvent = undoManager.groupsByEvent;
81 undoManager.groupsByEvent = NO;
82 BOOL canUndo = [dictionary[kCanUndo] boolValue];
83 BOOL canRedo = [dictionary[kCanRedo] boolValue];
84
85 [self resetUndoManager];
86
87 if (canUndo) {
88 [self registerUndoWithDirection:FlutterUndoRedoDirectionUndo];
89 }
90 if (canRedo) {
91 [self registerRedo];
92 }
93 UIView<UITextInput>* textInputView = self.undoManagerDelegate.activeTextInputView;
94 if (textInputView != nil) {
95 // This is needed to notify the iPadOS keyboard that it needs to update the
96 // state of the UIBarButtons. Otherwise, the state changes to NSUndoManager
97 // will not show up until the next keystroke (or other trigger).
98 UITextInputAssistantItem* assistantItem = textInputView.inputAssistantItem;
99 assistantItem.leadingBarButtonGroups = assistantItem.leadingBarButtonGroups;
100 }
101 undoManager.groupsByEvent = groupsByEvent;
102}
int BOOL

Property Documentation

◆ undoManagerDelegate

- (id<FlutterUndoManagerDelegate>) undoManagerDelegate
readnonatomicweakimplementation

Provided by category FlutterUndoManagerPlugin().

Definition at line 15 of file FlutterUndoManagerPlugin.mm.


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