objc2_app_kit/generated/
NSPanel.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11 #[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))]
23extern_conformance!(
24 unsafe impl NSAccessibility for NSPanel {}
25);
26
27#[cfg(all(
28 feature = "NSAccessibilityProtocols",
29 feature = "NSResponder",
30 feature = "NSWindow"
31))]
32extern_conformance!(
33 unsafe impl NSAccessibilityElementProtocol for NSPanel {}
34);
35
36#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSWindow"))]
37extern_conformance!(
38 unsafe impl NSAnimatablePropertyContainer for NSPanel {}
39);
40
41#[cfg(all(
42 feature = "NSAppearance",
43 feature = "NSResponder",
44 feature = "NSWindow"
45))]
46extern_conformance!(
47 unsafe impl NSAppearanceCustomization for NSPanel {}
48);
49
50#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
51extern_conformance!(
52 unsafe impl NSCoding for NSPanel {}
53);
54
55#[cfg(all(feature = "NSMenu", feature = "NSResponder", feature = "NSWindow"))]
56extern_conformance!(
57 unsafe impl NSMenuItemValidation for NSPanel {}
58);
59
60#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
61extern_conformance!(
62 unsafe impl NSObjectProtocol for NSPanel {}
63);
64
65#[cfg(all(
66 feature = "NSResponder",
67 feature = "NSUserInterfaceItemIdentification",
68 feature = "NSWindow"
69))]
70extern_conformance!(
71 unsafe impl NSUserInterfaceItemIdentification for NSPanel {}
72);
73
74#[cfg(all(
75 feature = "NSResponder",
76 feature = "NSUserInterfaceValidation",
77 feature = "NSWindow"
78))]
79extern_conformance!(
80 unsafe impl NSUserInterfaceValidations for NSPanel {}
81);
82
83#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
84impl NSPanel {
85 extern_methods!(
86 #[unsafe(method(isFloatingPanel))]
87 #[unsafe(method_family = none)]
88 pub fn isFloatingPanel(&self) -> bool;
89
90 #[unsafe(method(setFloatingPanel:))]
92 #[unsafe(method_family = none)]
93 pub fn setFloatingPanel(&self, floating_panel: bool);
94
95 #[unsafe(method(becomesKeyOnlyIfNeeded))]
96 #[unsafe(method_family = none)]
97 pub fn becomesKeyOnlyIfNeeded(&self) -> bool;
98
99 #[unsafe(method(setBecomesKeyOnlyIfNeeded:))]
101 #[unsafe(method_family = none)]
102 pub fn setBecomesKeyOnlyIfNeeded(&self, becomes_key_only_if_needed: bool);
103
104 #[unsafe(method(worksWhenModal))]
105 #[unsafe(method_family = none)]
106 pub fn worksWhenModal(&self) -> bool;
107
108 #[unsafe(method(setWorksWhenModal:))]
110 #[unsafe(method_family = none)]
111 pub fn setWorksWhenModal(&self, works_when_modal: bool);
112 );
113}
114
115#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
117impl NSPanel {
118 extern_methods!(
119 #[cfg(feature = "NSGraphics")]
120 #[unsafe(method(initWithContentRect:styleMask:backing:defer:))]
121 #[unsafe(method_family = init)]
122 pub fn initWithContentRect_styleMask_backing_defer(
123 this: Allocated<Self>,
124 content_rect: NSRect,
125 style: NSWindowStyleMask,
126 backing_store_type: NSBackingStoreType,
127 flag: bool,
128 ) -> Retained<Self>;
129
130 #[cfg(all(feature = "NSGraphics", feature = "NSScreen"))]
131 #[unsafe(method(initWithContentRect:styleMask:backing:defer:screen:))]
132 #[unsafe(method_family = init)]
133 pub fn initWithContentRect_styleMask_backing_defer_screen(
134 this: Allocated<Self>,
135 content_rect: NSRect,
136 style: NSWindowStyleMask,
137 backing_store_type: NSBackingStoreType,
138 flag: bool,
139 screen: Option<&NSScreen>,
140 ) -> Retained<Self>;
141
142 #[unsafe(method(initWithCoder:))]
146 #[unsafe(method_family = init)]
147 pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
148
149 #[cfg(feature = "NSViewController")]
150 #[unsafe(method(windowWithContentViewController:))]
152 #[unsafe(method_family = none)]
153 pub fn windowWithContentViewController(
154 content_view_controller: &NSViewController,
155 ) -> Retained<Self>;
156 );
157}
158
159#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
161impl NSPanel {
162 extern_methods!(
163 #[unsafe(method(init))]
164 #[unsafe(method_family = init)]
165 pub fn init(this: Allocated<Self>) -> Retained<Self>;
166 );
167}
168
169#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
171impl NSPanel {
172 extern_methods!(
173 #[unsafe(method(new))]
174 #[unsafe(method_family = new)]
175 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
176 );
177}
178
179extern "C-unwind" {
180 #[deprecated = "Use NSAlert instead"]
185 pub fn NSReleaseAlertPanel(panel: Option<&AnyObject>);
186}
187
188#[deprecated = "Use NSAlertFirstButtonReturn with an NSAlert presentation instead"]
190pub const NSAlertDefaultReturn: c_int = 1;
191#[deprecated = "Use NSAlertFirstButtonReturn and other NSModalResponses with an NSAlert presentation instead"]
193pub const NSAlertAlternateReturn: c_int = 0;
194#[deprecated = "Use NSAlertFirstButtonReturn and other NSModalResponses with an NSAlert presentation instead"]
196pub const NSAlertOtherReturn: c_int = -1;
197#[deprecated = "Use NSAlertFirstButtonReturn and other NSModalResponses with an NSAlert presentation instead"]
199pub const NSAlertErrorReturn: c_int = -2;