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 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 fn behavior(&self) -> Retained<NSSliderAccessoryBehavior>;
40
41        /// Setter for [`behavior`][Self::behavior].
42        ///
43        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
44        #[unsafe(method(setBehavior:))]
45        #[unsafe(method_family = none)]
46        pub fn setBehavior(&self, behavior: &NSSliderAccessoryBehavior);
47
48        /// Whether or not the accessory is interactive and draws with an enabled appearance. Defaults to YES.
49        #[unsafe(method(isEnabled))]
50        #[unsafe(method_family = none)]
51        pub fn isEnabled(&self) -> bool;
52
53        /// Setter for [`isEnabled`][Self::isEnabled].
54        #[unsafe(method(setEnabled:))]
55        #[unsafe(method_family = none)]
56        pub fn setEnabled(&self, enabled: bool);
57    );
58}
59
60/// Methods declared on superclass `NSObject`.
61impl NSSliderAccessory {
62    extern_methods!(
63        #[unsafe(method(init))]
64        #[unsafe(method_family = init)]
65        pub fn init(this: Allocated<Self>) -> Retained<Self>;
66
67        #[unsafe(method(new))]
68        #[unsafe(method_family = new)]
69        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
70    );
71}
72
73impl NSSliderAccessory {
74    extern_methods!();
75}
76
77#[cfg(feature = "NSAccessibilityProtocols")]
78extern_conformance!(
79    unsafe impl NSAccessibility for NSSliderAccessory {}
80);
81
82#[cfg(feature = "NSAccessibilityProtocols")]
83extern_conformance!(
84    unsafe impl NSAccessibilityElementProtocol for NSSliderAccessory {}
85);
86
87extern_class!(
88    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsslideraccessorybehavior?language=objc)
89    #[unsafe(super(NSObject))]
90    #[thread_kind = MainThreadOnly]
91    #[derive(Debug, PartialEq, Eq, Hash)]
92    pub struct NSSliderAccessoryBehavior;
93);
94
95extern_conformance!(
96    unsafe impl NSCoding for NSSliderAccessoryBehavior {}
97);
98
99extern_conformance!(
100    unsafe impl NSCopying for NSSliderAccessoryBehavior {}
101);
102
103unsafe impl CopyingHelper for NSSliderAccessoryBehavior {
104    type Result = Self;
105}
106
107extern_conformance!(
108    unsafe impl NSObjectProtocol for NSSliderAccessoryBehavior {}
109);
110
111impl NSSliderAccessoryBehavior {
112    extern_methods!(
113        /// The behavior is automatically picked to be the system standard for the slider's current context, e.g. NSTouchBarItems have `.valueStep` behavior.
114        #[unsafe(method(automaticBehavior))]
115        #[unsafe(method_family = none)]
116        pub fn automaticBehavior(mtm: MainThreadMarker) -> 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 fn valueStepBehavior(mtm: MainThreadMarker) -> Retained<NSSliderAccessoryBehavior>;
122
123        /// The value of the slider is reset to the associated value for the accessory.
124        #[unsafe(method(valueResetBehavior))]
125        #[unsafe(method_family = none)]
126        pub fn valueResetBehavior(mtm: MainThreadMarker) -> Retained<NSSliderAccessoryBehavior>;
127
128        /// The action is sent to the target on interaction. The optional first parameter is an NSSliderAccessory.
129        ///
130        /// # Safety
131        ///
132        /// - `target` should be of the correct type.
133        /// - `action` must be a valid selector.
134        #[unsafe(method(behaviorWithTarget:action:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn behaviorWithTarget_action(
137            target: Option<&AnyObject>,
138            action: Sel,
139            mtm: MainThreadMarker,
140        ) -> Retained<NSSliderAccessoryBehavior>;
141
142        #[cfg(feature = "block2")]
143        /// The handler block is invoked on interaction. This variant is not codable and will assert in `-encodeWithCoder:`.
144        #[unsafe(method(behaviorWithHandler:))]
145        #[unsafe(method_family = none)]
146        pub fn behaviorWithHandler(
147            handler: &block2::DynBlock<dyn Fn(NonNull<NSSliderAccessory>)>,
148            mtm: MainThreadMarker,
149        ) -> Retained<NSSliderAccessoryBehavior>;
150
151        /// Override point for custom subclasses to handle interaction.
152        #[unsafe(method(handleAction:))]
153        #[unsafe(method_family = none)]
154        pub fn handleAction(&self, sender: &NSSliderAccessory);
155    );
156}
157
158/// Methods declared on superclass `NSObject`.
159impl NSSliderAccessoryBehavior {
160    extern_methods!(
161        #[unsafe(method(init))]
162        #[unsafe(method_family = init)]
163        pub fn init(this: Allocated<Self>) -> Retained<Self>;
164
165        #[unsafe(method(new))]
166        #[unsafe(method_family = new)]
167        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
168    );
169}