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