objc2_app_kit/generated/
NSSlider.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
12extern_class!(
13    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsslider?language=objc)
14    #[unsafe(super(NSControl, NSView, NSResponder, NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
17    pub struct NSSlider;
18);
19
20#[cfg(all(
21    feature = "NSAccessibilityProtocols",
22    feature = "NSControl",
23    feature = "NSResponder",
24    feature = "NSView"
25))]
26unsafe impl NSAccessibility for NSSlider {}
27
28#[cfg(all(
29    feature = "NSAccessibilityProtocols",
30    feature = "NSControl",
31    feature = "NSResponder",
32    feature = "NSView"
33))]
34unsafe impl NSAccessibilityElementProtocol for NSSlider {}
35
36#[cfg(all(
37    feature = "NSAccessibilityProtocols",
38    feature = "NSControl",
39    feature = "NSResponder",
40    feature = "NSView"
41))]
42unsafe impl NSAccessibilitySlider for NSSlider {}
43
44#[cfg(all(
45    feature = "NSAnimation",
46    feature = "NSControl",
47    feature = "NSResponder",
48    feature = "NSView"
49))]
50unsafe impl NSAnimatablePropertyContainer for NSSlider {}
51
52#[cfg(all(
53    feature = "NSAppearance",
54    feature = "NSControl",
55    feature = "NSResponder",
56    feature = "NSView"
57))]
58unsafe impl NSAppearanceCustomization for NSSlider {}
59
60#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
61unsafe impl NSCoding for NSSlider {}
62
63#[cfg(all(
64    feature = "NSControl",
65    feature = "NSDragging",
66    feature = "NSResponder",
67    feature = "NSView"
68))]
69unsafe impl NSDraggingDestination for NSSlider {}
70
71#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
72unsafe impl NSObjectProtocol for NSSlider {}
73
74#[cfg(all(
75    feature = "NSControl",
76    feature = "NSResponder",
77    feature = "NSUserInterfaceItemIdentification",
78    feature = "NSView"
79))]
80unsafe impl NSUserInterfaceItemIdentification for NSSlider {}
81
82#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
83impl NSSlider {
84    extern_methods!(
85        #[cfg(feature = "NSSliderCell")]
86        #[unsafe(method(sliderType))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn sliderType(&self) -> NSSliderType;
89
90        #[cfg(feature = "NSSliderCell")]
91        /// Setter for [`sliderType`][Self::sliderType].
92        #[unsafe(method(setSliderType:))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn setSliderType(&self, slider_type: NSSliderType);
95
96        #[unsafe(method(minValue))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn minValue(&self) -> c_double;
99
100        /// Setter for [`minValue`][Self::minValue].
101        #[unsafe(method(setMinValue:))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn setMinValue(&self, min_value: c_double);
104
105        #[unsafe(method(maxValue))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn maxValue(&self) -> c_double;
108
109        /// Setter for [`maxValue`][Self::maxValue].
110        #[unsafe(method(setMaxValue:))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn setMaxValue(&self, max_value: c_double);
113
114        #[unsafe(method(altIncrementValue))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn altIncrementValue(&self) -> c_double;
117
118        /// Setter for [`altIncrementValue`][Self::altIncrementValue].
119        #[unsafe(method(setAltIncrementValue:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn setAltIncrementValue(&self, alt_increment_value: c_double);
122
123        #[cfg(feature = "objc2-core-foundation")]
124        #[unsafe(method(knobThickness))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn knobThickness(&self) -> CGFloat;
127
128        #[cfg(feature = "NSEvent")]
129        #[unsafe(method(acceptsFirstMouse:))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn acceptsFirstMouse(&self, event: Option<&NSEvent>) -> bool;
132
133        /// Setter for [`isVertical`][Self::isVertical].
134        #[unsafe(method(setVertical:))]
135        #[unsafe(method_family = none)]
136        pub unsafe fn setVertical(&self, vertical: bool);
137
138        #[cfg(feature = "NSColor")]
139        #[unsafe(method(trackFillColor))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn trackFillColor(&self) -> Option<Retained<NSColor>>;
142
143        #[cfg(feature = "NSColor")]
144        /// Setter for [`trackFillColor`][Self::trackFillColor].
145        #[unsafe(method(setTrackFillColor:))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn setTrackFillColor(&self, track_fill_color: Option<&NSColor>);
148    );
149}
150
151/// Methods declared on superclass `NSControl`.
152#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
153impl NSSlider {
154    extern_methods!(
155        #[unsafe(method(initWithFrame:))]
156        #[unsafe(method_family = init)]
157        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
158
159        #[unsafe(method(initWithCoder:))]
160        #[unsafe(method_family = init)]
161        pub unsafe fn initWithCoder(
162            this: Allocated<Self>,
163            coder: &NSCoder,
164        ) -> Option<Retained<Self>>;
165    );
166}
167
168/// Methods declared on superclass `NSResponder`.
169#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
170impl NSSlider {
171    extern_methods!(
172        #[unsafe(method(init))]
173        #[unsafe(method_family = init)]
174        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
175    );
176}
177
178/// Methods declared on superclass `NSObject`.
179#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
180impl NSSlider {
181    extern_methods!(
182        #[unsafe(method(new))]
183        #[unsafe(method_family = new)]
184        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
185    );
186}
187
188/// NSSliderVerticalGetter.
189#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
190impl NSSlider {
191    extern_methods!();
192}
193
194/// NSTickMarkSupport.
195#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
196impl NSSlider {
197    extern_methods!(
198        #[unsafe(method(numberOfTickMarks))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn numberOfTickMarks(&self) -> NSInteger;
201
202        /// Setter for [`numberOfTickMarks`][Self::numberOfTickMarks].
203        #[unsafe(method(setNumberOfTickMarks:))]
204        #[unsafe(method_family = none)]
205        pub unsafe fn setNumberOfTickMarks(&self, number_of_tick_marks: NSInteger);
206
207        #[cfg(feature = "NSSliderCell")]
208        #[unsafe(method(tickMarkPosition))]
209        #[unsafe(method_family = none)]
210        pub unsafe fn tickMarkPosition(&self) -> NSTickMarkPosition;
211
212        #[cfg(feature = "NSSliderCell")]
213        /// Setter for [`tickMarkPosition`][Self::tickMarkPosition].
214        #[unsafe(method(setTickMarkPosition:))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn setTickMarkPosition(&self, tick_mark_position: NSTickMarkPosition);
217
218        #[unsafe(method(allowsTickMarkValuesOnly))]
219        #[unsafe(method_family = none)]
220        pub unsafe fn allowsTickMarkValuesOnly(&self) -> bool;
221
222        /// Setter for [`allowsTickMarkValuesOnly`][Self::allowsTickMarkValuesOnly].
223        #[unsafe(method(setAllowsTickMarkValuesOnly:))]
224        #[unsafe(method_family = none)]
225        pub unsafe fn setAllowsTickMarkValuesOnly(&self, allows_tick_mark_values_only: bool);
226
227        #[unsafe(method(tickMarkValueAtIndex:))]
228        #[unsafe(method_family = none)]
229        pub unsafe fn tickMarkValueAtIndex(&self, index: NSInteger) -> c_double;
230
231        #[unsafe(method(rectOfTickMarkAtIndex:))]
232        #[unsafe(method_family = none)]
233        pub unsafe fn rectOfTickMarkAtIndex(&self, index: NSInteger) -> NSRect;
234
235        #[unsafe(method(indexOfTickMarkAtPoint:))]
236        #[unsafe(method_family = none)]
237        pub unsafe fn indexOfTickMarkAtPoint(&self, point: NSPoint) -> NSInteger;
238
239        #[unsafe(method(closestTickMarkValueToValue:))]
240        #[unsafe(method_family = none)]
241        pub unsafe fn closestTickMarkValueToValue(&self, value: c_double) -> c_double;
242    );
243}
244
245/// NSSliderConvenience.
246#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
247impl NSSlider {
248    extern_methods!(
249        /// Creates a continuous horizontal slider over the range 0.0 to 1.0. The default value is 0.0.
250        ///
251        /// Parameter `target`: The target object that receives action messages from the control.
252        ///
253        /// Parameter `action`: The action message sent by the control.
254        ///
255        /// Returns: An initialized slider control.
256        #[unsafe(method(sliderWithTarget:action:))]
257        #[unsafe(method_family = none)]
258        pub unsafe fn sliderWithTarget_action(
259            target: Option<&AnyObject>,
260            action: Option<Sel>,
261            mtm: MainThreadMarker,
262        ) -> Retained<Self>;
263
264        /// Creates a continuous horizontal slider that represents values over a specified range.
265        ///
266        /// Parameter `value`: The initial value displayed by the control.
267        ///
268        /// Parameter `minValue`: The minimum value represented by the control.
269        ///
270        /// Parameter `maxValue`: The maximum value represented by the control.
271        ///
272        /// Parameter `target`: The target object that receives action messages from the control.
273        ///
274        /// Parameter `action`: The action message sent by the control.
275        ///
276        /// Returns: An initialized slider control.
277        #[unsafe(method(sliderWithValue:minValue:maxValue:target:action:))]
278        #[unsafe(method_family = none)]
279        pub unsafe fn sliderWithValue_minValue_maxValue_target_action(
280            value: c_double,
281            min_value: c_double,
282            max_value: c_double,
283            target: Option<&AnyObject>,
284            action: Option<Sel>,
285            mtm: MainThreadMarker,
286        ) -> Retained<Self>;
287    );
288}
289
290/// NSSliderDeprecated.
291#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
292impl NSSlider {
293    extern_methods!(
294        #[cfg(feature = "NSCell")]
295        #[deprecated = "-setTitleCell: had no effect since 10.0"]
296        #[unsafe(method(setTitleCell:))]
297        #[unsafe(method_family = none)]
298        pub unsafe fn setTitleCell(&self, cell: Option<&NSCell>);
299
300        #[deprecated = "-titleCell has returned nil since 10.0"]
301        #[unsafe(method(titleCell))]
302        #[unsafe(method_family = none)]
303        pub unsafe fn titleCell(&self) -> Option<Retained<AnyObject>>;
304
305        #[cfg(feature = "NSColor")]
306        #[deprecated = "-setTitleColor: had no effect since 10.0"]
307        #[unsafe(method(setTitleColor:))]
308        #[unsafe(method_family = none)]
309        pub unsafe fn setTitleColor(&self, new_color: Option<&NSColor>);
310
311        #[cfg(feature = "NSColor")]
312        #[deprecated = "-titleColor has returned nil since 10.0"]
313        #[unsafe(method(titleColor))]
314        #[unsafe(method_family = none)]
315        pub unsafe fn titleColor(&self) -> Option<Retained<NSColor>>;
316
317        #[cfg(feature = "NSFont")]
318        #[deprecated = "-setTitleFont: had no effect since 10.0"]
319        #[unsafe(method(setTitleFont:))]
320        #[unsafe(method_family = none)]
321        pub unsafe fn setTitleFont(&self, font_obj: Option<&NSFont>);
322
323        #[cfg(feature = "NSFont")]
324        #[deprecated = "-titleFont has returned nil since 10.0"]
325        #[unsafe(method(titleFont))]
326        #[unsafe(method_family = none)]
327        pub unsafe fn titleFont(&self) -> Option<Retained<NSFont>>;
328
329        #[deprecated = "-title has returned nil since 10.0"]
330        #[unsafe(method(title))]
331        #[unsafe(method_family = none)]
332        pub unsafe fn title(&self) -> Option<Retained<NSString>>;
333
334        #[deprecated = "-setTitle: had no effect since 10.0"]
335        #[unsafe(method(setTitle:))]
336        #[unsafe(method_family = none)]
337        pub unsafe fn setTitle(&self, string: Option<&NSString>);
338
339        #[cfg(feature = "objc2-core-foundation")]
340        #[deprecated = "-knobThickness has returned 0 since 10.0"]
341        #[unsafe(method(setKnobThickness:))]
342        #[unsafe(method_family = none)]
343        pub unsafe fn setKnobThickness(&self, thickness: CGFloat);
344
345        #[cfg(feature = "NSImage")]
346        #[deprecated = "-setImage: had no effect since 10.0"]
347        #[unsafe(method(setImage:))]
348        #[unsafe(method_family = none)]
349        pub unsafe fn setImage(&self, background_image: Option<&NSImage>);
350
351        #[cfg(feature = "NSImage")]
352        #[deprecated = "-image has returned nil since 10.0"]
353        #[unsafe(method(image))]
354        #[unsafe(method_family = none)]
355        pub unsafe fn image(&self) -> Option<Retained<NSImage>>;
356    );
357}