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")]
42unsafe impl NSCoding for NSSliderTouchBarItem {}
43
44#[cfg(feature = "NSTouchBarItem")]
45unsafe impl NSObjectProtocol for NSSliderTouchBarItem {}
46
47#[cfg(feature = "NSTouchBarItem")]
48impl NSSliderTouchBarItem {
49    extern_methods!(
50        #[cfg(all(
51            feature = "NSResponder",
52            feature = "NSUserInterfaceCompression",
53            feature = "NSView"
54        ))]
55        #[unsafe(method(view))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn view(&self) -> Retained<NSView>;
58
59        #[cfg(all(
60            feature = "NSControl",
61            feature = "NSResponder",
62            feature = "NSSlider",
63            feature = "NSView"
64        ))]
65        /// 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.
66        #[unsafe(method(slider))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn slider(&self) -> Retained<NSSlider>;
69
70        #[cfg(all(
71            feature = "NSControl",
72            feature = "NSResponder",
73            feature = "NSSlider",
74            feature = "NSView"
75        ))]
76        /// Setter for [`slider`][Self::slider].
77        #[unsafe(method(setSlider:))]
78        #[unsafe(method_family = none)]
79        pub unsafe fn setSlider(&self, slider: &NSSlider);
80
81        /// The double value of the control
82        #[unsafe(method(doubleValue))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn doubleValue(&self) -> c_double;
85
86        /// Setter for [`doubleValue`][Self::doubleValue].
87        #[unsafe(method(setDoubleValue:))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn setDoubleValue(&self, double_value: c_double);
90
91        #[cfg(feature = "objc2-core-foundation")]
92        /// The width boundaries of the slider track of this item.
93        /// The system defines the default minimum. The maximum defaults to MAXFLOAT
94        #[unsafe(method(minimumSliderWidth))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn minimumSliderWidth(&self) -> CGFloat;
97
98        #[cfg(feature = "objc2-core-foundation")]
99        /// Setter for [`minimumSliderWidth`][Self::minimumSliderWidth].
100        #[unsafe(method(setMinimumSliderWidth:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn setMinimumSliderWidth(&self, minimum_slider_width: CGFloat);
103
104        #[cfg(feature = "objc2-core-foundation")]
105        #[unsafe(method(maximumSliderWidth))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn maximumSliderWidth(&self) -> CGFloat;
108
109        #[cfg(feature = "objc2-core-foundation")]
110        /// Setter for [`maximumSliderWidth`][Self::maximumSliderWidth].
111        #[unsafe(method(setMaximumSliderWidth:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn setMaximumSliderWidth(&self, maximum_slider_width: CGFloat);
114
115        /// The text label displayed along with the slider. If set to nil, the label will not have space reserved in the item.
116        #[unsafe(method(label))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn label(&self) -> Option<Retained<NSString>>;
119
120        /// Setter for [`label`][Self::label].
121        #[unsafe(method(setLabel:))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn setLabel(&self, label: Option<&NSString>);
124
125        #[cfg(feature = "NSSliderAccessory")]
126        /// The accessory that appears on the end of the slider with the minimum value
127        #[unsafe(method(minimumValueAccessory))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn minimumValueAccessory(&self) -> Option<Retained<NSSliderAccessory>>;
130
131        #[cfg(feature = "NSSliderAccessory")]
132        /// Setter for [`minimumValueAccessory`][Self::minimumValueAccessory].
133        #[unsafe(method(setMinimumValueAccessory:))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn setMinimumValueAccessory(
136            &self,
137            minimum_value_accessory: Option<&NSSliderAccessory>,
138        );
139
140        #[cfg(feature = "NSSliderAccessory")]
141        /// The accessory that appears on the end of the slider with the maximum value
142        #[unsafe(method(maximumValueAccessory))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn maximumValueAccessory(&self) -> Option<Retained<NSSliderAccessory>>;
145
146        #[cfg(feature = "NSSliderAccessory")]
147        /// Setter for [`maximumValueAccessory`][Self::maximumValueAccessory].
148        #[unsafe(method(setMaximumValueAccessory:))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn setMaximumValueAccessory(
151            &self,
152            maximum_value_accessory: Option<&NSSliderAccessory>,
153        );
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 unsafe 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 unsafe 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 unsafe fn target(&self) -> Option<Retained<AnyObject>>;
171
172        /// This is a [weak property][objc2::topics::weak_property].
173        /// Setter for [`target`][Self::target].
174        #[unsafe(method(setTarget:))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
177
178        /// The action of the item, called when the slider or accessories receive user interaction.
179        #[unsafe(method(action))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn action(&self) -> Option<Sel>;
182
183        /// Setter for [`action`][Self::action].
184        #[unsafe(method(setAction:))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn setAction(&self, action: Option<Sel>);
187
188        /// The localized string labelling this item during user customization. The default value is empty string.
189        #[unsafe(method(customizationLabel))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn customizationLabel(&self) -> Retained<NSString>;
192
193        /// Setter for [`customizationLabel`][Self::customizationLabel].
194        #[unsafe(method(setCustomizationLabel:))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn setCustomizationLabel(&self, customization_label: Option<&NSString>);
197    );
198}
199
200/// Methods declared on superclass `NSTouchBarItem`.
201#[cfg(feature = "NSTouchBarItem")]
202impl NSSliderTouchBarItem {
203    extern_methods!(
204        #[unsafe(method(initWithIdentifier:))]
205        #[unsafe(method_family = init)]
206        pub unsafe fn initWithIdentifier(
207            this: Allocated<Self>,
208            identifier: &NSTouchBarItemIdentifier,
209        ) -> Retained<Self>;
210
211        #[unsafe(method(initWithCoder:))]
212        #[unsafe(method_family = init)]
213        pub unsafe fn initWithCoder(
214            this: Allocated<Self>,
215            coder: &NSCoder,
216        ) -> Option<Retained<Self>>;
217
218        #[unsafe(method(init))]
219        #[unsafe(method_family = init)]
220        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
221    );
222}
223
224/// Methods declared on superclass `NSObject`.
225#[cfg(feature = "NSTouchBarItem")]
226impl NSSliderTouchBarItem {
227    extern_methods!(
228        #[unsafe(method(new))]
229        #[unsafe(method_family = new)]
230        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
231    );
232}