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))]
26extern_conformance!(
27    unsafe impl NSAccessibility for NSSlider {}
28);
29
30#[cfg(all(
31    feature = "NSAccessibilityProtocols",
32    feature = "NSControl",
33    feature = "NSResponder",
34    feature = "NSView"
35))]
36extern_conformance!(
37    unsafe impl NSAccessibilityElementProtocol for NSSlider {}
38);
39
40#[cfg(all(
41    feature = "NSAccessibilityProtocols",
42    feature = "NSControl",
43    feature = "NSResponder",
44    feature = "NSView"
45))]
46extern_conformance!(
47    unsafe impl NSAccessibilitySlider for NSSlider {}
48);
49
50#[cfg(all(
51    feature = "NSAnimation",
52    feature = "NSControl",
53    feature = "NSResponder",
54    feature = "NSView"
55))]
56extern_conformance!(
57    unsafe impl NSAnimatablePropertyContainer for NSSlider {}
58);
59
60#[cfg(all(
61    feature = "NSAppearance",
62    feature = "NSControl",
63    feature = "NSResponder",
64    feature = "NSView"
65))]
66extern_conformance!(
67    unsafe impl NSAppearanceCustomization for NSSlider {}
68);
69
70#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
71extern_conformance!(
72    unsafe impl NSCoding for NSSlider {}
73);
74
75#[cfg(all(
76    feature = "NSControl",
77    feature = "NSDragging",
78    feature = "NSResponder",
79    feature = "NSView"
80))]
81extern_conformance!(
82    unsafe impl NSDraggingDestination for NSSlider {}
83);
84
85#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
86extern_conformance!(
87    unsafe impl NSObjectProtocol for NSSlider {}
88);
89
90#[cfg(all(
91    feature = "NSControl",
92    feature = "NSResponder",
93    feature = "NSUserInterfaceItemIdentification",
94    feature = "NSView"
95))]
96extern_conformance!(
97    unsafe impl NSUserInterfaceItemIdentification for NSSlider {}
98);
99
100#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
101impl NSSlider {
102    extern_methods!(
103        #[cfg(feature = "NSSliderCell")]
104        #[unsafe(method(sliderType))]
105        #[unsafe(method_family = none)]
106        pub fn sliderType(&self) -> NSSliderType;
107
108        #[cfg(feature = "NSSliderCell")]
109        /// Setter for [`sliderType`][Self::sliderType].
110        #[unsafe(method(setSliderType:))]
111        #[unsafe(method_family = none)]
112        pub fn setSliderType(&self, slider_type: NSSliderType);
113
114        #[unsafe(method(minValue))]
115        #[unsafe(method_family = none)]
116        pub fn minValue(&self) -> c_double;
117
118        /// Setter for [`minValue`][Self::minValue].
119        #[unsafe(method(setMinValue:))]
120        #[unsafe(method_family = none)]
121        pub fn setMinValue(&self, min_value: c_double);
122
123        #[unsafe(method(maxValue))]
124        #[unsafe(method_family = none)]
125        pub fn maxValue(&self) -> c_double;
126
127        /// Setter for [`maxValue`][Self::maxValue].
128        #[unsafe(method(setMaxValue:))]
129        #[unsafe(method_family = none)]
130        pub fn setMaxValue(&self, max_value: c_double);
131
132        /// The value this slider will be filled from. This slider will be filled from its `neutralValue` to its current value. If `neutralValue` has not been explicitly set before, access to `neutralValue` will return `minValue`.
133        #[unsafe(method(neutralValue))]
134        #[unsafe(method_family = none)]
135        pub fn neutralValue(&self) -> c_double;
136
137        /// Setter for [`neutralValue`][Self::neutralValue].
138        #[unsafe(method(setNeutralValue:))]
139        #[unsafe(method_family = none)]
140        pub fn setNeutralValue(&self, neutral_value: c_double);
141
142        #[unsafe(method(altIncrementValue))]
143        #[unsafe(method_family = none)]
144        pub fn altIncrementValue(&self) -> c_double;
145
146        /// Setter for [`altIncrementValue`][Self::altIncrementValue].
147        #[unsafe(method(setAltIncrementValue:))]
148        #[unsafe(method_family = none)]
149        pub fn setAltIncrementValue(&self, alt_increment_value: c_double);
150
151        #[cfg(feature = "objc2-core-foundation")]
152        #[unsafe(method(knobThickness))]
153        #[unsafe(method_family = none)]
154        pub fn knobThickness(&self) -> CGFloat;
155
156        #[cfg(feature = "NSEvent")]
157        #[unsafe(method(acceptsFirstMouse:))]
158        #[unsafe(method_family = none)]
159        pub fn acceptsFirstMouse(&self, event: Option<&NSEvent>) -> bool;
160
161        /// Setter for [`isVertical`][Self::isVertical].
162        #[unsafe(method(setVertical:))]
163        #[unsafe(method_family = none)]
164        pub fn setVertical(&self, vertical: bool);
165
166        #[cfg(feature = "NSColor")]
167        #[unsafe(method(trackFillColor))]
168        #[unsafe(method_family = none)]
169        pub fn trackFillColor(&self) -> Option<Retained<NSColor>>;
170
171        #[cfg(feature = "NSColor")]
172        /// Setter for [`trackFillColor`][Self::trackFillColor].
173        ///
174        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
175        #[unsafe(method(setTrackFillColor:))]
176        #[unsafe(method_family = none)]
177        pub fn setTrackFillColor(&self, track_fill_color: Option<&NSColor>);
178
179        #[cfg(feature = "NSTintProminence")]
180        /// The tint prominence of the slider. The automatic behavior for a regular slider tints its track fill, while a slider with tick marks is untinted. Setting the tint prominence will override this default behavior and choose an explicit track fill tint behavior. See ``NSTintProminence`` for a list of possible values.
181        #[unsafe(method(tintProminence))]
182        #[unsafe(method_family = none)]
183        pub fn tintProminence(&self) -> NSTintProminence;
184
185        #[cfg(feature = "NSTintProminence")]
186        /// Setter for [`tintProminence`][Self::tintProminence].
187        #[unsafe(method(setTintProminence:))]
188        #[unsafe(method_family = none)]
189        pub fn setTintProminence(&self, tint_prominence: NSTintProminence);
190    );
191}
192
193/// Methods declared on superclass `NSControl`.
194#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
195impl NSSlider {
196    extern_methods!(
197        #[unsafe(method(initWithFrame:))]
198        #[unsafe(method_family = init)]
199        pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
200
201        /// # Safety
202        ///
203        /// `coder` possibly has further requirements.
204        #[unsafe(method(initWithCoder:))]
205        #[unsafe(method_family = init)]
206        pub unsafe fn initWithCoder(
207            this: Allocated<Self>,
208            coder: &NSCoder,
209        ) -> Option<Retained<Self>>;
210    );
211}
212
213/// Methods declared on superclass `NSResponder`.
214#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
215impl NSSlider {
216    extern_methods!(
217        #[unsafe(method(init))]
218        #[unsafe(method_family = init)]
219        pub fn init(this: Allocated<Self>) -> Retained<Self>;
220    );
221}
222
223/// Methods declared on superclass `NSObject`.
224#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
225impl NSSlider {
226    extern_methods!(
227        #[unsafe(method(new))]
228        #[unsafe(method_family = new)]
229        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
230    );
231}
232
233/// NSSliderVerticalGetter.
234#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
235impl NSSlider {
236    extern_methods!();
237}
238
239/// NSTickMarkSupport.
240#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
241impl NSSlider {
242    extern_methods!(
243        #[unsafe(method(numberOfTickMarks))]
244        #[unsafe(method_family = none)]
245        pub fn numberOfTickMarks(&self) -> NSInteger;
246
247        /// Setter for [`numberOfTickMarks`][Self::numberOfTickMarks].
248        #[unsafe(method(setNumberOfTickMarks:))]
249        #[unsafe(method_family = none)]
250        pub fn setNumberOfTickMarks(&self, number_of_tick_marks: NSInteger);
251
252        #[cfg(feature = "NSSliderCell")]
253        #[unsafe(method(tickMarkPosition))]
254        #[unsafe(method_family = none)]
255        pub fn tickMarkPosition(&self) -> NSTickMarkPosition;
256
257        #[cfg(feature = "NSSliderCell")]
258        /// Setter for [`tickMarkPosition`][Self::tickMarkPosition].
259        #[unsafe(method(setTickMarkPosition:))]
260        #[unsafe(method_family = none)]
261        pub fn setTickMarkPosition(&self, tick_mark_position: NSTickMarkPosition);
262
263        #[unsafe(method(allowsTickMarkValuesOnly))]
264        #[unsafe(method_family = none)]
265        pub fn allowsTickMarkValuesOnly(&self) -> bool;
266
267        /// Setter for [`allowsTickMarkValuesOnly`][Self::allowsTickMarkValuesOnly].
268        #[unsafe(method(setAllowsTickMarkValuesOnly:))]
269        #[unsafe(method_family = none)]
270        pub fn setAllowsTickMarkValuesOnly(&self, allows_tick_mark_values_only: bool);
271
272        #[unsafe(method(tickMarkValueAtIndex:))]
273        #[unsafe(method_family = none)]
274        pub fn tickMarkValueAtIndex(&self, index: NSInteger) -> c_double;
275
276        #[unsafe(method(rectOfTickMarkAtIndex:))]
277        #[unsafe(method_family = none)]
278        pub fn rectOfTickMarkAtIndex(&self, index: NSInteger) -> NSRect;
279
280        #[unsafe(method(indexOfTickMarkAtPoint:))]
281        #[unsafe(method_family = none)]
282        pub fn indexOfTickMarkAtPoint(&self, point: NSPoint) -> NSInteger;
283
284        #[unsafe(method(closestTickMarkValueToValue:))]
285        #[unsafe(method_family = none)]
286        pub fn closestTickMarkValueToValue(&self, value: c_double) -> c_double;
287    );
288}
289
290/// NSSliderConvenience.
291#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
292impl NSSlider {
293    extern_methods!(
294        /// Creates a continuous horizontal slider over the range 0.0 to 1.0. The default value is 0.0.
295        ///
296        /// Parameter `target`: The target object that receives action messages from the control.
297        ///
298        /// Parameter `action`: The action message sent by the control.
299        ///
300        /// Returns: An initialized slider control.
301        ///
302        /// # Safety
303        ///
304        /// - `target` should be of the correct type.
305        /// - `action` must be a valid selector.
306        #[unsafe(method(sliderWithTarget:action:))]
307        #[unsafe(method_family = none)]
308        pub unsafe fn sliderWithTarget_action(
309            target: Option<&AnyObject>,
310            action: Option<Sel>,
311            mtm: MainThreadMarker,
312        ) -> Retained<Self>;
313
314        /// Creates a continuous horizontal slider that represents values over a specified range.
315        ///
316        /// Parameter `value`: The initial value displayed by the control.
317        ///
318        /// Parameter `minValue`: The minimum value represented by the control.
319        ///
320        /// Parameter `maxValue`: The maximum value represented by the control.
321        ///
322        /// Parameter `target`: The target object that receives action messages from the control.
323        ///
324        /// Parameter `action`: The action message sent by the control.
325        ///
326        /// Returns: An initialized slider control.
327        ///
328        /// # Safety
329        ///
330        /// - `target` should be of the correct type.
331        /// - `action` must be a valid selector.
332        #[unsafe(method(sliderWithValue:minValue:maxValue:target:action:))]
333        #[unsafe(method_family = none)]
334        pub unsafe fn sliderWithValue_minValue_maxValue_target_action(
335            value: c_double,
336            min_value: c_double,
337            max_value: c_double,
338            target: Option<&AnyObject>,
339            action: Option<Sel>,
340            mtm: MainThreadMarker,
341        ) -> Retained<Self>;
342    );
343}
344
345/// NSSliderDeprecated.
346#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
347impl NSSlider {
348    extern_methods!(
349        #[cfg(feature = "NSCell")]
350        /// # Safety
351        ///
352        /// `cell` might not allow `None`.
353        #[deprecated = "-setTitleCell: had no effect since 10.0"]
354        #[unsafe(method(setTitleCell:))]
355        #[unsafe(method_family = none)]
356        pub unsafe fn setTitleCell(&self, cell: Option<&NSCell>);
357
358        #[deprecated = "-titleCell has returned nil since 10.0"]
359        #[unsafe(method(titleCell))]
360        #[unsafe(method_family = none)]
361        pub fn titleCell(&self) -> Option<Retained<AnyObject>>;
362
363        #[cfg(feature = "NSColor")]
364        /// # Safety
365        ///
366        /// `new_color` might not allow `None`.
367        #[deprecated = "-setTitleColor: had no effect since 10.0"]
368        #[unsafe(method(setTitleColor:))]
369        #[unsafe(method_family = none)]
370        pub unsafe fn setTitleColor(&self, new_color: Option<&NSColor>);
371
372        #[cfg(feature = "NSColor")]
373        #[deprecated = "-titleColor has returned nil since 10.0"]
374        #[unsafe(method(titleColor))]
375        #[unsafe(method_family = none)]
376        pub fn titleColor(&self) -> Option<Retained<NSColor>>;
377
378        #[cfg(feature = "NSFont")]
379        /// # Safety
380        ///
381        /// `font_obj` might not allow `None`.
382        #[deprecated = "-setTitleFont: had no effect since 10.0"]
383        #[unsafe(method(setTitleFont:))]
384        #[unsafe(method_family = none)]
385        pub unsafe fn setTitleFont(&self, font_obj: Option<&NSFont>);
386
387        #[cfg(feature = "NSFont")]
388        #[deprecated = "-titleFont has returned nil since 10.0"]
389        #[unsafe(method(titleFont))]
390        #[unsafe(method_family = none)]
391        pub fn titleFont(&self) -> Option<Retained<NSFont>>;
392
393        #[deprecated = "-title has returned nil since 10.0"]
394        #[unsafe(method(title))]
395        #[unsafe(method_family = none)]
396        pub fn title(&self) -> Option<Retained<NSString>>;
397
398        /// # Safety
399        ///
400        /// `string` might not allow `None`.
401        #[deprecated = "-setTitle: had no effect since 10.0"]
402        #[unsafe(method(setTitle:))]
403        #[unsafe(method_family = none)]
404        pub unsafe fn setTitle(&self, string: Option<&NSString>);
405
406        #[cfg(feature = "objc2-core-foundation")]
407        #[deprecated = "-knobThickness has returned 0 since 10.0"]
408        #[unsafe(method(setKnobThickness:))]
409        #[unsafe(method_family = none)]
410        pub fn setKnobThickness(&self, thickness: CGFloat);
411
412        #[cfg(feature = "NSImage")]
413        /// # Safety
414        ///
415        /// `background_image` might not allow `None`.
416        #[deprecated = "-setImage: had no effect since 10.0"]
417        #[unsafe(method(setImage:))]
418        #[unsafe(method_family = none)]
419        pub unsafe fn setImage(&self, background_image: Option<&NSImage>);
420
421        #[cfg(feature = "NSImage")]
422        #[deprecated = "-image has returned nil since 10.0"]
423        #[unsafe(method(image))]
424        #[unsafe(method_family = none)]
425        pub fn image(&self) -> Option<Retained<NSImage>>;
426    );
427}