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 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 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 fn setSlider(&self, slider: &NSSlider);
84
85        /// The double value of the control
86        #[unsafe(method(doubleValue))]
87        #[unsafe(method_family = none)]
88        pub fn doubleValue(&self) -> c_double;
89
90        /// Setter for [`doubleValue`][Self::doubleValue].
91        #[unsafe(method(setDoubleValue:))]
92        #[unsafe(method_family = none)]
93        pub 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 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 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 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 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 fn label(&self) -> Option<Retained<NSString>>;
123
124        /// Setter for [`label`][Self::label].
125        ///
126        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
127        #[unsafe(method(setLabel:))]
128        #[unsafe(method_family = none)]
129        pub fn setLabel(&self, label: Option<&NSString>);
130
131        #[cfg(feature = "NSSliderAccessory")]
132        /// The accessory that appears on the end of the slider with the minimum value
133        #[unsafe(method(minimumValueAccessory))]
134        #[unsafe(method_family = none)]
135        pub fn minimumValueAccessory(&self) -> Option<Retained<NSSliderAccessory>>;
136
137        #[cfg(feature = "NSSliderAccessory")]
138        /// Setter for [`minimumValueAccessory`][Self::minimumValueAccessory].
139        #[unsafe(method(setMinimumValueAccessory:))]
140        #[unsafe(method_family = none)]
141        pub fn setMinimumValueAccessory(&self, minimum_value_accessory: Option<&NSSliderAccessory>);
142
143        #[cfg(feature = "NSSliderAccessory")]
144        /// The accessory that appears on the end of the slider with the maximum value
145        #[unsafe(method(maximumValueAccessory))]
146        #[unsafe(method_family = none)]
147        pub fn maximumValueAccessory(&self) -> Option<Retained<NSSliderAccessory>>;
148
149        #[cfg(feature = "NSSliderAccessory")]
150        /// Setter for [`maximumValueAccessory`][Self::maximumValueAccessory].
151        #[unsafe(method(setMaximumValueAccessory:))]
152        #[unsafe(method_family = none)]
153        pub fn setMaximumValueAccessory(&self, maximum_value_accessory: Option<&NSSliderAccessory>);
154
155        #[cfg(feature = "objc2-core-foundation")]
156        /// The width of the value accessories. Defaults to `.default`, but can be set to `.wide` or a custom value.
157        #[unsafe(method(valueAccessoryWidth))]
158        #[unsafe(method_family = none)]
159        pub fn valueAccessoryWidth(&self) -> NSSliderAccessoryWidth;
160
161        #[cfg(feature = "objc2-core-foundation")]
162        /// Setter for [`valueAccessoryWidth`][Self::valueAccessoryWidth].
163        #[unsafe(method(setValueAccessoryWidth:))]
164        #[unsafe(method_family = none)]
165        pub fn setValueAccessoryWidth(&self, value_accessory_width: NSSliderAccessoryWidth);
166
167        /// The target of the item, notified when the slider or accessories receive user interaction.
168        #[unsafe(method(target))]
169        #[unsafe(method_family = none)]
170        pub fn target(&self) -> Option<Retained<AnyObject>>;
171
172        /// Setter for [`target`][Self::target].
173        ///
174        /// This is a [weak property][objc2::topics::weak_property].
175        ///
176        /// # Safety
177        ///
178        /// `target` should be of the correct type.
179        #[unsafe(method(setTarget:))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
182
183        /// The action of the item, called when the slider or accessories receive user interaction.
184        #[unsafe(method(action))]
185        #[unsafe(method_family = none)]
186        pub fn action(&self) -> Option<Sel>;
187
188        /// Setter for [`action`][Self::action].
189        ///
190        /// # Safety
191        ///
192        /// `action` must be a valid selector.
193        #[unsafe(method(setAction:))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn setAction(&self, action: Option<Sel>);
196
197        /// The localized string labelling this item during user customization. The default value is empty string.
198        #[unsafe(method(customizationLabel))]
199        #[unsafe(method_family = none)]
200        pub fn customizationLabel(&self) -> Retained<NSString>;
201
202        /// Setter for [`customizationLabel`][Self::customizationLabel].
203        ///
204        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
205        #[unsafe(method(setCustomizationLabel:))]
206        #[unsafe(method_family = none)]
207        pub fn setCustomizationLabel(&self, customization_label: Option<&NSString>);
208    );
209}
210
211/// Methods declared on superclass `NSTouchBarItem`.
212#[cfg(feature = "NSTouchBarItem")]
213impl NSSliderTouchBarItem {
214    extern_methods!(
215        #[unsafe(method(initWithIdentifier:))]
216        #[unsafe(method_family = init)]
217        pub fn initWithIdentifier(
218            this: Allocated<Self>,
219            identifier: &NSTouchBarItemIdentifier,
220        ) -> Retained<Self>;
221
222        /// # Safety
223        ///
224        /// `coder` possibly has further requirements.
225        #[unsafe(method(initWithCoder:))]
226        #[unsafe(method_family = init)]
227        pub unsafe fn initWithCoder(
228            this: Allocated<Self>,
229            coder: &NSCoder,
230        ) -> Option<Retained<Self>>;
231
232        #[unsafe(method(init))]
233        #[unsafe(method_family = init)]
234        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
235    );
236}
237
238/// Methods declared on superclass `NSObject`.
239#[cfg(feature = "NSTouchBarItem")]
240impl NSSliderTouchBarItem {
241    extern_methods!(
242        #[unsafe(method(new))]
243        #[unsafe(method_family = new)]
244        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
245    );
246}