objc2_application_services/generated/HIServices/
AXUIElement.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9use objc2_core_foundation::*;
10#[cfg(feature = "objc2-core-graphics")]
11use objc2_core_graphics::*;
12
13use crate::*;
14
15/// Returns whether the accessibility API is enabled.
16///
17/// Returns: Returns TRUE if the accessibility API is currently enabled, otherwise FALSE.
18#[deprecated]
19#[inline]
20pub unsafe extern "C-unwind" fn AXAPIEnabled() -> bool {
21    extern "C-unwind" {
22        fn AXAPIEnabled() -> Boolean;
23    }
24    let ret = unsafe { AXAPIEnabled() };
25    ret != 0
26}
27
28/// Returns whether the current process is a trusted accessibility client.
29///
30/// Parameter `options`: A dictionary of options, or NULL to specify no options. The following options are available:
31///
32/// KEY: kAXTrustedCheckOptionPrompt
33/// VALUE: ACFBooleanRef indicating whether the user will be informed if the current process is untrusted. This could be used, for example, on application startup to always warn a user if accessibility is not enabled for the current process. Prompting occurs asynchronously and does not affect the return value.
34///
35///
36/// Returns: Returns TRUE if the current process is a trusted accessibility client, FALSE if it is not.
37///
38/// # Safety
39///
40/// `options` generics must be of the correct type.
41#[inline]
42pub unsafe extern "C-unwind" fn AXIsProcessTrustedWithOptions(
43    options: Option<&CFDictionary>,
44) -> bool {
45    extern "C-unwind" {
46        fn AXIsProcessTrustedWithOptions(options: Option<&CFDictionary>) -> Boolean;
47    }
48    let ret = unsafe { AXIsProcessTrustedWithOptions(options) };
49    ret != 0
50}
51
52extern "C" {
53    /// [Apple's documentation](https://developer.apple.com/documentation/applicationservices/kaxtrustedcheckoptionprompt?language=objc)
54    pub static kAXTrustedCheckOptionPrompt: &'static CFString;
55}
56
57/// Returns whether the current process is a trusted accessibility client.
58///
59///
60/// Returns: Returns TRUE if the current process is a trusted accessibility client, FALSE if it is not.
61#[inline]
62pub unsafe extern "C-unwind" fn AXIsProcessTrusted() -> bool {
63    extern "C-unwind" {
64        fn AXIsProcessTrusted() -> Boolean;
65    }
66    let ret = unsafe { AXIsProcessTrusted() };
67    ret != 0
68}
69
70extern "C-unwind" {
71    /// Attempts to make the process represented by the specified path a trusted accessibility client.
72    ///
73    ///
74    /// Use this function to make a process a trusted accessibility client.  Note: The caller must be running as
75    /// <code>
76    /// root
77    /// </code>
78    /// to successfully call this function. In addition, the caller should relaunch the process after this function returns successfully for the trusted status to take effect.
79    ///
80    ///
81    /// Parameter `executablePath`: The path to the executable of the process to make trusted.
82    ///
83    ///
84    /// Returns: An AXError that indicates success or failure.
85    #[cfg(feature = "AXError")]
86    #[deprecated]
87    pub fn AXMakeProcessTrusted(executable_path: &CFString) -> AXError;
88}
89
90/// A structure used to refer to an accessibility object.
91///
92///
93/// An accessibility object provides information about the user interface object it represents. This information includes the object's
94/// position in the accessibility hierarchy, its position on the display, details about what it is, and what actions it can perform. Accessibility objects
95/// respond to messages sent by assistive applications and send notifications that describe state changes.
96///
97/// See also [Apple's documentation](https://developer.apple.com/documentation/applicationservices/axuielement?language=objc)
98#[doc(alias = "AXUIElementRef")]
99#[repr(C)]
100pub struct AXUIElement {
101    inner: [u8; 0],
102    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
103}
104
105cf_type!(
106    unsafe impl AXUIElement {}
107);
108#[cfg(feature = "objc2")]
109cf_objc2_type!(
110    unsafe impl RefEncode<"__AXUIElement"> for AXUIElement {}
111);
112
113/// Pass this option to
114///
115/// ```text
116///  AXUIElementCopyMultipleAttributeValues AXUIElementCopyMultipleAttributeValues
117/// ```
118///
119/// to force the function
120/// to stop when it gets an error.
121///
122/// See also [Apple's documentation](https://developer.apple.com/documentation/applicationservices/axcopymultipleattributeoptions?language=objc)
123// NS_OPTIONS
124#[repr(transparent)]
125#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
126pub struct AXCopyMultipleAttributeOptions(pub u32);
127bitflags::bitflags! {
128    impl AXCopyMultipleAttributeOptions: u32 {
129        #[doc(alias = "kAXCopyMultipleAttributeOptionStopOnError")]
130        const StopOnError = 0x1;
131    }
132}
133
134#[cfg(feature = "objc2")]
135unsafe impl Encode for AXCopyMultipleAttributeOptions {
136    const ENCODING: Encoding = u32::ENCODING;
137}
138
139#[cfg(feature = "objc2")]
140unsafe impl RefEncode for AXCopyMultipleAttributeOptions {
141    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
142}
143
144unsafe impl ConcreteType for AXUIElement {
145    /// Returns the unique type identifier for the AXUIElementRef type.
146    ///
147    ///
148    /// Returns: Returns a CFTypeID representing the AXUIElementRef type.
149    #[doc(alias = "AXUIElementGetTypeID")]
150    #[inline]
151    fn type_id() -> CFTypeID {
152        extern "C-unwind" {
153            fn AXUIElementGetTypeID() -> CFTypeID;
154        }
155        unsafe { AXUIElementGetTypeID() }
156    }
157}
158
159impl AXUIElement {
160    /// Returns a list of all the attributes supported by the specified accessibility object.
161    ///
162    ///
163    /// Parameter `element`: The AXUIElementRef representing the accessibility object.
164    ///
165    /// Parameter `names`: On return, an array containing the accessibility object's attribute names.
166    ///
167    ///
168    /// Returns: If unsuccessful,
169    /// <code>
170    /// AXUIElementCopyAttributeNames
171    /// </code>
172    /// may return one of the following error codes, among others:
173    /// <dl>
174    /// <dt>
175    /// <code>
176    /// kAXErrorAttributeUnsupported
177    /// </code>
178    /// </dt>
179    /// <dd>
180    /// The specified AXUIElementRef does not support the specified attribute.
181    /// </dd>
182    /// <dt>
183    /// <code>
184    /// kAXErrorIllegalArgument
185    /// </code>
186    /// </dt>
187    /// <dd>
188    /// One or both of the arguments is an illegal value.
189    /// </dd>
190    /// <dt>
191    /// <code>
192    /// kAXErrorInvalidUIElement
193    /// </code>
194    /// </dt>
195    /// <dd>
196    /// The AXUIElementRef is invalid.
197    /// </dd>
198    /// <dt>
199    /// <code>
200    /// kAXErrorFailure
201    /// </code>
202    /// </dt>
203    /// <dd>
204    /// There was a system memory failure.
205    /// </dd>
206    /// <dt>
207    /// <code>
208    /// kAXErrorCannotComplete
209    /// </code>
210    /// </dt>
211    /// <dd>
212    /// The function cannot complete because messaging has failed in some way.
213    /// </dd>
214    /// <dt>
215    /// <code>
216    /// kAXErrorNotImplemented
217    /// </code>
218    /// </dt>
219    /// <dd>
220    /// The process does not fully support the accessibility API.
221    /// </dd>
222    /// </dl>
223    ///
224    /// # Safety
225    ///
226    /// `names` must be a valid pointer.
227    #[doc(alias = "AXUIElementCopyAttributeNames")]
228    #[cfg(feature = "AXError")]
229    #[inline]
230    pub unsafe fn copy_attribute_names(&self, names: NonNull<*const CFArray>) -> AXError {
231        extern "C-unwind" {
232            fn AXUIElementCopyAttributeNames(
233                element: &AXUIElement,
234                names: NonNull<*const CFArray>,
235            ) -> AXError;
236        }
237        unsafe { AXUIElementCopyAttributeNames(self, names) }
238    }
239
240    /// Returns the value of an accessibility object's attribute.
241    ///
242    ///
243    /// Parameter `element`: The AXUIElementRef representing the accessibility object.
244    ///
245    /// Parameter `attribute`: The attribute name.
246    ///
247    /// Parameter `value`: On return, the value associated with the specified attribute.
248    ///
249    ///
250    /// Returns: If unsuccessful,
251    /// <code>
252    /// AXUIElementCopyAttributeValue
253    /// </code>
254    /// may return one of the following error codes, among others:
255    /// <dl>
256    /// <dt>
257    /// <code>
258    /// kAXErrorAttributeUnsupported
259    /// </code>
260    /// </dt>
261    /// <dd>
262    /// The specified AXUIElementRef does not support the specified attribute.
263    /// </dd>
264    /// <dt>
265    /// <code>
266    /// kAXErrorNoValue
267    /// </code>
268    /// </dt>
269    /// <dd>
270    /// The specified attribute does not have a value.
271    /// </dd>
272    /// <dt>
273    /// <code>
274    /// kAXErrorIllegalArgument
275    /// </code>
276    /// </dt>
277    /// <dd>
278    /// One or more of the arguments is an illegal value.
279    /// </dd>
280    /// <dt>
281    /// <code>
282    /// kAXErrorInvalidUIElement
283    /// </code>
284    /// </dt>
285    /// <dd>
286    /// The AXUIElementRef is invalid.
287    /// </dd>
288    /// <dt>
289    /// <code>
290    /// kAXErrorCannotComplete
291    /// </code>
292    /// </dt>
293    /// <dd>
294    /// The function cannot complete because messaging has failed in some way.
295    /// </dd>
296    /// <dt>
297    /// <code>
298    /// kAXErrorNotImplemented
299    /// </code>
300    /// </dt>
301    /// <dd>
302    /// The process does not fully support the accessibility API.
303    /// </dd>
304    /// </dl>
305    ///
306    /// # Safety
307    ///
308    /// `value` must be a valid pointer.
309    #[doc(alias = "AXUIElementCopyAttributeValue")]
310    #[cfg(feature = "AXError")]
311    #[inline]
312    pub unsafe fn copy_attribute_value(
313        &self,
314        attribute: &CFString,
315        value: NonNull<*const CFType>,
316    ) -> AXError {
317        extern "C-unwind" {
318            fn AXUIElementCopyAttributeValue(
319                element: &AXUIElement,
320                attribute: &CFString,
321                value: NonNull<*const CFType>,
322            ) -> AXError;
323        }
324        unsafe { AXUIElementCopyAttributeValue(self, attribute, value) }
325    }
326
327    /// Returns the count of the array of an accessibility object's attribute value.
328    ///
329    ///
330    /// Parameter `element`: The AXUIElementRef representing the accessibility object.
331    ///
332    /// Parameter `attribute`: The attribute name.
333    ///
334    /// Parameter `count`: On return, the size of the array that is the attribute's value.
335    ///
336    ///
337    /// Returns: If unsuccessful,
338    /// <code>
339    /// AXUIElementGetAttributeValueCount
340    /// </code>
341    /// may return one of the following error codes, among others:
342    /// <dl>
343    /// <dt>
344    /// <code>
345    /// kAXErrorIllegalArgument
346    /// </code>
347    /// </dt>
348    /// <dd>
349    /// The attribute's value is not an array or one of the other arguments is an illegal value.
350    /// </dd>
351    /// <dt>
352    /// <code>
353    /// kAXErrorAttributeUnsupported
354    /// </code>
355    /// </dt>
356    /// <dd>
357    /// The specified AXUIElementRef does not support the specified attribute.
358    /// </dd>
359    /// <dt>
360    /// <code>
361    /// kAXErrorInvalidUIElement
362    /// </code>
363    /// </dt>
364    /// <dd>
365    /// The AXUIElementRef is invalid.
366    /// </dd>
367    /// <dt>
368    /// <code>
369    /// kAXErrorCannotComplete
370    /// </code>
371    /// </dt>
372    /// <dd>
373    /// The function cannot complete because messaging has failed in some way.
374    /// </dd>
375    /// <dt>
376    /// <code>
377    /// kAXErrorNotImplemented
378    /// </code>
379    /// </dt>
380    /// <dd>
381    /// The process does not fully support the accessibility API.
382    /// </dd>
383    /// </dl>
384    ///
385    /// # Safety
386    ///
387    /// `count` must be a valid pointer.
388    #[doc(alias = "AXUIElementGetAttributeValueCount")]
389    #[cfg(feature = "AXError")]
390    #[inline]
391    pub unsafe fn attribute_value_count(
392        &self,
393        attribute: &CFString,
394        count: NonNull<CFIndex>,
395    ) -> AXError {
396        extern "C-unwind" {
397            fn AXUIElementGetAttributeValueCount(
398                element: &AXUIElement,
399                attribute: &CFString,
400                count: NonNull<CFIndex>,
401            ) -> AXError;
402        }
403        unsafe { AXUIElementGetAttributeValueCount(self, attribute, count) }
404    }
405
406    /// Returns an array of attribute values for the accessibility object's attribute, starting at the specified index.
407    ///
408    /// This function is useful for dealing with large arrays, for example, a table view with a large number of children.
409    ///
410    ///
411    /// Parameter `element`: The AXUIElementRef representing the accessibility object.
412    ///
413    /// Parameter `attribute`: The attribute name.
414    ///
415    /// Parameter `index`: The index into the array.
416    ///
417    /// Parameter `maxValues`: The maximum number of values you want (this may be more or less than the number of values associated with the attribute).
418    ///
419    /// Parameter `values`: On return, the attribute values you requested. If
420    /// <code>
421    /// maxValues
422    /// </code>
423    /// is greater than the number of values associated with the attribute, the
424    /// <code>
425    /// values
426    /// </code>
427    /// array will contain values found between
428    /// <code>
429    /// index
430    /// </code>
431    /// and the end of the attribute's array, inclusive.
432    ///
433    ///
434    /// Returns: If unsuccessful,
435    /// <code>
436    /// AXUIElementCopyAttributeValues
437    /// </code>
438    /// may return one of the following error codes, among others:
439    /// <dl>
440    /// <dt>
441    /// <code>
442    /// kAXErrorIllegalArgument
443    /// </code>
444    /// </dt>
445    /// <dd>
446    /// The attribute's value is not array, the
447    /// <code>
448    /// index
449    /// </code>
450    /// or
451    /// <code>
452    /// maxValues
453    /// </code>
454    /// arguments are outside the array's range, or one of the other arguments is an illegal value.
455    /// </dd>
456    /// <dt>
457    /// <code>
458    /// kAXErrorNoValue
459    /// </code>
460    /// </dt>
461    /// <dd>
462    /// The specified attribute does not have a value.
463    /// </dd>
464    /// <dt>
465    /// <code>
466    /// kAXErrorInvalidUIElement
467    /// </code>
468    /// </dt>
469    /// <dd>
470    /// The AXUIElementRef is invalid.
471    /// </dd>
472    /// <dt>
473    /// <code>
474    /// kAXErrorCannotComplete
475    /// </code>
476    /// </dt>
477    /// <dd>
478    /// The function cannot complete because messaging has failed in some way.
479    /// </dd>
480    /// <dt>
481    /// <code>
482    /// kAXErrorNotImplemented
483    /// </code>
484    /// </dt>
485    /// <dd>
486    /// The process does not fully support the accessibility API.
487    /// </dd>
488    /// </dl>
489    ///
490    /// # Safety
491    ///
492    /// `values` must be a valid pointer.
493    #[doc(alias = "AXUIElementCopyAttributeValues")]
494    #[cfg(feature = "AXError")]
495    #[inline]
496    pub unsafe fn copy_attribute_values(
497        &self,
498        attribute: &CFString,
499        index: CFIndex,
500        max_values: CFIndex,
501        values: NonNull<*const CFArray>,
502    ) -> AXError {
503        extern "C-unwind" {
504            fn AXUIElementCopyAttributeValues(
505                element: &AXUIElement,
506                attribute: &CFString,
507                index: CFIndex,
508                max_values: CFIndex,
509                values: NonNull<*const CFArray>,
510            ) -> AXError;
511        }
512        unsafe { AXUIElementCopyAttributeValues(self, attribute, index, max_values, values) }
513    }
514
515    /// Returns whether the specified accessibility object's attribute can be modified.
516    ///
517    /// If you receive a
518    /// <code>
519    /// kAXErrorCannotComplete
520    /// </code>
521    /// error from this function, you might want to repeat the request or change the timeout value.
522    ///
523    ///
524    /// Parameter `element`: The AXUIElementRef representing the accessibility object.
525    ///
526    /// Parameter `attribute`: The attribute name.
527    ///
528    /// Parameter `settable`: On return, a Boolean value indicating whether the attribute is settable.
529    ///
530    ///
531    /// Returns: If unsuccessful,
532    /// <code>
533    /// AXUIElementIsAttributeSettable
534    /// </code>
535    /// may return one of the following error codes, among others:
536    /// <dl>
537    /// <dt>
538    /// <code>
539    /// kAXErrorCannotComplete
540    /// </code>
541    /// </dt>
542    /// <dd>
543    /// The function cannot complete because messaging has failed in some way (often due to a timeout).
544    /// </dd>
545    /// <dt>
546    /// <code>
547    /// kAXErrorIllegalArgument
548    /// </code>
549    /// </dt>
550    /// <dd>
551    /// One or more of the arguments is an illegal value.
552    /// </dd>
553    /// <dt>
554    /// <code>
555    /// kAXErrorAttributeUnsupported
556    /// </code>
557    /// </dt>
558    /// <dd>
559    /// The specified AXUIElementRef does not support the specified attribute.
560    /// </dd>
561    /// <dt>
562    /// <code>
563    /// kAXErrorNoValue
564    /// </code>
565    /// </dt>
566    /// <dd>
567    /// The specified attribute does not have a value.
568    /// </dd>
569    /// <dt>
570    /// <code>
571    /// kAXErrorInvalidUIElement
572    /// </code>
573    /// </dt>
574    /// <dd>
575    /// The AXUIElementRef is invalid.
576    /// </dd>
577    /// <dt>
578    /// <code>
579    /// kAXErrorNotImplemented
580    /// </code>
581    /// </dt>
582    /// <dd>
583    /// The process does not fully support the accessibility API.
584    /// </dd>
585    /// </dl>
586    ///
587    /// # Safety
588    ///
589    /// `settable` must be a valid pointer.
590    #[doc(alias = "AXUIElementIsAttributeSettable")]
591    #[cfg(feature = "AXError")]
592    #[inline]
593    pub unsafe fn is_attribute_settable(
594        &self,
595        attribute: &CFString,
596        settable: NonNull<Boolean>,
597    ) -> AXError {
598        extern "C-unwind" {
599            fn AXUIElementIsAttributeSettable(
600                element: &AXUIElement,
601                attribute: &CFString,
602                settable: NonNull<Boolean>,
603            ) -> AXError;
604        }
605        unsafe { AXUIElementIsAttributeSettable(self, attribute, settable) }
606    }
607
608    /// Sets the accessibility object's attribute to the specified value.
609    ///
610    /// You can send and receive many different CFTypeRefs using the accessibility API.
611    /// These include all CFPropertyListRef types, AXUIElementRef, AXValueRef, AXTextMarkerRef, AXTextMarkerRangeRef,
612    /// CFNullRef, CFAttributedStringRef, and CRURLRef.
613    ///
614    /// Parameter `element`: The AXUIElementRef representing the accessibility object.
615    ///
616    /// Parameter `attribute`: The attribute name.
617    ///
618    /// Parameter `value`: The new value for the attribute.
619    ///
620    ///
621    /// Returns: If unsuccessful,
622    /// <code>
623    /// AXUIElementSetAttributeValue
624    /// </code>
625    /// may return one of the following error codes, among others:
626    /// <dl>
627    /// <dt>
628    /// <code>
629    /// kAXErrorIllegalArgument
630    /// </code>
631    /// </dt>
632    /// <dd>
633    /// The value is not recognized by the accessible application or one of the other arguments is an illegal value.
634    /// </dd>
635    /// <dt>
636    /// <code>
637    /// kAXErrorAttributeUnsupported
638    /// </code>
639    /// </dt>
640    /// <dd>
641    /// The specified AXUIElementRef does not support the specified attribute.
642    /// </dd>
643    /// <dt>
644    /// <code>
645    /// kAXErrorInvalidUIElement
646    /// </code>
647    /// </dt>
648    /// <dd>
649    /// The AXUIElementRef is invalid.
650    /// </dd>
651    /// <dt>
652    /// <code>
653    /// kAXErrorCannotComplete
654    /// </code>
655    /// </dt>
656    /// <dd>
657    /// The function cannot complete because messaging has failed in some way.
658    /// </dd>
659    /// <dt>
660    /// <code>
661    /// kAXErrorNotImplemented
662    /// </code>
663    /// </dt>
664    /// <dd>
665    /// The process does not fully support the accessibility API.
666    /// </dd>
667    /// </dl>
668    ///
669    /// # Safety
670    ///
671    /// `value` should be of the correct type.
672    #[doc(alias = "AXUIElementSetAttributeValue")]
673    #[cfg(feature = "AXError")]
674    #[inline]
675    pub unsafe fn set_attribute_value(&self, attribute: &CFString, value: &CFType) -> AXError {
676        extern "C-unwind" {
677            fn AXUIElementSetAttributeValue(
678                element: &AXUIElement,
679                attribute: &CFString,
680                value: &CFType,
681            ) -> AXError;
682        }
683        unsafe { AXUIElementSetAttributeValue(self, attribute, value) }
684    }
685
686    /// Returns the values of multiple attributes in the accessibility object.
687    ///
688    /// If the specified AXUIElementRef does not support an attribute passed in the
689    /// <code>
690    /// attributes
691    /// </code>
692    /// array, the returned array
693    /// can contain an error or CFNull at the corresponding position.
694    ///
695    /// Parameter `element`: The AXUIElementRef representing the accessibility object.
696    ///
697    /// Parameter `attributes`: An array of attribute names.
698    ///
699    /// Parameter `options`: A value that tells
700    /// <code>
701    /// AXUIElementCopyMultipleAttributeValues
702    /// </code>
703    /// how to handle errors.
704    ///
705    /// Parameter `values`: On return, an array in which each position contains the value of the
706    /// attribute that is in the corresponding position in the passed-in
707    /// <code>
708    /// attributes
709    /// </code>
710    /// array (or CFNull). If
711    /// <code>
712    /// options
713    /// </code>
714    /// = 0,
715    /// the
716    /// <code>
717    /// values
718    /// </code>
719    /// array can contain an AXValueRef of type
720    /// <code>
721    /// kAXValueAXErrorType
722    /// </code>
723    /// in the corresponding position. If
724    /// <code>
725    /// options
726    /// </code>
727    /// =
728    /// <code>
729    /// kAXCopyMultipleAttributeOptionStopOnError
730    /// </code>
731    /// ,
732    /// this function will return immediately when it gets an error.
733    ///
734    ///
735    /// Returns: If unsuccessful,
736    /// <code>
737    /// AXUIElementCopyMultipleAttributeValues
738    /// </code>
739    /// may return one of the following error codes, among others:
740    /// <dl>
741    /// <dt>
742    /// <code>
743    /// kAXErrorIllegalArgument
744    /// </code>
745    /// </dt>
746    /// <dd>
747    /// One of the arguments is an illegal value.
748    /// </dd>
749    /// <dt>
750    /// <code>
751    /// kAXErrorInvalidUIElement
752    /// </code>
753    /// </dt>
754    /// <dd>
755    /// The AXUIElementRef is invalid.
756    /// </dd>
757    /// <dt>
758    /// <code>
759    /// kAXErrorCannotComplete
760    /// </code>
761    /// </dt>
762    /// <dd>
763    /// The function cannot complete because messaging has failed in some way.
764    /// </dd>
765    /// <dt>
766    /// <code>
767    /// kAXErrorNotImplemented
768    /// </code>
769    /// </dt>
770    /// <dd>
771    /// The process does not fully support the accessibility API.
772    /// </dd>
773    /// </dl>
774    ///
775    /// # Safety
776    ///
777    /// - `attributes` generic must be of the correct type.
778    /// - `values` must be a valid pointer.
779    #[doc(alias = "AXUIElementCopyMultipleAttributeValues")]
780    #[cfg(feature = "AXError")]
781    #[inline]
782    pub unsafe fn copy_multiple_attribute_values(
783        &self,
784        attributes: &CFArray,
785        options: AXCopyMultipleAttributeOptions,
786        values: NonNull<*const CFArray>,
787    ) -> AXError {
788        extern "C-unwind" {
789            fn AXUIElementCopyMultipleAttributeValues(
790                element: &AXUIElement,
791                attributes: &CFArray,
792                options: AXCopyMultipleAttributeOptions,
793                values: NonNull<*const CFArray>,
794            ) -> AXError;
795        }
796        unsafe { AXUIElementCopyMultipleAttributeValues(self, attributes, options, values) }
797    }
798
799    /// Returns a list of all the parameterized attributes supported by the specified accessibility object.
800    ///
801    ///
802    /// Parameter `element`: The AXUIElementRef representing the accessibility object.
803    ///
804    /// Parameter `names`: On return, an array containing the accessibility object's parameterized attribute names.
805    ///
806    ///
807    /// Returns: If unsuccessful,
808    /// <code>
809    /// AXUIElementCopyParameterizedAttributeNames
810    /// </code>
811    /// may return one of the following error codes, among others:
812    /// <dl>
813    /// <dt>
814    /// <code>
815    /// kAXErrorAttributeUnsupported
816    /// </code>
817    /// or
818    /// <code>
819    /// kAXErrorParameterizedAttributeUnsupported
820    /// </code>
821    /// </dt>
822    /// <dd>
823    /// The specified AXUIElementRef does not support the specified parameterized attribute.
824    /// </dd>
825    /// <dt>
826    /// <code>
827    /// kAXErrorIllegalArgument
828    /// </code>
829    /// </dt>
830    /// <dd>
831    /// One or both of the arguments is an illegal value.
832    /// </dd>
833    /// <dt>
834    /// <code>
835    /// kAXErrorInvalidUIElement
836    /// </code>
837    /// </dt>
838    /// <dd>
839    /// The AXUIElementRef is invalid.
840    /// </dd>
841    /// <dt>
842    /// <code>
843    /// kAXErrorFailure
844    /// </code>
845    /// </dt>
846    /// <dd>
847    /// There was some sort of system memory failure.
848    /// </dd>
849    /// <dt>
850    /// <code>
851    /// kAXErrorCannotComplete
852    /// </code>
853    /// </dt>
854    /// <dd>
855    /// The function cannot complete because messaging has failed in some way.
856    /// </dd>
857    /// <dt>
858    /// <code>
859    /// kAXErrorNotImplemented
860    /// </code>
861    /// </dt>
862    /// <dd>
863    /// The process does not fully support the accessibility API.
864    /// </dd>
865    /// </dl>
866    ///
867    /// # Safety
868    ///
869    /// `names` must be a valid pointer.
870    #[doc(alias = "AXUIElementCopyParameterizedAttributeNames")]
871    #[cfg(feature = "AXError")]
872    #[inline]
873    pub unsafe fn copy_parameterized_attribute_names(
874        &self,
875        names: NonNull<*const CFArray>,
876    ) -> AXError {
877        extern "C-unwind" {
878            fn AXUIElementCopyParameterizedAttributeNames(
879                element: &AXUIElement,
880                names: NonNull<*const CFArray>,
881            ) -> AXError;
882        }
883        unsafe { AXUIElementCopyParameterizedAttributeNames(self, names) }
884    }
885
886    /// Returns the value of an accessibility object's parameterized attribute.
887    ///
888    ///
889    /// Parameter `element`: The AXUIElementRef representing the accessibility object.
890    ///
891    /// Parameter `parameterizedAttribute`: The parameterized attribute.
892    ///
893    /// Parameter `parameter`: The parameter.
894    ///
895    /// Parameter `result`: On return, the value of the parameterized attribute.
896    ///
897    ///
898    /// Returns: If unsuccessful,
899    /// <code>
900    /// AXUIElementCopyParameterizedAttributeValue
901    /// </code>
902    /// may return one of the following error codes, among others:
903    /// <dl>
904    /// <dt>
905    /// <code>
906    /// kAXErrorAttributeUnsupported
907    /// </code>
908    /// or
909    /// <code>
910    /// kAXErrorParameterizedAttributeUnsupported
911    /// </code>
912    /// </dt>
913    /// <dd>
914    /// The specified AXUIElementRef does not support the specified parameterized attribute.
915    /// </dd>
916    /// <dt>
917    /// <code>
918    /// kAXErrorNoValue
919    /// </code>
920    /// </dt>
921    /// <dd>
922    /// The specified parameterized attribute does not have a value.
923    /// </dd>
924    /// <dt>
925    /// <code>
926    /// kAXErrorIllegalArgument
927    /// </code>
928    /// </dt>
929    /// <dd>
930    /// One or more of the arguments is an illegal value.
931    /// </dd>
932    /// <dt>
933    /// <code>
934    /// kAXErrorInvalidUIElement
935    /// </code>
936    /// </dt>
937    /// <dd>
938    /// The AXUIElementRef is invalid.
939    /// </dd>
940    /// <dt>
941    /// <code>
942    /// kAXErrorCannotComplete
943    /// </code>
944    /// </dt>
945    /// <dd>
946    /// The function cannot complete because messaging has failed in some way.
947    /// </dd>
948    /// <dt>
949    /// <code>
950    /// kAXErrorNotImplemented
951    /// </code>
952    /// </dt>
953    /// <dd>
954    /// The process does not fully support the accessibility API.
955    /// </dd>
956    /// </dl>
957    ///
958    /// # Safety
959    ///
960    /// - `parameter` should be of the correct type.
961    /// - `result` must be a valid pointer.
962    #[doc(alias = "AXUIElementCopyParameterizedAttributeValue")]
963    #[cfg(feature = "AXError")]
964    #[inline]
965    pub unsafe fn copy_parameterized_attribute_value(
966        &self,
967        parameterized_attribute: &CFString,
968        parameter: &CFType,
969        result: NonNull<*const CFType>,
970    ) -> AXError {
971        extern "C-unwind" {
972            fn AXUIElementCopyParameterizedAttributeValue(
973                element: &AXUIElement,
974                parameterized_attribute: &CFString,
975                parameter: &CFType,
976                result: NonNull<*const CFType>,
977            ) -> AXError;
978        }
979        unsafe {
980            AXUIElementCopyParameterizedAttributeValue(
981                self,
982                parameterized_attribute,
983                parameter,
984                result,
985            )
986        }
987    }
988
989    /// Returns a list of all the actions the specified accessibility object can perform.
990    ///
991    /// Parameter `element`: The AXUIElementRef representing the accessibility object.
992    ///
993    /// Parameter `names`: On return, an array of actions the accessibility object can perform (empty if the accessibility object supports no actions).
994    ///
995    ///
996    /// Returns: If unsuccessful,
997    /// <code>
998    /// AXUIElementCopyActionNames
999    /// </code>
1000    /// may return one of the following error codes, among others:
1001    /// <dl>
1002    /// <dt>
1003    /// <code>
1004    /// kAXErrorIllegalArgument
1005    /// </code>
1006    /// </dt>
1007    /// <dd>
1008    /// One or both of the arguments is an illegal value.
1009    /// </dd>
1010    /// <dt>
1011    /// <code>
1012    /// kAXErrorInvalidUIElement
1013    /// </code>
1014    /// </dt>
1015    /// <dd>
1016    /// The AXUIElementRef is invalid.
1017    /// </dd>
1018    /// <dt>
1019    /// <code>
1020    /// kAXErrorFailure
1021    /// </code>
1022    /// </dt>
1023    /// <dd>
1024    /// There was some sort of system memory failure.
1025    /// </dd>
1026    /// <dt>
1027    /// <code>
1028    /// kAXErrorCannotComplete
1029    /// </code>
1030    /// </dt>
1031    /// <dd>
1032    /// The function cannot complete because messaging has failed in some way.
1033    /// </dd>
1034    /// <dt>
1035    /// <code>
1036    /// kAXErrorNotImplemented
1037    /// </code>
1038    /// </dt>
1039    /// <dd>
1040    /// The process does not fully support the accessibility API.
1041    /// </dd>
1042    /// </dl>
1043    ///
1044    /// # Safety
1045    ///
1046    /// `names` must be a valid pointer.
1047    #[doc(alias = "AXUIElementCopyActionNames")]
1048    #[cfg(feature = "AXError")]
1049    #[inline]
1050    pub unsafe fn copy_action_names(&self, names: NonNull<*const CFArray>) -> AXError {
1051        extern "C-unwind" {
1052            fn AXUIElementCopyActionNames(
1053                element: &AXUIElement,
1054                names: NonNull<*const CFArray>,
1055            ) -> AXError;
1056        }
1057        unsafe { AXUIElementCopyActionNames(self, names) }
1058    }
1059
1060    /// Returns a localized description of the specified accessibility object's action.
1061    ///
1062    ///
1063    /// Parameter `element`: The AXUIElementRef representing the accessibility object.
1064    ///
1065    /// Parameter `action`: The action to be described.
1066    ///
1067    /// Parameter `description`: On return, a string containing the description of the action.
1068    ///
1069    ///
1070    /// Returns: If unsuccessful,
1071    /// <code>
1072    /// AXUIElementCopyActionDescription
1073    /// </code>
1074    /// may return one of the following error codes, among others:
1075    /// <dl>
1076    /// <dt>
1077    /// <code>
1078    /// kAXErrorActionUnsupported
1079    /// </code>
1080    /// </dt>
1081    /// <dd>
1082    /// The specified AXUIElementRef does not support the specified action (you will also receive this error if you pass in the system-wide accessibility object).
1083    /// </dd>
1084    /// <dt>
1085    /// <code>
1086    /// kAXErrorIllegalArgument
1087    /// </code>
1088    /// </dt>
1089    /// <dd>
1090    /// One or more of the arguments is an illegal value.
1091    /// </dd>
1092    /// <dt>
1093    /// <code>
1094    /// kAXErrorInvalidUIElement
1095    /// </code>
1096    /// </dt>
1097    /// <dd>
1098    /// The AXUIElementRef is invalid.
1099    /// </dd>
1100    /// <dt>
1101    /// <code>
1102    /// kAXErrorCannotComplete
1103    /// </code>
1104    /// </dt>
1105    /// <dd>
1106    /// The function cannot complete because messaging has failed in some way.
1107    /// </dd>
1108    /// <dt>
1109    /// <code>
1110    /// kAXErrorNotImplemented
1111    /// </code>
1112    /// </dt>
1113    /// <dd>
1114    /// The process does not fully support the accessibility API.
1115    /// </dd>
1116    /// </dl>
1117    ///
1118    /// # Safety
1119    ///
1120    /// `description` must be a valid pointer.
1121    #[doc(alias = "AXUIElementCopyActionDescription")]
1122    #[cfg(feature = "AXError")]
1123    #[inline]
1124    pub unsafe fn copy_action_description(
1125        &self,
1126        action: &CFString,
1127        description: NonNull<*const CFString>,
1128    ) -> AXError {
1129        extern "C-unwind" {
1130            fn AXUIElementCopyActionDescription(
1131                element: &AXUIElement,
1132                action: &CFString,
1133                description: NonNull<*const CFString>,
1134            ) -> AXError;
1135        }
1136        unsafe { AXUIElementCopyActionDescription(self, action, description) }
1137    }
1138
1139    /// Requests that the specified accessibility object perform the specified action.
1140    ///
1141    /// It is possible to receive the
1142    /// <code>
1143    /// kAXErrorCannotComplete
1144    /// </code>
1145    /// error code from this function because accessible applications often need to
1146    /// perform some sort of modal processing inside their action callbacks and they may not return within the timeout value set by the accessibility API.
1147    /// This does not necessarily mean that the function has failed, however. If appropriate, your assistive application
1148    /// can try to call this function again. Also, you may be able to increase the timeout value (see
1149    ///
1150    /// ```text
1151    ///  AXUIElementSetMessagingTimeout AXUIElementSetMessagingTimeout
1152    /// ```
1153    ///
1154    /// ).
1155    ///
1156    /// Parameter `element`: The AXUIElementRef representing the accessibility object.
1157    ///
1158    /// Parameter `action`: The action to be performed.
1159    ///
1160    ///
1161    /// Returns: If unsuccessful,
1162    /// <code>
1163    /// AXUIElementPerformAction
1164    /// </code>
1165    /// may return one of the following error codes, among others:
1166    /// <dl>
1167    /// <dt>
1168    /// <code>
1169    /// kAXErrorActionUnsupported
1170    /// </code>
1171    /// </dt>
1172    /// <dd>
1173    /// The specified AXUIElementRef does not support the specified action (you will also receive this error if you pass in the system-wide accessibility object).
1174    /// </dd>
1175    /// <dt>
1176    /// <code>
1177    /// kAXErrorIllegalArgument
1178    /// </code>
1179    /// </dt>
1180    /// <dd>
1181    /// One or more of the arguments is an illegal value.
1182    /// </dd>
1183    /// <dt>
1184    /// <code>
1185    /// kAXErrorInvalidUIElement
1186    /// </code>
1187    /// </dt>
1188    /// <dd>
1189    /// The AXUIElementRef is invalid.
1190    /// </dd>
1191    /// <dt>
1192    /// <code>
1193    /// kAXErrorCannotComplete
1194    /// </code>
1195    /// </dt>
1196    /// <dd>
1197    /// The function cannot complete because messaging has failed in some way or the application has not yet responded.
1198    /// </dd>
1199    /// <dt>
1200    /// <code>
1201    /// kAXErrorNotImplemented
1202    /// </code>
1203    /// </dt>
1204    /// <dd>
1205    /// The process does not fully support the accessibility API.
1206    /// </dd>
1207    /// </dl>
1208    #[doc(alias = "AXUIElementPerformAction")]
1209    #[cfg(feature = "AXError")]
1210    #[inline]
1211    pub unsafe fn perform_action(&self, action: &CFString) -> AXError {
1212        extern "C-unwind" {
1213            fn AXUIElementPerformAction(element: &AXUIElement, action: &CFString) -> AXError;
1214        }
1215        unsafe { AXUIElementPerformAction(self, action) }
1216    }
1217
1218    /// Returns the accessibility object at the specified position in top-left relative screen coordinates.
1219    ///
1220    ///
1221    /// This function does hit-testing based on window z-order (that is, layering). If one window is on top of another window, the returned accessibility object comes from whichever window is topmost at the specified
1222    /// location. Note that if the system-wide accessibility object is passed in the
1223    /// <code>
1224    /// application
1225    /// </code>
1226    /// parameter, the position test is not restricted to a
1227    /// particular application.
1228    ///
1229    ///
1230    /// Parameter `application`: The AXUIElementRef representing the application that contains the screen coordinates (or the system-wide accessibility object).
1231    ///
1232    /// Parameter `x`: The horizontal position.
1233    ///
1234    /// Parameter `y`: The vertical position.
1235    ///
1236    /// Parameter `element`: On return, the accessibility object at the position specified by x and y.
1237    ///
1238    ///
1239    /// Returns: If unsuccessful,
1240    /// <code>
1241    /// AXUIElementCopyElementAtPosition
1242    /// </code>
1243    /// may return one of the following error codes, among others:
1244    /// <dl>
1245    /// <dt>
1246    /// <code>
1247    /// kAXErrorNoValue
1248    /// </code>
1249    /// </dt>
1250    /// <dd>
1251    /// There is no accessibility object at the specified position.
1252    /// </dd>
1253    /// <dt>
1254    /// <code>
1255    /// kAXErrorIllegalArgument
1256    /// </code>
1257    /// </dt>
1258    /// <dd>
1259    /// One or more of the arguments is an illegal value.
1260    /// </dd>
1261    /// <dt>
1262    /// <code>
1263    /// kAXErrorInvalidUIElement
1264    /// </code>
1265    /// </dt>
1266    /// <dd>
1267    /// The AXUIElementRef is invalid.
1268    /// </dd>
1269    /// <dt>
1270    /// <code>
1271    /// kAXErrorCannotComplete
1272    /// </code>
1273    /// </dt>
1274    /// <dd>
1275    /// The function cannot complete because messaging has failed in some way.
1276    /// </dd>
1277    /// <dt>
1278    /// <code>
1279    /// kAXErrorNotImplemented
1280    /// </code>
1281    /// </dt>
1282    /// <dd>
1283    /// The process does not fully support the accessibility API.
1284    /// </dd>
1285    /// </dl>
1286    ///
1287    /// # Safety
1288    ///
1289    /// `element` must be a valid pointer.
1290    #[doc(alias = "AXUIElementCopyElementAtPosition")]
1291    #[cfg(feature = "AXError")]
1292    #[inline]
1293    pub unsafe fn copy_element_at_position(
1294        &self,
1295        x: c_float,
1296        y: c_float,
1297        element: NonNull<*const AXUIElement>,
1298    ) -> AXError {
1299        extern "C-unwind" {
1300            fn AXUIElementCopyElementAtPosition(
1301                application: &AXUIElement,
1302                x: c_float,
1303                y: c_float,
1304                element: NonNull<*const AXUIElement>,
1305            ) -> AXError;
1306        }
1307        unsafe { AXUIElementCopyElementAtPosition(self, x, y, element) }
1308    }
1309
1310    /// Creates and returns the top-level accessibility object for the application with the specified process ID.
1311    ///
1312    ///
1313    /// Parameter `pid`: The process ID of an application.
1314    ///
1315    /// Returns: The AXUIElementRef representing the top-level accessibility object for the application with the specified process ID.
1316    #[doc(alias = "AXUIElementCreateApplication")]
1317    #[cfg(feature = "libc")]
1318    #[inline]
1319    pub unsafe fn new_application(pid: libc::pid_t) -> CFRetained<AXUIElement> {
1320        extern "C-unwind" {
1321            fn AXUIElementCreateApplication(pid: libc::pid_t) -> Option<NonNull<AXUIElement>>;
1322        }
1323        let ret = unsafe { AXUIElementCreateApplication(pid) };
1324        let ret =
1325            ret.expect("function was marked as returning non-null, but actually returned NULL");
1326        unsafe { CFRetained::from_raw(ret) }
1327    }
1328
1329    /// Returns an accessibility object that provides access to system attributes.
1330    ///
1331    /// This is useful for things like finding the focused accessibility object regardless of which application is currently active.
1332    ///
1333    ///
1334    /// Returns: The AXUIElementRef representing the system-wide accessibility object.
1335    #[doc(alias = "AXUIElementCreateSystemWide")]
1336    #[inline]
1337    pub unsafe fn new_system_wide() -> CFRetained<AXUIElement> {
1338        extern "C-unwind" {
1339            fn AXUIElementCreateSystemWide() -> Option<NonNull<AXUIElement>>;
1340        }
1341        let ret = unsafe { AXUIElementCreateSystemWide() };
1342        let ret =
1343            ret.expect("function was marked as returning non-null, but actually returned NULL");
1344        unsafe { CFRetained::from_raw(ret) }
1345    }
1346
1347    /// Returns the process ID associated with the specified accessibility object.
1348    ///
1349    ///
1350    /// Parameter `element`: The AXUIElementRef representing an accessibility object.
1351    ///
1352    /// Parameter `pid`: On return, the process ID associated with the specified accessibility object.
1353    ///
1354    ///
1355    /// Returns: If unsuccessful,
1356    /// <code>
1357    /// AXUIElementGetPid
1358    /// </code>
1359    /// may return one of the following error codes, among others:
1360    /// <dl>
1361    /// <dt>
1362    /// <code>
1363    /// kAXErrorIllegalArgument
1364    /// </code>
1365    /// </dt>
1366    /// <dd>
1367    /// One or more of the arguments is an illegal value.
1368    /// </dd>
1369    /// <dt>
1370    /// <code>
1371    /// kAXErrorInvalidUIElement
1372    /// </code>
1373    /// </dt>
1374    /// <dd>
1375    /// The AXUIElementRef is invalid.
1376    /// </dd>
1377    /// </dl>
1378    ///
1379    /// # Safety
1380    ///
1381    /// `pid` must be a valid pointer.
1382    #[doc(alias = "AXUIElementGetPid")]
1383    #[cfg(all(feature = "AXError", feature = "libc"))]
1384    #[inline]
1385    pub unsafe fn pid(&self, pid: NonNull<libc::pid_t>) -> AXError {
1386        extern "C-unwind" {
1387            fn AXUIElementGetPid(element: &AXUIElement, pid: NonNull<libc::pid_t>) -> AXError;
1388        }
1389        unsafe { AXUIElementGetPid(self, pid) }
1390    }
1391
1392    /// Sets the timeout value used in the accessibility API.
1393    ///
1394    /// Pass the system-wide accessibility object (see
1395    ///
1396    /// ```text
1397    ///  AXUIElementCreateSystemWide AXUIElementCreateSystemWide
1398    /// ```
1399    ///
1400    /// ) if you want to set the timeout globally for this process.
1401    /// Setting the timeout on another accessibility object sets it only for that object, not for other accessibility objects that are equal to it.
1402    ///
1403    /// Setting
1404    /// <code>
1405    /// timeoutInSeconds
1406    /// </code>
1407    /// to 0 for the system-wide accessibility object resets the global timeout to its default value. Setting
1408    /// <code>
1409    /// timeoutInSeconds
1410    /// </code>
1411    /// to 0 for any other accessibility object makes that element use the current global timeout value.
1412    ///
1413    ///
1414    /// Parameter `element`: The AXUIElementRef representing an accessibility object.
1415    ///
1416    /// Parameter `timeoutInSeconds`: The number of seconds for the new timeout value.
1417    ///
1418    ///
1419    /// Returns: If unsuccessful,
1420    /// <code>
1421    /// AXUIElementSetMessagingTimeout
1422    /// </code>
1423    /// may return one of the following error codes, among others:
1424    /// <dl>
1425    /// <dt>
1426    /// <code>
1427    /// kAXErrorIllegalArgument
1428    /// </code>
1429    /// </dt>
1430    /// <dd>
1431    /// One or more of the arguments is an illegal value (timeout values must be positive).
1432    /// </dd>
1433    /// <dt>
1434    /// <code>
1435    /// kAXErrorInvalidUIElement
1436    /// </code>
1437    /// </dt>
1438    /// <dd>
1439    /// The AXUIElementRef is invalid.
1440    /// </dd>
1441    /// </dl>
1442    #[doc(alias = "AXUIElementSetMessagingTimeout")]
1443    #[cfg(feature = "AXError")]
1444    #[inline]
1445    pub unsafe fn set_messaging_timeout(&self, timeout_in_seconds: c_float) -> AXError {
1446        extern "C-unwind" {
1447            fn AXUIElementSetMessagingTimeout(
1448                element: &AXUIElement,
1449                timeout_in_seconds: c_float,
1450            ) -> AXError;
1451        }
1452        unsafe { AXUIElementSetMessagingTimeout(self, timeout_in_seconds) }
1453    }
1454
1455    /// Posts keys to the specified application.
1456    ///
1457    ///
1458    /// This is similar to
1459    ///
1460    /// ```text
1461    ///  //apple_ref/c/func/CGPostKeyboardEvent CGPostKeyboardEvent
1462    /// ```
1463    ///
1464    /// (which synthesizes a low-level keyboard event on the
1465    /// local machine), but it allows you to specify the target application as opposed to always sending the events to the active application. If the
1466    /// system-wide accessibility object is passed in the
1467    /// <code>
1468    /// application
1469    /// </code>
1470    /// parameter, the event is sent to the active application.
1471    ///
1472    /// You can only pass in the system-wide or application AXUIElementRef.
1473    ///
1474    ///
1475    /// Parameter `application`: The AXUIElementRef representing the application (or the system-wide accessibility object).
1476    ///
1477    /// Parameter `keyChar`:
1478    /// Parameter `virtualKey`:
1479    /// Parameter `keyDown`:
1480    /// Returns: If unsuccessful,
1481    /// <code>
1482    /// AXUIElementPostKeyboardEvent
1483    /// </code>
1484    /// may return one of the following error codes, among others:
1485    /// <dl>
1486    /// <dt>
1487    /// <code>
1488    /// kAXErrorIllegalArgument
1489    /// </code>
1490    /// </dt>
1491    /// <dd>
1492    /// One or more of the arguments is an illegal value.
1493    /// </dd>
1494    /// <dt>
1495    /// <code>
1496    /// kAXErrorInvalidUIElement
1497    /// </code>
1498    /// </dt>
1499    /// <dd>
1500    /// The AXUIElementRef is invalid.
1501    /// </dd>
1502    /// <dt>
1503    /// <code>
1504    /// kAXErrorFailure
1505    /// </code>
1506    /// </dt>
1507    /// <dd>
1508    /// There is some sort of system memory failure.
1509    /// </dd>
1510    /// <dt>
1511    /// <code>
1512    /// kAXErrorCannotComplete
1513    /// </code>
1514    /// </dt>
1515    /// <dd>
1516    /// The function cannot complete because messaging has failed in some way.
1517    /// </dd>
1518    /// <dt>
1519    /// <code>
1520    /// kAXErrorNotImplemented
1521    /// </code>
1522    /// </dt>
1523    /// <dd>
1524    /// The process does not fully support the accessibility API.
1525    /// </dd>
1526    /// </dl>
1527    #[doc(alias = "AXUIElementPostKeyboardEvent")]
1528    #[cfg(all(feature = "AXError", feature = "objc2-core-graphics"))]
1529    #[deprecated]
1530    #[inline]
1531    pub unsafe fn post_keyboard_event(
1532        &self,
1533        key_char: CGCharCode,
1534        virtual_key: CGKeyCode,
1535        key_down: bool,
1536    ) -> AXError {
1537        extern "C-unwind" {
1538            fn AXUIElementPostKeyboardEvent(
1539                application: &AXUIElement,
1540                key_char: CGCharCode,
1541                virtual_key: CGKeyCode,
1542                key_down: Boolean,
1543            ) -> AXError;
1544        }
1545        unsafe { AXUIElementPostKeyboardEvent(self, key_char, virtual_key, key_down as _) }
1546    }
1547}
1548
1549/// An AXTextMarkerRef is a CFType. Like all CFTypes, they are reference counted (
1550///
1551/// ```text
1552///  //apple_ref/c/func/CFRetain CFRetain
1553/// ```
1554///
1555/// ,
1556///
1557/// ```text
1558///  //apple_ref/c/func/CFRelease CFRelease
1559/// ```
1560///
1561/// ).
1562///
1563/// See also [Apple's documentation](https://developer.apple.com/documentation/applicationservices/axtextmarker?language=objc)
1564#[doc(alias = "AXTextMarkerRef")]
1565#[repr(C)]
1566pub struct AXTextMarker {
1567    inner: [u8; 0],
1568    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
1569}
1570
1571cf_type!(
1572    unsafe impl AXTextMarker {}
1573);
1574#[cfg(feature = "objc2")]
1575cf_objc2_type!(
1576    unsafe impl RefEncode<"__AXTextMarker"> for AXTextMarker {}
1577);
1578
1579unsafe impl ConcreteType for AXTextMarker {
1580    /// Returns the unique type identifier for the AXTextMarkerRef type.
1581    ///
1582    ///
1583    /// Returns: Returns the CFTypeID of the AXTextMarkerRef type.
1584    #[doc(alias = "AXTextMarkerGetTypeID")]
1585    #[inline]
1586    fn type_id() -> CFTypeID {
1587        extern "C-unwind" {
1588            fn AXTextMarkerGetTypeID() -> CFTypeID;
1589        }
1590        unsafe { AXTextMarkerGetTypeID() }
1591    }
1592}
1593
1594impl AXTextMarker {
1595    /// Creates a new text marker.
1596    ///
1597    ///
1598    /// Parameter `bytes`: The data used to identify this location in text
1599    ///
1600    /// Parameter `length`: The length of the data
1601    ///
1602    /// # Safety
1603    ///
1604    /// `bytes` must be a valid pointer.
1605    #[doc(alias = "AXTextMarkerCreate")]
1606    #[inline]
1607    pub unsafe fn new(
1608        allocator: Option<&CFAllocator>,
1609        bytes: NonNull<u8>,
1610        length: CFIndex,
1611    ) -> CFRetained<AXTextMarker> {
1612        extern "C-unwind" {
1613            fn AXTextMarkerCreate(
1614                allocator: Option<&CFAllocator>,
1615                bytes: NonNull<u8>,
1616                length: CFIndex,
1617            ) -> Option<NonNull<AXTextMarker>>;
1618        }
1619        let ret = unsafe { AXTextMarkerCreate(allocator, bytes, length) };
1620        let ret =
1621            ret.expect("function was marked as returning non-null, but actually returned NULL");
1622        unsafe { CFRetained::from_raw(ret) }
1623    }
1624
1625    /// Get the length of bytes stored in a text marker
1626    ///
1627    ///
1628    /// Parameter `marker`: The text marker
1629    ///
1630    ///
1631    /// Returns: The length of the data
1632    #[doc(alias = "AXTextMarkerGetLength")]
1633    #[inline]
1634    pub unsafe fn length(&self) -> CFIndex {
1635        extern "C-unwind" {
1636            fn AXTextMarkerGetLength(marker: &AXTextMarker) -> CFIndex;
1637        }
1638        unsafe { AXTextMarkerGetLength(self) }
1639    }
1640
1641    /// Get the byte data used to identify this location in text.
1642    ///
1643    ///
1644    /// Parameter `marker`: The text marker
1645    ///
1646    ///
1647    /// Returns: a pointer to the byte data used to identify this location in text.
1648    #[doc(alias = "AXTextMarkerGetBytePtr")]
1649    #[inline]
1650    pub unsafe fn byte_ptr(&self) -> NonNull<u8> {
1651        extern "C-unwind" {
1652            fn AXTextMarkerGetBytePtr(the_text_marker: &AXTextMarker) -> Option<NonNull<u8>>;
1653        }
1654        let ret = unsafe { AXTextMarkerGetBytePtr(self) };
1655        ret.expect("function was marked as returning non-null, but actually returned NULL")
1656    }
1657}
1658
1659/// An AXTextMarkerRangeRef is a CFType. Like all CFTypes, they are reference counted (
1660///
1661/// ```text
1662///  //apple_ref/c/func/CFRetain CFRetain
1663/// ```
1664///
1665/// ,
1666///
1667/// ```text
1668///  //apple_ref/c/func/CFRelease CFRelease
1669/// ```
1670///
1671/// ).
1672///
1673/// See also [Apple's documentation](https://developer.apple.com/documentation/applicationservices/axtextmarkerrange?language=objc)
1674#[doc(alias = "AXTextMarkerRangeRef")]
1675#[repr(C)]
1676pub struct AXTextMarkerRange {
1677    inner: [u8; 0],
1678    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
1679}
1680
1681cf_type!(
1682    unsafe impl AXTextMarkerRange {}
1683);
1684#[cfg(feature = "objc2")]
1685cf_objc2_type!(
1686    unsafe impl RefEncode<"__AXTextMarkerRange"> for AXTextMarkerRange {}
1687);
1688
1689unsafe impl ConcreteType for AXTextMarkerRange {
1690    /// Returns the unique type identifier for the AXTextMarkerRangeRef type.
1691    ///
1692    ///
1693    /// Returns: Returns the CFTypeID of the AXTextMarkerRangeRef type.
1694    #[doc(alias = "AXTextMarkerRangeGetTypeID")]
1695    #[inline]
1696    fn type_id() -> CFTypeID {
1697        extern "C-unwind" {
1698            fn AXTextMarkerRangeGetTypeID() -> CFTypeID;
1699        }
1700        unsafe { AXTextMarkerRangeGetTypeID() }
1701    }
1702}
1703
1704impl AXTextMarkerRange {
1705    /// Creates a new text marker given a start and end marker
1706    ///
1707    ///
1708    /// Parameter `startMarker`: The text marker for the beginning of the range
1709    ///
1710    /// Parameter `endMarker`: The text marker for the end of the range
1711    ///
1712    ///
1713    /// Returns: The text marker range object
1714    #[doc(alias = "AXTextMarkerRangeCreate")]
1715    #[inline]
1716    pub unsafe fn new(
1717        allocator: Option<&CFAllocator>,
1718        start_marker: &AXTextMarker,
1719        end_marker: &AXTextMarker,
1720    ) -> CFRetained<AXTextMarkerRange> {
1721        extern "C-unwind" {
1722            fn AXTextMarkerRangeCreate(
1723                allocator: Option<&CFAllocator>,
1724                start_marker: &AXTextMarker,
1725                end_marker: &AXTextMarker,
1726            ) -> Option<NonNull<AXTextMarkerRange>>;
1727        }
1728        let ret = unsafe { AXTextMarkerRangeCreate(allocator, start_marker, end_marker) };
1729        let ret =
1730            ret.expect("function was marked as returning non-null, but actually returned NULL");
1731        unsafe { CFRetained::from_raw(ret) }
1732    }
1733
1734    /// Creates a new text marker given the bytes for a start marker and an end marker
1735    ///
1736    ///
1737    /// Parameter `startMarkerBytes`: The data used to identify the start marker location in text
1738    ///
1739    /// Parameter `startMarkerLength`: The length of the start marker data
1740    ///
1741    /// Parameter `endMarkeBytes`: The data used to identify the end marker location in text
1742    ///
1743    /// Parameter `endMarkerLength`: The length of the end marker data
1744    ///
1745    ///
1746    /// Returns: The text marker range object
1747    ///
1748    /// # Safety
1749    ///
1750    /// - `start_marker_bytes` must be a valid pointer.
1751    /// - `end_marker_bytes` must be a valid pointer.
1752    #[doc(alias = "AXTextMarkerRangeCreateWithBytes")]
1753    #[inline]
1754    pub unsafe fn with_bytes(
1755        allocator: Option<&CFAllocator>,
1756        start_marker_bytes: NonNull<u8>,
1757        start_marker_length: CFIndex,
1758        end_marker_bytes: NonNull<u8>,
1759        end_marker_length: CFIndex,
1760    ) -> CFRetained<AXTextMarkerRange> {
1761        extern "C-unwind" {
1762            fn AXTextMarkerRangeCreateWithBytes(
1763                allocator: Option<&CFAllocator>,
1764                start_marker_bytes: NonNull<u8>,
1765                start_marker_length: CFIndex,
1766                end_marker_bytes: NonNull<u8>,
1767                end_marker_length: CFIndex,
1768            ) -> Option<NonNull<AXTextMarkerRange>>;
1769        }
1770        let ret = unsafe {
1771            AXTextMarkerRangeCreateWithBytes(
1772                allocator,
1773                start_marker_bytes,
1774                start_marker_length,
1775                end_marker_bytes,
1776                end_marker_length,
1777            )
1778        };
1779        let ret =
1780            ret.expect("function was marked as returning non-null, but actually returned NULL");
1781        unsafe { CFRetained::from_raw(ret) }
1782    }
1783
1784    /// Copies the start marker from a text marker range
1785    ///
1786    ///
1787    /// Parameter `textMarkerRange`: The text marker range
1788    ///
1789    ///
1790    /// Returns: The start text marker object
1791    #[doc(alias = "AXTextMarkerRangeCopyStartMarker")]
1792    #[inline]
1793    pub unsafe fn start_marker(&self) -> CFRetained<AXTextMarker> {
1794        extern "C-unwind" {
1795            fn AXTextMarkerRangeCopyStartMarker(
1796                text_marker_range: &AXTextMarkerRange,
1797            ) -> Option<NonNull<AXTextMarker>>;
1798        }
1799        let ret = unsafe { AXTextMarkerRangeCopyStartMarker(self) };
1800        let ret =
1801            ret.expect("function was marked as returning non-null, but actually returned NULL");
1802        unsafe { CFRetained::from_raw(ret) }
1803    }
1804
1805    /// Copies the end marker from a text marker range
1806    ///
1807    ///
1808    /// Parameter `textMarkerRange`: The text marker range
1809    ///
1810    ///
1811    /// Returns: The end text marker object
1812    #[doc(alias = "AXTextMarkerRangeCopyEndMarker")]
1813    #[inline]
1814    pub unsafe fn end_marker(&self) -> CFRetained<AXTextMarker> {
1815        extern "C-unwind" {
1816            fn AXTextMarkerRangeCopyEndMarker(
1817                text_marker_range: &AXTextMarkerRange,
1818            ) -> Option<NonNull<AXTextMarker>>;
1819        }
1820        let ret = unsafe { AXTextMarkerRangeCopyEndMarker(self) };
1821        let ret =
1822            ret.expect("function was marked as returning non-null, but actually returned NULL");
1823        unsafe { CFRetained::from_raw(ret) }
1824    }
1825}
1826
1827/// An AXObserverRef is a CFType. Like all CFTypes, they are reference counted (
1828///
1829/// ```text
1830///  //apple_ref/c/func/CFRetain CFRetain
1831/// ```
1832///
1833/// ,
1834///
1835/// ```text
1836///  //apple_ref/c/func/CFRelease CFRelease
1837/// ```
1838///
1839/// ).
1840///
1841/// See also [Apple's documentation](https://developer.apple.com/documentation/applicationservices/axobserver?language=objc)
1842#[doc(alias = "AXObserverRef")]
1843#[repr(C)]
1844pub struct AXObserver {
1845    inner: [u8; 0],
1846    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
1847}
1848
1849cf_type!(
1850    unsafe impl AXObserver {}
1851);
1852#[cfg(feature = "objc2")]
1853cf_objc2_type!(
1854    unsafe impl RefEncode<"__AXObserver"> for AXObserver {}
1855);
1856
1857/// Parameter `observer`: An AXObserverRef object to observe the notifications.
1858///
1859/// Parameter `element`: The accessibility object.
1860///
1861/// Parameter `notification`: The name of the notification to observe.
1862///
1863/// Parameter `refcon`: Application-defined data specified when registering the observer for notification
1864///
1865/// See also [Apple's documentation](https://developer.apple.com/documentation/applicationservices/axobservercallback?language=objc)
1866pub type AXObserverCallback = Option<
1867    unsafe extern "C-unwind" fn(
1868        NonNull<AXObserver>,
1869        NonNull<AXUIElement>,
1870        NonNull<CFString>,
1871        *mut c_void,
1872    ),
1873>;
1874
1875/// Parameter `observer`: An AXObserverRef object to observe the notifications.
1876///
1877/// Parameter `element`: The accessibility object.
1878///
1879/// Parameter `notification`: The name of the notification to observe.
1880///
1881/// Parameter `info`: The coresponding notification information.
1882///
1883/// Parameter `refcon`: Application-defined data specified when registering the observer for notification
1884///
1885/// See also [Apple's documentation](https://developer.apple.com/documentation/applicationservices/axobservercallbackwithinfo?language=objc)
1886pub type AXObserverCallbackWithInfo = Option<
1887    unsafe extern "C-unwind" fn(
1888        NonNull<AXObserver>,
1889        NonNull<AXUIElement>,
1890        NonNull<CFString>,
1891        NonNull<CFDictionary>,
1892        *mut c_void,
1893    ),
1894>;
1895
1896unsafe impl ConcreteType for AXObserver {
1897    /// Returns the unique type identifier for the AXObserverRef type.
1898    ///
1899    ///
1900    /// Returns: Returns the CFTypeID of the AXObserverRef type.
1901    #[doc(alias = "AXObserverGetTypeID")]
1902    #[inline]
1903    fn type_id() -> CFTypeID {
1904        extern "C-unwind" {
1905            fn AXObserverGetTypeID() -> CFTypeID;
1906        }
1907        unsafe { AXObserverGetTypeID() }
1908    }
1909}
1910
1911impl AXObserver {
1912    /// Creates a new observer that can receive notifications from the specified application.
1913    ///
1914    /// When an observed notification is received, it is passed to
1915    ///
1916    /// ```text
1917    ///  AXObserverCallback AXObserverCallback
1918    /// ```
1919    ///
1920    /// .
1921    ///
1922    ///
1923    /// Parameter `application`: The process ID of the application.
1924    ///
1925    /// Parameter `callback`: The callback function.
1926    ///
1927    /// Parameter `outObserver`: On return, an AXObserverRef representing the observer object.
1928    ///
1929    ///
1930    /// Returns: If unsuccessful,
1931    /// <code>
1932    /// AXObserverCreate
1933    /// </code>
1934    /// may return one of the following error codes, among others:
1935    /// <dl>
1936    /// <dt>
1937    /// <code>
1938    /// kAXErrorIllegalArgument
1939    /// </code>
1940    /// </dt>
1941    /// <dd>
1942    /// One or more of the arguments is an illegal value.
1943    /// </dd>
1944    /// <dt>
1945    /// <code>
1946    /// kAXErrorFailure
1947    /// </code>
1948    /// </dt>
1949    /// <dd>
1950    /// There is some sort of system memory failure.
1951    /// </dd>
1952    /// </dl>
1953    ///
1954    /// # Safety
1955    ///
1956    /// - `callback` must be implemented correctly.
1957    /// - `out_observer` must be a valid pointer.
1958    #[doc(alias = "AXObserverCreate")]
1959    #[cfg(all(feature = "AXError", feature = "libc"))]
1960    #[inline]
1961    pub unsafe fn create(
1962        application: libc::pid_t,
1963        callback: AXObserverCallback,
1964        out_observer: NonNull<*mut AXObserver>,
1965    ) -> AXError {
1966        extern "C-unwind" {
1967            fn AXObserverCreate(
1968                application: libc::pid_t,
1969                callback: AXObserverCallback,
1970                out_observer: NonNull<*mut AXObserver>,
1971            ) -> AXError;
1972        }
1973        unsafe { AXObserverCreate(application, callback, out_observer) }
1974    }
1975
1976    /// Creates a new observer that can receive notifications with an information dictionary from the specified application.
1977    ///
1978    /// When an observed notification is received, it is passed to
1979    ///
1980    /// ```text
1981    ///  AXObserverCallbackWithInfo AXObserverCallbackWithInfo
1982    /// ```
1983    ///
1984    /// .
1985    ///
1986    ///
1987    /// Parameter `application`: The process ID of the application.
1988    ///
1989    /// Parameter `callback`: The callback function.
1990    ///
1991    /// Parameter `outObserver`: On return, an AXObserverRef representing the observer object.
1992    ///
1993    ///
1994    /// Returns: If unsuccessful,
1995    /// <code>
1996    /// AXObserverCreateWithInfoCallback
1997    /// </code>
1998    /// may return one of the following error codes, among others:
1999    /// <dl>
2000    /// <dt>
2001    /// <code>
2002    /// kAXErrorIllegalArgument
2003    /// </code>
2004    /// </dt>
2005    /// <dd>
2006    /// One or more of the arguments is an illegal value.
2007    /// </dd>
2008    /// <dt>
2009    /// <code>
2010    /// kAXErrorFailure
2011    /// </code>
2012    /// </dt>
2013    /// <dd>
2014    /// There is some sort of system memory failure.
2015    /// </dd>
2016    /// </dl>
2017    ///
2018    /// # Safety
2019    ///
2020    /// - `callback` must be implemented correctly.
2021    /// - `out_observer` must be a valid pointer.
2022    #[doc(alias = "AXObserverCreateWithInfoCallback")]
2023    #[cfg(all(feature = "AXError", feature = "libc"))]
2024    #[inline]
2025    pub unsafe fn create_with_info_callback(
2026        application: libc::pid_t,
2027        callback: AXObserverCallbackWithInfo,
2028        out_observer: NonNull<*mut AXObserver>,
2029    ) -> AXError {
2030        extern "C-unwind" {
2031            fn AXObserverCreateWithInfoCallback(
2032                application: libc::pid_t,
2033                callback: AXObserverCallbackWithInfo,
2034                out_observer: NonNull<*mut AXObserver>,
2035            ) -> AXError;
2036        }
2037        unsafe { AXObserverCreateWithInfoCallback(application, callback, out_observer) }
2038    }
2039
2040    /// Registers the specified observer to receive notifications from the specified accessibility object.
2041    ///
2042    ///
2043    /// Parameter `observer`: The observer object created from a call to
2044    ///
2045    /// ```text
2046    ///  AXObserverCreate AXObserverCreate
2047    /// ```
2048    ///
2049    /// .
2050    ///
2051    /// Parameter `element`: The accessibility object for which to observe notifications.
2052    ///
2053    /// Parameter `notification`: The name of the notification to observe.
2054    ///
2055    /// Parameter `refcon`: Application-defined data passed to the callback when it is called.
2056    ///
2057    ///
2058    /// Returns: If unsuccessful,
2059    /// <code>
2060    /// AXObserverAddNotification
2061    /// </code>
2062    /// may return one of the following error codes, among others:
2063    /// <dl>
2064    /// <dt>
2065    /// <code>
2066    /// kAXErrorInvalidUIElementObserver
2067    /// </code>
2068    /// </dt>
2069    /// <dd>
2070    /// The observer is not a valid AXObserverRef type.
2071    /// </dd>
2072    /// <dt>
2073    /// <code>
2074    /// kAXErrorIllegalArgument
2075    /// </code>
2076    /// </dt>
2077    /// <dd>
2078    /// One or more of the arguments is an illegal value or the length of the notification name is greater than 1024.
2079    /// </dd>
2080    /// <dt>
2081    /// <code>
2082    /// kAXErrorNotificationUnsupported
2083    /// </code>
2084    /// </dt>
2085    /// <dd>
2086    /// The accessibility object does not support notifications (note that the system-wide accessibility object does not support notifications).
2087    /// </dd>
2088    /// <dt>
2089    /// <code>
2090    /// kAXErrorNotificationAlreadyRegistered
2091    /// </code>
2092    /// </dt>
2093    /// <dd>
2094    /// The notification has already been registered.
2095    /// </dd>
2096    /// <dt>
2097    /// <code>
2098    /// kAXErrorCannotComplete
2099    /// </code>
2100    /// </dt>
2101    /// <dd>
2102    /// The function cannot complete because messaging has failed in some way.
2103    /// </dd>
2104    /// <dt>
2105    /// <code>
2106    /// kAXErrorFailure
2107    /// </code>
2108    /// </dt>
2109    /// <dd>
2110    /// There is some sort of system memory failure.
2111    /// </dd>
2112    /// </dl>
2113    ///
2114    /// # Safety
2115    ///
2116    /// `refcon` must be a valid pointer or null.
2117    #[doc(alias = "AXObserverAddNotification")]
2118    #[cfg(feature = "AXError")]
2119    #[inline]
2120    pub unsafe fn add_notification(
2121        &self,
2122        element: &AXUIElement,
2123        notification: &CFString,
2124        refcon: *mut c_void,
2125    ) -> AXError {
2126        extern "C-unwind" {
2127            fn AXObserverAddNotification(
2128                observer: &AXObserver,
2129                element: &AXUIElement,
2130                notification: &CFString,
2131                refcon: *mut c_void,
2132            ) -> AXError;
2133        }
2134        unsafe { AXObserverAddNotification(self, element, notification, refcon) }
2135    }
2136
2137    /// Removes the specified notification from the list of notifications the observer wants to receive from the accessibility object.
2138    ///
2139    ///
2140    /// Parameter `observer`: The observer object created from a call to
2141    ///
2142    /// ```text
2143    ///  AXObserverCreate AXObserverCreate
2144    /// ```
2145    ///
2146    /// .
2147    ///
2148    /// Parameter `element`: The accessibility object for which this observer observes notifications.
2149    ///
2150    /// Parameter `notification`: The name of the notification to remove from the list of observed notifications.
2151    ///
2152    ///
2153    /// Returns: If unsuccessful,
2154    /// <code>
2155    /// AXObserverRemoveNotification
2156    /// </code>
2157    /// may return one of the following error codes, among others:
2158    /// <dl>
2159    /// <dt>
2160    /// <code>
2161    /// kAXErrorInvalidUIElementObserver
2162    /// </code>
2163    /// </dt>
2164    /// <dd>
2165    /// The observer is not a valid AXObserverRef type.
2166    /// </dd>
2167    /// <dt>
2168    /// <code>
2169    /// kAXErrorIllegalArgument
2170    /// </code>
2171    /// </dt>
2172    /// <dd>
2173    /// One or more of the arguments is an illegal value or the length of the notification name is greater than 1024.
2174    /// </dd>
2175    /// <dt>
2176    /// <code>
2177    /// kAXErrorNotificationUnsupported
2178    /// </code>
2179    /// </dt>
2180    /// <dd>
2181    /// The accessibility object does not support notifications (note that the system-wide accessibility object does not support notifications).
2182    /// </dd>
2183    /// <dt>
2184    /// <code>
2185    /// kAXErrorNotificationNotRegistered
2186    /// </code>
2187    /// </dt>
2188    /// <dd>
2189    /// This observer has not registered for any notifications.
2190    /// </dd>
2191    /// <dt>
2192    /// <code>
2193    /// kAXErrorCannotComplete
2194    /// </code>
2195    /// </dt>
2196    /// <dd>
2197    /// The function cannot complete because messaging has failed in some way.
2198    /// </dd>
2199    /// <dt>
2200    /// <code>
2201    /// kAXErrorFailure
2202    /// </code>
2203    /// </dt>
2204    /// <dd>
2205    /// There is some sort of system memory failure.
2206    /// </dd>
2207    /// </dl>
2208    #[doc(alias = "AXObserverRemoveNotification")]
2209    #[cfg(feature = "AXError")]
2210    #[inline]
2211    pub unsafe fn remove_notification(
2212        &self,
2213        element: &AXUIElement,
2214        notification: &CFString,
2215    ) -> AXError {
2216        extern "C-unwind" {
2217            fn AXObserverRemoveNotification(
2218                observer: &AXObserver,
2219                element: &AXUIElement,
2220                notification: &CFString,
2221            ) -> AXError;
2222        }
2223        unsafe { AXObserverRemoveNotification(self, element, notification) }
2224    }
2225
2226    /// Returns the observer's run loop source.
2227    ///
2228    /// The observer must be added to a run loop before it can receive notifications. Note that releasing the AXObserverRef automatically
2229    /// removes the run loop source from the run loop (you can also do this explicitly by calling
2230    ///
2231    /// ```text
2232    ///  //apple_ref/c/func/CFRunLoopRemoveSource CFRunLoopRemoveSource
2233    /// ```
2234    ///
2235    /// ).
2236    ///
2237    /// <code>
2238    /// AXObserverGetRunLoopSource
2239    /// </code>
2240    /// might be used in code in this way:
2241    ///
2242    /// <pre>
2243    /// CFRunLoopAddSource(CFRunLoopGetCurrent(), AXObserverGetRunLoopSource(observer), kCFRunLoopDefaultMode);
2244    /// </pre>
2245    ///
2246    ///
2247    /// Parameter `observer`: The observer object (created from a call to
2248    ///
2249    /// ```text
2250    ///  AXObserverCreate AXObserverCreate
2251    /// ```
2252    ///
2253    /// ) for which to get the run loop source.
2254    ///
2255    /// Returns: Returns the CFRunLoopSourceRef of the observer; NIL if you pass NIL in
2256    /// <code>
2257    /// observer
2258    /// </code>
2259    /// .
2260    #[doc(alias = "AXObserverGetRunLoopSource")]
2261    #[inline]
2262    pub unsafe fn run_loop_source(&self) -> CFRetained<CFRunLoopSource> {
2263        extern "C-unwind" {
2264            fn AXObserverGetRunLoopSource(
2265                observer: &AXObserver,
2266            ) -> Option<NonNull<CFRunLoopSource>>;
2267        }
2268        let ret = unsafe { AXObserverGetRunLoopSource(self) };
2269        let ret =
2270            ret.expect("function was marked as returning non-null, but actually returned NULL");
2271        unsafe { CFRetained::retain(ret) }
2272    }
2273}
2274
2275extern "C-unwind" {
2276    #[cfg(feature = "AXError")]
2277    #[deprecated = "renamed to `AXUIElement::copy_attribute_names`"]
2278    pub fn AXUIElementCopyAttributeNames(
2279        element: &AXUIElement,
2280        names: NonNull<*const CFArray>,
2281    ) -> AXError;
2282}
2283
2284extern "C-unwind" {
2285    #[cfg(feature = "AXError")]
2286    #[deprecated = "renamed to `AXUIElement::copy_attribute_value`"]
2287    pub fn AXUIElementCopyAttributeValue(
2288        element: &AXUIElement,
2289        attribute: &CFString,
2290        value: NonNull<*const CFType>,
2291    ) -> AXError;
2292}
2293
2294extern "C-unwind" {
2295    #[cfg(feature = "AXError")]
2296    #[deprecated = "renamed to `AXUIElement::attribute_value_count`"]
2297    pub fn AXUIElementGetAttributeValueCount(
2298        element: &AXUIElement,
2299        attribute: &CFString,
2300        count: NonNull<CFIndex>,
2301    ) -> AXError;
2302}
2303
2304extern "C-unwind" {
2305    #[cfg(feature = "AXError")]
2306    #[deprecated = "renamed to `AXUIElement::copy_attribute_values`"]
2307    pub fn AXUIElementCopyAttributeValues(
2308        element: &AXUIElement,
2309        attribute: &CFString,
2310        index: CFIndex,
2311        max_values: CFIndex,
2312        values: NonNull<*const CFArray>,
2313    ) -> AXError;
2314}
2315
2316extern "C-unwind" {
2317    #[cfg(feature = "AXError")]
2318    #[deprecated = "renamed to `AXUIElement::is_attribute_settable`"]
2319    pub fn AXUIElementIsAttributeSettable(
2320        element: &AXUIElement,
2321        attribute: &CFString,
2322        settable: NonNull<Boolean>,
2323    ) -> AXError;
2324}
2325
2326extern "C-unwind" {
2327    #[cfg(feature = "AXError")]
2328    #[deprecated = "renamed to `AXUIElement::set_attribute_value`"]
2329    pub fn AXUIElementSetAttributeValue(
2330        element: &AXUIElement,
2331        attribute: &CFString,
2332        value: &CFType,
2333    ) -> AXError;
2334}
2335
2336extern "C-unwind" {
2337    #[cfg(feature = "AXError")]
2338    #[deprecated = "renamed to `AXUIElement::copy_multiple_attribute_values`"]
2339    pub fn AXUIElementCopyMultipleAttributeValues(
2340        element: &AXUIElement,
2341        attributes: &CFArray,
2342        options: AXCopyMultipleAttributeOptions,
2343        values: NonNull<*const CFArray>,
2344    ) -> AXError;
2345}
2346
2347extern "C-unwind" {
2348    #[cfg(feature = "AXError")]
2349    #[deprecated = "renamed to `AXUIElement::copy_parameterized_attribute_names`"]
2350    pub fn AXUIElementCopyParameterizedAttributeNames(
2351        element: &AXUIElement,
2352        names: NonNull<*const CFArray>,
2353    ) -> AXError;
2354}
2355
2356extern "C-unwind" {
2357    #[cfg(feature = "AXError")]
2358    #[deprecated = "renamed to `AXUIElement::copy_parameterized_attribute_value`"]
2359    pub fn AXUIElementCopyParameterizedAttributeValue(
2360        element: &AXUIElement,
2361        parameterized_attribute: &CFString,
2362        parameter: &CFType,
2363        result: NonNull<*const CFType>,
2364    ) -> AXError;
2365}
2366
2367extern "C-unwind" {
2368    #[cfg(feature = "AXError")]
2369    #[deprecated = "renamed to `AXUIElement::copy_action_names`"]
2370    pub fn AXUIElementCopyActionNames(
2371        element: &AXUIElement,
2372        names: NonNull<*const CFArray>,
2373    ) -> AXError;
2374}
2375
2376extern "C-unwind" {
2377    #[cfg(feature = "AXError")]
2378    #[deprecated = "renamed to `AXUIElement::copy_action_description`"]
2379    pub fn AXUIElementCopyActionDescription(
2380        element: &AXUIElement,
2381        action: &CFString,
2382        description: NonNull<*const CFString>,
2383    ) -> AXError;
2384}
2385
2386extern "C-unwind" {
2387    #[cfg(feature = "AXError")]
2388    #[deprecated = "renamed to `AXUIElement::perform_action`"]
2389    pub fn AXUIElementPerformAction(element: &AXUIElement, action: &CFString) -> AXError;
2390}
2391
2392extern "C-unwind" {
2393    #[cfg(feature = "AXError")]
2394    #[deprecated = "renamed to `AXUIElement::copy_element_at_position`"]
2395    pub fn AXUIElementCopyElementAtPosition(
2396        application: &AXUIElement,
2397        x: c_float,
2398        y: c_float,
2399        element: NonNull<*const AXUIElement>,
2400    ) -> AXError;
2401}
2402
2403#[cfg(feature = "libc")]
2404#[deprecated = "renamed to `AXUIElement::new_application`"]
2405#[inline]
2406pub unsafe extern "C-unwind" fn AXUIElementCreateApplication(
2407    pid: libc::pid_t,
2408) -> CFRetained<AXUIElement> {
2409    extern "C-unwind" {
2410        fn AXUIElementCreateApplication(pid: libc::pid_t) -> Option<NonNull<AXUIElement>>;
2411    }
2412    let ret = unsafe { AXUIElementCreateApplication(pid) };
2413    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2414    unsafe { CFRetained::from_raw(ret) }
2415}
2416
2417#[deprecated = "renamed to `AXUIElement::new_system_wide`"]
2418#[inline]
2419pub unsafe extern "C-unwind" fn AXUIElementCreateSystemWide() -> CFRetained<AXUIElement> {
2420    extern "C-unwind" {
2421        fn AXUIElementCreateSystemWide() -> Option<NonNull<AXUIElement>>;
2422    }
2423    let ret = unsafe { AXUIElementCreateSystemWide() };
2424    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2425    unsafe { CFRetained::from_raw(ret) }
2426}
2427
2428extern "C-unwind" {
2429    #[cfg(all(feature = "AXError", feature = "libc"))]
2430    #[deprecated = "renamed to `AXUIElement::pid`"]
2431    pub fn AXUIElementGetPid(element: &AXUIElement, pid: NonNull<libc::pid_t>) -> AXError;
2432}
2433
2434extern "C-unwind" {
2435    #[cfg(feature = "AXError")]
2436    #[deprecated = "renamed to `AXUIElement::set_messaging_timeout`"]
2437    pub fn AXUIElementSetMessagingTimeout(
2438        element: &AXUIElement,
2439        timeout_in_seconds: c_float,
2440    ) -> AXError;
2441}
2442
2443#[cfg(all(feature = "AXError", feature = "objc2-core-graphics"))]
2444#[deprecated = "renamed to `AXUIElement::post_keyboard_event`"]
2445#[inline]
2446pub unsafe extern "C-unwind" fn AXUIElementPostKeyboardEvent(
2447    application: &AXUIElement,
2448    key_char: CGCharCode,
2449    virtual_key: CGKeyCode,
2450    key_down: bool,
2451) -> AXError {
2452    extern "C-unwind" {
2453        fn AXUIElementPostKeyboardEvent(
2454            application: &AXUIElement,
2455            key_char: CGCharCode,
2456            virtual_key: CGKeyCode,
2457            key_down: Boolean,
2458        ) -> AXError;
2459    }
2460    unsafe { AXUIElementPostKeyboardEvent(application, key_char, virtual_key, key_down as _) }
2461}
2462
2463#[deprecated = "renamed to `AXTextMarker::new`"]
2464#[inline]
2465pub unsafe extern "C-unwind" fn AXTextMarkerCreate(
2466    allocator: Option<&CFAllocator>,
2467    bytes: NonNull<u8>,
2468    length: CFIndex,
2469) -> CFRetained<AXTextMarker> {
2470    extern "C-unwind" {
2471        fn AXTextMarkerCreate(
2472            allocator: Option<&CFAllocator>,
2473            bytes: NonNull<u8>,
2474            length: CFIndex,
2475        ) -> Option<NonNull<AXTextMarker>>;
2476    }
2477    let ret = unsafe { AXTextMarkerCreate(allocator, bytes, length) };
2478    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2479    unsafe { CFRetained::from_raw(ret) }
2480}
2481
2482extern "C-unwind" {
2483    #[deprecated = "renamed to `AXTextMarker::length`"]
2484    pub fn AXTextMarkerGetLength(marker: &AXTextMarker) -> CFIndex;
2485}
2486
2487#[deprecated = "renamed to `AXTextMarker::byte_ptr`"]
2488#[inline]
2489pub unsafe extern "C-unwind" fn AXTextMarkerGetBytePtr(
2490    the_text_marker: &AXTextMarker,
2491) -> NonNull<u8> {
2492    extern "C-unwind" {
2493        fn AXTextMarkerGetBytePtr(the_text_marker: &AXTextMarker) -> Option<NonNull<u8>>;
2494    }
2495    let ret = unsafe { AXTextMarkerGetBytePtr(the_text_marker) };
2496    ret.expect("function was marked as returning non-null, but actually returned NULL")
2497}
2498
2499#[deprecated = "renamed to `AXTextMarkerRange::new`"]
2500#[inline]
2501pub unsafe extern "C-unwind" fn AXTextMarkerRangeCreate(
2502    allocator: Option<&CFAllocator>,
2503    start_marker: &AXTextMarker,
2504    end_marker: &AXTextMarker,
2505) -> CFRetained<AXTextMarkerRange> {
2506    extern "C-unwind" {
2507        fn AXTextMarkerRangeCreate(
2508            allocator: Option<&CFAllocator>,
2509            start_marker: &AXTextMarker,
2510            end_marker: &AXTextMarker,
2511        ) -> Option<NonNull<AXTextMarkerRange>>;
2512    }
2513    let ret = unsafe { AXTextMarkerRangeCreate(allocator, start_marker, end_marker) };
2514    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2515    unsafe { CFRetained::from_raw(ret) }
2516}
2517
2518#[deprecated = "renamed to `AXTextMarkerRange::with_bytes`"]
2519#[inline]
2520pub unsafe extern "C-unwind" fn AXTextMarkerRangeCreateWithBytes(
2521    allocator: Option<&CFAllocator>,
2522    start_marker_bytes: NonNull<u8>,
2523    start_marker_length: CFIndex,
2524    end_marker_bytes: NonNull<u8>,
2525    end_marker_length: CFIndex,
2526) -> CFRetained<AXTextMarkerRange> {
2527    extern "C-unwind" {
2528        fn AXTextMarkerRangeCreateWithBytes(
2529            allocator: Option<&CFAllocator>,
2530            start_marker_bytes: NonNull<u8>,
2531            start_marker_length: CFIndex,
2532            end_marker_bytes: NonNull<u8>,
2533            end_marker_length: CFIndex,
2534        ) -> Option<NonNull<AXTextMarkerRange>>;
2535    }
2536    let ret = unsafe {
2537        AXTextMarkerRangeCreateWithBytes(
2538            allocator,
2539            start_marker_bytes,
2540            start_marker_length,
2541            end_marker_bytes,
2542            end_marker_length,
2543        )
2544    };
2545    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2546    unsafe { CFRetained::from_raw(ret) }
2547}
2548
2549#[deprecated = "renamed to `AXTextMarkerRange::start_marker`"]
2550#[inline]
2551pub unsafe extern "C-unwind" fn AXTextMarkerRangeCopyStartMarker(
2552    text_marker_range: &AXTextMarkerRange,
2553) -> CFRetained<AXTextMarker> {
2554    extern "C-unwind" {
2555        fn AXTextMarkerRangeCopyStartMarker(
2556            text_marker_range: &AXTextMarkerRange,
2557        ) -> Option<NonNull<AXTextMarker>>;
2558    }
2559    let ret = unsafe { AXTextMarkerRangeCopyStartMarker(text_marker_range) };
2560    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2561    unsafe { CFRetained::from_raw(ret) }
2562}
2563
2564#[deprecated = "renamed to `AXTextMarkerRange::end_marker`"]
2565#[inline]
2566pub unsafe extern "C-unwind" fn AXTextMarkerRangeCopyEndMarker(
2567    text_marker_range: &AXTextMarkerRange,
2568) -> CFRetained<AXTextMarker> {
2569    extern "C-unwind" {
2570        fn AXTextMarkerRangeCopyEndMarker(
2571            text_marker_range: &AXTextMarkerRange,
2572        ) -> Option<NonNull<AXTextMarker>>;
2573    }
2574    let ret = unsafe { AXTextMarkerRangeCopyEndMarker(text_marker_range) };
2575    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2576    unsafe { CFRetained::from_raw(ret) }
2577}
2578
2579extern "C-unwind" {
2580    #[cfg(all(feature = "AXError", feature = "libc"))]
2581    #[deprecated = "renamed to `AXObserver::create`"]
2582    pub fn AXObserverCreate(
2583        application: libc::pid_t,
2584        callback: AXObserverCallback,
2585        out_observer: NonNull<*mut AXObserver>,
2586    ) -> AXError;
2587}
2588
2589extern "C-unwind" {
2590    #[cfg(all(feature = "AXError", feature = "libc"))]
2591    #[deprecated = "renamed to `AXObserver::create_with_info_callback`"]
2592    pub fn AXObserverCreateWithInfoCallback(
2593        application: libc::pid_t,
2594        callback: AXObserverCallbackWithInfo,
2595        out_observer: NonNull<*mut AXObserver>,
2596    ) -> AXError;
2597}
2598
2599extern "C-unwind" {
2600    #[cfg(feature = "AXError")]
2601    #[deprecated = "renamed to `AXObserver::add_notification`"]
2602    pub fn AXObserverAddNotification(
2603        observer: &AXObserver,
2604        element: &AXUIElement,
2605        notification: &CFString,
2606        refcon: *mut c_void,
2607    ) -> AXError;
2608}
2609
2610extern "C-unwind" {
2611    #[cfg(feature = "AXError")]
2612    #[deprecated = "renamed to `AXObserver::remove_notification`"]
2613    pub fn AXObserverRemoveNotification(
2614        observer: &AXObserver,
2615        element: &AXUIElement,
2616        notification: &CFString,
2617    ) -> AXError;
2618}
2619
2620#[deprecated = "renamed to `AXObserver::run_loop_source`"]
2621#[inline]
2622pub unsafe extern "C-unwind" fn AXObserverGetRunLoopSource(
2623    observer: &AXObserver,
2624) -> CFRetained<CFRunLoopSource> {
2625    extern "C-unwind" {
2626        fn AXObserverGetRunLoopSource(observer: &AXObserver) -> Option<NonNull<CFRunLoopSource>>;
2627    }
2628    let ret = unsafe { AXObserverGetRunLoopSource(observer) };
2629    let ret = ret.expect("function was marked as returning non-null, but actually returned NULL");
2630    unsafe { CFRetained::retain(ret) }
2631}