objc2_app_kit/generated/
NSResponder.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsresponder?language=objc)
12    #[unsafe(super(NSObject))]
13    #[thread_kind = MainThreadOnly]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    pub struct NSResponder;
16);
17
18unsafe impl NSCoding for NSResponder {}
19
20unsafe impl NSObjectProtocol for NSResponder {}
21
22impl NSResponder {
23    extern_methods!(
24        #[unsafe(method(init))]
25        #[unsafe(method_family = init)]
26        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
27
28        #[unsafe(method(initWithCoder:))]
29        #[unsafe(method_family = init)]
30        pub unsafe fn initWithCoder(
31            this: Allocated<Self>,
32            coder: &NSCoder,
33        ) -> Option<Retained<Self>>;
34
35        #[unsafe(method(nextResponder))]
36        #[unsafe(method_family = none)]
37        pub unsafe fn nextResponder(&self) -> Option<Retained<NSResponder>>;
38
39        /// Setter for [`nextResponder`][Self::nextResponder].
40        #[unsafe(method(setNextResponder:))]
41        #[unsafe(method_family = none)]
42        pub unsafe fn setNextResponder(&self, next_responder: Option<&NSResponder>);
43
44        #[unsafe(method(tryToPerform:with:))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn tryToPerform_with(&self, action: Sel, object: Option<&AnyObject>) -> bool;
47
48        #[cfg(feature = "NSEvent")]
49        #[unsafe(method(performKeyEquivalent:))]
50        #[unsafe(method_family = none)]
51        pub unsafe fn performKeyEquivalent(&self, event: &NSEvent) -> bool;
52
53        #[cfg(feature = "NSPasteboard")]
54        #[unsafe(method(validRequestorForSendType:returnType:))]
55        #[unsafe(method_family = none)]
56        pub unsafe fn validRequestorForSendType_returnType(
57            &self,
58            send_type: Option<&NSPasteboardType>,
59            return_type: Option<&NSPasteboardType>,
60        ) -> Option<Retained<AnyObject>>;
61
62        #[cfg(feature = "NSEvent")]
63        #[unsafe(method(mouseDown:))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn mouseDown(&self, event: &NSEvent);
66
67        #[cfg(feature = "NSEvent")]
68        #[unsafe(method(rightMouseDown:))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn rightMouseDown(&self, event: &NSEvent);
71
72        #[cfg(feature = "NSEvent")]
73        #[unsafe(method(otherMouseDown:))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn otherMouseDown(&self, event: &NSEvent);
76
77        #[cfg(feature = "NSEvent")]
78        #[unsafe(method(mouseUp:))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn mouseUp(&self, event: &NSEvent);
81
82        #[cfg(feature = "NSEvent")]
83        #[unsafe(method(rightMouseUp:))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn rightMouseUp(&self, event: &NSEvent);
86
87        #[cfg(feature = "NSEvent")]
88        #[unsafe(method(otherMouseUp:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn otherMouseUp(&self, event: &NSEvent);
91
92        #[cfg(feature = "NSEvent")]
93        #[unsafe(method(mouseMoved:))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn mouseMoved(&self, event: &NSEvent);
96
97        #[cfg(feature = "NSEvent")]
98        #[unsafe(method(mouseDragged:))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn mouseDragged(&self, event: &NSEvent);
101
102        #[cfg(feature = "NSEvent")]
103        #[unsafe(method(scrollWheel:))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn scrollWheel(&self, event: &NSEvent);
106
107        #[cfg(feature = "NSEvent")]
108        #[unsafe(method(rightMouseDragged:))]
109        #[unsafe(method_family = none)]
110        pub unsafe fn rightMouseDragged(&self, event: &NSEvent);
111
112        #[cfg(feature = "NSEvent")]
113        #[unsafe(method(otherMouseDragged:))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn otherMouseDragged(&self, event: &NSEvent);
116
117        #[cfg(feature = "NSEvent")]
118        #[unsafe(method(mouseEntered:))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn mouseEntered(&self, event: &NSEvent);
121
122        #[cfg(feature = "NSEvent")]
123        #[unsafe(method(mouseExited:))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn mouseExited(&self, event: &NSEvent);
126
127        #[cfg(feature = "NSEvent")]
128        #[unsafe(method(keyDown:))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn keyDown(&self, event: &NSEvent);
131
132        #[cfg(feature = "NSEvent")]
133        #[unsafe(method(keyUp:))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn keyUp(&self, event: &NSEvent);
136
137        #[cfg(feature = "NSEvent")]
138        #[unsafe(method(flagsChanged:))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn flagsChanged(&self, event: &NSEvent);
141
142        #[cfg(feature = "NSEvent")]
143        #[unsafe(method(tabletPoint:))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn tabletPoint(&self, event: &NSEvent);
146
147        #[cfg(feature = "NSEvent")]
148        #[unsafe(method(tabletProximity:))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn tabletProximity(&self, event: &NSEvent);
151
152        #[cfg(feature = "NSEvent")]
153        #[unsafe(method(cursorUpdate:))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn cursorUpdate(&self, event: &NSEvent);
156
157        #[cfg(feature = "NSEvent")]
158        #[unsafe(method(magnifyWithEvent:))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn magnifyWithEvent(&self, event: &NSEvent);
161
162        #[cfg(feature = "NSEvent")]
163        #[unsafe(method(rotateWithEvent:))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn rotateWithEvent(&self, event: &NSEvent);
166
167        #[cfg(feature = "NSEvent")]
168        #[unsafe(method(swipeWithEvent:))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn swipeWithEvent(&self, event: &NSEvent);
171
172        #[cfg(feature = "NSEvent")]
173        #[unsafe(method(beginGestureWithEvent:))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn beginGestureWithEvent(&self, event: &NSEvent);
176
177        #[cfg(feature = "NSEvent")]
178        #[unsafe(method(endGestureWithEvent:))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn endGestureWithEvent(&self, event: &NSEvent);
181
182        #[cfg(feature = "NSEvent")]
183        #[unsafe(method(smartMagnifyWithEvent:))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn smartMagnifyWithEvent(&self, event: &NSEvent);
186
187        #[cfg(feature = "NSEvent")]
188        #[unsafe(method(changeModeWithEvent:))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn changeModeWithEvent(&self, event: &NSEvent);
191
192        #[cfg(feature = "NSEvent")]
193        #[unsafe(method(touchesBeganWithEvent:))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn touchesBeganWithEvent(&self, event: &NSEvent);
196
197        #[cfg(feature = "NSEvent")]
198        #[unsafe(method(touchesMovedWithEvent:))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn touchesMovedWithEvent(&self, event: &NSEvent);
201
202        #[cfg(feature = "NSEvent")]
203        #[unsafe(method(touchesEndedWithEvent:))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn touchesEndedWithEvent(&self, event: &NSEvent);
206
207        #[cfg(feature = "NSEvent")]
208        #[unsafe(method(touchesCancelledWithEvent:))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn touchesCancelledWithEvent(&self, event: &NSEvent);
211
212        #[cfg(feature = "NSEvent")]
213        #[unsafe(method(quickLookWithEvent:))]
214        #[unsafe(method_family = none)]
215        pub unsafe fn quickLookWithEvent(&self, event: &NSEvent);
216
217        #[cfg(feature = "NSEvent")]
218        #[unsafe(method(pressureChangeWithEvent:))]
219        #[unsafe(method_family = none)]
220        pub unsafe fn pressureChangeWithEvent(&self, event: &NSEvent);
221
222        #[cfg(feature = "NSEvent")]
223        /// Handle a key event that should present a context menu at the user focus.
224        ///
225        /// Most applications should not override this method. Instead, you should customize the context menu displayed from a keyboard event by implementing `menuForEvent:` and `selectionAnchorRect`, or `showContextMenuForSelection:`, rather than this method.
226        ///
227        /// You should only override this method when you do not want the system-provided default behavior for the context menu hotkey, either for a specific key combination, or for the hotkey in general. For example, if your application already provides a different behavior for control-Return (the default context menu hotkey definition), and you want to preserve that behavior, you should override this method to handle that specific key combination, and then return without calling `super`. Note that the user may customize the hotkey to a different key combination, so in this example, if any other key combination is passed to your method, you would call `super`.
228        ///
229        /// An implementation of this method should call `[super contextMenuKeyDown:event]` to pass the request up the responder chain. If the message reaches the application object, NSApplication's implementation of this method will send `showContextMenuForSelection:` to the responder chain. If you do not call `super`, then no further handling of the key event will be performed.
230        ///
231        ///
232        /// Note: In some cases, `showContextMenuForSelection:` will be called without a prior call to `contextMenuKeyDown:`. This occurs when a view receives an Accessibility ShowMenu action, or when the user has created a Cocoa Text key binding to map a different key combination to the `showContextMenuForSelection:` action.
233        ///
234        ///
235        /// Parameter `event`: The key down event that matches the system-wide context menu hotkey combination.
236        ///
237        ///
238        /// See also: `showContextMenuForSelection:`
239        #[unsafe(method(contextMenuKeyDown:))]
240        #[unsafe(method_family = none)]
241        pub unsafe fn contextMenuKeyDown(&self, event: &NSEvent);
242
243        #[unsafe(method(noResponderFor:))]
244        #[unsafe(method_family = none)]
245        pub unsafe fn noResponderFor(&self, event_selector: Sel);
246
247        #[unsafe(method(acceptsFirstResponder))]
248        #[unsafe(method_family = none)]
249        pub unsafe fn acceptsFirstResponder(&self) -> bool;
250
251        #[unsafe(method(becomeFirstResponder))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn becomeFirstResponder(&self) -> bool;
254
255        #[unsafe(method(resignFirstResponder))]
256        #[unsafe(method_family = none)]
257        pub unsafe fn resignFirstResponder(&self) -> bool;
258
259        #[cfg(feature = "NSEvent")]
260        #[unsafe(method(interpretKeyEvents:))]
261        #[unsafe(method_family = none)]
262        pub unsafe fn interpretKeyEvents(&self, event_array: &NSArray<NSEvent>);
263
264        #[unsafe(method(flushBufferedKeyEvents))]
265        #[unsafe(method_family = none)]
266        pub unsafe fn flushBufferedKeyEvents(&self);
267
268        #[cfg(feature = "NSMenu")]
269        #[unsafe(method(menu))]
270        #[unsafe(method_family = none)]
271        pub unsafe fn menu(&self) -> Option<Retained<NSMenu>>;
272
273        #[cfg(feature = "NSMenu")]
274        /// Setter for [`menu`][Self::menu].
275        #[unsafe(method(setMenu:))]
276        #[unsafe(method_family = none)]
277        pub unsafe fn setMenu(&self, menu: Option<&NSMenu>);
278
279        #[unsafe(method(showContextHelp:))]
280        #[unsafe(method_family = none)]
281        pub unsafe fn showContextHelp(&self, sender: Option<&AnyObject>);
282
283        #[cfg(feature = "NSEvent")]
284        #[unsafe(method(helpRequested:))]
285        #[unsafe(method_family = none)]
286        pub unsafe fn helpRequested(&self, event_ptr: &NSEvent);
287
288        #[cfg(feature = "NSEvent")]
289        #[unsafe(method(shouldBeTreatedAsInkEvent:))]
290        #[unsafe(method_family = none)]
291        pub unsafe fn shouldBeTreatedAsInkEvent(&self, event: &NSEvent) -> bool;
292
293        #[cfg(feature = "NSEvent")]
294        #[unsafe(method(wantsScrollEventsForSwipeTrackingOnAxis:))]
295        #[unsafe(method_family = none)]
296        pub unsafe fn wantsScrollEventsForSwipeTrackingOnAxis(
297            &self,
298            axis: NSEventGestureAxis,
299        ) -> bool;
300
301        #[cfg(feature = "NSEvent")]
302        #[unsafe(method(wantsForwardedScrollEventsForAxis:))]
303        #[unsafe(method_family = none)]
304        pub unsafe fn wantsForwardedScrollEventsForAxis(&self, axis: NSEventGestureAxis) -> bool;
305
306        #[unsafe(method(supplementalTargetForAction:sender:))]
307        #[unsafe(method_family = none)]
308        pub unsafe fn supplementalTargetForAction_sender(
309            &self,
310            action: Sel,
311            sender: Option<&AnyObject>,
312        ) -> Option<Retained<AnyObject>>;
313    );
314}
315
316/// Methods declared on superclass `NSObject`.
317impl NSResponder {
318    extern_methods!(
319        #[unsafe(method(new))]
320        #[unsafe(method_family = new)]
321        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
322    );
323}
324
325extern_protocol!(
326    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsstandardkeybindingresponding?language=objc)
327    pub unsafe trait NSStandardKeyBindingResponding:
328        NSObjectProtocol + MainThreadOnly
329    {
330        /// *********************** Key binding entry-points ************************
331        #[optional]
332        #[unsafe(method(insertText:))]
333        #[unsafe(method_family = none)]
334        unsafe fn insertText(&self, insert_string: &AnyObject);
335
336        #[optional]
337        #[unsafe(method(doCommandBySelector:))]
338        #[unsafe(method_family = none)]
339        unsafe fn doCommandBySelector(&self, selector: Sel);
340
341        /// *********************** Standard bindable commands ************************
342        #[optional]
343        #[unsafe(method(moveForward:))]
344        #[unsafe(method_family = none)]
345        unsafe fn moveForward(&self, sender: Option<&AnyObject>);
346
347        #[optional]
348        #[unsafe(method(moveRight:))]
349        #[unsafe(method_family = none)]
350        unsafe fn moveRight(&self, sender: Option<&AnyObject>);
351
352        #[optional]
353        #[unsafe(method(moveBackward:))]
354        #[unsafe(method_family = none)]
355        unsafe fn moveBackward(&self, sender: Option<&AnyObject>);
356
357        #[optional]
358        #[unsafe(method(moveLeft:))]
359        #[unsafe(method_family = none)]
360        unsafe fn moveLeft(&self, sender: Option<&AnyObject>);
361
362        #[optional]
363        #[unsafe(method(moveUp:))]
364        #[unsafe(method_family = none)]
365        unsafe fn moveUp(&self, sender: Option<&AnyObject>);
366
367        #[optional]
368        #[unsafe(method(moveDown:))]
369        #[unsafe(method_family = none)]
370        unsafe fn moveDown(&self, sender: Option<&AnyObject>);
371
372        #[optional]
373        #[unsafe(method(moveWordForward:))]
374        #[unsafe(method_family = none)]
375        unsafe fn moveWordForward(&self, sender: Option<&AnyObject>);
376
377        #[optional]
378        #[unsafe(method(moveWordBackward:))]
379        #[unsafe(method_family = none)]
380        unsafe fn moveWordBackward(&self, sender: Option<&AnyObject>);
381
382        #[optional]
383        #[unsafe(method(moveToBeginningOfLine:))]
384        #[unsafe(method_family = none)]
385        unsafe fn moveToBeginningOfLine(&self, sender: Option<&AnyObject>);
386
387        #[optional]
388        #[unsafe(method(moveToEndOfLine:))]
389        #[unsafe(method_family = none)]
390        unsafe fn moveToEndOfLine(&self, sender: Option<&AnyObject>);
391
392        #[optional]
393        #[unsafe(method(moveToBeginningOfParagraph:))]
394        #[unsafe(method_family = none)]
395        unsafe fn moveToBeginningOfParagraph(&self, sender: Option<&AnyObject>);
396
397        #[optional]
398        #[unsafe(method(moveToEndOfParagraph:))]
399        #[unsafe(method_family = none)]
400        unsafe fn moveToEndOfParagraph(&self, sender: Option<&AnyObject>);
401
402        #[optional]
403        #[unsafe(method(moveToEndOfDocument:))]
404        #[unsafe(method_family = none)]
405        unsafe fn moveToEndOfDocument(&self, sender: Option<&AnyObject>);
406
407        #[optional]
408        #[unsafe(method(moveToBeginningOfDocument:))]
409        #[unsafe(method_family = none)]
410        unsafe fn moveToBeginningOfDocument(&self, sender: Option<&AnyObject>);
411
412        #[optional]
413        #[unsafe(method(pageDown:))]
414        #[unsafe(method_family = none)]
415        unsafe fn pageDown(&self, sender: Option<&AnyObject>);
416
417        #[optional]
418        #[unsafe(method(pageUp:))]
419        #[unsafe(method_family = none)]
420        unsafe fn pageUp(&self, sender: Option<&AnyObject>);
421
422        #[optional]
423        #[unsafe(method(centerSelectionInVisibleArea:))]
424        #[unsafe(method_family = none)]
425        unsafe fn centerSelectionInVisibleArea(&self, sender: Option<&AnyObject>);
426
427        #[optional]
428        #[unsafe(method(moveBackwardAndModifySelection:))]
429        #[unsafe(method_family = none)]
430        unsafe fn moveBackwardAndModifySelection(&self, sender: Option<&AnyObject>);
431
432        #[optional]
433        #[unsafe(method(moveForwardAndModifySelection:))]
434        #[unsafe(method_family = none)]
435        unsafe fn moveForwardAndModifySelection(&self, sender: Option<&AnyObject>);
436
437        #[optional]
438        #[unsafe(method(moveWordForwardAndModifySelection:))]
439        #[unsafe(method_family = none)]
440        unsafe fn moveWordForwardAndModifySelection(&self, sender: Option<&AnyObject>);
441
442        #[optional]
443        #[unsafe(method(moveWordBackwardAndModifySelection:))]
444        #[unsafe(method_family = none)]
445        unsafe fn moveWordBackwardAndModifySelection(&self, sender: Option<&AnyObject>);
446
447        #[optional]
448        #[unsafe(method(moveUpAndModifySelection:))]
449        #[unsafe(method_family = none)]
450        unsafe fn moveUpAndModifySelection(&self, sender: Option<&AnyObject>);
451
452        #[optional]
453        #[unsafe(method(moveDownAndModifySelection:))]
454        #[unsafe(method_family = none)]
455        unsafe fn moveDownAndModifySelection(&self, sender: Option<&AnyObject>);
456
457        #[optional]
458        #[unsafe(method(moveToBeginningOfLineAndModifySelection:))]
459        #[unsafe(method_family = none)]
460        unsafe fn moveToBeginningOfLineAndModifySelection(&self, sender: Option<&AnyObject>);
461
462        #[optional]
463        #[unsafe(method(moveToEndOfLineAndModifySelection:))]
464        #[unsafe(method_family = none)]
465        unsafe fn moveToEndOfLineAndModifySelection(&self, sender: Option<&AnyObject>);
466
467        #[optional]
468        #[unsafe(method(moveToBeginningOfParagraphAndModifySelection:))]
469        #[unsafe(method_family = none)]
470        unsafe fn moveToBeginningOfParagraphAndModifySelection(&self, sender: Option<&AnyObject>);
471
472        #[optional]
473        #[unsafe(method(moveToEndOfParagraphAndModifySelection:))]
474        #[unsafe(method_family = none)]
475        unsafe fn moveToEndOfParagraphAndModifySelection(&self, sender: Option<&AnyObject>);
476
477        #[optional]
478        #[unsafe(method(moveToEndOfDocumentAndModifySelection:))]
479        #[unsafe(method_family = none)]
480        unsafe fn moveToEndOfDocumentAndModifySelection(&self, sender: Option<&AnyObject>);
481
482        #[optional]
483        #[unsafe(method(moveToBeginningOfDocumentAndModifySelection:))]
484        #[unsafe(method_family = none)]
485        unsafe fn moveToBeginningOfDocumentAndModifySelection(&self, sender: Option<&AnyObject>);
486
487        #[optional]
488        #[unsafe(method(pageDownAndModifySelection:))]
489        #[unsafe(method_family = none)]
490        unsafe fn pageDownAndModifySelection(&self, sender: Option<&AnyObject>);
491
492        #[optional]
493        #[unsafe(method(pageUpAndModifySelection:))]
494        #[unsafe(method_family = none)]
495        unsafe fn pageUpAndModifySelection(&self, sender: Option<&AnyObject>);
496
497        #[optional]
498        #[unsafe(method(moveParagraphForwardAndModifySelection:))]
499        #[unsafe(method_family = none)]
500        unsafe fn moveParagraphForwardAndModifySelection(&self, sender: Option<&AnyObject>);
501
502        #[optional]
503        #[unsafe(method(moveParagraphBackwardAndModifySelection:))]
504        #[unsafe(method_family = none)]
505        unsafe fn moveParagraphBackwardAndModifySelection(&self, sender: Option<&AnyObject>);
506
507        #[optional]
508        #[unsafe(method(moveWordRight:))]
509        #[unsafe(method_family = none)]
510        unsafe fn moveWordRight(&self, sender: Option<&AnyObject>);
511
512        #[optional]
513        #[unsafe(method(moveWordLeft:))]
514        #[unsafe(method_family = none)]
515        unsafe fn moveWordLeft(&self, sender: Option<&AnyObject>);
516
517        #[optional]
518        #[unsafe(method(moveRightAndModifySelection:))]
519        #[unsafe(method_family = none)]
520        unsafe fn moveRightAndModifySelection(&self, sender: Option<&AnyObject>);
521
522        #[optional]
523        #[unsafe(method(moveLeftAndModifySelection:))]
524        #[unsafe(method_family = none)]
525        unsafe fn moveLeftAndModifySelection(&self, sender: Option<&AnyObject>);
526
527        #[optional]
528        #[unsafe(method(moveWordRightAndModifySelection:))]
529        #[unsafe(method_family = none)]
530        unsafe fn moveWordRightAndModifySelection(&self, sender: Option<&AnyObject>);
531
532        #[optional]
533        #[unsafe(method(moveWordLeftAndModifySelection:))]
534        #[unsafe(method_family = none)]
535        unsafe fn moveWordLeftAndModifySelection(&self, sender: Option<&AnyObject>);
536
537        #[optional]
538        #[unsafe(method(moveToLeftEndOfLine:))]
539        #[unsafe(method_family = none)]
540        unsafe fn moveToLeftEndOfLine(&self, sender: Option<&AnyObject>);
541
542        #[optional]
543        #[unsafe(method(moveToRightEndOfLine:))]
544        #[unsafe(method_family = none)]
545        unsafe fn moveToRightEndOfLine(&self, sender: Option<&AnyObject>);
546
547        #[optional]
548        #[unsafe(method(moveToLeftEndOfLineAndModifySelection:))]
549        #[unsafe(method_family = none)]
550        unsafe fn moveToLeftEndOfLineAndModifySelection(&self, sender: Option<&AnyObject>);
551
552        #[optional]
553        #[unsafe(method(moveToRightEndOfLineAndModifySelection:))]
554        #[unsafe(method_family = none)]
555        unsafe fn moveToRightEndOfLineAndModifySelection(&self, sender: Option<&AnyObject>);
556
557        #[optional]
558        #[unsafe(method(scrollPageUp:))]
559        #[unsafe(method_family = none)]
560        unsafe fn scrollPageUp(&self, sender: Option<&AnyObject>);
561
562        #[optional]
563        #[unsafe(method(scrollPageDown:))]
564        #[unsafe(method_family = none)]
565        unsafe fn scrollPageDown(&self, sender: Option<&AnyObject>);
566
567        #[optional]
568        #[unsafe(method(scrollLineUp:))]
569        #[unsafe(method_family = none)]
570        unsafe fn scrollLineUp(&self, sender: Option<&AnyObject>);
571
572        #[optional]
573        #[unsafe(method(scrollLineDown:))]
574        #[unsafe(method_family = none)]
575        unsafe fn scrollLineDown(&self, sender: Option<&AnyObject>);
576
577        #[optional]
578        #[unsafe(method(scrollToBeginningOfDocument:))]
579        #[unsafe(method_family = none)]
580        unsafe fn scrollToBeginningOfDocument(&self, sender: Option<&AnyObject>);
581
582        #[optional]
583        #[unsafe(method(scrollToEndOfDocument:))]
584        #[unsafe(method_family = none)]
585        unsafe fn scrollToEndOfDocument(&self, sender: Option<&AnyObject>);
586
587        #[optional]
588        #[unsafe(method(transpose:))]
589        #[unsafe(method_family = none)]
590        unsafe fn transpose(&self, sender: Option<&AnyObject>);
591
592        #[optional]
593        #[unsafe(method(transposeWords:))]
594        #[unsafe(method_family = none)]
595        unsafe fn transposeWords(&self, sender: Option<&AnyObject>);
596
597        #[optional]
598        #[unsafe(method(selectAll:))]
599        #[unsafe(method_family = none)]
600        unsafe fn selectAll(&self, sender: Option<&AnyObject>);
601
602        #[optional]
603        #[unsafe(method(selectParagraph:))]
604        #[unsafe(method_family = none)]
605        unsafe fn selectParagraph(&self, sender: Option<&AnyObject>);
606
607        #[optional]
608        #[unsafe(method(selectLine:))]
609        #[unsafe(method_family = none)]
610        unsafe fn selectLine(&self, sender: Option<&AnyObject>);
611
612        #[optional]
613        #[unsafe(method(selectWord:))]
614        #[unsafe(method_family = none)]
615        unsafe fn selectWord(&self, sender: Option<&AnyObject>);
616
617        #[optional]
618        #[unsafe(method(indent:))]
619        #[unsafe(method_family = none)]
620        unsafe fn indent(&self, sender: Option<&AnyObject>);
621
622        #[optional]
623        #[unsafe(method(insertTab:))]
624        #[unsafe(method_family = none)]
625        unsafe fn insertTab(&self, sender: Option<&AnyObject>);
626
627        #[optional]
628        #[unsafe(method(insertBacktab:))]
629        #[unsafe(method_family = none)]
630        unsafe fn insertBacktab(&self, sender: Option<&AnyObject>);
631
632        #[optional]
633        #[unsafe(method(insertNewline:))]
634        #[unsafe(method_family = none)]
635        unsafe fn insertNewline(&self, sender: Option<&AnyObject>);
636
637        #[optional]
638        #[unsafe(method(insertParagraphSeparator:))]
639        #[unsafe(method_family = none)]
640        unsafe fn insertParagraphSeparator(&self, sender: Option<&AnyObject>);
641
642        #[optional]
643        #[unsafe(method(insertNewlineIgnoringFieldEditor:))]
644        #[unsafe(method_family = none)]
645        unsafe fn insertNewlineIgnoringFieldEditor(&self, sender: Option<&AnyObject>);
646
647        #[optional]
648        #[unsafe(method(insertTabIgnoringFieldEditor:))]
649        #[unsafe(method_family = none)]
650        unsafe fn insertTabIgnoringFieldEditor(&self, sender: Option<&AnyObject>);
651
652        #[optional]
653        #[unsafe(method(insertLineBreak:))]
654        #[unsafe(method_family = none)]
655        unsafe fn insertLineBreak(&self, sender: Option<&AnyObject>);
656
657        #[optional]
658        #[unsafe(method(insertContainerBreak:))]
659        #[unsafe(method_family = none)]
660        unsafe fn insertContainerBreak(&self, sender: Option<&AnyObject>);
661
662        #[optional]
663        #[unsafe(method(insertSingleQuoteIgnoringSubstitution:))]
664        #[unsafe(method_family = none)]
665        unsafe fn insertSingleQuoteIgnoringSubstitution(&self, sender: Option<&AnyObject>);
666
667        #[optional]
668        #[unsafe(method(insertDoubleQuoteIgnoringSubstitution:))]
669        #[unsafe(method_family = none)]
670        unsafe fn insertDoubleQuoteIgnoringSubstitution(&self, sender: Option<&AnyObject>);
671
672        #[optional]
673        #[unsafe(method(changeCaseOfLetter:))]
674        #[unsafe(method_family = none)]
675        unsafe fn changeCaseOfLetter(&self, sender: Option<&AnyObject>);
676
677        #[optional]
678        #[unsafe(method(uppercaseWord:))]
679        #[unsafe(method_family = none)]
680        unsafe fn uppercaseWord(&self, sender: Option<&AnyObject>);
681
682        #[optional]
683        #[unsafe(method(lowercaseWord:))]
684        #[unsafe(method_family = none)]
685        unsafe fn lowercaseWord(&self, sender: Option<&AnyObject>);
686
687        #[optional]
688        #[unsafe(method(capitalizeWord:))]
689        #[unsafe(method_family = none)]
690        unsafe fn capitalizeWord(&self, sender: Option<&AnyObject>);
691
692        #[optional]
693        #[unsafe(method(deleteForward:))]
694        #[unsafe(method_family = none)]
695        unsafe fn deleteForward(&self, sender: Option<&AnyObject>);
696
697        #[optional]
698        #[unsafe(method(deleteBackward:))]
699        #[unsafe(method_family = none)]
700        unsafe fn deleteBackward(&self, sender: Option<&AnyObject>);
701
702        #[optional]
703        #[unsafe(method(deleteBackwardByDecomposingPreviousCharacter:))]
704        #[unsafe(method_family = none)]
705        unsafe fn deleteBackwardByDecomposingPreviousCharacter(&self, sender: Option<&AnyObject>);
706
707        #[optional]
708        #[unsafe(method(deleteWordForward:))]
709        #[unsafe(method_family = none)]
710        unsafe fn deleteWordForward(&self, sender: Option<&AnyObject>);
711
712        #[optional]
713        #[unsafe(method(deleteWordBackward:))]
714        #[unsafe(method_family = none)]
715        unsafe fn deleteWordBackward(&self, sender: Option<&AnyObject>);
716
717        #[optional]
718        #[unsafe(method(deleteToBeginningOfLine:))]
719        #[unsafe(method_family = none)]
720        unsafe fn deleteToBeginningOfLine(&self, sender: Option<&AnyObject>);
721
722        #[optional]
723        #[unsafe(method(deleteToEndOfLine:))]
724        #[unsafe(method_family = none)]
725        unsafe fn deleteToEndOfLine(&self, sender: Option<&AnyObject>);
726
727        #[optional]
728        #[unsafe(method(deleteToBeginningOfParagraph:))]
729        #[unsafe(method_family = none)]
730        unsafe fn deleteToBeginningOfParagraph(&self, sender: Option<&AnyObject>);
731
732        #[optional]
733        #[unsafe(method(deleteToEndOfParagraph:))]
734        #[unsafe(method_family = none)]
735        unsafe fn deleteToEndOfParagraph(&self, sender: Option<&AnyObject>);
736
737        #[optional]
738        #[unsafe(method(yank:))]
739        #[unsafe(method_family = none)]
740        unsafe fn yank(&self, sender: Option<&AnyObject>);
741
742        #[optional]
743        #[unsafe(method(complete:))]
744        #[unsafe(method_family = none)]
745        unsafe fn complete(&self, sender: Option<&AnyObject>);
746
747        #[optional]
748        #[unsafe(method(setMark:))]
749        #[unsafe(method_family = none)]
750        unsafe fn setMark(&self, sender: Option<&AnyObject>);
751
752        #[optional]
753        #[unsafe(method(deleteToMark:))]
754        #[unsafe(method_family = none)]
755        unsafe fn deleteToMark(&self, sender: Option<&AnyObject>);
756
757        #[optional]
758        #[unsafe(method(selectToMark:))]
759        #[unsafe(method_family = none)]
760        unsafe fn selectToMark(&self, sender: Option<&AnyObject>);
761
762        #[optional]
763        #[unsafe(method(swapWithMark:))]
764        #[unsafe(method_family = none)]
765        unsafe fn swapWithMark(&self, sender: Option<&AnyObject>);
766
767        #[optional]
768        #[unsafe(method(cancelOperation:))]
769        #[unsafe(method_family = none)]
770        unsafe fn cancelOperation(&self, sender: Option<&AnyObject>);
771
772        #[optional]
773        #[unsafe(method(makeBaseWritingDirectionNatural:))]
774        #[unsafe(method_family = none)]
775        unsafe fn makeBaseWritingDirectionNatural(&self, sender: Option<&AnyObject>);
776
777        #[optional]
778        #[unsafe(method(makeBaseWritingDirectionLeftToRight:))]
779        #[unsafe(method_family = none)]
780        unsafe fn makeBaseWritingDirectionLeftToRight(&self, sender: Option<&AnyObject>);
781
782        #[optional]
783        #[unsafe(method(makeBaseWritingDirectionRightToLeft:))]
784        #[unsafe(method_family = none)]
785        unsafe fn makeBaseWritingDirectionRightToLeft(&self, sender: Option<&AnyObject>);
786
787        #[optional]
788        #[unsafe(method(makeTextWritingDirectionNatural:))]
789        #[unsafe(method_family = none)]
790        unsafe fn makeTextWritingDirectionNatural(&self, sender: Option<&AnyObject>);
791
792        #[optional]
793        #[unsafe(method(makeTextWritingDirectionLeftToRight:))]
794        #[unsafe(method_family = none)]
795        unsafe fn makeTextWritingDirectionLeftToRight(&self, sender: Option<&AnyObject>);
796
797        #[optional]
798        #[unsafe(method(makeTextWritingDirectionRightToLeft:))]
799        #[unsafe(method_family = none)]
800        unsafe fn makeTextWritingDirectionRightToLeft(&self, sender: Option<&AnyObject>);
801
802        #[optional]
803        #[unsafe(method(quickLookPreviewItems:))]
804        #[unsafe(method_family = none)]
805        unsafe fn quickLookPreviewItems(&self, sender: Option<&AnyObject>);
806
807        /// Present a context menu at the text cursor position, selection, or wherever is appropriate for your responder.
808        ///
809        /// NSView has a default implementation of this method. For any view that returns a non-nil value from `-menuForEvent:`, the default implementation will display that menu automatically. The NSView implementation uses the `selectionAnchorRect` method in the `NSViewContentSelectionInfo` protocol to determine the location of the selection and of the menu. The NSView implementation determines the menu to display by calling `menuForEvent:` with a right-mouse-down event that is centered on the anchor rect. If `selectionAnchorRect` is not implemented, then the NSView implementation calls `menuForEvent` with a right-mouse-down event that is centered on the view's bounds, and also displays the menu at that location.
810        ///
811        /// You should only override this method in a custom view if you need full control over the display of a context menu from the keyboard or Accessibility, beyond what is provided by default by NSView.
812        ///
813        /// If the view does not support a context menu, then you should call `[[self nextResponder] tryToPerform:_cmd with:sender]` to pass the request up the responder chain.
814        ///
815        ///
816        /// Note: In some cases, this method will be called without a prior call to `contextMenuKeyDown:`. This occurs when a view receives an Accessibility ShowMenu action, or when the user has created a Cocoa Text key binding to map a different key combination to the `showContextMenuForSelection:` action.
817        ///
818        ///
819        /// Parameter `sender`: The object that originated the display of the context menu.
820        ///
821        ///
822        /// See also: `menuForEvent:`
823        ///
824        /// See also: `selectionAnchorRect`
825        ///
826        /// See also: `contextMenuKeyDown:`
827        #[optional]
828        #[unsafe(method(showContextMenuForSelection:))]
829        #[unsafe(method_family = none)]
830        unsafe fn showContextMenuForSelection(&self, sender: Option<&AnyObject>);
831    }
832);
833
834/// NSStandardKeyBindingMethods.
835impl NSResponder {
836    extern_methods!();
837}
838
839unsafe impl NSStandardKeyBindingResponding for NSResponder {}
840
841/// NSUndoSupport.
842impl NSResponder {
843    extern_methods!(
844        #[unsafe(method(undoManager))]
845        #[unsafe(method_family = none)]
846        pub unsafe fn undoManager(&self) -> Option<Retained<NSUndoManager>>;
847    );
848}
849
850/// NSControlEditingSupport.
851impl NSResponder {
852    extern_methods!(
853        #[cfg(feature = "NSEvent")]
854        #[unsafe(method(validateProposedFirstResponder:forEvent:))]
855        #[unsafe(method_family = none)]
856        pub unsafe fn validateProposedFirstResponder_forEvent(
857            &self,
858            responder: &NSResponder,
859            event: Option<&NSEvent>,
860        ) -> bool;
861    );
862}
863
864/// NSErrorPresentation.
865impl NSResponder {
866    extern_methods!(
867        #[cfg(feature = "NSWindow")]
868        #[unsafe(method(presentError:modalForWindow:delegate:didPresentSelector:contextInfo:))]
869        #[unsafe(method_family = none)]
870        pub unsafe fn presentError_modalForWindow_delegate_didPresentSelector_contextInfo(
871            &self,
872            error: &NSError,
873            window: &NSWindow,
874            delegate: Option<&AnyObject>,
875            did_present_selector: Option<Sel>,
876            context_info: *mut c_void,
877        );
878
879        #[unsafe(method(presentError:))]
880        #[unsafe(method_family = none)]
881        pub unsafe fn presentError(&self, error: &NSError) -> bool;
882
883        #[unsafe(method(willPresentError:))]
884        #[unsafe(method_family = none)]
885        pub unsafe fn willPresentError(&self, error: &NSError) -> Retained<NSError>;
886    );
887}
888
889/// NSTextFinderSupport.
890impl NSResponder {
891    extern_methods!(
892        #[unsafe(method(performTextFinderAction:))]
893        #[unsafe(method_family = none)]
894        pub unsafe fn performTextFinderAction(&self, sender: Option<&AnyObject>);
895    );
896}
897
898/// NSWindowTabbing.
899impl NSResponder {
900    extern_methods!(
901        #[unsafe(method(newWindowForTab:))]
902        #[unsafe(method_family = none)]
903        pub unsafe fn newWindowForTab(&self, sender: Option<&AnyObject>);
904    );
905}
906
907/// NSWritingToolsSupport.
908impl NSResponder {
909    extern_methods!(
910        #[unsafe(method(showWritingTools:))]
911        #[unsafe(method_family = none)]
912        pub unsafe fn showWritingTools(&self, sender: Option<&AnyObject>);
913    );
914}
915
916/// NSDeprecated.
917impl NSResponder {
918    extern_methods!(
919        #[deprecated = "This has always returned NO and had no effect on macOS"]
920        #[unsafe(method(performMnemonic:))]
921        #[unsafe(method_family = none)]
922        pub unsafe fn performMnemonic(&self, string: &NSString) -> bool;
923    );
924}