objc2_app_kit/generated/
NSColorSampler.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::*;
6
7use crate::*;
8
9extern_class!(
10    /// Manages a color sampling interface to allow the user to select a color from their screen.
11    ///
12    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nscolorsampler?language=objc)
13    #[unsafe(super(NSObject))]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    pub struct NSColorSampler;
16);
17
18unsafe impl NSObjectProtocol for NSColorSampler {}
19
20impl NSColorSampler {
21    extern_methods!(
22        #[cfg(all(feature = "NSColor", feature = "block2"))]
23        /// The primary method for NSColorSampler.
24        ///
25        /// Begins or attaches to an existing color sampling session which presents UI to the user for selecting a color from their screen. The handler will be called on the main thread when the user completes the session (either by selection, or cancelation). In the event of user-cancellation, `colorSelectionHandler` will be called with `nil`.
26        ///
27        /// The calling NSColorSampler instance is retained until the sampling session is completed.
28        #[unsafe(method(showSamplerWithSelectionHandler:))]
29        #[unsafe(method_family = none)]
30        pub unsafe fn showSamplerWithSelectionHandler(
31            &self,
32            selection_handler: &block2::Block<dyn Fn(*mut NSColor)>,
33        );
34    );
35}
36
37/// Methods declared on superclass `NSObject`.
38impl NSColorSampler {
39    extern_methods!(
40        #[unsafe(method(init))]
41        #[unsafe(method_family = init)]
42        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
43
44        #[unsafe(method(new))]
45        #[unsafe(method_family = new)]
46        pub unsafe fn new() -> Retained<Self>;
47    );
48}