1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
/// Manages a color sampling interface to allow the user to select a color from their screen.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nscolorsampler?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSColorSampler;
);
extern_conformance!(
unsafe impl NSObjectProtocol for NSColorSampler {}
);
impl NSColorSampler {
extern_methods!(
#[cfg(all(feature = "NSColor", feature = "block2"))]
/// The primary method for NSColorSampler.
///
/// 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`.
///
/// The calling NSColorSampler instance is retained until the sampling session is completed.
#[unsafe(method(showSamplerWithSelectionHandler:))]
#[unsafe(method_family = none)]
pub unsafe fn showSamplerWithSelectionHandler(
&self,
selection_handler: &block2::DynBlock<dyn Fn(*mut NSColor)>,
);
);
}
/// Methods declared on superclass `NSObject`.
impl NSColorSampler {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for NSColorSampler {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}