objc2_app_kit/generated/
NSPanel.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/nspanel?language=objc)
12    #[unsafe(super(NSWindow, NSResponder, NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    #[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
15    pub struct NSPanel;
16);
17
18#[cfg(all(
19    feature = "NSAccessibilityProtocols",
20    feature = "NSResponder",
21    feature = "NSWindow"
22))]
23unsafe impl NSAccessibility for NSPanel {}
24
25#[cfg(all(
26    feature = "NSAccessibilityProtocols",
27    feature = "NSResponder",
28    feature = "NSWindow"
29))]
30unsafe impl NSAccessibilityElementProtocol for NSPanel {}
31
32#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSWindow"))]
33unsafe impl NSAnimatablePropertyContainer for NSPanel {}
34
35#[cfg(all(
36    feature = "NSAppearance",
37    feature = "NSResponder",
38    feature = "NSWindow"
39))]
40unsafe impl NSAppearanceCustomization for NSPanel {}
41
42#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
43unsafe impl NSCoding for NSPanel {}
44
45#[cfg(all(feature = "NSMenu", feature = "NSResponder", feature = "NSWindow"))]
46unsafe impl NSMenuItemValidation for NSPanel {}
47
48#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
49unsafe impl NSObjectProtocol for NSPanel {}
50
51#[cfg(all(
52    feature = "NSResponder",
53    feature = "NSUserInterfaceItemIdentification",
54    feature = "NSWindow"
55))]
56unsafe impl NSUserInterfaceItemIdentification for NSPanel {}
57
58#[cfg(all(
59    feature = "NSResponder",
60    feature = "NSUserInterfaceValidation",
61    feature = "NSWindow"
62))]
63unsafe impl NSUserInterfaceValidations for NSPanel {}
64
65#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
66impl NSPanel {
67    extern_methods!(
68        #[unsafe(method(isFloatingPanel))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn isFloatingPanel(&self) -> bool;
71
72        /// Setter for [`isFloatingPanel`][Self::isFloatingPanel].
73        #[unsafe(method(setFloatingPanel:))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn setFloatingPanel(&self, floating_panel: bool);
76
77        #[unsafe(method(becomesKeyOnlyIfNeeded))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn becomesKeyOnlyIfNeeded(&self) -> bool;
80
81        /// Setter for [`becomesKeyOnlyIfNeeded`][Self::becomesKeyOnlyIfNeeded].
82        #[unsafe(method(setBecomesKeyOnlyIfNeeded:))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn setBecomesKeyOnlyIfNeeded(&self, becomes_key_only_if_needed: bool);
85
86        #[unsafe(method(worksWhenModal))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn worksWhenModal(&self) -> bool;
89
90        /// Setter for [`worksWhenModal`][Self::worksWhenModal].
91        #[unsafe(method(setWorksWhenModal:))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn setWorksWhenModal(&self, works_when_modal: bool);
94    );
95}
96
97/// Methods declared on superclass `NSWindow`.
98#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
99impl NSPanel {
100    extern_methods!(
101        #[cfg(feature = "NSGraphics")]
102        #[unsafe(method(initWithContentRect:styleMask:backing:defer:))]
103        #[unsafe(method_family = init)]
104        pub unsafe fn initWithContentRect_styleMask_backing_defer(
105            this: Allocated<Self>,
106            content_rect: NSRect,
107            style: NSWindowStyleMask,
108            backing_store_type: NSBackingStoreType,
109            flag: bool,
110        ) -> Retained<Self>;
111
112        #[cfg(all(feature = "NSGraphics", feature = "NSScreen"))]
113        #[unsafe(method(initWithContentRect:styleMask:backing:defer:screen:))]
114        #[unsafe(method_family = init)]
115        pub unsafe fn initWithContentRect_styleMask_backing_defer_screen(
116            this: Allocated<Self>,
117            content_rect: NSRect,
118            style: NSWindowStyleMask,
119            backing_store_type: NSBackingStoreType,
120            flag: bool,
121            screen: Option<&NSScreen>,
122        ) -> Retained<Self>;
123
124        #[unsafe(method(initWithCoder:))]
125        #[unsafe(method_family = init)]
126        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
127
128        #[cfg(feature = "NSViewController")]
129        /// Convenience method for creating an autoreleased titled window with the given contentViewController. A basic NSWindow with the following attributes is made: titled, closable, resizable, miniaturizable. The window's title is automatically bound to the contentViewController's title. The size of the window can easily be controlled by utilizing autolayout and applying size constraints to the view (or its subviews). The window has isReleasedWhenClosed set to NO, and it must be explicitly retained to keep the window instance alive. To have it automatically be freed when it is closed, do the following: [window retain] and [window setReleasedWhenClosed:YES].
130        #[unsafe(method(windowWithContentViewController:))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn windowWithContentViewController(
133            content_view_controller: &NSViewController,
134        ) -> Retained<Self>;
135    );
136}
137
138/// Methods declared on superclass `NSResponder`.
139#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
140impl NSPanel {
141    extern_methods!(
142        #[unsafe(method(init))]
143        #[unsafe(method_family = init)]
144        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
145    );
146}
147
148/// Methods declared on superclass `NSObject`.
149#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
150impl NSPanel {
151    extern_methods!(
152        #[unsafe(method(new))]
153        #[unsafe(method_family = new)]
154        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
155    );
156}
157
158extern "C-unwind" {
159    #[deprecated = "Use NSAlert instead"]
160    pub fn NSReleaseAlertPanel(panel: Option<&AnyObject>);
161}
162
163/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsalertdefaultreturn?language=objc)
164#[deprecated = "Use NSAlertFirstButtonReturn with an NSAlert presentation instead"]
165pub const NSAlertDefaultReturn: c_int = 1;
166/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsalertalternatereturn?language=objc)
167#[deprecated = "Use NSAlertFirstButtonReturn and other NSModalResponses with an NSAlert presentation instead"]
168pub const NSAlertAlternateReturn: c_int = 0;
169/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsalertotherreturn?language=objc)
170#[deprecated = "Use NSAlertFirstButtonReturn and other NSModalResponses with an NSAlert presentation instead"]
171pub const NSAlertOtherReturn: c_int = -1;
172/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsalerterrorreturn?language=objc)
173#[deprecated = "Use NSAlertFirstButtonReturn and other NSModalResponses with an NSAlert presentation instead"]
174pub const NSAlertErrorReturn: c_int = -2;