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