objc2_osa_kit/generated/
OSAScriptController.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_app_kit::*;
7use objc2_foundation::*;
8
9use crate::*;
10
11/// [Apple's documentation](https://developer.apple.com/documentation/osakit/osascriptstate?language=objc)
12// NS_ENUM
13#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct OSAScriptState(pub NSInteger);
16impl OSAScriptState {
17    #[doc(alias = "OSAScriptStopped")]
18    pub const Stopped: Self = Self(0);
19    #[doc(alias = "OSAScriptRunning")]
20    pub const Running: Self = Self(1);
21    #[doc(alias = "OSAScriptRecording")]
22    pub const Recording: Self = Self(2);
23}
24
25unsafe impl Encode for OSAScriptState {
26    const ENCODING: Encoding = NSInteger::ENCODING;
27}
28
29unsafe impl RefEncode for OSAScriptState {
30    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
31}
32
33extern_class!(
34    /// [Apple's documentation](https://developer.apple.com/documentation/osakit/osascriptcontroller?language=objc)
35    #[unsafe(super(NSController, NSObject))]
36    #[derive(Debug, PartialEq, Eq, Hash)]
37    pub struct OSAScriptController;
38);
39
40extern_conformance!(
41    unsafe impl NSCoding for OSAScriptController {}
42);
43
44extern_conformance!(
45    unsafe impl NSEditor for OSAScriptController {}
46);
47
48extern_conformance!(
49    unsafe impl NSEditorRegistration for OSAScriptController {}
50);
51
52extern_conformance!(
53    unsafe impl NSObjectProtocol for OSAScriptController {}
54);
55
56impl OSAScriptController {
57    extern_methods!(
58        #[cfg(feature = "OSAScriptView")]
59        #[unsafe(method(scriptView))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn scriptView(&self) -> Option<Retained<OSAScriptView>>;
62
63        #[cfg(feature = "OSAScriptView")]
64        /// Setter for [`scriptView`][Self::scriptView].
65        #[unsafe(method(setScriptView:))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn setScriptView(&self, script_view: Option<&OSAScriptView>);
68
69        #[unsafe(method(resultView))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn resultView(&self) -> Option<Retained<NSTextView>>;
72
73        /// Setter for [`resultView`][Self::resultView].
74        #[unsafe(method(setResultView:))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn setResultView(&self, result_view: Option<&NSTextView>);
77
78        #[cfg(feature = "OSAScript")]
79        #[unsafe(method(script))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn script(&self) -> Option<Retained<OSAScript>>;
82
83        #[cfg(feature = "OSAScript")]
84        /// Setter for [`script`][Self::script].
85        ///
86        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
87        #[unsafe(method(setScript:))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn setScript(&self, script: Option<&OSAScript>);
90
91        #[cfg(feature = "OSALanguage")]
92        #[unsafe(method(language))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn language(&self) -> Option<Retained<OSALanguage>>;
95
96        #[cfg(feature = "OSALanguage")]
97        /// Setter for [`language`][Self::language].
98        #[unsafe(method(setLanguage:))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn setLanguage(&self, language: Option<&OSALanguage>);
101
102        #[unsafe(method(scriptState))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn scriptState(&self) -> OSAScriptState;
105
106        #[unsafe(method(isCompiling))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn isCompiling(&self) -> bool;
109
110        /// # Safety
111        ///
112        /// `sender` should be of the correct type.
113        #[unsafe(method(compileScript:))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn compileScript(&self, sender: Option<&AnyObject>);
116
117        /// # Safety
118        ///
119        /// `sender` should be of the correct type.
120        #[unsafe(method(recordScript:))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn recordScript(&self, sender: Option<&AnyObject>);
123
124        /// # Safety
125        ///
126        /// `sender` should be of the correct type.
127        #[unsafe(method(runScript:))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn runScript(&self, sender: Option<&AnyObject>);
130
131        /// # Safety
132        ///
133        /// `sender` should be of the correct type.
134        #[unsafe(method(stopScript:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn stopScript(&self, sender: Option<&AnyObject>);
137    );
138}
139
140/// Methods declared on superclass `NSController`.
141impl OSAScriptController {
142    extern_methods!(
143        #[unsafe(method(init))]
144        #[unsafe(method_family = init)]
145        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
146
147        /// # Safety
148        ///
149        /// `coder` possibly has further requirements.
150        #[unsafe(method(initWithCoder:))]
151        #[unsafe(method_family = init)]
152        pub unsafe fn initWithCoder(
153            this: Allocated<Self>,
154            coder: &NSCoder,
155        ) -> Option<Retained<Self>>;
156    );
157}
158
159/// Methods declared on superclass `NSObject`.
160impl OSAScriptController {
161    extern_methods!(
162        #[unsafe(method(new))]
163        #[unsafe(method_family = new)]
164        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
165    );
166}