objc2_app_kit/generated/
NSFontPanel.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSFontPanelModeMask(pub NSUInteger);
15bitflags::bitflags! {
16 impl NSFontPanelModeMask: NSUInteger {
17 #[doc(alias = "NSFontPanelModeMaskFace")]
18 const ModeMaskFace = 1<<0;
19 #[doc(alias = "NSFontPanelModeMaskSize")]
20 const ModeMaskSize = 1<<1;
21 #[doc(alias = "NSFontPanelModeMaskCollection")]
22 const ModeMaskCollection = 1<<2;
23 #[doc(alias = "NSFontPanelModeMaskUnderlineEffect")]
24 const ModeMaskUnderlineEffect = 1<<8;
25 #[doc(alias = "NSFontPanelModeMaskStrikethroughEffect")]
26 const ModeMaskStrikethroughEffect = 1<<9;
27 #[doc(alias = "NSFontPanelModeMaskTextColorEffect")]
28 const ModeMaskTextColorEffect = 1<<10;
29 #[doc(alias = "NSFontPanelModeMaskDocumentColorEffect")]
30 const ModeMaskDocumentColorEffect = 1<<11;
31 #[doc(alias = "NSFontPanelModeMaskShadowEffect")]
32 const ModeMaskShadowEffect = 1<<12;
33 #[doc(alias = "NSFontPanelModeMaskAllEffects")]
34 const ModeMaskAllEffects = 0xFFF00;
35 #[doc(alias = "NSFontPanelModesMaskStandardModes")]
36 const ModesMaskStandardModes = 0xFFFF;
37 #[doc(alias = "NSFontPanelModesMaskAllModes")]
38 const ModesMaskAllModes = 0xFFFFFFFF;
39 }
40}
41
42unsafe impl Encode for NSFontPanelModeMask {
43 const ENCODING: Encoding = NSUInteger::ENCODING;
44}
45
46unsafe impl RefEncode for NSFontPanelModeMask {
47 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
48}
49
50extern_protocol!(
51 pub unsafe trait NSFontChanging: NSObjectProtocol + MainThreadOnly {
53 #[cfg(feature = "NSFontManager")]
54 #[optional]
55 #[unsafe(method(changeFont:))]
56 #[unsafe(method_family = none)]
57 unsafe fn changeFont(&self, sender: Option<&NSFontManager>);
58
59 #[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
60 #[optional]
61 #[unsafe(method(validModesForFontPanel:))]
62 #[unsafe(method_family = none)]
63 unsafe fn validModesForFontPanel(&self, font_panel: &NSFontPanel) -> NSFontPanelModeMask;
64 }
65);
66
67extern_class!(
68 #[unsafe(super(NSPanel, NSWindow, NSResponder, NSObject))]
70 #[derive(Debug, PartialEq, Eq, Hash)]
71 #[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
72 pub struct NSFontPanel;
73);
74
75#[cfg(all(
76 feature = "NSAccessibilityProtocols",
77 feature = "NSPanel",
78 feature = "NSResponder",
79 feature = "NSWindow"
80))]
81extern_conformance!(
82 unsafe impl NSAccessibility for NSFontPanel {}
83);
84
85#[cfg(all(
86 feature = "NSAccessibilityProtocols",
87 feature = "NSPanel",
88 feature = "NSResponder",
89 feature = "NSWindow"
90))]
91extern_conformance!(
92 unsafe impl NSAccessibilityElementProtocol for NSFontPanel {}
93);
94
95#[cfg(all(
96 feature = "NSAnimation",
97 feature = "NSPanel",
98 feature = "NSResponder",
99 feature = "NSWindow"
100))]
101extern_conformance!(
102 unsafe impl NSAnimatablePropertyContainer for NSFontPanel {}
103);
104
105#[cfg(all(
106 feature = "NSAppearance",
107 feature = "NSPanel",
108 feature = "NSResponder",
109 feature = "NSWindow"
110))]
111extern_conformance!(
112 unsafe impl NSAppearanceCustomization for NSFontPanel {}
113);
114
115#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
116extern_conformance!(
117 unsafe impl NSCoding for NSFontPanel {}
118);
119
120#[cfg(all(
121 feature = "NSMenu",
122 feature = "NSPanel",
123 feature = "NSResponder",
124 feature = "NSWindow"
125))]
126extern_conformance!(
127 unsafe impl NSMenuItemValidation for NSFontPanel {}
128);
129
130#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
131extern_conformance!(
132 unsafe impl NSObjectProtocol for NSFontPanel {}
133);
134
135#[cfg(all(
136 feature = "NSPanel",
137 feature = "NSResponder",
138 feature = "NSUserInterfaceItemIdentification",
139 feature = "NSWindow"
140))]
141extern_conformance!(
142 unsafe impl NSUserInterfaceItemIdentification for NSFontPanel {}
143);
144
145#[cfg(all(
146 feature = "NSPanel",
147 feature = "NSResponder",
148 feature = "NSUserInterfaceValidation",
149 feature = "NSWindow"
150))]
151extern_conformance!(
152 unsafe impl NSUserInterfaceValidations for NSFontPanel {}
153);
154
155#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
156impl NSFontPanel {
157 extern_methods!(
158 #[unsafe(method(sharedFontPanel))]
159 #[unsafe(method_family = none)]
160 pub unsafe fn sharedFontPanel(mtm: MainThreadMarker) -> Retained<NSFontPanel>;
161
162 #[unsafe(method(sharedFontPanelExists))]
163 #[unsafe(method_family = none)]
164 pub unsafe fn sharedFontPanelExists(mtm: MainThreadMarker) -> bool;
165
166 #[cfg(feature = "NSView")]
167 #[unsafe(method(accessoryView))]
168 #[unsafe(method_family = none)]
169 pub unsafe fn accessoryView(&self) -> Option<Retained<NSView>>;
170
171 #[cfg(feature = "NSView")]
172 #[unsafe(method(setAccessoryView:))]
174 #[unsafe(method_family = none)]
175 pub unsafe fn setAccessoryView(&self, accessory_view: Option<&NSView>);
176
177 #[cfg(feature = "NSFont")]
178 #[unsafe(method(setPanelFont:isMultiple:))]
179 #[unsafe(method_family = none)]
180 pub unsafe fn setPanelFont_isMultiple(&self, font_obj: &NSFont, flag: bool);
181
182 #[cfg(feature = "NSFont")]
183 #[unsafe(method(panelConvertFont:))]
184 #[unsafe(method_family = none)]
185 pub unsafe fn panelConvertFont(&self, font_obj: &NSFont) -> Retained<NSFont>;
186
187 #[unsafe(method(worksWhenModal))]
188 #[unsafe(method_family = none)]
189 pub unsafe fn worksWhenModal(&self) -> bool;
190
191 #[unsafe(method(setWorksWhenModal:))]
193 #[unsafe(method_family = none)]
194 pub unsafe fn setWorksWhenModal(&self, works_when_modal: bool);
195
196 #[unsafe(method(isEnabled))]
197 #[unsafe(method_family = none)]
198 pub unsafe fn isEnabled(&self) -> bool;
199
200 #[unsafe(method(setEnabled:))]
202 #[unsafe(method_family = none)]
203 pub unsafe fn setEnabled(&self, enabled: bool);
204
205 #[unsafe(method(reloadDefaultFontFamilies))]
206 #[unsafe(method_family = none)]
207 pub unsafe fn reloadDefaultFontFamilies(&self);
208 );
209}
210
211#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
213impl NSFontPanel {
214 extern_methods!(
215 #[cfg(feature = "NSGraphics")]
216 #[unsafe(method(initWithContentRect:styleMask:backing:defer:))]
217 #[unsafe(method_family = init)]
218 pub unsafe fn initWithContentRect_styleMask_backing_defer(
219 this: Allocated<Self>,
220 content_rect: NSRect,
221 style: NSWindowStyleMask,
222 backing_store_type: NSBackingStoreType,
223 flag: bool,
224 ) -> Retained<Self>;
225
226 #[cfg(all(feature = "NSGraphics", feature = "NSScreen"))]
227 #[unsafe(method(initWithContentRect:styleMask:backing:defer:screen:))]
228 #[unsafe(method_family = init)]
229 pub unsafe fn initWithContentRect_styleMask_backing_defer_screen(
230 this: Allocated<Self>,
231 content_rect: NSRect,
232 style: NSWindowStyleMask,
233 backing_store_type: NSBackingStoreType,
234 flag: bool,
235 screen: Option<&NSScreen>,
236 ) -> Retained<Self>;
237
238 #[unsafe(method(initWithCoder:))]
239 #[unsafe(method_family = init)]
240 pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
241
242 #[cfg(feature = "NSViewController")]
243 #[unsafe(method(windowWithContentViewController:))]
245 #[unsafe(method_family = none)]
246 pub unsafe fn windowWithContentViewController(
247 content_view_controller: &NSViewController,
248 ) -> Retained<Self>;
249 );
250}
251
252#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
254impl NSFontPanel {
255 extern_methods!(
256 #[unsafe(method(init))]
257 #[unsafe(method_family = init)]
258 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
259 );
260}
261
262#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
264impl NSFontPanel {
265 extern_methods!(
266 #[unsafe(method(new))]
267 #[unsafe(method_family = new)]
268 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
269 );
270}
271
272pub const NSFontPanelFaceModeMask: c_uint = 1 << 0;
274pub const NSFontPanelSizeModeMask: c_uint = 1 << 1;
276pub const NSFontPanelCollectionModeMask: c_uint = 1 << 2;
278pub const NSFontPanelUnderlineEffectModeMask: c_uint = 1 << 8;
280pub const NSFontPanelStrikethroughEffectModeMask: c_uint = 1 << 9;
282pub const NSFontPanelTextColorEffectModeMask: c_uint = 1 << 10;
284pub const NSFontPanelDocumentColorEffectModeMask: c_uint = 1 << 11;
286pub const NSFontPanelShadowEffectModeMask: c_uint = 1 << 12;
288pub const NSFontPanelAllEffectsModeMask: c_uint = 0xFFF00;
290pub const NSFontPanelStandardModesMask: c_uint = 0xFFFF;
292pub const NSFontPanelAllModesMask: c_uint = 0xFFFFFFFF;
294
295pub const NSFPPreviewButton: c_uint = 131;
297pub const NSFPRevertButton: c_uint = 130;
299pub const NSFPSetButton: c_uint = 132;
301pub const NSFPPreviewField: c_uint = 128;
303pub const NSFPSizeField: c_uint = 129;
305pub const NSFPSizeTitle: c_uint = 133;
307pub const NSFPCurrentField: c_uint = 134;