objc2-media-accessibility 0.3.2

Bindings to the MediaAccessibility framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use objc2_core_foundation::*;
#[cfg(feature = "objc2-core-graphics")]
use objc2_core_graphics::*;
#[cfg(feature = "objc2-core-text")]
use objc2_core_text::*;

use crate::*;

extern "C" {
    /// CFNotification sent when any user-defined captioning settings are changed.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/mediaaccessibility/kmacaptionappearancesettingschangednotification?language=objc)
    pub static kMACaptionAppearanceSettingsChangedNotification: &'static CFString;
}

/// MACaptionAppearanceDomain is used to specify which domain of preferences to access.
///
///
/// The user-defined preferences. This domain should be passed to retrieve settings that should be used to render captions.
///
/// 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.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/mediaaccessibility/macaptionappearancedomain?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MACaptionAppearanceDomain(pub CFIndex);
impl MACaptionAppearanceDomain {
    #[doc(alias = "kMACaptionAppearanceDomainDefault")]
    pub const Default: Self = Self(0);
    #[doc(alias = "kMACaptionAppearanceDomainUser")]
    pub const User: Self = Self(1);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for MACaptionAppearanceDomain {
    const ENCODING: Encoding = CFIndex::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for MACaptionAppearanceDomain {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// MACaptionAppearanceDisplayType is used to specify the the type of captions that should be displayed
///
///
/// Only forced captions for translation should be displayed.
///
/// If the language of the audio track differs from the system locale then captions matching the system locale should be displayed (if available).
///
/// The best available captioning track should always be displayed, whether it be CC, SDH, or subtitles.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/mediaaccessibility/macaptionappearancedisplaytype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MACaptionAppearanceDisplayType(pub CFIndex);
impl MACaptionAppearanceDisplayType {
    #[doc(alias = "kMACaptionAppearanceDisplayTypeForcedOnly")]
    pub const ForcedOnly: Self = Self(0);
    #[doc(alias = "kMACaptionAppearanceDisplayTypeAutomatic")]
    pub const Automatic: Self = Self(1);
    #[doc(alias = "kMACaptionAppearanceDisplayTypeAlwaysOn")]
    pub const AlwaysOn: Self = Self(2);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for MACaptionAppearanceDisplayType {
    const ENCODING: Encoding = CFIndex::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for MACaptionAppearanceDisplayType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// MACaptionAppearanceBehavior is used to determine how a preference value should be used.
///
///
/// The value should override any content, application, or otherwise-defined values.
///
/// Content, application, or otherwise-defined values should override the returned value. If no other value is defined, then the return value should be used.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/mediaaccessibility/macaptionappearancebehavior?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MACaptionAppearanceBehavior(pub CFIndex);
impl MACaptionAppearanceBehavior {
    #[doc(alias = "kMACaptionAppearanceBehaviorUseValue")]
    pub const UseValue: Self = Self(0);
    #[doc(alias = "kMACaptionAppearanceBehaviorUseContentIfAvailable")]
    pub const UseContentIfAvailable: Self = Self(1);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for MACaptionAppearanceBehavior {
    const ENCODING: Encoding = CFIndex::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for MACaptionAppearanceBehavior {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// MACaptionAppearanceFontStyle is used to specify a font style
///
///
/// Default font style.
///
/// Font style for fonts similar to Courier.
///
/// Font style for fonts similar to Times New Roman.
///
/// Font style for fonts similar to Helvetica Monospaced.
///
/// Font style for fonts similar to Arial.
///
/// Font style for fonts similar to Dom and Impress.
///
/// Font style for fonts similar to Coronet and Marigold.
///
/// Font style for fonts similar to Engravers Gothic.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/mediaaccessibility/macaptionappearancefontstyle?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MACaptionAppearanceFontStyle(pub CFIndex);
impl MACaptionAppearanceFontStyle {
    #[doc(alias = "kMACaptionAppearanceFontStyleDefault")]
    pub const Default: Self = Self(0);
    #[doc(alias = "kMACaptionAppearanceFontStyleMonospacedWithSerif")]
    pub const MonospacedWithSerif: Self = Self(1);
    #[doc(alias = "kMACaptionAppearanceFontStyleProportionalWithSerif")]
    pub const ProportionalWithSerif: Self = Self(2);
    #[doc(alias = "kMACaptionAppearanceFontStyleMonospacedWithoutSerif")]
    pub const MonospacedWithoutSerif: Self = Self(3);
    #[doc(alias = "kMACaptionAppearanceFontStyleProportionalWithoutSerif")]
    pub const ProportionalWithoutSerif: Self = Self(4);
    #[doc(alias = "kMACaptionAppearanceFontStyleCasual")]
    pub const Casual: Self = Self(5);
    #[doc(alias = "kMACaptionAppearanceFontStyleCursive")]
    pub const Cursive: Self = Self(6);
    #[doc(alias = "kMACaptionAppearanceFontStyleSmallCapital")]
    pub const SmallCapital: Self = Self(7);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for MACaptionAppearanceFontStyle {
    const ENCODING: Encoding = CFIndex::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for MACaptionAppearanceFontStyle {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// MACaptionAppearanceTextEdgeStyle is used to specify a text-edge style.
///
///
/// Undefined edge style.
///
/// No edge style.
///
/// Raised edge style.
///
/// Depressed edge style.
///
/// Uniform edge style.
///
/// Shadow edge style.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/mediaaccessibility/macaptionappearancetextedgestyle?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MACaptionAppearanceTextEdgeStyle(pub CFIndex);
impl MACaptionAppearanceTextEdgeStyle {
    #[doc(alias = "kMACaptionAppearanceTextEdgeStyleUndefined")]
    pub const Undefined: Self = Self(0);
    #[doc(alias = "kMACaptionAppearanceTextEdgeStyleNone")]
    pub const None: Self = Self(1);
    #[doc(alias = "kMACaptionAppearanceTextEdgeStyleRaised")]
    pub const Raised: Self = Self(2);
    #[doc(alias = "kMACaptionAppearanceTextEdgeStyleDepressed")]
    pub const Depressed: Self = Self(3);
    #[doc(alias = "kMACaptionAppearanceTextEdgeStyleUniform")]
    pub const Uniform: Self = Self(4);
    #[doc(alias = "kMACaptionAppearanceTextEdgeStyleDropShadow")]
    pub const DropShadow: Self = Self(5);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for MACaptionAppearanceTextEdgeStyle {
    const ENCODING: Encoding = CFIndex::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for MACaptionAppearanceTextEdgeStyle {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern "C" {
    /// A media characteristic that indicates that a track or media selection option includes legible content in the language of its specified locale that:
    /// - describes music and
    /// - describes sound other than spoken dialog, such as sound effects and significant silences, occurring in program audio.
    ///
    /// Legible tracks provided for accessibility purposes are typically tagged both with this characteristic as well as with MAMediaCharacteristicTranscribesSpokenDialogForAccessibility.
    /// 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.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/mediaaccessibility/mamediacharacteristicdescribesmusicandsoundforaccessibility?language=objc)
    pub static MAMediaCharacteristicDescribesMusicAndSoundForAccessibility: &'static CFString;
}

extern "C" {
    /// A media characteristic that indicates that a track or media selection option includes legible content in the language of its specified locale that:
    /// - transcribes spoken dialog and
    /// - identifies speakers whenever other visual cues are insufficient for a viewer to determine who is speaking.
    ///
    /// Legible tracks provided for accessibility purposes are typically tagged both with this characteristic as well as with MAMediaCharacteristicDescribesMusicAndSoundForAccessibility.
    /// 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.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/mediaaccessibility/mamediacharacteristictranscribesspokendialogforaccessibility?language=objc)
    pub static MAMediaCharacteristicTranscribesSpokenDialogForAccessibility: &'static CFString;
}

extern "C-unwind" {
    /// Called by clients to inform accessibility products that captions have been displayed onscreen.
    ///
    /// 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.
    ///
    /// # Safety
    ///
    /// `strings` generic must be of the correct type.
    pub fn MACaptionAppearanceDidDisplayCaptions(strings: &CFArray);
}

extern "C-unwind" {
    /// Adds a user's selected caption language to stack of languages.
    ///
    /// Parameter `domain`: Preference domain, see
    ///
    /// ```text
    ///  MACaptionAppearanceDomain
    /// ```
    ///
    ///
    /// Parameter `language`: Canonical language identifier (see
    ///
    /// ```text
    ///  CFLocale
    /// ```
    ///
    /// ) of the user's preferred caption language.
    ///
    /// Returns: <code>
    /// true
    /// </code>
    /// if addition was successful. Unsuccessful additions are most liketly the result of invalid language codes.
    ///
    /// 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.
    ///
    /// For example, an AVFoundation clients may execute the following code in response to a user selecting a captioning track:
    /// <code>
    /// // in response to a user selection (from a pop-up menu or any other UI affordance), make the selection effective
    /// -[AVPlayerItem selectMediaOption:legibleOption inMediaSelectionGroup:legibleGroup];
    ///
    /// // now update system-wide captioning preferences by registering the language of the option selected by the user
    /// MACaptionAppearanceAddSelectedLanguage(kMACaptionAppearanceDomainUser, (CFStringRef)[[legibleOption locale] localeIdentifier]);
    /// </code>
    pub fn MACaptionAppearanceAddSelectedLanguage(
        domain: MACaptionAppearanceDomain,
        language: &CFString,
    ) -> bool;
}

/// Copies the user's preferred caption languages.
///
///
/// Parameter `domain`: Preference domain, see
///
/// ```text
///  MACaptionAppearanceDomain
/// ```
///
/// .
///
///
/// Returns: Ordered array of preferred canonical language identifiers.
///
///
/// Languages added using MACaptionAppearanceAddSelectedLanguage are normalized, and thus the contents of this array may have slightly different strings than those passed into MACaptionAppearanceAddSelectedLanguage.
#[inline]
pub unsafe extern "C-unwind" fn MACaptionAppearanceCopySelectedLanguages(
    domain: MACaptionAppearanceDomain,
) -> CFRetained<CFArray> {
    extern "C-unwind" {
        fn MACaptionAppearanceCopySelectedLanguages(
            domain: MACaptionAppearanceDomain,
        ) -> Option<NonNull<CFArray>>;
    }
    let ret = unsafe { MACaptionAppearanceCopySelectedLanguages(domain) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

extern "C-unwind" {
    /// User preference representing what type of captions should be displayed
    ///
    /// Parameter `domain`: Preference domain, see
    ///
    /// ```text
    ///  MACaptionAppearanceDomain
    /// ```
    ///
    /// .
    ///
    /// Returns: User preference representing what type of captions should be displayed. See
    ///
    /// ```text
    ///  MACaptionAppearanceDisplayType
    /// ```
    ///
    /// .
    pub fn MACaptionAppearanceGetDisplayType(
        domain: MACaptionAppearanceDomain,
    ) -> MACaptionAppearanceDisplayType;
}

extern "C-unwind" {
    /// User preference representing what type of captions should be displayed
    ///
    /// Parameter `domain`: Preference domain, see
    ///
    /// ```text
    ///  MACaptionAppearanceDomain
    /// ```
    ///
    /// .
    ///
    /// Parameter `displayType`: Captions display type, see
    ///
    /// ```text
    ///  MACaptionAppearanceDisplayType
    /// ```
    ///
    /// .
    pub fn MACaptionAppearanceSetDisplayType(
        domain: MACaptionAppearanceDomain,
        display_type: MACaptionAppearanceDisplayType,
    );
}

/// User preference for captioning media characteristic
///
/// Parameter `domain`: Preference domain, see
///
/// ```text
///  MACaptionAppearanceDomain
/// ```
///
/// .
///
/// Returns: An array containing the preferred order of media characteristics for captions.
#[inline]
pub unsafe extern "C-unwind" fn MACaptionAppearanceCopyPreferredCaptioningMediaCharacteristics(
    domain: MACaptionAppearanceDomain,
) -> CFRetained<CFArray> {
    extern "C-unwind" {
        fn MACaptionAppearanceCopyPreferredCaptioningMediaCharacteristics(
            domain: MACaptionAppearanceDomain,
        ) -> Option<NonNull<CFArray>>;
    }
    let ret = unsafe { MACaptionAppearanceCopyPreferredCaptioningMediaCharacteristics(domain) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

extern "C-unwind" {
    /// 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.
    ///
    /// Parameter `domain`: Preference domain, see
    ///
    /// ```text
    ///  MACaptionAppearanceDomain
    /// ```
    ///
    /// .
    ///
    /// Returns: A boolean indicating if the currently-active style has been customized by the user
    pub fn MACaptionAppearanceIsCustomized(domain: MACaptionAppearanceDomain) -> bool;
}

/// User preference for foreground/text color.
///
/// Parameter `domain`: Preference domain, see
///
/// ```text
///  MACaptionAppearanceDomain
/// ```
///
/// .
///
/// Parameter `behavior`: (see
///
/// ```text
///  MACaptionAppearanceBehavior
/// ```
///
/// )
///
/// Returns: User preference for foreground/text color.
///
/// # Safety
///
/// `behavior` must be a valid pointer or null.
#[cfg(feature = "objc2-core-graphics")]
#[inline]
pub unsafe extern "C-unwind" fn MACaptionAppearanceCopyForegroundColor(
    domain: MACaptionAppearanceDomain,
    behavior: *mut MACaptionAppearanceBehavior,
) -> CFRetained<CGColor> {
    extern "C-unwind" {
        fn MACaptionAppearanceCopyForegroundColor(
            domain: MACaptionAppearanceDomain,
            behavior: *mut MACaptionAppearanceBehavior,
        ) -> Option<NonNull<CGColor>>;
    }
    let ret = unsafe { MACaptionAppearanceCopyForegroundColor(domain, behavior) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

/// User preference for background color.
///
/// The background color is the color behind each caption glyph.
///
/// Parameter `domain`: Preference domain, see
///
/// ```text
///  MACaptionAppearanceDomain
/// ```
///
/// .
///
/// Parameter `behavior`: (see
///
/// ```text
///  MACaptionAppearanceBehavior
/// ```
///
/// )
///
/// Returns: User preference for background color.
///
/// # Safety
///
/// `behavior` must be a valid pointer or null.
#[cfg(feature = "objc2-core-graphics")]
#[inline]
pub unsafe extern "C-unwind" fn MACaptionAppearanceCopyBackgroundColor(
    domain: MACaptionAppearanceDomain,
    behavior: *mut MACaptionAppearanceBehavior,
) -> CFRetained<CGColor> {
    extern "C-unwind" {
        fn MACaptionAppearanceCopyBackgroundColor(
            domain: MACaptionAppearanceDomain,
            behavior: *mut MACaptionAppearanceBehavior,
        ) -> Option<NonNull<CGColor>>;
    }
    let ret = unsafe { MACaptionAppearanceCopyBackgroundColor(domain, behavior) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

/// User preference for window color.
///
/// The window color is the color of a box behind all of the caption glyphs.
///
/// Parameter `domain`: Preference domain, see
///
/// ```text
///  MACaptionAppearanceDomain
/// ```
///
/// .
///
/// Parameter `behavior`: (see
///
/// ```text
///  MACaptionAppearanceBehavior
/// ```
///
/// )
///
/// Returns: User preference for window color.
///
/// # Safety
///
/// `behavior` must be a valid pointer or null.
#[cfg(feature = "objc2-core-graphics")]
#[inline]
pub unsafe extern "C-unwind" fn MACaptionAppearanceCopyWindowColor(
    domain: MACaptionAppearanceDomain,
    behavior: *mut MACaptionAppearanceBehavior,
) -> CFRetained<CGColor> {
    extern "C-unwind" {
        fn MACaptionAppearanceCopyWindowColor(
            domain: MACaptionAppearanceDomain,
            behavior: *mut MACaptionAppearanceBehavior,
        ) -> Option<NonNull<CGColor>>;
    }
    let ret = unsafe { MACaptionAppearanceCopyWindowColor(domain, behavior) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

extern "C-unwind" {
    /// User preference for foreground opacity.
    ///
    /// Parameter `domain`: Preference domain, see
    ///
    /// ```text
    ///  MACaptionAppearanceDomain
    /// ```
    ///
    /// .
    ///
    /// Parameter `behavior`: (see
    ///
    /// ```text
    ///  MACaptionAppearanceBehavior
    /// ```
    ///
    /// )
    ///
    /// Returns: User preference for foreground opacity.
    ///
    /// # Safety
    ///
    /// `behavior` must be a valid pointer or null.
    pub fn MACaptionAppearanceGetForegroundOpacity(
        domain: MACaptionAppearanceDomain,
        behavior: *mut MACaptionAppearanceBehavior,
    ) -> CGFloat;
}

extern "C-unwind" {
    /// User preference for background opacity.
    ///
    /// Parameter `domain`: Preference domain, see
    ///
    /// ```text
    ///  MACaptionAppearanceDomain
    /// ```
    ///
    /// .
    ///
    /// Parameter `behavior`: (see
    ///
    /// ```text
    ///  MACaptionAppearanceBehavior
    /// ```
    ///
    /// )
    ///
    /// Returns: User preference for background opacity.
    ///
    /// # Safety
    ///
    /// `behavior` must be a valid pointer or null.
    pub fn MACaptionAppearanceGetBackgroundOpacity(
        domain: MACaptionAppearanceDomain,
        behavior: *mut MACaptionAppearanceBehavior,
    ) -> CGFloat;
}

extern "C-unwind" {
    /// User preference for window opacity.
    ///
    /// Parameter `domain`: Preference domain, see
    ///
    /// ```text
    ///  MACaptionAppearanceDomain
    /// ```
    ///
    /// .
    ///
    /// Parameter `behavior`: (see
    ///
    /// ```text
    ///  MACaptionAppearanceBehavior
    /// ```
    ///
    /// )
    ///
    /// Returns: User preference for window opacity.
    ///
    /// # Safety
    ///
    /// `behavior` must be a valid pointer or null.
    pub fn MACaptionAppearanceGetWindowOpacity(
        domain: MACaptionAppearanceDomain,
        behavior: *mut MACaptionAppearanceBehavior,
    ) -> CGFloat;
}

extern "C-unwind" {
    /// User preference for caption-window corner radius.
    ///
    /// Parameter `domain`: Preference domain, see
    ///
    /// ```text
    ///  MACaptionAppearanceDomain
    /// ```
    ///
    /// .
    ///
    /// Parameter `behavior`: (see
    ///
    /// ```text
    ///  MACaptionAppearanceBehavior
    /// ```
    ///
    /// )
    ///
    /// Returns: User preference for caption-window corner radius.
    ///
    /// # Safety
    ///
    /// `behavior` must be a valid pointer or null.
    pub fn MACaptionAppearanceGetWindowRoundedCornerRadius(
        domain: MACaptionAppearanceDomain,
        behavior: *mut MACaptionAppearanceBehavior,
    ) -> CGFloat;
}

/// User font preference for the specified style.
///
/// Parameter `domain`: Preference domain, see
///
/// ```text
///  MACaptionAppearanceDomain
/// ```
///
/// .
///
/// Parameter `behavior`: (see
///
/// ```text
///  MACaptionAppearanceBehavior
/// ```
///
/// )
///
/// Parameter `fontStyle`: Font style, see
///
/// ```text
///  MACaptionAppearanceFontStyle
/// ```
///
/// .
///
/// Returns: User font preference for the specified style.
///
/// # Safety
///
/// `behavior` must be a valid pointer or null.
#[cfg(feature = "objc2-core-text")]
#[inline]
pub unsafe extern "C-unwind" fn MACaptionAppearanceCopyFontDescriptorForStyle(
    domain: MACaptionAppearanceDomain,
    behavior: *mut MACaptionAppearanceBehavior,
    font_style: MACaptionAppearanceFontStyle,
) -> CFRetained<CTFontDescriptor> {
    extern "C-unwind" {
        fn MACaptionAppearanceCopyFontDescriptorForStyle(
            domain: MACaptionAppearanceDomain,
            behavior: *mut MACaptionAppearanceBehavior,
            font_style: MACaptionAppearanceFontStyle,
        ) -> Option<NonNull<CTFontDescriptor>>;
    }
    let ret =
        unsafe { MACaptionAppearanceCopyFontDescriptorForStyle(domain, behavior, font_style) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

extern "C-unwind" {
    /// User preference for font scaling.
    ///
    /// Parameter `domain`: Preference domain, see
    ///
    /// ```text
    ///  MACaptionAppearanceDomain
    /// ```
    ///
    /// .
    ///
    /// Parameter `behavior`: (see
    ///
    /// ```text
    ///  MACaptionAppearanceBehavior
    /// ```
    ///
    /// )
    ///
    /// Returns: User font scaling preference for the specified style.
    ///
    /// # Safety
    ///
    /// `behavior` must be a valid pointer or null.
    pub fn MACaptionAppearanceGetRelativeCharacterSize(
        domain: MACaptionAppearanceDomain,
        behavior: *mut MACaptionAppearanceBehavior,
    ) -> CGFloat;
}

extern "C-unwind" {
    /// User preference for text edge style.
    ///
    /// Parameter `domain`: Preference domain, see
    ///
    /// ```text
    ///  MACaptionAppearanceDomain
    /// ```
    ///
    /// .
    ///
    /// Parameter `behavior`: (see
    ///
    /// ```text
    ///  MACaptionAppearanceBehavior
    /// ```
    ///
    /// )
    ///
    /// Returns: User preference for text edge style.
    ///
    /// # Safety
    ///
    /// `behavior` must be a valid pointer or null.
    pub fn MACaptionAppearanceGetTextEdgeStyle(
        domain: MACaptionAppearanceDomain,
        behavior: *mut MACaptionAppearanceBehavior,
    ) -> MACaptionAppearanceTextEdgeStyle;
}

/// Copies all system and user defined profiles, each represented by a CFString containing a non-human-readable ID
///
/// Returns: An array of strings where each string represents a unique caption profile ID.
#[inline]
pub unsafe extern "C-unwind" fn MACaptionAppearanceCopyProfileIDs() -> CFRetained<CFArray> {
    extern "C-unwind" {
        fn MACaptionAppearanceCopyProfileIDs() -> Option<NonNull<CFArray>>;
    }
    let ret = unsafe { MACaptionAppearanceCopyProfileIDs() };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

extern "C-unwind" {
    /// Sets the currently-selected caption drawing profileID system wide. Behavior is undefined if NULL or an invalid profileID is provided
    ///
    /// Parameter `profileID`: The profileID to make active.
    pub fn MACaptionAppearanceSetActiveProfileID(profile_id: &CFString);
}

/// Gets the currently-selected caption drawing profileID system wide.
///
/// Returns: The currently-selected profileID.
#[inline]
pub unsafe extern "C-unwind" fn MACaptionAppearanceCopyActiveProfileID() -> CFRetained<CFString> {
    extern "C-unwind" {
        fn MACaptionAppearanceCopyActiveProfileID() -> Option<NonNull<CFString>>;
    }
    let ret = unsafe { MACaptionAppearanceCopyActiveProfileID() };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

/// Copies the human-readable name of a profileID
///
/// Parameter `profileID`: The profileID to copy the name of
///
/// Returns: A human-readable name of the provided profileID
#[inline]
pub unsafe extern "C-unwind" fn MACaptionAppearanceCopyProfileName(
    profile_id: &CFString,
) -> CFRetained<CFString> {
    extern "C-unwind" {
        fn MACaptionAppearanceCopyProfileName(profile_id: &CFString) -> Option<NonNull<CFString>>;
    }
    let ret = unsafe { MACaptionAppearanceCopyProfileName(profile_id) };
    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
    unsafe { CFRetained::from_raw(ret) }
}

extern "C-unwind" {
    /// 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.
    ///
    /// Parameter `profileID`: The profileID which will appear active when executing the block
    ///
    /// Parameter `aBlock`: the block of code to execute
    #[cfg(feature = "block2")]
    pub fn MACaptionAppearanceExecuteBlockForProfileID(
        profile_id: &CFString,
        a_block: &block2::DynBlock<dyn Fn()>,
    );
}