objc2_app_kit/generated/
NSSpeechRecognizer.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/nsspeechrecognizer?language=objc)
12    #[unsafe(super(NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    pub struct NSSpeechRecognizer;
15);
16
17extern_conformance!(
18    unsafe impl NSObjectProtocol for NSSpeechRecognizer {}
19);
20
21impl NSSpeechRecognizer {
22    extern_methods!(
23        #[unsafe(method(init))]
24        #[unsafe(method_family = init)]
25        pub unsafe fn init(this: Allocated<Self>) -> Option<Retained<Self>>;
26
27        #[unsafe(method(startListening))]
28        #[unsafe(method_family = none)]
29        pub unsafe fn startListening(&self);
30
31        #[unsafe(method(stopListening))]
32        #[unsafe(method_family = none)]
33        pub unsafe fn stopListening(&self);
34
35        #[unsafe(method(delegate))]
36        #[unsafe(method_family = none)]
37        pub unsafe fn delegate(
38            &self,
39            mtm: MainThreadMarker,
40        ) -> Option<Retained<ProtocolObject<dyn NSSpeechRecognizerDelegate>>>;
41
42        /// This is a [weak property][objc2::topics::weak_property].
43        /// Setter for [`delegate`][Self::delegate].
44        #[unsafe(method(setDelegate:))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn setDelegate(
47            &self,
48            delegate: Option<&ProtocolObject<dyn NSSpeechRecognizerDelegate>>,
49        );
50
51        #[unsafe(method(commands))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn commands(&self) -> Option<Retained<NSArray<NSString>>>;
54
55        /// Setter for [`commands`][Self::commands].
56        #[unsafe(method(setCommands:))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn setCommands(&self, commands: Option<&NSArray<NSString>>);
59
60        #[unsafe(method(displayedCommandsTitle))]
61        #[unsafe(method_family = none)]
62        pub unsafe fn displayedCommandsTitle(&self) -> Option<Retained<NSString>>;
63
64        /// Setter for [`displayedCommandsTitle`][Self::displayedCommandsTitle].
65        #[unsafe(method(setDisplayedCommandsTitle:))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn setDisplayedCommandsTitle(&self, displayed_commands_title: Option<&NSString>);
68
69        #[unsafe(method(listensInForegroundOnly))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn listensInForegroundOnly(&self) -> bool;
72
73        /// Setter for [`listensInForegroundOnly`][Self::listensInForegroundOnly].
74        #[unsafe(method(setListensInForegroundOnly:))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn setListensInForegroundOnly(&self, listens_in_foreground_only: bool);
77
78        #[unsafe(method(blocksOtherRecognizers))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn blocksOtherRecognizers(&self) -> bool;
81
82        /// Setter for [`blocksOtherRecognizers`][Self::blocksOtherRecognizers].
83        #[unsafe(method(setBlocksOtherRecognizers:))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn setBlocksOtherRecognizers(&self, blocks_other_recognizers: bool);
86    );
87}
88
89/// Methods declared on superclass `NSObject`.
90impl NSSpeechRecognizer {
91    extern_methods!(
92        #[unsafe(method(new))]
93        #[unsafe(method_family = new)]
94        pub unsafe fn new() -> Retained<Self>;
95    );
96}
97
98extern_protocol!(
99    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsspeechrecognizerdelegate?language=objc)
100    pub unsafe trait NSSpeechRecognizerDelegate: NSObjectProtocol + MainThreadOnly {
101        #[optional]
102        #[unsafe(method(speechRecognizer:didRecognizeCommand:))]
103        #[unsafe(method_family = none)]
104        unsafe fn speechRecognizer_didRecognizeCommand(
105            &self,
106            sender: &NSSpeechRecognizer,
107            command: &NSString,
108        );
109    }
110);