objc2_app_kit/generated/
NSWindowController.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/nswindowcontroller?language=objc)
12    #[unsafe(super(NSResponder, NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    #[cfg(feature = "NSResponder")]
15    pub struct NSWindowController;
16);
17
18#[cfg(feature = "NSResponder")]
19extern_conformance!(
20    unsafe impl NSCoding for NSWindowController {}
21);
22
23#[cfg(feature = "NSResponder")]
24extern_conformance!(
25    unsafe impl NSObjectProtocol for NSWindowController {}
26);
27
28#[cfg(all(feature = "NSResponder", feature = "NSStoryboardSegue"))]
29extern_conformance!(
30    unsafe impl NSSeguePerforming for NSWindowController {}
31);
32
33#[cfg(feature = "NSResponder")]
34impl NSWindowController {
35    extern_methods!(
36        #[cfg(feature = "NSWindow")]
37        #[unsafe(method(initWithWindow:))]
38        #[unsafe(method_family = init)]
39        pub fn initWithWindow(this: Allocated<Self>, window: Option<&NSWindow>) -> Retained<Self>;
40
41        /// # Safety
42        ///
43        /// `coder` possibly has further requirements.
44        #[unsafe(method(initWithCoder:))]
45        #[unsafe(method_family = init)]
46        pub unsafe fn initWithCoder(
47            this: Allocated<Self>,
48            coder: &NSCoder,
49        ) -> Option<Retained<Self>>;
50
51        #[cfg(feature = "NSNib")]
52        #[unsafe(method(initWithWindowNibName:))]
53        #[unsafe(method_family = init)]
54        pub fn initWithWindowNibName(
55            this: Allocated<Self>,
56            window_nib_name: &NSNibName,
57        ) -> Retained<Self>;
58
59        #[cfg(feature = "NSNib")]
60        /// # Safety
61        ///
62        /// `owner` should be of the correct type.
63        #[unsafe(method(initWithWindowNibName:owner:))]
64        #[unsafe(method_family = init)]
65        pub unsafe fn initWithWindowNibName_owner(
66            this: Allocated<Self>,
67            window_nib_name: &NSNibName,
68            owner: &AnyObject,
69        ) -> Retained<Self>;
70
71        /// # Safety
72        ///
73        /// `owner` should be of the correct type.
74        #[unsafe(method(initWithWindowNibPath:owner:))]
75        #[unsafe(method_family = init)]
76        pub unsafe fn initWithWindowNibPath_owner(
77            this: Allocated<Self>,
78            window_nib_path: &NSString,
79            owner: &AnyObject,
80        ) -> Retained<Self>;
81
82        #[cfg(feature = "NSNib")]
83        #[unsafe(method(windowNibName))]
84        #[unsafe(method_family = none)]
85        pub fn windowNibName(&self) -> Option<Retained<NSNibName>>;
86
87        #[unsafe(method(windowNibPath))]
88        #[unsafe(method_family = none)]
89        pub fn windowNibPath(&self) -> Option<Retained<NSString>>;
90
91        #[unsafe(method(owner))]
92        #[unsafe(method_family = none)]
93        pub fn owner(&self) -> Option<Retained<AnyObject>>;
94
95        #[cfg(feature = "NSWindow")]
96        #[unsafe(method(windowFrameAutosaveName))]
97        #[unsafe(method_family = none)]
98        pub fn windowFrameAutosaveName(&self) -> Retained<NSWindowFrameAutosaveName>;
99
100        #[cfg(feature = "NSWindow")]
101        /// Setter for [`windowFrameAutosaveName`][Self::windowFrameAutosaveName].
102        ///
103        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
104        #[unsafe(method(setWindowFrameAutosaveName:))]
105        #[unsafe(method_family = none)]
106        pub fn setWindowFrameAutosaveName(
107            &self,
108            window_frame_autosave_name: &NSWindowFrameAutosaveName,
109        );
110
111        #[unsafe(method(shouldCascadeWindows))]
112        #[unsafe(method_family = none)]
113        pub fn shouldCascadeWindows(&self) -> bool;
114
115        /// Setter for [`shouldCascadeWindows`][Self::shouldCascadeWindows].
116        #[unsafe(method(setShouldCascadeWindows:))]
117        #[unsafe(method_family = none)]
118        pub fn setShouldCascadeWindows(&self, should_cascade_windows: bool);
119
120        #[cfg(feature = "NSPreviewRepresentingActivityItem")]
121        #[unsafe(method(previewRepresentableActivityItems))]
122        #[unsafe(method_family = none)]
123        pub fn previewRepresentableActivityItems(
124            &self,
125        ) -> Option<Retained<NSArray<ProtocolObject<dyn NSPreviewRepresentableActivityItem>>>>;
126
127        #[cfg(feature = "NSPreviewRepresentingActivityItem")]
128        /// Setter for [`previewRepresentableActivityItems`][Self::previewRepresentableActivityItems].
129        ///
130        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
131        #[unsafe(method(setPreviewRepresentableActivityItems:))]
132        #[unsafe(method_family = none)]
133        pub fn setPreviewRepresentableActivityItems(
134            &self,
135            preview_representable_activity_items: Option<
136                &NSArray<ProtocolObject<dyn NSPreviewRepresentableActivityItem>>,
137            >,
138        );
139
140        /// # Safety
141        ///
142        /// This is not retained internally, you must ensure the object is still alive.
143        #[unsafe(method(document))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn document(&self) -> Option<Retained<AnyObject>>;
146
147        /// Setter for [`document`][Self::document].
148        ///
149        /// # Safety
150        ///
151        /// - `document` should be of the correct type.
152        /// - This is unretained, you must ensure the object is kept alive while in use.
153        #[unsafe(method(setDocument:))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn setDocument(&self, document: Option<&AnyObject>);
156
157        #[unsafe(method(setDocumentEdited:))]
158        #[unsafe(method_family = none)]
159        pub fn setDocumentEdited(&self, dirty_flag: bool);
160
161        #[unsafe(method(shouldCloseDocument))]
162        #[unsafe(method_family = none)]
163        pub fn shouldCloseDocument(&self) -> bool;
164
165        /// Setter for [`shouldCloseDocument`][Self::shouldCloseDocument].
166        #[unsafe(method(setShouldCloseDocument:))]
167        #[unsafe(method_family = none)]
168        pub fn setShouldCloseDocument(&self, should_close_document: bool);
169
170        #[unsafe(method(synchronizeWindowTitleWithDocumentName))]
171        #[unsafe(method_family = none)]
172        pub fn synchronizeWindowTitleWithDocumentName(&self);
173
174        #[unsafe(method(windowTitleForDocumentDisplayName:))]
175        #[unsafe(method_family = none)]
176        pub fn windowTitleForDocumentDisplayName(
177            &self,
178            display_name: &NSString,
179        ) -> Retained<NSString>;
180
181        #[cfg(feature = "NSViewController")]
182        #[unsafe(method(contentViewController))]
183        #[unsafe(method_family = none)]
184        pub fn contentViewController(&self) -> Option<Retained<NSViewController>>;
185
186        #[cfg(feature = "NSViewController")]
187        /// Setter for [`contentViewController`][Self::contentViewController].
188        #[unsafe(method(setContentViewController:))]
189        #[unsafe(method_family = none)]
190        pub fn setContentViewController(&self, content_view_controller: Option<&NSViewController>);
191
192        #[cfg(feature = "NSWindow")]
193        #[unsafe(method(window))]
194        #[unsafe(method_family = none)]
195        pub fn window(&self) -> Option<Retained<NSWindow>>;
196
197        #[cfg(feature = "NSWindow")]
198        /// Setter for [`window`][Self::window].
199        #[unsafe(method(setWindow:))]
200        #[unsafe(method_family = none)]
201        pub fn setWindow(&self, window: Option<&NSWindow>);
202
203        #[unsafe(method(isWindowLoaded))]
204        #[unsafe(method_family = none)]
205        pub fn isWindowLoaded(&self) -> bool;
206
207        #[unsafe(method(windowWillLoad))]
208        #[unsafe(method_family = none)]
209        pub fn windowWillLoad(&self);
210
211        #[unsafe(method(windowDidLoad))]
212        #[unsafe(method_family = none)]
213        pub fn windowDidLoad(&self);
214
215        #[unsafe(method(loadWindow))]
216        #[unsafe(method_family = none)]
217        pub fn loadWindow(&self);
218
219        #[unsafe(method(close))]
220        #[unsafe(method_family = none)]
221        pub fn close(&self);
222
223        /// # Safety
224        ///
225        /// `sender` should be of the correct type.
226        #[unsafe(method(showWindow:))]
227        #[unsafe(method_family = none)]
228        pub unsafe fn showWindow(&self, sender: Option<&AnyObject>);
229    );
230}
231
232/// Methods declared on superclass `NSResponder`.
233#[cfg(feature = "NSResponder")]
234impl NSWindowController {
235    extern_methods!(
236        #[unsafe(method(init))]
237        #[unsafe(method_family = init)]
238        pub fn init(this: Allocated<Self>) -> Retained<Self>;
239    );
240}
241
242/// Methods declared on superclass `NSObject`.
243#[cfg(feature = "NSResponder")]
244impl NSWindowController {
245    extern_methods!(
246        #[unsafe(method(new))]
247        #[unsafe(method_family = new)]
248        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
249    );
250}
251
252/// NSWindowControllerStoryboardingMethods.
253///
254/// These methods are used to support using Storyboards with your app.
255#[cfg(feature = "NSResponder")]
256impl NSWindowController {
257    extern_methods!(
258        #[cfg(feature = "NSStoryboard")]
259        #[unsafe(method(storyboard))]
260        #[unsafe(method_family = none)]
261        pub fn storyboard(&self) -> Option<Retained<NSStoryboard>>;
262    );
263}
264
265/// NSWindowControllerDismissing.
266#[cfg(feature = "NSResponder")]
267impl NSWindowController {
268    extern_methods!(
269        /// # Safety
270        ///
271        /// `sender` should be of the correct type.
272        #[unsafe(method(dismissController:))]
273        #[unsafe(method_family = none)]
274        pub unsafe fn dismissController(&self, sender: Option<&AnyObject>);
275    );
276}