objc2_ui_kit/generated/
UIGuidedAccess.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern "C" {
11    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiguidedaccesserrordomain?language=objc)
12    pub static UIGuidedAccessErrorDomain: &'static NSErrorDomain;
13}
14
15/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiguidedaccesserrorcode?language=objc)
16// NS_ERROR_ENUM
17#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct UIGuidedAccessErrorCode(pub NSInteger);
20impl UIGuidedAccessErrorCode {
21    #[doc(alias = "UIGuidedAccessErrorPermissionDenied")]
22    pub const PermissionDenied: Self = Self(0);
23    #[doc(alias = "UIGuidedAccessErrorFailed")]
24    pub const Failed: Self = Self(NSIntegerMax as _);
25}
26
27unsafe impl Encode for UIGuidedAccessErrorCode {
28    const ENCODING: Encoding = NSInteger::ENCODING;
29}
30
31unsafe impl RefEncode for UIGuidedAccessErrorCode {
32    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiguidedaccessrestrictionstate?language=objc)
36// NS_ENUM
37#[repr(transparent)]
38#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
39pub struct UIGuidedAccessRestrictionState(pub NSInteger);
40impl UIGuidedAccessRestrictionState {
41    #[doc(alias = "UIGuidedAccessRestrictionStateAllow")]
42    pub const Allow: Self = Self(0);
43    #[doc(alias = "UIGuidedAccessRestrictionStateDeny")]
44    pub const Deny: Self = Self(1);
45}
46
47unsafe impl Encode for UIGuidedAccessRestrictionState {
48    const ENCODING: Encoding = NSInteger::ENCODING;
49}
50
51unsafe impl RefEncode for UIGuidedAccessRestrictionState {
52    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
53}
54
55extern_protocol!(
56    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiguidedaccessrestrictiondelegate?language=objc)
57    pub unsafe trait UIGuidedAccessRestrictionDelegate:
58        NSObjectProtocol + MainThreadOnly
59    {
60        #[unsafe(method(guidedAccessRestrictionIdentifiers))]
61        #[unsafe(method_family = none)]
62        unsafe fn guidedAccessRestrictionIdentifiers(&self) -> Option<Retained<NSArray<NSString>>>;
63
64        #[unsafe(method(guidedAccessRestrictionWithIdentifier:didChangeState:))]
65        #[unsafe(method_family = none)]
66        unsafe fn guidedAccessRestrictionWithIdentifier_didChangeState(
67            &self,
68            restriction_identifier: &NSString,
69            new_restriction_state: UIGuidedAccessRestrictionState,
70        );
71
72        #[unsafe(method(textForGuidedAccessRestrictionWithIdentifier:))]
73        #[unsafe(method_family = none)]
74        unsafe fn textForGuidedAccessRestrictionWithIdentifier(
75            &self,
76            restriction_identifier: &NSString,
77        ) -> Option<Retained<NSString>>;
78
79        #[optional]
80        #[unsafe(method(detailTextForGuidedAccessRestrictionWithIdentifier:))]
81        #[unsafe(method_family = none)]
82        unsafe fn detailTextForGuidedAccessRestrictionWithIdentifier(
83            &self,
84            restriction_identifier: &NSString,
85        ) -> Option<Retained<NSString>>;
86    }
87);
88
89extern "C-unwind" {
90    pub fn UIGuidedAccessRestrictionStateForIdentifier(
91        restriction_identifier: &NSString,
92    ) -> UIGuidedAccessRestrictionState;
93}
94
95/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiguidedaccessaccessibilityfeature?language=objc)
96// NS_OPTIONS
97#[repr(transparent)]
98#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
99pub struct UIGuidedAccessAccessibilityFeature(pub NSUInteger);
100bitflags::bitflags! {
101    impl UIGuidedAccessAccessibilityFeature: NSUInteger {
102        #[doc(alias = "UIGuidedAccessAccessibilityFeatureVoiceOver")]
103        const VoiceOver = 1<<0;
104        #[doc(alias = "UIGuidedAccessAccessibilityFeatureZoom")]
105        const Zoom = 1<<1;
106        #[doc(alias = "UIGuidedAccessAccessibilityFeatureAssistiveTouch")]
107        const AssistiveTouch = 1<<2;
108        #[doc(alias = "UIGuidedAccessAccessibilityFeatureInvertColors")]
109        const InvertColors = 1<<3;
110        #[doc(alias = "UIGuidedAccessAccessibilityFeatureGrayscaleDisplay")]
111        const GrayscaleDisplay = 1<<4;
112    }
113}
114
115unsafe impl Encode for UIGuidedAccessAccessibilityFeature {
116    const ENCODING: Encoding = NSUInteger::ENCODING;
117}
118
119unsafe impl RefEncode for UIGuidedAccessAccessibilityFeature {
120    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
121}
122
123#[cfg(feature = "block2")]
124#[inline]
125pub unsafe extern "C-unwind" fn UIGuidedAccessConfigureAccessibilityFeatures(
126    features: UIGuidedAccessAccessibilityFeature,
127    enabled: bool,
128    completion: &block2::Block<dyn Fn(Bool, *mut NSError)>,
129) {
130    extern "C-unwind" {
131        fn UIGuidedAccessConfigureAccessibilityFeatures(
132            features: UIGuidedAccessAccessibilityFeature,
133            enabled: Bool,
134            completion: &block2::Block<dyn Fn(Bool, *mut NSError)>,
135        );
136    }
137    unsafe {
138        UIGuidedAccessConfigureAccessibilityFeatures(features, Bool::new(enabled), completion)
139    }
140}