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