objc2_app_kit/generated/
NSSliderAccessory.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsslideraccessory?language=objc)
12    #[unsafe(super(NSObject))]
13    #[thread_kind = MainThreadOnly]
14    #[derive(Debug, PartialEq, Eq, Hash)]
15    pub struct NSSliderAccessory;
16);
17
18extern_conformance!(
19    unsafe impl NSCoding for NSSliderAccessory {}
20);
21
22extern_conformance!(
23    unsafe impl NSObjectProtocol for NSSliderAccessory {}
24);
25
26impl NSSliderAccessory {
27    extern_methods!(
28        #[cfg(feature = "NSImage")]
29        #[unsafe(method(accessoryWithImage:))]
30        #[unsafe(method_family = none)]
31        pub unsafe fn accessoryWithImage(
32            image: &NSImage,
33            mtm: MainThreadMarker,
34        ) -> Retained<NSSliderAccessory>;
35
36        /// The effect on interaction with the accessory. Defaults to `automaticBehavior`
37        #[unsafe(method(behavior))]
38        #[unsafe(method_family = none)]
39        pub unsafe fn behavior(&self) -> Retained<NSSliderAccessoryBehavior>;
40
41        /// Setter for [`behavior`][Self::behavior].
42        #[unsafe(method(setBehavior:))]
43        #[unsafe(method_family = none)]
44        pub unsafe fn setBehavior(&self, behavior: &NSSliderAccessoryBehavior);
45
46        /// Whether or not the accessory is interactive and draws with an enabled appearance. Defaults to YES.
47        #[unsafe(method(isEnabled))]
48        #[unsafe(method_family = none)]
49        pub unsafe fn isEnabled(&self) -> bool;
50
51        /// Setter for [`isEnabled`][Self::isEnabled].
52        #[unsafe(method(setEnabled:))]
53        #[unsafe(method_family = none)]
54        pub unsafe fn setEnabled(&self, enabled: bool);
55    );
56}
57
58/// Methods declared on superclass `NSObject`.
59impl NSSliderAccessory {
60    extern_methods!(
61        #[unsafe(method(init))]
62        #[unsafe(method_family = init)]
63        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
64
65        #[unsafe(method(new))]
66        #[unsafe(method_family = new)]
67        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
68    );
69}
70
71impl NSSliderAccessory {
72    extern_methods!();
73}
74
75#[cfg(feature = "NSAccessibilityProtocols")]
76extern_conformance!(
77    unsafe impl NSAccessibility for NSSliderAccessory {}
78);
79
80#[cfg(feature = "NSAccessibilityProtocols")]
81extern_conformance!(
82    unsafe impl NSAccessibilityElementProtocol for NSSliderAccessory {}
83);
84
85extern_class!(
86    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsslideraccessorybehavior?language=objc)
87    #[unsafe(super(NSObject))]
88    #[thread_kind = MainThreadOnly]
89    #[derive(Debug, PartialEq, Eq, Hash)]
90    pub struct NSSliderAccessoryBehavior;
91);
92
93extern_conformance!(
94    unsafe impl NSCoding for NSSliderAccessoryBehavior {}
95);
96
97extern_conformance!(
98    unsafe impl NSCopying for NSSliderAccessoryBehavior {}
99);
100
101unsafe impl CopyingHelper for NSSliderAccessoryBehavior {
102    type Result = Self;
103}
104
105extern_conformance!(
106    unsafe impl NSObjectProtocol for NSSliderAccessoryBehavior {}
107);
108
109impl NSSliderAccessoryBehavior {
110    extern_methods!(
111        /// The behavior is automatically picked to be the system standard for the slider's current context, e.g. NSTouchBarItems have `.valueStep` behavior.
112        #[unsafe(method(automaticBehavior))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn automaticBehavior(
115            mtm: MainThreadMarker,
116        ) -> Retained<NSSliderAccessoryBehavior>;
117
118        /// The value of the slider moves towards the associated value for the accessory with by a delta of the slider's `altIncrementValue`.
119        #[unsafe(method(valueStepBehavior))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn valueStepBehavior(
122            mtm: MainThreadMarker,
123        ) -> Retained<NSSliderAccessoryBehavior>;
124
125        /// The value of the slider is reset to the associated value for the accessory.
126        #[unsafe(method(valueResetBehavior))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn valueResetBehavior(
129            mtm: MainThreadMarker,
130        ) -> Retained<NSSliderAccessoryBehavior>;
131
132        /// The action is sent to the target on interaction. The optional first parameter is an NSSliderAccessory.
133        #[unsafe(method(behaviorWithTarget:action:))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn behaviorWithTarget_action(
136            target: Option<&AnyObject>,
137            action: Sel,
138            mtm: MainThreadMarker,
139        ) -> Retained<NSSliderAccessoryBehavior>;
140
141        #[cfg(feature = "block2")]
142        /// The handler block is invoked on interaction. This variant is not codable and will assert in `-encodeWithCoder:`.
143        #[unsafe(method(behaviorWithHandler:))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn behaviorWithHandler(
146            handler: &block2::DynBlock<dyn Fn(NonNull<NSSliderAccessory>)>,
147            mtm: MainThreadMarker,
148        ) -> Retained<NSSliderAccessoryBehavior>;
149
150        /// Override point for custom subclasses to handle interaction.
151        #[unsafe(method(handleAction:))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn handleAction(&self, sender: &NSSliderAccessory);
154    );
155}
156
157/// Methods declared on superclass `NSObject`.
158impl NSSliderAccessoryBehavior {
159    extern_methods!(
160        #[unsafe(method(init))]
161        #[unsafe(method_family = init)]
162        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
163
164        #[unsafe(method(new))]
165        #[unsafe(method_family = new)]
166        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
167    );
168}