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
18extern_conformance!(
19    unsafe impl NSCoding for NSResponder {}
20);
21
22extern_conformance!(
23    unsafe impl NSObjectProtocol for NSResponder {}
24);
25
26impl NSResponder {
27    extern_methods!(
28        #[unsafe(method(init))]
29        #[unsafe(method_family = init)]
30        pub fn init(this: Allocated<Self>) -> Retained<Self>;
31
32        /// # Safety
33        ///
34        /// `coder` possibly has further requirements.
35        #[unsafe(method(initWithCoder:))]
36        #[unsafe(method_family = init)]
37        pub unsafe fn initWithCoder(
38            this: Allocated<Self>,
39            coder: &NSCoder,
40        ) -> Option<Retained<Self>>;
41
42        /// # Safety
43        ///
44        /// This is not retained internally, you must ensure the object is still alive.
45        #[unsafe(method(nextResponder))]
46        #[unsafe(method_family = none)]
47        pub unsafe fn nextResponder(&self) -> Option<Retained<NSResponder>>;
48
49        /// Setter for [`nextResponder`][Self::nextResponder].
50        ///
51        /// # Safety
52        ///
53        /// This is unretained, you must ensure the object is kept alive while in use.
54        #[unsafe(method(setNextResponder:))]
55        #[unsafe(method_family = none)]
56        pub unsafe fn setNextResponder(&self, next_responder: Option<&NSResponder>);
57
58        /// # Safety
59        ///
60        /// - `action` must be a valid selector.
61        /// - `object` should be of the correct type.
62        #[unsafe(method(tryToPerform:with:))]
63        #[unsafe(method_family = none)]
64        pub unsafe fn tryToPerform_with(&self, action: Sel, object: Option<&AnyObject>) -> bool;
65
66        #[cfg(feature = "NSEvent")]
67        #[unsafe(method(performKeyEquivalent:))]
68        #[unsafe(method_family = none)]
69        pub fn performKeyEquivalent(&self, event: &NSEvent) -> bool;
70
71        #[cfg(feature = "NSPasteboard")]
72        #[unsafe(method(validRequestorForSendType:returnType:))]
73        #[unsafe(method_family = none)]
74        pub fn validRequestorForSendType_returnType(
75            &self,
76            send_type: Option<&NSPasteboardType>,
77            return_type: Option<&NSPasteboardType>,
78        ) -> Option<Retained<AnyObject>>;
79
80        #[cfg(feature = "NSEvent")]
81        #[unsafe(method(mouseDown:))]
82        #[unsafe(method_family = none)]
83        pub fn mouseDown(&self, event: &NSEvent);
84
85        #[cfg(feature = "NSEvent")]
86        #[unsafe(method(rightMouseDown:))]
87        #[unsafe(method_family = none)]
88        pub fn rightMouseDown(&self, event: &NSEvent);
89
90        #[cfg(feature = "NSEvent")]
91        #[unsafe(method(otherMouseDown:))]
92        #[unsafe(method_family = none)]
93        pub fn otherMouseDown(&self, event: &NSEvent);
94
95        #[cfg(feature = "NSEvent")]
96        #[unsafe(method(mouseUp:))]
97        #[unsafe(method_family = none)]
98        pub fn mouseUp(&self, event: &NSEvent);
99
100        #[cfg(feature = "NSEvent")]
101        #[unsafe(method(rightMouseUp:))]
102        #[unsafe(method_family = none)]
103        pub fn rightMouseUp(&self, event: &NSEvent);
104
105        #[cfg(feature = "NSEvent")]
106        #[unsafe(method(otherMouseUp:))]
107        #[unsafe(method_family = none)]
108        pub fn otherMouseUp(&self, event: &NSEvent);
109
110        #[cfg(feature = "NSEvent")]
111        #[unsafe(method(mouseMoved:))]
112        #[unsafe(method_family = none)]
113        pub fn mouseMoved(&self, event: &NSEvent);
114
115        #[cfg(feature = "NSEvent")]
116        #[unsafe(method(mouseDragged:))]
117        #[unsafe(method_family = none)]
118        pub fn mouseDragged(&self, event: &NSEvent);
119
120        #[cfg(feature = "NSEvent")]
121        #[unsafe(method(mouseCancelled:))]
122        #[unsafe(method_family = none)]
123        pub fn mouseCancelled(&self, event: &NSEvent);
124
125        #[cfg(feature = "NSEvent")]
126        #[unsafe(method(scrollWheel:))]
127        #[unsafe(method_family = none)]
128        pub fn scrollWheel(&self, event: &NSEvent);
129
130        #[cfg(feature = "NSEvent")]
131        #[unsafe(method(rightMouseDragged:))]
132        #[unsafe(method_family = none)]
133        pub fn rightMouseDragged(&self, event: &NSEvent);
134
135        #[cfg(feature = "NSEvent")]
136        #[unsafe(method(otherMouseDragged:))]
137        #[unsafe(method_family = none)]
138        pub fn otherMouseDragged(&self, event: &NSEvent);
139
140        #[cfg(feature = "NSEvent")]
141        #[unsafe(method(mouseEntered:))]
142        #[unsafe(method_family = none)]
143        pub fn mouseEntered(&self, event: &NSEvent);
144
145        #[cfg(feature = "NSEvent")]
146        #[unsafe(method(mouseExited:))]
147        #[unsafe(method_family = none)]
148        pub fn mouseExited(&self, event: &NSEvent);
149
150        #[cfg(feature = "NSEvent")]
151        #[unsafe(method(keyDown:))]
152        #[unsafe(method_family = none)]
153        pub fn keyDown(&self, event: &NSEvent);
154
155        #[cfg(feature = "NSEvent")]
156        #[unsafe(method(keyUp:))]
157        #[unsafe(method_family = none)]
158        pub fn keyUp(&self, event: &NSEvent);
159
160        #[cfg(feature = "NSEvent")]
161        #[unsafe(method(flagsChanged:))]
162        #[unsafe(method_family = none)]
163        pub fn flagsChanged(&self, event: &NSEvent);
164
165        #[cfg(feature = "NSEvent")]
166        #[unsafe(method(tabletPoint:))]
167        #[unsafe(method_family = none)]
168        pub fn tabletPoint(&self, event: &NSEvent);
169
170        #[cfg(feature = "NSEvent")]
171        #[unsafe(method(tabletProximity:))]
172        #[unsafe(method_family = none)]
173        pub fn tabletProximity(&self, event: &NSEvent);
174
175        #[cfg(feature = "NSEvent")]
176        #[unsafe(method(cursorUpdate:))]
177        #[unsafe(method_family = none)]
178        pub fn cursorUpdate(&self, event: &NSEvent);
179
180        #[cfg(feature = "NSEvent")]
181        #[unsafe(method(magnifyWithEvent:))]
182        #[unsafe(method_family = none)]
183        pub fn magnifyWithEvent(&self, event: &NSEvent);
184
185        #[cfg(feature = "NSEvent")]
186        #[unsafe(method(rotateWithEvent:))]
187        #[unsafe(method_family = none)]
188        pub fn rotateWithEvent(&self, event: &NSEvent);
189
190        #[cfg(feature = "NSEvent")]
191        #[unsafe(method(swipeWithEvent:))]
192        #[unsafe(method_family = none)]
193        pub fn swipeWithEvent(&self, event: &NSEvent);
194
195        #[cfg(feature = "NSEvent")]
196        #[unsafe(method(beginGestureWithEvent:))]
197        #[unsafe(method_family = none)]
198        pub fn beginGestureWithEvent(&self, event: &NSEvent);
199
200        #[cfg(feature = "NSEvent")]
201        #[unsafe(method(endGestureWithEvent:))]
202        #[unsafe(method_family = none)]
203        pub fn endGestureWithEvent(&self, event: &NSEvent);
204
205        #[cfg(feature = "NSEvent")]
206        #[unsafe(method(smartMagnifyWithEvent:))]
207        #[unsafe(method_family = none)]
208        pub fn smartMagnifyWithEvent(&self, event: &NSEvent);
209
210        #[cfg(feature = "NSEvent")]
211        #[unsafe(method(changeModeWithEvent:))]
212        #[unsafe(method_family = none)]
213        pub fn changeModeWithEvent(&self, event: &NSEvent);
214
215        #[cfg(feature = "NSEvent")]
216        #[unsafe(method(touchesBeganWithEvent:))]
217        #[unsafe(method_family = none)]
218        pub fn touchesBeganWithEvent(&self, event: &NSEvent);
219
220        #[cfg(feature = "NSEvent")]
221        #[unsafe(method(touchesMovedWithEvent:))]
222        #[unsafe(method_family = none)]
223        pub fn touchesMovedWithEvent(&self, event: &NSEvent);
224
225        #[cfg(feature = "NSEvent")]
226        #[unsafe(method(touchesEndedWithEvent:))]
227        #[unsafe(method_family = none)]
228        pub fn touchesEndedWithEvent(&self, event: &NSEvent);
229
230        #[cfg(feature = "NSEvent")]
231        #[unsafe(method(touchesCancelledWithEvent:))]
232        #[unsafe(method_family = none)]
233        pub fn touchesCancelledWithEvent(&self, event: &NSEvent);
234
235        #[cfg(feature = "NSEvent")]
236        #[unsafe(method(quickLookWithEvent:))]
237        #[unsafe(method_family = none)]
238        pub fn quickLookWithEvent(&self, event: &NSEvent);
239
240        #[cfg(feature = "NSEvent")]
241        #[unsafe(method(pressureChangeWithEvent:))]
242        #[unsafe(method_family = none)]
243        pub fn pressureChangeWithEvent(&self, event: &NSEvent);
244
245        #[cfg(feature = "NSEvent")]
246        /// Handle a key event that should present a context menu at the user focus.
247        ///
248        /// 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.
249        ///
250        /// 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`.
251        ///
252        /// 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.
253        ///
254        ///
255        /// 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.
256        ///
257        ///
258        /// Parameter `event`: The key down event that matches the system-wide context menu hotkey combination.
259        ///
260        ///
261        /// See also: `showContextMenuForSelection:`
262        #[unsafe(method(contextMenuKeyDown:))]
263        #[unsafe(method_family = none)]
264        pub fn contextMenuKeyDown(&self, event: &NSEvent);
265
266        /// # Safety
267        ///
268        /// `event_selector` must be a valid selector.
269        #[unsafe(method(noResponderFor:))]
270        #[unsafe(method_family = none)]
271        pub unsafe fn noResponderFor(&self, event_selector: Sel);
272
273        #[unsafe(method(acceptsFirstResponder))]
274        #[unsafe(method_family = none)]
275        pub fn acceptsFirstResponder(&self) -> bool;
276
277        #[unsafe(method(becomeFirstResponder))]
278        #[unsafe(method_family = none)]
279        pub fn becomeFirstResponder(&self) -> bool;
280
281        #[unsafe(method(resignFirstResponder))]
282        #[unsafe(method_family = none)]
283        pub fn resignFirstResponder(&self) -> bool;
284
285        #[cfg(feature = "NSEvent")]
286        #[unsafe(method(interpretKeyEvents:))]
287        #[unsafe(method_family = none)]
288        pub fn interpretKeyEvents(&self, event_array: &NSArray<NSEvent>);
289
290        #[unsafe(method(flushBufferedKeyEvents))]
291        #[unsafe(method_family = none)]
292        pub fn flushBufferedKeyEvents(&self);
293
294        #[cfg(feature = "NSMenu")]
295        #[unsafe(method(menu))]
296        #[unsafe(method_family = none)]
297        pub fn menu(&self) -> Option<Retained<NSMenu>>;
298
299        #[cfg(feature = "NSMenu")]
300        /// Setter for [`menu`][Self::menu].
301        #[unsafe(method(setMenu:))]
302        #[unsafe(method_family = none)]
303        pub unsafe fn setMenu(&self, menu: Option<&NSMenu>);
304
305        /// # Safety
306        ///
307        /// `sender` should be of the correct type.
308        #[unsafe(method(showContextHelp:))]
309        #[unsafe(method_family = none)]
310        pub unsafe fn showContextHelp(&self, sender: Option<&AnyObject>);
311
312        #[cfg(feature = "NSEvent")]
313        #[unsafe(method(helpRequested:))]
314        #[unsafe(method_family = none)]
315        pub fn helpRequested(&self, event_ptr: &NSEvent);
316
317        #[cfg(feature = "NSEvent")]
318        #[unsafe(method(shouldBeTreatedAsInkEvent:))]
319        #[unsafe(method_family = none)]
320        pub fn shouldBeTreatedAsInkEvent(&self, event: &NSEvent) -> bool;
321
322        #[cfg(feature = "NSEvent")]
323        #[unsafe(method(wantsScrollEventsForSwipeTrackingOnAxis:))]
324        #[unsafe(method_family = none)]
325        pub fn wantsScrollEventsForSwipeTrackingOnAxis(&self, axis: NSEventGestureAxis) -> bool;
326
327        #[cfg(feature = "NSEvent")]
328        #[unsafe(method(wantsForwardedScrollEventsForAxis:))]
329        #[unsafe(method_family = none)]
330        pub fn wantsForwardedScrollEventsForAxis(&self, axis: NSEventGestureAxis) -> bool;
331
332        /// # Safety
333        ///
334        /// - `action` must be a valid selector.
335        /// - `sender` should be of the correct type.
336        #[unsafe(method(supplementalTargetForAction:sender:))]
337        #[unsafe(method_family = none)]
338        pub unsafe fn supplementalTargetForAction_sender(
339            &self,
340            action: Sel,
341            sender: Option<&AnyObject>,
342        ) -> Option<Retained<AnyObject>>;
343    );
344}
345
346/// Methods declared on superclass `NSObject`.
347impl NSResponder {
348    extern_methods!(
349        #[unsafe(method(new))]
350        #[unsafe(method_family = new)]
351        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
352    );
353}
354
355extern_protocol!(
356    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsstandardkeybindingresponding?language=objc)
357    pub unsafe trait NSStandardKeyBindingResponding:
358        NSObjectProtocol + MainThreadOnly
359    {
360        /// *********************** Key binding entry-points ************************
361        ///
362        /// # Safety
363        ///
364        /// `insert_string` should be of the correct type.
365        #[optional]
366        #[unsafe(method(insertText:))]
367        #[unsafe(method_family = none)]
368        unsafe fn insertText(&self, insert_string: &AnyObject);
369
370        /// # Safety
371        ///
372        /// `selector` must be a valid selector.
373        #[optional]
374        #[unsafe(method(doCommandBySelector:))]
375        #[unsafe(method_family = none)]
376        unsafe fn doCommandBySelector(&self, selector: Sel);
377
378        /// *********************** Standard bindable commands ************************
379        ///
380        /// # Safety
381        ///
382        /// `sender` should be of the correct type.
383        #[optional]
384        #[unsafe(method(moveForward:))]
385        #[unsafe(method_family = none)]
386        unsafe fn moveForward(&self, sender: Option<&AnyObject>);
387
388        /// # Safety
389        ///
390        /// `sender` should be of the correct type.
391        #[optional]
392        #[unsafe(method(moveRight:))]
393        #[unsafe(method_family = none)]
394        unsafe fn moveRight(&self, sender: Option<&AnyObject>);
395
396        /// # Safety
397        ///
398        /// `sender` should be of the correct type.
399        #[optional]
400        #[unsafe(method(moveBackward:))]
401        #[unsafe(method_family = none)]
402        unsafe fn moveBackward(&self, sender: Option<&AnyObject>);
403
404        /// # Safety
405        ///
406        /// `sender` should be of the correct type.
407        #[optional]
408        #[unsafe(method(moveLeft:))]
409        #[unsafe(method_family = none)]
410        unsafe fn moveLeft(&self, sender: Option<&AnyObject>);
411
412        /// # Safety
413        ///
414        /// `sender` should be of the correct type.
415        #[optional]
416        #[unsafe(method(moveUp:))]
417        #[unsafe(method_family = none)]
418        unsafe fn moveUp(&self, sender: Option<&AnyObject>);
419
420        /// # Safety
421        ///
422        /// `sender` should be of the correct type.
423        #[optional]
424        #[unsafe(method(moveDown:))]
425        #[unsafe(method_family = none)]
426        unsafe fn moveDown(&self, sender: Option<&AnyObject>);
427
428        /// # Safety
429        ///
430        /// `sender` should be of the correct type.
431        #[optional]
432        #[unsafe(method(moveWordForward:))]
433        #[unsafe(method_family = none)]
434        unsafe fn moveWordForward(&self, sender: Option<&AnyObject>);
435
436        /// # Safety
437        ///
438        /// `sender` should be of the correct type.
439        #[optional]
440        #[unsafe(method(moveWordBackward:))]
441        #[unsafe(method_family = none)]
442        unsafe fn moveWordBackward(&self, sender: Option<&AnyObject>);
443
444        /// # Safety
445        ///
446        /// `sender` should be of the correct type.
447        #[optional]
448        #[unsafe(method(moveToBeginningOfLine:))]
449        #[unsafe(method_family = none)]
450        unsafe fn moveToBeginningOfLine(&self, sender: Option<&AnyObject>);
451
452        /// # Safety
453        ///
454        /// `sender` should be of the correct type.
455        #[optional]
456        #[unsafe(method(moveToEndOfLine:))]
457        #[unsafe(method_family = none)]
458        unsafe fn moveToEndOfLine(&self, sender: Option<&AnyObject>);
459
460        /// # Safety
461        ///
462        /// `sender` should be of the correct type.
463        #[optional]
464        #[unsafe(method(moveToBeginningOfParagraph:))]
465        #[unsafe(method_family = none)]
466        unsafe fn moveToBeginningOfParagraph(&self, sender: Option<&AnyObject>);
467
468        /// # Safety
469        ///
470        /// `sender` should be of the correct type.
471        #[optional]
472        #[unsafe(method(moveToEndOfParagraph:))]
473        #[unsafe(method_family = none)]
474        unsafe fn moveToEndOfParagraph(&self, sender: Option<&AnyObject>);
475
476        /// # Safety
477        ///
478        /// `sender` should be of the correct type.
479        #[optional]
480        #[unsafe(method(moveToEndOfDocument:))]
481        #[unsafe(method_family = none)]
482        unsafe fn moveToEndOfDocument(&self, sender: Option<&AnyObject>);
483
484        /// # Safety
485        ///
486        /// `sender` should be of the correct type.
487        #[optional]
488        #[unsafe(method(moveToBeginningOfDocument:))]
489        #[unsafe(method_family = none)]
490        unsafe fn moveToBeginningOfDocument(&self, sender: Option<&AnyObject>);
491
492        /// # Safety
493        ///
494        /// `sender` should be of the correct type.
495        #[optional]
496        #[unsafe(method(pageDown:))]
497        #[unsafe(method_family = none)]
498        unsafe fn pageDown(&self, sender: Option<&AnyObject>);
499
500        /// # Safety
501        ///
502        /// `sender` should be of the correct type.
503        #[optional]
504        #[unsafe(method(pageUp:))]
505        #[unsafe(method_family = none)]
506        unsafe fn pageUp(&self, sender: Option<&AnyObject>);
507
508        /// # Safety
509        ///
510        /// `sender` should be of the correct type.
511        #[optional]
512        #[unsafe(method(centerSelectionInVisibleArea:))]
513        #[unsafe(method_family = none)]
514        unsafe fn centerSelectionInVisibleArea(&self, sender: Option<&AnyObject>);
515
516        /// # Safety
517        ///
518        /// `sender` should be of the correct type.
519        #[optional]
520        #[unsafe(method(moveBackwardAndModifySelection:))]
521        #[unsafe(method_family = none)]
522        unsafe fn moveBackwardAndModifySelection(&self, sender: Option<&AnyObject>);
523
524        /// # Safety
525        ///
526        /// `sender` should be of the correct type.
527        #[optional]
528        #[unsafe(method(moveForwardAndModifySelection:))]
529        #[unsafe(method_family = none)]
530        unsafe fn moveForwardAndModifySelection(&self, sender: Option<&AnyObject>);
531
532        /// # Safety
533        ///
534        /// `sender` should be of the correct type.
535        #[optional]
536        #[unsafe(method(moveWordForwardAndModifySelection:))]
537        #[unsafe(method_family = none)]
538        unsafe fn moveWordForwardAndModifySelection(&self, sender: Option<&AnyObject>);
539
540        /// # Safety
541        ///
542        /// `sender` should be of the correct type.
543        #[optional]
544        #[unsafe(method(moveWordBackwardAndModifySelection:))]
545        #[unsafe(method_family = none)]
546        unsafe fn moveWordBackwardAndModifySelection(&self, sender: Option<&AnyObject>);
547
548        /// # Safety
549        ///
550        /// `sender` should be of the correct type.
551        #[optional]
552        #[unsafe(method(moveUpAndModifySelection:))]
553        #[unsafe(method_family = none)]
554        unsafe fn moveUpAndModifySelection(&self, sender: Option<&AnyObject>);
555
556        /// # Safety
557        ///
558        /// `sender` should be of the correct type.
559        #[optional]
560        #[unsafe(method(moveDownAndModifySelection:))]
561        #[unsafe(method_family = none)]
562        unsafe fn moveDownAndModifySelection(&self, sender: Option<&AnyObject>);
563
564        /// # Safety
565        ///
566        /// `sender` should be of the correct type.
567        #[optional]
568        #[unsafe(method(moveToBeginningOfLineAndModifySelection:))]
569        #[unsafe(method_family = none)]
570        unsafe fn moveToBeginningOfLineAndModifySelection(&self, sender: Option<&AnyObject>);
571
572        /// # Safety
573        ///
574        /// `sender` should be of the correct type.
575        #[optional]
576        #[unsafe(method(moveToEndOfLineAndModifySelection:))]
577        #[unsafe(method_family = none)]
578        unsafe fn moveToEndOfLineAndModifySelection(&self, sender: Option<&AnyObject>);
579
580        /// # Safety
581        ///
582        /// `sender` should be of the correct type.
583        #[optional]
584        #[unsafe(method(moveToBeginningOfParagraphAndModifySelection:))]
585        #[unsafe(method_family = none)]
586        unsafe fn moveToBeginningOfParagraphAndModifySelection(&self, sender: Option<&AnyObject>);
587
588        /// # Safety
589        ///
590        /// `sender` should be of the correct type.
591        #[optional]
592        #[unsafe(method(moveToEndOfParagraphAndModifySelection:))]
593        #[unsafe(method_family = none)]
594        unsafe fn moveToEndOfParagraphAndModifySelection(&self, sender: Option<&AnyObject>);
595
596        /// # Safety
597        ///
598        /// `sender` should be of the correct type.
599        #[optional]
600        #[unsafe(method(moveToEndOfDocumentAndModifySelection:))]
601        #[unsafe(method_family = none)]
602        unsafe fn moveToEndOfDocumentAndModifySelection(&self, sender: Option<&AnyObject>);
603
604        /// # Safety
605        ///
606        /// `sender` should be of the correct type.
607        #[optional]
608        #[unsafe(method(moveToBeginningOfDocumentAndModifySelection:))]
609        #[unsafe(method_family = none)]
610        unsafe fn moveToBeginningOfDocumentAndModifySelection(&self, sender: Option<&AnyObject>);
611
612        /// # Safety
613        ///
614        /// `sender` should be of the correct type.
615        #[optional]
616        #[unsafe(method(pageDownAndModifySelection:))]
617        #[unsafe(method_family = none)]
618        unsafe fn pageDownAndModifySelection(&self, sender: Option<&AnyObject>);
619
620        /// # Safety
621        ///
622        /// `sender` should be of the correct type.
623        #[optional]
624        #[unsafe(method(pageUpAndModifySelection:))]
625        #[unsafe(method_family = none)]
626        unsafe fn pageUpAndModifySelection(&self, sender: Option<&AnyObject>);
627
628        /// # Safety
629        ///
630        /// `sender` should be of the correct type.
631        #[optional]
632        #[unsafe(method(moveParagraphForwardAndModifySelection:))]
633        #[unsafe(method_family = none)]
634        unsafe fn moveParagraphForwardAndModifySelection(&self, sender: Option<&AnyObject>);
635
636        /// # Safety
637        ///
638        /// `sender` should be of the correct type.
639        #[optional]
640        #[unsafe(method(moveParagraphBackwardAndModifySelection:))]
641        #[unsafe(method_family = none)]
642        unsafe fn moveParagraphBackwardAndModifySelection(&self, sender: Option<&AnyObject>);
643
644        /// # Safety
645        ///
646        /// `sender` should be of the correct type.
647        #[optional]
648        #[unsafe(method(moveWordRight:))]
649        #[unsafe(method_family = none)]
650        unsafe fn moveWordRight(&self, sender: Option<&AnyObject>);
651
652        /// # Safety
653        ///
654        /// `sender` should be of the correct type.
655        #[optional]
656        #[unsafe(method(moveWordLeft:))]
657        #[unsafe(method_family = none)]
658        unsafe fn moveWordLeft(&self, sender: Option<&AnyObject>);
659
660        /// # Safety
661        ///
662        /// `sender` should be of the correct type.
663        #[optional]
664        #[unsafe(method(moveRightAndModifySelection:))]
665        #[unsafe(method_family = none)]
666        unsafe fn moveRightAndModifySelection(&self, sender: Option<&AnyObject>);
667
668        /// # Safety
669        ///
670        /// `sender` should be of the correct type.
671        #[optional]
672        #[unsafe(method(moveLeftAndModifySelection:))]
673        #[unsafe(method_family = none)]
674        unsafe fn moveLeftAndModifySelection(&self, sender: Option<&AnyObject>);
675
676        /// # Safety
677        ///
678        /// `sender` should be of the correct type.
679        #[optional]
680        #[unsafe(method(moveWordRightAndModifySelection:))]
681        #[unsafe(method_family = none)]
682        unsafe fn moveWordRightAndModifySelection(&self, sender: Option<&AnyObject>);
683
684        /// # Safety
685        ///
686        /// `sender` should be of the correct type.
687        #[optional]
688        #[unsafe(method(moveWordLeftAndModifySelection:))]
689        #[unsafe(method_family = none)]
690        unsafe fn moveWordLeftAndModifySelection(&self, sender: Option<&AnyObject>);
691
692        /// # Safety
693        ///
694        /// `sender` should be of the correct type.
695        #[optional]
696        #[unsafe(method(moveToLeftEndOfLine:))]
697        #[unsafe(method_family = none)]
698        unsafe fn moveToLeftEndOfLine(&self, sender: Option<&AnyObject>);
699
700        /// # Safety
701        ///
702        /// `sender` should be of the correct type.
703        #[optional]
704        #[unsafe(method(moveToRightEndOfLine:))]
705        #[unsafe(method_family = none)]
706        unsafe fn moveToRightEndOfLine(&self, sender: Option<&AnyObject>);
707
708        /// # Safety
709        ///
710        /// `sender` should be of the correct type.
711        #[optional]
712        #[unsafe(method(moveToLeftEndOfLineAndModifySelection:))]
713        #[unsafe(method_family = none)]
714        unsafe fn moveToLeftEndOfLineAndModifySelection(&self, sender: Option<&AnyObject>);
715
716        /// # Safety
717        ///
718        /// `sender` should be of the correct type.
719        #[optional]
720        #[unsafe(method(moveToRightEndOfLineAndModifySelection:))]
721        #[unsafe(method_family = none)]
722        unsafe fn moveToRightEndOfLineAndModifySelection(&self, sender: Option<&AnyObject>);
723
724        /// # Safety
725        ///
726        /// `sender` should be of the correct type.
727        #[optional]
728        #[unsafe(method(scrollPageUp:))]
729        #[unsafe(method_family = none)]
730        unsafe fn scrollPageUp(&self, sender: Option<&AnyObject>);
731
732        /// # Safety
733        ///
734        /// `sender` should be of the correct type.
735        #[optional]
736        #[unsafe(method(scrollPageDown:))]
737        #[unsafe(method_family = none)]
738        unsafe fn scrollPageDown(&self, sender: Option<&AnyObject>);
739
740        /// # Safety
741        ///
742        /// `sender` should be of the correct type.
743        #[optional]
744        #[unsafe(method(scrollLineUp:))]
745        #[unsafe(method_family = none)]
746        unsafe fn scrollLineUp(&self, sender: Option<&AnyObject>);
747
748        /// # Safety
749        ///
750        /// `sender` should be of the correct type.
751        #[optional]
752        #[unsafe(method(scrollLineDown:))]
753        #[unsafe(method_family = none)]
754        unsafe fn scrollLineDown(&self, sender: Option<&AnyObject>);
755
756        /// # Safety
757        ///
758        /// `sender` should be of the correct type.
759        #[optional]
760        #[unsafe(method(scrollToBeginningOfDocument:))]
761        #[unsafe(method_family = none)]
762        unsafe fn scrollToBeginningOfDocument(&self, sender: Option<&AnyObject>);
763
764        /// # Safety
765        ///
766        /// `sender` should be of the correct type.
767        #[optional]
768        #[unsafe(method(scrollToEndOfDocument:))]
769        #[unsafe(method_family = none)]
770        unsafe fn scrollToEndOfDocument(&self, sender: Option<&AnyObject>);
771
772        /// # Safety
773        ///
774        /// `sender` should be of the correct type.
775        #[optional]
776        #[unsafe(method(transpose:))]
777        #[unsafe(method_family = none)]
778        unsafe fn transpose(&self, sender: Option<&AnyObject>);
779
780        /// # Safety
781        ///
782        /// `sender` should be of the correct type.
783        #[optional]
784        #[unsafe(method(transposeWords:))]
785        #[unsafe(method_family = none)]
786        unsafe fn transposeWords(&self, sender: Option<&AnyObject>);
787
788        /// # Safety
789        ///
790        /// `sender` should be of the correct type.
791        #[optional]
792        #[unsafe(method(selectAll:))]
793        #[unsafe(method_family = none)]
794        unsafe fn selectAll(&self, sender: Option<&AnyObject>);
795
796        /// # Safety
797        ///
798        /// `sender` should be of the correct type.
799        #[optional]
800        #[unsafe(method(selectParagraph:))]
801        #[unsafe(method_family = none)]
802        unsafe fn selectParagraph(&self, sender: Option<&AnyObject>);
803
804        /// # Safety
805        ///
806        /// `sender` should be of the correct type.
807        #[optional]
808        #[unsafe(method(selectLine:))]
809        #[unsafe(method_family = none)]
810        unsafe fn selectLine(&self, sender: Option<&AnyObject>);
811
812        /// # Safety
813        ///
814        /// `sender` should be of the correct type.
815        #[optional]
816        #[unsafe(method(selectWord:))]
817        #[unsafe(method_family = none)]
818        unsafe fn selectWord(&self, sender: Option<&AnyObject>);
819
820        /// # Safety
821        ///
822        /// `sender` should be of the correct type.
823        #[optional]
824        #[unsafe(method(indent:))]
825        #[unsafe(method_family = none)]
826        unsafe fn indent(&self, sender: Option<&AnyObject>);
827
828        /// # Safety
829        ///
830        /// `sender` should be of the correct type.
831        #[optional]
832        #[unsafe(method(insertTab:))]
833        #[unsafe(method_family = none)]
834        unsafe fn insertTab(&self, sender: Option<&AnyObject>);
835
836        /// # Safety
837        ///
838        /// `sender` should be of the correct type.
839        #[optional]
840        #[unsafe(method(insertBacktab:))]
841        #[unsafe(method_family = none)]
842        unsafe fn insertBacktab(&self, sender: Option<&AnyObject>);
843
844        /// # Safety
845        ///
846        /// `sender` should be of the correct type.
847        #[optional]
848        #[unsafe(method(insertNewline:))]
849        #[unsafe(method_family = none)]
850        unsafe fn insertNewline(&self, sender: Option<&AnyObject>);
851
852        /// # Safety
853        ///
854        /// `sender` should be of the correct type.
855        #[optional]
856        #[unsafe(method(insertParagraphSeparator:))]
857        #[unsafe(method_family = none)]
858        unsafe fn insertParagraphSeparator(&self, sender: Option<&AnyObject>);
859
860        /// # Safety
861        ///
862        /// `sender` should be of the correct type.
863        #[optional]
864        #[unsafe(method(insertNewlineIgnoringFieldEditor:))]
865        #[unsafe(method_family = none)]
866        unsafe fn insertNewlineIgnoringFieldEditor(&self, sender: Option<&AnyObject>);
867
868        /// # Safety
869        ///
870        /// `sender` should be of the correct type.
871        #[optional]
872        #[unsafe(method(insertTabIgnoringFieldEditor:))]
873        #[unsafe(method_family = none)]
874        unsafe fn insertTabIgnoringFieldEditor(&self, sender: Option<&AnyObject>);
875
876        /// # Safety
877        ///
878        /// `sender` should be of the correct type.
879        #[optional]
880        #[unsafe(method(insertLineBreak:))]
881        #[unsafe(method_family = none)]
882        unsafe fn insertLineBreak(&self, sender: Option<&AnyObject>);
883
884        /// # Safety
885        ///
886        /// `sender` should be of the correct type.
887        #[optional]
888        #[unsafe(method(insertContainerBreak:))]
889        #[unsafe(method_family = none)]
890        unsafe fn insertContainerBreak(&self, sender: Option<&AnyObject>);
891
892        /// # Safety
893        ///
894        /// `sender` should be of the correct type.
895        #[optional]
896        #[unsafe(method(insertSingleQuoteIgnoringSubstitution:))]
897        #[unsafe(method_family = none)]
898        unsafe fn insertSingleQuoteIgnoringSubstitution(&self, sender: Option<&AnyObject>);
899
900        /// # Safety
901        ///
902        /// `sender` should be of the correct type.
903        #[optional]
904        #[unsafe(method(insertDoubleQuoteIgnoringSubstitution:))]
905        #[unsafe(method_family = none)]
906        unsafe fn insertDoubleQuoteIgnoringSubstitution(&self, sender: Option<&AnyObject>);
907
908        /// # Safety
909        ///
910        /// `sender` should be of the correct type.
911        #[optional]
912        #[unsafe(method(changeCaseOfLetter:))]
913        #[unsafe(method_family = none)]
914        unsafe fn changeCaseOfLetter(&self, sender: Option<&AnyObject>);
915
916        /// # Safety
917        ///
918        /// `sender` should be of the correct type.
919        #[optional]
920        #[unsafe(method(uppercaseWord:))]
921        #[unsafe(method_family = none)]
922        unsafe fn uppercaseWord(&self, sender: Option<&AnyObject>);
923
924        /// # Safety
925        ///
926        /// `sender` should be of the correct type.
927        #[optional]
928        #[unsafe(method(lowercaseWord:))]
929        #[unsafe(method_family = none)]
930        unsafe fn lowercaseWord(&self, sender: Option<&AnyObject>);
931
932        /// # Safety
933        ///
934        /// `sender` should be of the correct type.
935        #[optional]
936        #[unsafe(method(capitalizeWord:))]
937        #[unsafe(method_family = none)]
938        unsafe fn capitalizeWord(&self, sender: Option<&AnyObject>);
939
940        /// # Safety
941        ///
942        /// `sender` should be of the correct type.
943        #[optional]
944        #[unsafe(method(deleteForward:))]
945        #[unsafe(method_family = none)]
946        unsafe fn deleteForward(&self, sender: Option<&AnyObject>);
947
948        /// # Safety
949        ///
950        /// `sender` should be of the correct type.
951        #[optional]
952        #[unsafe(method(deleteBackward:))]
953        #[unsafe(method_family = none)]
954        unsafe fn deleteBackward(&self, sender: Option<&AnyObject>);
955
956        /// # Safety
957        ///
958        /// `sender` should be of the correct type.
959        #[optional]
960        #[unsafe(method(deleteBackwardByDecomposingPreviousCharacter:))]
961        #[unsafe(method_family = none)]
962        unsafe fn deleteBackwardByDecomposingPreviousCharacter(&self, sender: Option<&AnyObject>);
963
964        /// # Safety
965        ///
966        /// `sender` should be of the correct type.
967        #[optional]
968        #[unsafe(method(deleteWordForward:))]
969        #[unsafe(method_family = none)]
970        unsafe fn deleteWordForward(&self, sender: Option<&AnyObject>);
971
972        /// # Safety
973        ///
974        /// `sender` should be of the correct type.
975        #[optional]
976        #[unsafe(method(deleteWordBackward:))]
977        #[unsafe(method_family = none)]
978        unsafe fn deleteWordBackward(&self, sender: Option<&AnyObject>);
979
980        /// # Safety
981        ///
982        /// `sender` should be of the correct type.
983        #[optional]
984        #[unsafe(method(deleteToBeginningOfLine:))]
985        #[unsafe(method_family = none)]
986        unsafe fn deleteToBeginningOfLine(&self, sender: Option<&AnyObject>);
987
988        /// # Safety
989        ///
990        /// `sender` should be of the correct type.
991        #[optional]
992        #[unsafe(method(deleteToEndOfLine:))]
993        #[unsafe(method_family = none)]
994        unsafe fn deleteToEndOfLine(&self, sender: Option<&AnyObject>);
995
996        /// # Safety
997        ///
998        /// `sender` should be of the correct type.
999        #[optional]
1000        #[unsafe(method(deleteToBeginningOfParagraph:))]
1001        #[unsafe(method_family = none)]
1002        unsafe fn deleteToBeginningOfParagraph(&self, sender: Option<&AnyObject>);
1003
1004        /// # Safety
1005        ///
1006        /// `sender` should be of the correct type.
1007        #[optional]
1008        #[unsafe(method(deleteToEndOfParagraph:))]
1009        #[unsafe(method_family = none)]
1010        unsafe fn deleteToEndOfParagraph(&self, sender: Option<&AnyObject>);
1011
1012        /// # Safety
1013        ///
1014        /// `sender` should be of the correct type.
1015        #[optional]
1016        #[unsafe(method(yank:))]
1017        #[unsafe(method_family = none)]
1018        unsafe fn yank(&self, sender: Option<&AnyObject>);
1019
1020        /// # Safety
1021        ///
1022        /// `sender` should be of the correct type.
1023        #[optional]
1024        #[unsafe(method(complete:))]
1025        #[unsafe(method_family = none)]
1026        unsafe fn complete(&self, sender: Option<&AnyObject>);
1027
1028        /// # Safety
1029        ///
1030        /// `sender` should be of the correct type.
1031        #[optional]
1032        #[unsafe(method(setMark:))]
1033        #[unsafe(method_family = none)]
1034        unsafe fn setMark(&self, sender: Option<&AnyObject>);
1035
1036        /// # Safety
1037        ///
1038        /// `sender` should be of the correct type.
1039        #[optional]
1040        #[unsafe(method(deleteToMark:))]
1041        #[unsafe(method_family = none)]
1042        unsafe fn deleteToMark(&self, sender: Option<&AnyObject>);
1043
1044        /// # Safety
1045        ///
1046        /// `sender` should be of the correct type.
1047        #[optional]
1048        #[unsafe(method(selectToMark:))]
1049        #[unsafe(method_family = none)]
1050        unsafe fn selectToMark(&self, sender: Option<&AnyObject>);
1051
1052        /// # Safety
1053        ///
1054        /// `sender` should be of the correct type.
1055        #[optional]
1056        #[unsafe(method(swapWithMark:))]
1057        #[unsafe(method_family = none)]
1058        unsafe fn swapWithMark(&self, sender: Option<&AnyObject>);
1059
1060        /// # Safety
1061        ///
1062        /// `sender` should be of the correct type.
1063        #[optional]
1064        #[unsafe(method(cancelOperation:))]
1065        #[unsafe(method_family = none)]
1066        unsafe fn cancelOperation(&self, sender: Option<&AnyObject>);
1067
1068        /// # Safety
1069        ///
1070        /// `sender` should be of the correct type.
1071        #[optional]
1072        #[unsafe(method(makeBaseWritingDirectionNatural:))]
1073        #[unsafe(method_family = none)]
1074        unsafe fn makeBaseWritingDirectionNatural(&self, sender: Option<&AnyObject>);
1075
1076        /// # Safety
1077        ///
1078        /// `sender` should be of the correct type.
1079        #[optional]
1080        #[unsafe(method(makeBaseWritingDirectionLeftToRight:))]
1081        #[unsafe(method_family = none)]
1082        unsafe fn makeBaseWritingDirectionLeftToRight(&self, sender: Option<&AnyObject>);
1083
1084        /// # Safety
1085        ///
1086        /// `sender` should be of the correct type.
1087        #[optional]
1088        #[unsafe(method(makeBaseWritingDirectionRightToLeft:))]
1089        #[unsafe(method_family = none)]
1090        unsafe fn makeBaseWritingDirectionRightToLeft(&self, sender: Option<&AnyObject>);
1091
1092        /// # Safety
1093        ///
1094        /// `sender` should be of the correct type.
1095        #[optional]
1096        #[unsafe(method(makeTextWritingDirectionNatural:))]
1097        #[unsafe(method_family = none)]
1098        unsafe fn makeTextWritingDirectionNatural(&self, sender: Option<&AnyObject>);
1099
1100        /// # Safety
1101        ///
1102        /// `sender` should be of the correct type.
1103        #[optional]
1104        #[unsafe(method(makeTextWritingDirectionLeftToRight:))]
1105        #[unsafe(method_family = none)]
1106        unsafe fn makeTextWritingDirectionLeftToRight(&self, sender: Option<&AnyObject>);
1107
1108        /// # Safety
1109        ///
1110        /// `sender` should be of the correct type.
1111        #[optional]
1112        #[unsafe(method(makeTextWritingDirectionRightToLeft:))]
1113        #[unsafe(method_family = none)]
1114        unsafe fn makeTextWritingDirectionRightToLeft(&self, sender: Option<&AnyObject>);
1115
1116        /// # Safety
1117        ///
1118        /// `sender` should be of the correct type.
1119        #[optional]
1120        #[unsafe(method(quickLookPreviewItems:))]
1121        #[unsafe(method_family = none)]
1122        unsafe fn quickLookPreviewItems(&self, sender: Option<&AnyObject>);
1123
1124        /// Present a context menu at the text cursor position, selection, or wherever is appropriate for your responder.
1125        ///
1126        /// 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.
1127        ///
1128        /// 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.
1129        ///
1130        /// 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.
1131        ///
1132        ///
1133        /// 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.
1134        ///
1135        ///
1136        /// Parameter `sender`: The object that originated the display of the context menu.
1137        ///
1138        ///
1139        /// See also: `menuForEvent:`
1140        ///
1141        /// See also: `selectionAnchorRect`
1142        ///
1143        /// See also: `contextMenuKeyDown:`
1144        ///
1145        /// # Safety
1146        ///
1147        /// `sender` should be of the correct type.
1148        #[optional]
1149        #[unsafe(method(showContextMenuForSelection:))]
1150        #[unsafe(method_family = none)]
1151        unsafe fn showContextMenuForSelection(&self, sender: Option<&AnyObject>);
1152    }
1153);
1154
1155/// NSStandardKeyBindingMethods.
1156impl NSResponder {
1157    extern_methods!();
1158}
1159
1160extern_conformance!(
1161    unsafe impl NSStandardKeyBindingResponding for NSResponder {}
1162);
1163
1164/// NSUndoSupport.
1165impl NSResponder {
1166    extern_methods!(
1167        #[unsafe(method(undoManager))]
1168        #[unsafe(method_family = none)]
1169        pub fn undoManager(&self) -> Option<Retained<NSUndoManager>>;
1170    );
1171}
1172
1173/// NSControlEditingSupport.
1174impl NSResponder {
1175    extern_methods!(
1176        #[cfg(feature = "NSEvent")]
1177        #[unsafe(method(validateProposedFirstResponder:forEvent:))]
1178        #[unsafe(method_family = none)]
1179        pub fn validateProposedFirstResponder_forEvent(
1180            &self,
1181            responder: &NSResponder,
1182            event: Option<&NSEvent>,
1183        ) -> bool;
1184    );
1185}
1186
1187/// NSErrorPresentation.
1188impl NSResponder {
1189    extern_methods!(
1190        #[cfg(feature = "NSWindow")]
1191        /// # Safety
1192        ///
1193        /// - `delegate` should be of the correct type.
1194        /// - `did_present_selector` must be a valid selector.
1195        /// - `context_info` must be a valid pointer or null.
1196        #[unsafe(method(presentError:modalForWindow:delegate:didPresentSelector:contextInfo:))]
1197        #[unsafe(method_family = none)]
1198        pub unsafe fn presentError_modalForWindow_delegate_didPresentSelector_contextInfo(
1199            &self,
1200            error: &NSError,
1201            window: &NSWindow,
1202            delegate: Option<&AnyObject>,
1203            did_present_selector: Option<Sel>,
1204            context_info: *mut c_void,
1205        );
1206
1207        #[unsafe(method(presentError:))]
1208        #[unsafe(method_family = none)]
1209        pub fn presentError(&self, error: &NSError) -> bool;
1210
1211        #[unsafe(method(willPresentError:))]
1212        #[unsafe(method_family = none)]
1213        pub fn willPresentError(&self, error: &NSError) -> Retained<NSError>;
1214    );
1215}
1216
1217/// NSTextFinderSupport.
1218impl NSResponder {
1219    extern_methods!(
1220        /// # Safety
1221        ///
1222        /// `sender` should be of the correct type.
1223        #[unsafe(method(performTextFinderAction:))]
1224        #[unsafe(method_family = none)]
1225        pub unsafe fn performTextFinderAction(&self, sender: Option<&AnyObject>);
1226    );
1227}
1228
1229/// NSWindowTabbing.
1230impl NSResponder {
1231    extern_methods!(
1232        /// # Safety
1233        ///
1234        /// `sender` should be of the correct type.
1235        #[unsafe(method(newWindowForTab:))]
1236        #[unsafe(method_family = none)]
1237        pub unsafe fn newWindowForTab(&self, sender: Option<&AnyObject>);
1238    );
1239}
1240
1241/// NSWritingToolsSupport.
1242impl NSResponder {
1243    extern_methods!(
1244        /// # Safety
1245        ///
1246        /// `sender` should be of the correct type.
1247        #[unsafe(method(showWritingTools:))]
1248        #[unsafe(method_family = none)]
1249        pub unsafe fn showWritingTools(&self, sender: Option<&AnyObject>);
1250    );
1251}
1252
1253/// NSDeprecated.
1254impl NSResponder {
1255    extern_methods!(
1256        #[deprecated = "This has always returned NO and had no effect on macOS"]
1257        #[unsafe(method(performMnemonic:))]
1258        #[unsafe(method_family = none)]
1259        pub fn performMnemonic(&self, string: &NSString) -> bool;
1260    );
1261}