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