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))]
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 #[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 #[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 #[unsafe(method(setWorksWhenModal:))]
92 #[unsafe(method_family = none)]
93 pub unsafe fn setWorksWhenModal(&self, works_when_modal: bool);
94 );
95}
96
97#[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 #[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#[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#[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#[deprecated = "Use NSAlertFirstButtonReturn with an NSAlert presentation instead"]
165pub const NSAlertDefaultReturn: c_int = 1;
166#[deprecated = "Use NSAlertFirstButtonReturn and other NSModalResponses with an NSAlert presentation instead"]
168pub const NSAlertAlternateReturn: c_int = 0;
169#[deprecated = "Use NSAlertFirstButtonReturn and other NSModalResponses with an NSAlert presentation instead"]
171pub const NSAlertOtherReturn: c_int = -1;
172#[deprecated = "Use NSAlertFirstButtonReturn and other NSModalResponses with an NSAlert presentation instead"]
174pub const NSAlertErrorReturn: c_int = -2;