Flutter Engine
The Flutter Engine
Instance Methods | Properties | List of all members
TestKeyEvent Class Reference
Inheritance diagram for TestKeyEvent:

Instance Methods

(nonnull instancetype) - initWithEvent:callback:userData:
 
(BOOL- hasCallback
 
(void) - respond:
 
(void) - dealloc [implementation]
 

Properties

FlutterKeyEventdata
 
FlutterKeyEventCallback callback
 
void * userData
 

Detailed Description

Definition at line 27 of file FlutterEmbedderKeyResponderTest.mm.

Method Documentation

◆ dealloc

- (void) dealloc
implementation

Definition at line 30 of file FlutterEmbedderKeyResponderTest.mm.

61 {
62 if (_data->character != nullptr) {
63 delete[] _data->character;
64 }
65 delete _data;
66}

◆ hasCallback

- (BOOL) hasCallback

Definition at line 30 of file FlutterEmbedderKeyResponderTest.mm.

50 {
51 return _callback != nil;
52}

◆ initWithEvent:callback:userData:

- (instancetype) initWithEvent: (const FlutterKeyEvent*)  event
callback: (nullable FlutterKeyEventCallback callback
userData: (nullable void*)  userData 

Definition at line 30 of file FlutterEmbedderKeyResponderTest.mm.

34 :(const FlutterKeyEvent*)event
36 userData:(nullable void*)userData {
37 self = [super init];
38 _data = new FlutterKeyEvent(*event);
39 if (event->character != nullptr) {
40 size_t len = strlen(event->character);
41 char* character = new char[len + 1];
42 strlcpy(character, event->character, len + 1);
43 _data->character = character;
44 }
45 _callback = callback;
46 _userData = userData;
47 return self;
48}
void(* FlutterKeyEventCallback)(bool, void *)
Definition: embedder.h:1155
FlKeyEvent * event
FlutterKeyEventCallback callback

◆ respond:

- (void) respond: (BOOL handled

Definition at line 30 of file FlutterEmbedderKeyResponderTest.mm.

54 :(BOOL)handled {
55 NSAssert(
56 _callback != nil,
57 @"Improper call to `respond` that does not have a callback."); // Caller's responsibility
58 _callback(handled, _userData);
59}
int BOOL
Definition: windows_types.h:37

Property Documentation

◆ callback

- (FlutterKeyEventCallback) callback
readwritenonatomicassign

Definition at line 29 of file FlutterEmbedderKeyResponderTest.mm.

◆ data

- (FlutterKeyEvent *) data
readwritenonatomicassign

Definition at line 28 of file FlutterEmbedderKeyResponderTest.mm.

◆ userData

- (void *) userData
readwritenonatomicassign

Definition at line 30 of file FlutterEmbedderKeyResponderTest.mm.


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