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        fn guidedAccessRestrictionIdentifiers(&self) -> Option<Retained<NSArray<NSString>>>;
63
64        #[unsafe(method(guidedAccessRestrictionWithIdentifier:didChangeState:))]
65        #[unsafe(method_family = none)]
66        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        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        fn detailTextForGuidedAccessRestrictionWithIdentifier(
83            &self,
84            restriction_identifier: &NSString,
85        ) -> Option<Retained<NSString>>;
86    }
87);
88
89impl UIGuidedAccessRestrictionState {
90    #[doc(alias = "UIGuidedAccessRestrictionStateForIdentifier")]
91    #[inline]
92    pub fn for_identifier(restriction_identifier: &NSString) -> UIGuidedAccessRestrictionState {
93        extern "C-unwind" {
94            fn UIGuidedAccessRestrictionStateForIdentifier(
95                restriction_identifier: &NSString,
96            ) -> UIGuidedAccessRestrictionState;
97        }
98        unsafe { UIGuidedAccessRestrictionStateForIdentifier(restriction_identifier) }
99    }
100}
101
102/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiguidedaccessaccessibilityfeature?language=objc)
103// NS_OPTIONS
104#[repr(transparent)]
105#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
106pub struct UIGuidedAccessAccessibilityFeature(pub NSUInteger);
107bitflags::bitflags! {
108    impl UIGuidedAccessAccessibilityFeature: NSUInteger {
109        #[doc(alias = "UIGuidedAccessAccessibilityFeatureVoiceOver")]
110        const VoiceOver = 1<<0;
111        #[doc(alias = "UIGuidedAccessAccessibilityFeatureZoom")]
112        const Zoom = 1<<1;
113        #[doc(alias = "UIGuidedAccessAccessibilityFeatureAssistiveTouch")]
114        const AssistiveTouch = 1<<2;
115        #[doc(alias = "UIGuidedAccessAccessibilityFeatureInvertColors")]
116        const InvertColors = 1<<3;
117        #[doc(alias = "UIGuidedAccessAccessibilityFeatureGrayscaleDisplay")]
118        const GrayscaleDisplay = 1<<4;
119    }
120}
121
122unsafe impl Encode for UIGuidedAccessAccessibilityFeature {
123    const ENCODING: Encoding = NSUInteger::ENCODING;
124}
125
126unsafe impl RefEncode for UIGuidedAccessAccessibilityFeature {
127    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
128}
129
130#[cfg(feature = "block2")]
131#[inline]
132pub extern "C-unwind" fn UIGuidedAccessConfigureAccessibilityFeatures(
133    features: UIGuidedAccessAccessibilityFeature,
134    enabled: bool,
135    completion: &block2::DynBlock<dyn Fn(Bool, *mut NSError)>,
136) {
137    extern "C-unwind" {
138        fn UIGuidedAccessConfigureAccessibilityFeatures(
139            features: UIGuidedAccessAccessibilityFeature,
140            enabled: Bool,
141            completion: &block2::DynBlock<dyn Fn(Bool, *mut NSError)>,
142        );
143    }
144    unsafe {
145        UIGuidedAccessConfigureAccessibilityFeatures(features, Bool::new(enabled), completion)
146    }
147}
148
149#[deprecated = "renamed to `UIGuidedAccessRestrictionState::for_identifier`"]
150#[inline]
151pub extern "C-unwind" fn UIGuidedAccessRestrictionStateForIdentifier(
152    restriction_identifier: &NSString,
153) -> UIGuidedAccessRestrictionState {
154    extern "C-unwind" {
155        fn UIGuidedAccessRestrictionStateForIdentifier(
156            restriction_identifier: &NSString,
157        ) -> UIGuidedAccessRestrictionState;
158    }
159    unsafe { UIGuidedAccessRestrictionStateForIdentifier(restriction_identifier) }
160}