objc2_media_accessibility/generated/
MACaptionAppearance.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "objc2")]
6use objc2::__framework_prelude::*;
7use objc2_core_foundation::*;
8#[cfg(feature = "objc2-core-graphics")]
9use objc2_core_graphics::*;
10#[cfg(feature = "objc2-core-text")]
11use objc2_core_text::*;
12
13use crate::*;
14
15extern "C" {
16    /// CFNotification sent when any user-defined captioning settings are changed.
17    ///
18    /// See also [Apple's documentation](https://developer.apple.com/documentation/mediaaccessibility/kmacaptionappearancesettingschangednotification?language=objc)
19    pub static kMACaptionAppearanceSettingsChangedNotification: &'static CFString;
20}
21
22/// MACaptionAppearanceDomain is used to specify which domain of preferences to access.
23///
24///
25/// The user-defined preferences. This domain should be passed to retrieve settings that should be used to render captions.
26///
27/// The system defaults which will not change during a user session. These settings should be used for comparison, not to render captions. For example, when rendering a glyph some caption render engines need to get the user-defined font and the system-defined font to determeine the final pixel size to render a glyph. Most render engines will never need to use this domain.
28///
29/// See also [Apple's documentation](https://developer.apple.com/documentation/mediaaccessibility/macaptionappearancedomain?language=objc)
30// NS_ENUM
31#[repr(transparent)]
32#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
33pub struct MACaptionAppearanceDomain(pub CFIndex);
34impl MACaptionAppearanceDomain {
35    #[doc(alias = "kMACaptionAppearanceDomainDefault")]
36    pub const Default: Self = Self(0);
37    #[doc(alias = "kMACaptionAppearanceDomainUser")]
38    pub const User: Self = Self(1);
39}
40
41#[cfg(feature = "objc2")]
42unsafe impl Encode for MACaptionAppearanceDomain {
43    const ENCODING: Encoding = CFIndex::ENCODING;
44}
45
46#[cfg(feature = "objc2")]
47unsafe impl RefEncode for MACaptionAppearanceDomain {
48    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
49}
50
51/// MACaptionAppearanceDisplayType is used to specify the the type of captions that should be displayed
52///
53///
54/// Only forced captions for translation should be displayed.
55///
56/// If the language of the audio track differs from the system locale then captions matching the system locale should be displayed (if available).
57///
58/// The best available captioning track should always be displayed, whether it be CC, SDH, or subtitles.
59///
60/// See also [Apple's documentation](https://developer.apple.com/documentation/mediaaccessibility/macaptionappearancedisplaytype?language=objc)
61// NS_ENUM
62#[repr(transparent)]
63#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
64pub struct MACaptionAppearanceDisplayType(pub CFIndex);
65impl MACaptionAppearanceDisplayType {
66    #[doc(alias = "kMACaptionAppearanceDisplayTypeForcedOnly")]
67    pub const ForcedOnly: Self = Self(0);
68    #[doc(alias = "kMACaptionAppearanceDisplayTypeAutomatic")]
69    pub const Automatic: Self = Self(1);
70    #[doc(alias = "kMACaptionAppearanceDisplayTypeAlwaysOn")]
71    pub const AlwaysOn: Self = Self(2);
72}
73
74#[cfg(feature = "objc2")]
75unsafe impl Encode for MACaptionAppearanceDisplayType {
76    const ENCODING: Encoding = CFIndex::ENCODING;
77}
78
79#[cfg(feature = "objc2")]
80unsafe impl RefEncode for MACaptionAppearanceDisplayType {
81    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
82}
83
84/// MACaptionAppearanceBehavior is used to determine how a preference value should be used.
85///
86///
87/// The value should override any content, application, or otherwise-defined values.
88///
89/// Content, application, or otherwise-defined values should override the returned value. If no other value is defined, then the return value should be used.
90///
91/// See also [Apple's documentation](https://developer.apple.com/documentation/mediaaccessibility/macaptionappearancebehavior?language=objc)
92// NS_ENUM
93#[repr(transparent)]
94#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
95pub struct MACaptionAppearanceBehavior(pub CFIndex);
96impl MACaptionAppearanceBehavior {
97    #[doc(alias = "kMACaptionAppearanceBehaviorUseValue")]
98    pub const UseValue: Self = Self(0);
99    #[doc(alias = "kMACaptionAppearanceBehaviorUseContentIfAvailable")]
100    pub const UseContentIfAvailable: Self = Self(1);
101}
102
103#[cfg(feature = "objc2")]
104unsafe impl Encode for MACaptionAppearanceBehavior {
105    const ENCODING: Encoding = CFIndex::ENCODING;
106}
107
108#[cfg(feature = "objc2")]
109unsafe impl RefEncode for MACaptionAppearanceBehavior {
110    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
111}
112
113/// MACaptionAppearanceFontStyle is used to specify a font style
114///
115///
116/// Default font style.
117///
118/// Font style for fonts similar to Courier.
119///
120/// Font style for fonts similar to Times New Roman.
121///
122/// Font style for fonts similar to Helvetica Monospaced.
123///
124/// Font style for fonts similar to Arial.
125///
126/// Font style for fonts similar to Dom and Impress.
127///
128/// Font style for fonts similar to Coronet and Marigold.
129///
130/// Font style for fonts similar to Engravers Gothic.
131///
132/// See also [Apple's documentation](https://developer.apple.com/documentation/mediaaccessibility/macaptionappearancefontstyle?language=objc)
133// NS_ENUM
134#[repr(transparent)]
135#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
136pub struct MACaptionAppearanceFontStyle(pub CFIndex);
137impl MACaptionAppearanceFontStyle {
138    #[doc(alias = "kMACaptionAppearanceFontStyleDefault")]
139    pub const Default: Self = Self(0);
140    #[doc(alias = "kMACaptionAppearanceFontStyleMonospacedWithSerif")]
141    pub const MonospacedWithSerif: Self = Self(1);
142    #[doc(alias = "kMACaptionAppearanceFontStyleProportionalWithSerif")]
143    pub const ProportionalWithSerif: Self = Self(2);
144    #[doc(alias = "kMACaptionAppearanceFontStyleMonospacedWithoutSerif")]
145    pub const MonospacedWithoutSerif: Self = Self(3);
146    #[doc(alias = "kMACaptionAppearanceFontStyleProportionalWithoutSerif")]
147    pub const ProportionalWithoutSerif: Self = Self(4);
148    #[doc(alias = "kMACaptionAppearanceFontStyleCasual")]
149    pub const Casual: Self = Self(5);
150    #[doc(alias = "kMACaptionAppearanceFontStyleCursive")]
151    pub const Cursive: Self = Self(6);
152    #[doc(alias = "kMACaptionAppearanceFontStyleSmallCapital")]
153    pub const SmallCapital: Self = Self(7);
154}
155
156#[cfg(feature = "objc2")]
157unsafe impl Encode for MACaptionAppearanceFontStyle {
158    const ENCODING: Encoding = CFIndex::ENCODING;
159}
160
161#[cfg(feature = "objc2")]
162unsafe impl RefEncode for MACaptionAppearanceFontStyle {
163    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
164}
165
166/// MACaptionAppearanceTextEdgeStyle is used to specify a text-edge style.
167///
168///
169/// Undefined edge style.
170///
171/// No edge style.
172///
173/// Raised edge style.
174///
175/// Depressed edge style.
176///
177/// Uniform edge style.
178///
179/// Shadow edge style.
180///
181/// See also [Apple's documentation](https://developer.apple.com/documentation/mediaaccessibility/macaptionappearancetextedgestyle?language=objc)
182// NS_ENUM
183#[repr(transparent)]
184#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
185pub struct MACaptionAppearanceTextEdgeStyle(pub CFIndex);
186impl MACaptionAppearanceTextEdgeStyle {
187    #[doc(alias = "kMACaptionAppearanceTextEdgeStyleUndefined")]
188    pub const Undefined: Self = Self(0);
189    #[doc(alias = "kMACaptionAppearanceTextEdgeStyleNone")]
190    pub const None: Self = Self(1);
191    #[doc(alias = "kMACaptionAppearanceTextEdgeStyleRaised")]
192    pub const Raised: Self = Self(2);
193    #[doc(alias = "kMACaptionAppearanceTextEdgeStyleDepressed")]
194    pub const Depressed: Self = Self(3);
195    #[doc(alias = "kMACaptionAppearanceTextEdgeStyleUniform")]
196    pub const Uniform: Self = Self(4);
197    #[doc(alias = "kMACaptionAppearanceTextEdgeStyleDropShadow")]
198    pub const DropShadow: Self = Self(5);
199}
200
201#[cfg(feature = "objc2")]
202unsafe impl Encode for MACaptionAppearanceTextEdgeStyle {
203    const ENCODING: Encoding = CFIndex::ENCODING;
204}
205
206#[cfg(feature = "objc2")]
207unsafe impl RefEncode for MACaptionAppearanceTextEdgeStyle {
208    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
209}
210
211extern "C" {
212    /// A media characteristic that indicates that a track or media selection option includes legible content in the language of its specified locale that:
213    /// - describes music and
214    /// - describes sound other than spoken dialog, such as sound effects and significant silences, occurring in program audio.
215    ///
216    /// Legible tracks provided for accessibility purposes are typically tagged both with this characteristic as well as with MAMediaCharacteristicTranscribesSpokenDialogForAccessibility.
217    /// A legible track provided for accessibility purposes that's associated with an audio track without music and without sound other than spoken dialog -- lacking even significant silences -- can be tagged with this characteristic, because it trivially meets these requirements.
218    ///
219    /// See also [Apple's documentation](https://developer.apple.com/documentation/mediaaccessibility/mamediacharacteristicdescribesmusicandsoundforaccessibility?language=objc)
220    pub static MAMediaCharacteristicDescribesMusicAndSoundForAccessibility: &'static CFString;
221}
222
223extern "C" {
224    /// A media characteristic that indicates that a track or media selection option includes legible content in the language of its specified locale that:
225    /// - transcribes spoken dialog and
226    /// - identifies speakers whenever other visual cues are insufficient for a viewer to determine who is speaking.
227    ///
228    /// Legible tracks provided for accessibility purposes are typically tagged both with this characteristic as well as with MAMediaCharacteristicDescribesMusicAndSoundForAccessibility.
229    /// A legible track provided for accessibility purposes that's associated with an audio track that has no spoken dialog can be tagged with this characteristic, because it trivially meets these requirements.
230    ///
231    /// See also [Apple's documentation](https://developer.apple.com/documentation/mediaaccessibility/mamediacharacteristictranscribesspokendialogforaccessibility?language=objc)
232    pub static MAMediaCharacteristicTranscribesSpokenDialogForAccessibility: &'static CFString;
233}
234
235extern "C-unwind" {
236    /// Called by clients to inform accessibility products that captions have been displayed onscreen.
237    ///
238    /// Parameter `strings`: An array of CFStringRef or CFAttributedStringRef objects that represent the text that is being displayed. An empty array is used to indicate that no captions are being displayed.
239    ///
240    /// # Safety
241    ///
242    /// `strings` generic must be of the correct type.
243    pub fn MACaptionAppearanceDidDisplayCaptions(strings: &CFArray);
244}
245
246extern "C-unwind" {
247    /// Adds a user's selected caption language to stack of languages.
248    ///
249    /// Parameter `domain`: Preference domain, see
250    ///
251    /// ```text
252    ///  MACaptionAppearanceDomain
253    /// ```
254    ///
255    ///
256    /// Parameter `language`: Canonical language identifier (see
257    ///
258    /// ```text
259    ///  CFLocale
260    /// ```
261    ///
262    /// ) of the user's preferred caption language.
263    ///
264    /// Returns: <code>
265    /// true
266    /// </code>
267    /// if addition was successful. Unsuccessful additions are most liketly the result of invalid language codes.
268    ///
269    /// After a language is added it will appear first in the array returned by MACaptionAppearanceCopySelectedLanguages. Applications should call this anytime a user selects a specific languages for captioning tracks.
270    ///
271    /// For example, an AVFoundation clients may execute the following code in response to a user selecting a captioning track:
272    /// <code>
273    /// // in response to a user selection (from a pop-up menu or any other UI affordance), make the selection effective
274    /// -[AVPlayerItem selectMediaOption:legibleOption inMediaSelectionGroup:legibleGroup];
275    ///
276    /// // now update system-wide captioning preferences by registering the language of the option selected by the user
277    /// MACaptionAppearanceAddSelectedLanguage(kMACaptionAppearanceDomainUser, (CFStringRef)[[legibleOption locale] localeIdentifier]);
278    /// </code>
279    pub fn MACaptionAppearanceAddSelectedLanguage(
280        domain: MACaptionAppearanceDomain,
281        language: &CFString,
282    ) -> bool;
283}
284
285/// Copies the user's preferred caption languages.
286///
287///
288/// Parameter `domain`: Preference domain, see
289///
290/// ```text
291///  MACaptionAppearanceDomain
292/// ```
293///
294/// .
295///
296///
297/// Returns: Ordered array of preferred canonical language identifiers.
298///
299///
300/// Languages added using MACaptionAppearanceAddSelectedLanguage are normalized, and thus the contents of this array may have slightly different strings than those passed into MACaptionAppearanceAddSelectedLanguage.
301#[inline]
302pub unsafe extern "C-unwind" fn MACaptionAppearanceCopySelectedLanguages(
303    domain: MACaptionAppearanceDomain,
304) -> CFRetained<CFArray> {
305    extern "C-unwind" {
306        fn MACaptionAppearanceCopySelectedLanguages(
307            domain: MACaptionAppearanceDomain,
308        ) -> Option<NonNull<CFArray>>;
309    }
310    let ret = unsafe { MACaptionAppearanceCopySelectedLanguages(domain) };
311    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
312    unsafe { CFRetained::from_raw(ret) }
313}
314
315extern "C-unwind" {
316    /// User preference representing what type of captions should be displayed
317    ///
318    /// Parameter `domain`: Preference domain, see
319    ///
320    /// ```text
321    ///  MACaptionAppearanceDomain
322    /// ```
323    ///
324    /// .
325    ///
326    /// Returns: User preference representing what type of captions should be displayed. See
327    ///
328    /// ```text
329    ///  MACaptionAppearanceDisplayType
330    /// ```
331    ///
332    /// .
333    pub fn MACaptionAppearanceGetDisplayType(
334        domain: MACaptionAppearanceDomain,
335    ) -> MACaptionAppearanceDisplayType;
336}
337
338extern "C-unwind" {
339    /// User preference representing what type of captions should be displayed
340    ///
341    /// Parameter `domain`: Preference domain, see
342    ///
343    /// ```text
344    ///  MACaptionAppearanceDomain
345    /// ```
346    ///
347    /// .
348    ///
349    /// Parameter `displayType`: Captions display type, see
350    ///
351    /// ```text
352    ///  MACaptionAppearanceDisplayType
353    /// ```
354    ///
355    /// .
356    pub fn MACaptionAppearanceSetDisplayType(
357        domain: MACaptionAppearanceDomain,
358        display_type: MACaptionAppearanceDisplayType,
359    );
360}
361
362/// User preference for captioning media characteristic
363///
364/// Parameter `domain`: Preference domain, see
365///
366/// ```text
367///  MACaptionAppearanceDomain
368/// ```
369///
370/// .
371///
372/// Returns: An array containing the preferred order of media characteristics for captions.
373#[inline]
374pub unsafe extern "C-unwind" fn MACaptionAppearanceCopyPreferredCaptioningMediaCharacteristics(
375    domain: MACaptionAppearanceDomain,
376) -> CFRetained<CFArray> {
377    extern "C-unwind" {
378        fn MACaptionAppearanceCopyPreferredCaptioningMediaCharacteristics(
379            domain: MACaptionAppearanceDomain,
380        ) -> Option<NonNull<CFArray>>;
381    }
382    let ret = unsafe { MACaptionAppearanceCopyPreferredCaptioningMediaCharacteristics(domain) };
383    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
384    unsafe { CFRetained::from_raw(ret) }
385}
386
387extern "C-unwind" {
388    /// Provides a boolean indicating if the currently-active style has been customized by the user. This is useful for some clients who may need different fallback strategies for customized styles vs system-default styles.
389    ///
390    /// Parameter `domain`: Preference domain, see
391    ///
392    /// ```text
393    ///  MACaptionAppearanceDomain
394    /// ```
395    ///
396    /// .
397    ///
398    /// Returns: A boolean indicating if the currently-active style has been customized by the user
399    pub fn MACaptionAppearanceIsCustomized(domain: MACaptionAppearanceDomain) -> bool;
400}
401
402/// User preference for foreground/text color.
403///
404/// Parameter `domain`: Preference domain, see
405///
406/// ```text
407///  MACaptionAppearanceDomain
408/// ```
409///
410/// .
411///
412/// Parameter `behavior`: (see
413///
414/// ```text
415///  MACaptionAppearanceBehavior
416/// ```
417///
418/// )
419///
420/// Returns: User preference for foreground/text color.
421///
422/// # Safety
423///
424/// `behavior` must be a valid pointer or null.
425#[cfg(feature = "objc2-core-graphics")]
426#[inline]
427pub unsafe extern "C-unwind" fn MACaptionAppearanceCopyForegroundColor(
428    domain: MACaptionAppearanceDomain,
429    behavior: *mut MACaptionAppearanceBehavior,
430) -> CFRetained<CGColor> {
431    extern "C-unwind" {
432        fn MACaptionAppearanceCopyForegroundColor(
433            domain: MACaptionAppearanceDomain,
434            behavior: *mut MACaptionAppearanceBehavior,
435        ) -> Option<NonNull<CGColor>>;
436    }
437    let ret = unsafe { MACaptionAppearanceCopyForegroundColor(domain, behavior) };
438    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
439    unsafe { CFRetained::from_raw(ret) }
440}
441
442/// User preference for background color.
443///
444/// The background color is the color behind each caption glyph.
445///
446/// Parameter `domain`: Preference domain, see
447///
448/// ```text
449///  MACaptionAppearanceDomain
450/// ```
451///
452/// .
453///
454/// Parameter `behavior`: (see
455///
456/// ```text
457///  MACaptionAppearanceBehavior
458/// ```
459///
460/// )
461///
462/// Returns: User preference for background color.
463///
464/// # Safety
465///
466/// `behavior` must be a valid pointer or null.
467#[cfg(feature = "objc2-core-graphics")]
468#[inline]
469pub unsafe extern "C-unwind" fn MACaptionAppearanceCopyBackgroundColor(
470    domain: MACaptionAppearanceDomain,
471    behavior: *mut MACaptionAppearanceBehavior,
472) -> CFRetained<CGColor> {
473    extern "C-unwind" {
474        fn MACaptionAppearanceCopyBackgroundColor(
475            domain: MACaptionAppearanceDomain,
476            behavior: *mut MACaptionAppearanceBehavior,
477        ) -> Option<NonNull<CGColor>>;
478    }
479    let ret = unsafe { MACaptionAppearanceCopyBackgroundColor(domain, behavior) };
480    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
481    unsafe { CFRetained::from_raw(ret) }
482}
483
484/// User preference for window color.
485///
486/// The window color is the color of a box behind all of the caption glyphs.
487///
488/// Parameter `domain`: Preference domain, see
489///
490/// ```text
491///  MACaptionAppearanceDomain
492/// ```
493///
494/// .
495///
496/// Parameter `behavior`: (see
497///
498/// ```text
499///  MACaptionAppearanceBehavior
500/// ```
501///
502/// )
503///
504/// Returns: User preference for window color.
505///
506/// # Safety
507///
508/// `behavior` must be a valid pointer or null.
509#[cfg(feature = "objc2-core-graphics")]
510#[inline]
511pub unsafe extern "C-unwind" fn MACaptionAppearanceCopyWindowColor(
512    domain: MACaptionAppearanceDomain,
513    behavior: *mut MACaptionAppearanceBehavior,
514) -> CFRetained<CGColor> {
515    extern "C-unwind" {
516        fn MACaptionAppearanceCopyWindowColor(
517            domain: MACaptionAppearanceDomain,
518            behavior: *mut MACaptionAppearanceBehavior,
519        ) -> Option<NonNull<CGColor>>;
520    }
521    let ret = unsafe { MACaptionAppearanceCopyWindowColor(domain, behavior) };
522    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
523    unsafe { CFRetained::from_raw(ret) }
524}
525
526extern "C-unwind" {
527    /// User preference for foreground opacity.
528    ///
529    /// Parameter `domain`: Preference domain, see
530    ///
531    /// ```text
532    ///  MACaptionAppearanceDomain
533    /// ```
534    ///
535    /// .
536    ///
537    /// Parameter `behavior`: (see
538    ///
539    /// ```text
540    ///  MACaptionAppearanceBehavior
541    /// ```
542    ///
543    /// )
544    ///
545    /// Returns: User preference for foreground opacity.
546    ///
547    /// # Safety
548    ///
549    /// `behavior` must be a valid pointer or null.
550    pub fn MACaptionAppearanceGetForegroundOpacity(
551        domain: MACaptionAppearanceDomain,
552        behavior: *mut MACaptionAppearanceBehavior,
553    ) -> CGFloat;
554}
555
556extern "C-unwind" {
557    /// User preference for background opacity.
558    ///
559    /// Parameter `domain`: Preference domain, see
560    ///
561    /// ```text
562    ///  MACaptionAppearanceDomain
563    /// ```
564    ///
565    /// .
566    ///
567    /// Parameter `behavior`: (see
568    ///
569    /// ```text
570    ///  MACaptionAppearanceBehavior
571    /// ```
572    ///
573    /// )
574    ///
575    /// Returns: User preference for background opacity.
576    ///
577    /// # Safety
578    ///
579    /// `behavior` must be a valid pointer or null.
580    pub fn MACaptionAppearanceGetBackgroundOpacity(
581        domain: MACaptionAppearanceDomain,
582        behavior: *mut MACaptionAppearanceBehavior,
583    ) -> CGFloat;
584}
585
586extern "C-unwind" {
587    /// User preference for window opacity.
588    ///
589    /// Parameter `domain`: Preference domain, see
590    ///
591    /// ```text
592    ///  MACaptionAppearanceDomain
593    /// ```
594    ///
595    /// .
596    ///
597    /// Parameter `behavior`: (see
598    ///
599    /// ```text
600    ///  MACaptionAppearanceBehavior
601    /// ```
602    ///
603    /// )
604    ///
605    /// Returns: User preference for window opacity.
606    ///
607    /// # Safety
608    ///
609    /// `behavior` must be a valid pointer or null.
610    pub fn MACaptionAppearanceGetWindowOpacity(
611        domain: MACaptionAppearanceDomain,
612        behavior: *mut MACaptionAppearanceBehavior,
613    ) -> CGFloat;
614}
615
616extern "C-unwind" {
617    /// User preference for caption-window corner radius.
618    ///
619    /// Parameter `domain`: Preference domain, see
620    ///
621    /// ```text
622    ///  MACaptionAppearanceDomain
623    /// ```
624    ///
625    /// .
626    ///
627    /// Parameter `behavior`: (see
628    ///
629    /// ```text
630    ///  MACaptionAppearanceBehavior
631    /// ```
632    ///
633    /// )
634    ///
635    /// Returns: User preference for caption-window corner radius.
636    ///
637    /// # Safety
638    ///
639    /// `behavior` must be a valid pointer or null.
640    pub fn MACaptionAppearanceGetWindowRoundedCornerRadius(
641        domain: MACaptionAppearanceDomain,
642        behavior: *mut MACaptionAppearanceBehavior,
643    ) -> CGFloat;
644}
645
646/// User font preference for the specified style.
647///
648/// Parameter `domain`: Preference domain, see
649///
650/// ```text
651///  MACaptionAppearanceDomain
652/// ```
653///
654/// .
655///
656/// Parameter `behavior`: (see
657///
658/// ```text
659///  MACaptionAppearanceBehavior
660/// ```
661///
662/// )
663///
664/// Parameter `fontStyle`: Font style, see
665///
666/// ```text
667///  MACaptionAppearanceFontStyle
668/// ```
669///
670/// .
671///
672/// Returns: User font preference for the specified style.
673///
674/// # Safety
675///
676/// `behavior` must be a valid pointer or null.
677#[cfg(feature = "objc2-core-text")]
678#[inline]
679pub unsafe extern "C-unwind" fn MACaptionAppearanceCopyFontDescriptorForStyle(
680    domain: MACaptionAppearanceDomain,
681    behavior: *mut MACaptionAppearanceBehavior,
682    font_style: MACaptionAppearanceFontStyle,
683) -> CFRetained<CTFontDescriptor> {
684    extern "C-unwind" {
685        fn MACaptionAppearanceCopyFontDescriptorForStyle(
686            domain: MACaptionAppearanceDomain,
687            behavior: *mut MACaptionAppearanceBehavior,
688            font_style: MACaptionAppearanceFontStyle,
689        ) -> Option<NonNull<CTFontDescriptor>>;
690    }
691    let ret =
692        unsafe { MACaptionAppearanceCopyFontDescriptorForStyle(domain, behavior, font_style) };
693    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
694    unsafe { CFRetained::from_raw(ret) }
695}
696
697extern "C-unwind" {
698    /// User preference for font scaling.
699    ///
700    /// Parameter `domain`: Preference domain, see
701    ///
702    /// ```text
703    ///  MACaptionAppearanceDomain
704    /// ```
705    ///
706    /// .
707    ///
708    /// Parameter `behavior`: (see
709    ///
710    /// ```text
711    ///  MACaptionAppearanceBehavior
712    /// ```
713    ///
714    /// )
715    ///
716    /// Returns: User font scaling preference for the specified style.
717    ///
718    /// # Safety
719    ///
720    /// `behavior` must be a valid pointer or null.
721    pub fn MACaptionAppearanceGetRelativeCharacterSize(
722        domain: MACaptionAppearanceDomain,
723        behavior: *mut MACaptionAppearanceBehavior,
724    ) -> CGFloat;
725}
726
727extern "C-unwind" {
728    /// User preference for text edge style.
729    ///
730    /// Parameter `domain`: Preference domain, see
731    ///
732    /// ```text
733    ///  MACaptionAppearanceDomain
734    /// ```
735    ///
736    /// .
737    ///
738    /// Parameter `behavior`: (see
739    ///
740    /// ```text
741    ///  MACaptionAppearanceBehavior
742    /// ```
743    ///
744    /// )
745    ///
746    /// Returns: User preference for text edge style.
747    ///
748    /// # Safety
749    ///
750    /// `behavior` must be a valid pointer or null.
751    pub fn MACaptionAppearanceGetTextEdgeStyle(
752        domain: MACaptionAppearanceDomain,
753        behavior: *mut MACaptionAppearanceBehavior,
754    ) -> MACaptionAppearanceTextEdgeStyle;
755}
756
757/// Copies all system and user defined profiles, each represented by a CFString containing a non-human-readable ID
758///
759/// Returns: An array of strings where each string represents a unique caption profile ID.
760#[inline]
761pub unsafe extern "C-unwind" fn MACaptionAppearanceCopyProfileIDs() -> CFRetained<CFArray> {
762    extern "C-unwind" {
763        fn MACaptionAppearanceCopyProfileIDs() -> Option<NonNull<CFArray>>;
764    }
765    let ret = unsafe { MACaptionAppearanceCopyProfileIDs() };
766    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
767    unsafe { CFRetained::from_raw(ret) }
768}
769
770extern "C-unwind" {
771    /// Sets the currently-selected caption drawing profileID system wide. Behavior is undefined if NULL or an invalid profileID is provided
772    ///
773    /// Parameter `profileID`: The profileID to make active.
774    pub fn MACaptionAppearanceSetActiveProfileID(profile_id: &CFString);
775}
776
777/// Gets the currently-selected caption drawing profileID system wide.
778///
779/// Returns: The currently-selected profileID.
780#[inline]
781pub unsafe extern "C-unwind" fn MACaptionAppearanceCopyActiveProfileID() -> CFRetained<CFString> {
782    extern "C-unwind" {
783        fn MACaptionAppearanceCopyActiveProfileID() -> Option<NonNull<CFString>>;
784    }
785    let ret = unsafe { MACaptionAppearanceCopyActiveProfileID() };
786    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
787    unsafe { CFRetained::from_raw(ret) }
788}
789
790/// Copies the human-readable name of a profileID
791///
792/// Parameter `profileID`: The profileID to copy the name of
793///
794/// Returns: A human-readable name of the provided profileID
795#[inline]
796pub unsafe extern "C-unwind" fn MACaptionAppearanceCopyProfileName(
797    profile_id: &CFString,
798) -> CFRetained<CFString> {
799    extern "C-unwind" {
800        fn MACaptionAppearanceCopyProfileName(profile_id: &CFString) -> Option<NonNull<CFString>>;
801    }
802    let ret = unsafe { MACaptionAppearanceCopyProfileName(profile_id) };
803    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
804    unsafe { CFRetained::from_raw(ret) }
805}
806
807extern "C-unwind" {
808    /// Executes a block of code as if the provided profileID was active. This is used in cases such as a need to get the fonts and colors of a profileID without changing the currently selected profileID.
809    ///
810    /// Parameter `profileID`: The profileID which will appear active when executing the block
811    ///
812    /// Parameter `aBlock`: the block of code to execute
813    #[cfg(feature = "block2")]
814    pub fn MACaptionAppearanceExecuteBlockForProfileID(
815        profile_id: &CFString,
816        a_block: &block2::DynBlock<dyn Fn()>,
817    );
818}