objc2_app_kit/generated/
NSSliderTouchBarItem.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#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsslideraccessorywidth?language=objc)
13// NS_TYPED_EXTENSIBLE_ENUM
14#[cfg(feature = "objc2-core-foundation")]
15pub type NSSliderAccessoryWidth = CGFloat;
16
17extern "C" {
18    /// The default width for slider accessories.
19    ///
20    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsslideraccessorywidthdefault?language=objc)
21    #[cfg(feature = "objc2-core-foundation")]
22    pub static NSSliderAccessoryWidthDefault: NSSliderAccessoryWidth;
23}
24
25extern "C" {
26    /// The standard "wide" width for slider accessories.
27    ///
28    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsslideraccessorywidthwide?language=objc)
29    #[cfg(feature = "objc2-core-foundation")]
30    pub static NSSliderAccessoryWidthWide: NSSliderAccessoryWidth;
31}
32
33extern_class!(
34    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsslidertouchbaritem?language=objc)
35    #[unsafe(super(NSTouchBarItem, NSObject))]
36    #[derive(Debug, PartialEq, Eq, Hash)]
37    #[cfg(feature = "NSTouchBarItem")]
38    pub struct NSSliderTouchBarItem;
39);
40
41#[cfg(feature = "NSTouchBarItem")]
42extern_conformance!(
43    unsafe impl NSCoding for NSSliderTouchBarItem {}
44);
45
46#[cfg(feature = "NSTouchBarItem")]
47extern_conformance!(
48    unsafe impl NSObjectProtocol for NSSliderTouchBarItem {}
49);
50
51#[cfg(feature = "NSTouchBarItem")]
52impl NSSliderTouchBarItem {
53    extern_methods!(
54        #[cfg(all(
55            feature = "NSResponder",
56            feature = "NSUserInterfaceCompression",
57            feature = "NSView"
58        ))]
59        #[unsafe(method(view))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn view(&self) -> Retained<NSView>;
62
63        #[cfg(all(
64            feature = "NSControl",
65            feature = "NSResponder",
66            feature = "NSSlider",
67            feature = "NSView"
68        ))]
69        /// The slider displayed by the bar item. It is automatically created, but can be set to a custom subclass. doubleValue, minValue, maxValue, etc can all be read and set through the slider.
70        #[unsafe(method(slider))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn slider(&self) -> Retained<NSSlider>;
73
74        #[cfg(all(
75            feature = "NSControl",
76            feature = "NSResponder",
77            feature = "NSSlider",
78            feature = "NSView"
79        ))]
80        /// Setter for [`slider`][Self::slider].
81        #[unsafe(method(setSlider:))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn setSlider(&self, slider: &NSSlider);
84
85        /// The double value of the control
86        #[unsafe(method(doubleValue))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn doubleValue(&self) -> c_double;
89
90        /// Setter for [`doubleValue`][Self::doubleValue].
91        #[unsafe(method(setDoubleValue:))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn setDoubleValue(&self, double_value: c_double);
94
95        #[cfg(feature = "objc2-core-foundation")]
96        /// The width boundaries of the slider track of this item.
97        /// The system defines the default minimum. The maximum defaults to MAXFLOAT
98        #[unsafe(method(minimumSliderWidth))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn minimumSliderWidth(&self) -> CGFloat;
101
102        #[cfg(feature = "objc2-core-foundation")]
103        /// Setter for [`minimumSliderWidth`][Self::minimumSliderWidth].
104        #[unsafe(method(setMinimumSliderWidth:))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn setMinimumSliderWidth(&self, minimum_slider_width: CGFloat);
107
108        #[cfg(feature = "objc2-core-foundation")]
109        #[unsafe(method(maximumSliderWidth))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn maximumSliderWidth(&self) -> CGFloat;
112
113        #[cfg(feature = "objc2-core-foundation")]
114        /// Setter for [`maximumSliderWidth`][Self::maximumSliderWidth].
115        #[unsafe(method(setMaximumSliderWidth:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn setMaximumSliderWidth(&self, maximum_slider_width: CGFloat);
118
119        /// The text label displayed along with the slider. If set to nil, the label will not have space reserved in the item.
120        #[unsafe(method(label))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn label(&self) -> Option<Retained<NSString>>;
123
124        /// Setter for [`label`][Self::label].
125        #[unsafe(method(setLabel:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn setLabel(&self, label: Option<&NSString>);
128
129        #[cfg(feature = "NSSliderAccessory")]
130        /// The accessory that appears on the end of the slider with the minimum value
131        #[unsafe(method(minimumValueAccessory))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn minimumValueAccessory(&self) -> Option<Retained<NSSliderAccessory>>;
134
135        #[cfg(feature = "NSSliderAccessory")]
136        /// Setter for [`minimumValueAccessory`][Self::minimumValueAccessory].
137        #[unsafe(method(setMinimumValueAccessory:))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn setMinimumValueAccessory(
140            &self,
141            minimum_value_accessory: Option<&NSSliderAccessory>,
142        );
143
144        #[cfg(feature = "NSSliderAccessory")]
145        /// The accessory that appears on the end of the slider with the maximum value
146        #[unsafe(method(maximumValueAccessory))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn maximumValueAccessory(&self) -> Option<Retained<NSSliderAccessory>>;
149
150        #[cfg(feature = "NSSliderAccessory")]
151        /// Setter for [`maximumValueAccessory`][Self::maximumValueAccessory].
152        #[unsafe(method(setMaximumValueAccessory:))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn setMaximumValueAccessory(
155            &self,
156            maximum_value_accessory: Option<&NSSliderAccessory>,
157        );
158
159        #[cfg(feature = "objc2-core-foundation")]
160        /// The width of the value accessories. Defaults to `.default`, but can be set to `.wide` or a custom value.
161        #[unsafe(method(valueAccessoryWidth))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn valueAccessoryWidth(&self) -> NSSliderAccessoryWidth;
164
165        #[cfg(feature = "objc2-core-foundation")]
166        /// Setter for [`valueAccessoryWidth`][Self::valueAccessoryWidth].
167        #[unsafe(method(setValueAccessoryWidth:))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn setValueAccessoryWidth(&self, value_accessory_width: NSSliderAccessoryWidth);
170
171        /// The target of the item, notified when the slider or accessories receive user interaction.
172        #[unsafe(method(target))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn target(&self) -> Option<Retained<AnyObject>>;
175
176        /// This is a [weak property][objc2::topics::weak_property].
177        /// Setter for [`target`][Self::target].
178        #[unsafe(method(setTarget:))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
181
182        /// The action of the item, called when the slider or accessories receive user interaction.
183        #[unsafe(method(action))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn action(&self) -> Option<Sel>;
186
187        /// Setter for [`action`][Self::action].
188        #[unsafe(method(setAction:))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn setAction(&self, action: Option<Sel>);
191
192        /// The localized string labelling this item during user customization. The default value is empty string.
193        #[unsafe(method(customizationLabel))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn customizationLabel(&self) -> Retained<NSString>;
196
197        /// Setter for [`customizationLabel`][Self::customizationLabel].
198        #[unsafe(method(setCustomizationLabel:))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn setCustomizationLabel(&self, customization_label: Option<&NSString>);
201    );
202}
203
204/// Methods declared on superclass `NSTouchBarItem`.
205#[cfg(feature = "NSTouchBarItem")]
206impl NSSliderTouchBarItem {
207    extern_methods!(
208        #[unsafe(method(initWithIdentifier:))]
209        #[unsafe(method_family = init)]
210        pub unsafe fn initWithIdentifier(
211            this: Allocated<Self>,
212            identifier: &NSTouchBarItemIdentifier,
213        ) -> Retained<Self>;
214
215        #[unsafe(method(initWithCoder:))]
216        #[unsafe(method_family = init)]
217        pub unsafe fn initWithCoder(
218            this: Allocated<Self>,
219            coder: &NSCoder,
220        ) -> Option<Retained<Self>>;
221
222        #[unsafe(method(init))]
223        #[unsafe(method_family = init)]
224        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
225    );
226}
227
228/// Methods declared on superclass `NSObject`.
229#[cfg(feature = "NSTouchBarItem")]
230impl NSSliderTouchBarItem {
231    extern_methods!(
232        #[unsafe(method(new))]
233        #[unsafe(method_family = new)]
234        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
235    );
236}