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 unsafe 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 unsafe fn setSliderType(&self, slider_type: NSSliderType);
113
114        #[unsafe(method(minValue))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn minValue(&self) -> c_double;
117
118        /// Setter for [`minValue`][Self::minValue].
119        #[unsafe(method(setMinValue:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn setMinValue(&self, min_value: c_double);
122
123        #[unsafe(method(maxValue))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn maxValue(&self) -> c_double;
126
127        /// Setter for [`maxValue`][Self::maxValue].
128        #[unsafe(method(setMaxValue:))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn setMaxValue(&self, max_value: c_double);
131
132        #[unsafe(method(altIncrementValue))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn altIncrementValue(&self) -> c_double;
135
136        /// Setter for [`altIncrementValue`][Self::altIncrementValue].
137        #[unsafe(method(setAltIncrementValue:))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn setAltIncrementValue(&self, alt_increment_value: c_double);
140
141        #[cfg(feature = "objc2-core-foundation")]
142        #[unsafe(method(knobThickness))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn knobThickness(&self) -> CGFloat;
145
146        #[cfg(feature = "NSEvent")]
147        #[unsafe(method(acceptsFirstMouse:))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn acceptsFirstMouse(&self, event: Option<&NSEvent>) -> bool;
150
151        /// Setter for [`isVertical`][Self::isVertical].
152        #[unsafe(method(setVertical:))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn setVertical(&self, vertical: bool);
155
156        #[cfg(feature = "NSColor")]
157        #[unsafe(method(trackFillColor))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn trackFillColor(&self) -> Option<Retained<NSColor>>;
160
161        #[cfg(feature = "NSColor")]
162        /// Setter for [`trackFillColor`][Self::trackFillColor].
163        #[unsafe(method(setTrackFillColor:))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn setTrackFillColor(&self, track_fill_color: Option<&NSColor>);
166    );
167}
168
169/// Methods declared on superclass `NSControl`.
170#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
171impl NSSlider {
172    extern_methods!(
173        #[unsafe(method(initWithFrame:))]
174        #[unsafe(method_family = init)]
175        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
176
177        #[unsafe(method(initWithCoder:))]
178        #[unsafe(method_family = init)]
179        pub unsafe fn initWithCoder(
180            this: Allocated<Self>,
181            coder: &NSCoder,
182        ) -> Option<Retained<Self>>;
183    );
184}
185
186/// Methods declared on superclass `NSResponder`.
187#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
188impl NSSlider {
189    extern_methods!(
190        #[unsafe(method(init))]
191        #[unsafe(method_family = init)]
192        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
193    );
194}
195
196/// Methods declared on superclass `NSObject`.
197#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
198impl NSSlider {
199    extern_methods!(
200        #[unsafe(method(new))]
201        #[unsafe(method_family = new)]
202        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
203    );
204}
205
206/// NSSliderVerticalGetter.
207#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
208impl NSSlider {
209    extern_methods!();
210}
211
212/// NSTickMarkSupport.
213#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
214impl NSSlider {
215    extern_methods!(
216        #[unsafe(method(numberOfTickMarks))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn numberOfTickMarks(&self) -> NSInteger;
219
220        /// Setter for [`numberOfTickMarks`][Self::numberOfTickMarks].
221        #[unsafe(method(setNumberOfTickMarks:))]
222        #[unsafe(method_family = none)]
223        pub unsafe fn setNumberOfTickMarks(&self, number_of_tick_marks: NSInteger);
224
225        #[cfg(feature = "NSSliderCell")]
226        #[unsafe(method(tickMarkPosition))]
227        #[unsafe(method_family = none)]
228        pub unsafe fn tickMarkPosition(&self) -> NSTickMarkPosition;
229
230        #[cfg(feature = "NSSliderCell")]
231        /// Setter for [`tickMarkPosition`][Self::tickMarkPosition].
232        #[unsafe(method(setTickMarkPosition:))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn setTickMarkPosition(&self, tick_mark_position: NSTickMarkPosition);
235
236        #[unsafe(method(allowsTickMarkValuesOnly))]
237        #[unsafe(method_family = none)]
238        pub unsafe fn allowsTickMarkValuesOnly(&self) -> bool;
239
240        /// Setter for [`allowsTickMarkValuesOnly`][Self::allowsTickMarkValuesOnly].
241        #[unsafe(method(setAllowsTickMarkValuesOnly:))]
242        #[unsafe(method_family = none)]
243        pub unsafe fn setAllowsTickMarkValuesOnly(&self, allows_tick_mark_values_only: bool);
244
245        #[unsafe(method(tickMarkValueAtIndex:))]
246        #[unsafe(method_family = none)]
247        pub unsafe fn tickMarkValueAtIndex(&self, index: NSInteger) -> c_double;
248
249        #[unsafe(method(rectOfTickMarkAtIndex:))]
250        #[unsafe(method_family = none)]
251        pub unsafe fn rectOfTickMarkAtIndex(&self, index: NSInteger) -> NSRect;
252
253        #[unsafe(method(indexOfTickMarkAtPoint:))]
254        #[unsafe(method_family = none)]
255        pub unsafe fn indexOfTickMarkAtPoint(&self, point: NSPoint) -> NSInteger;
256
257        #[unsafe(method(closestTickMarkValueToValue:))]
258        #[unsafe(method_family = none)]
259        pub unsafe fn closestTickMarkValueToValue(&self, value: c_double) -> c_double;
260    );
261}
262
263/// NSSliderConvenience.
264#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
265impl NSSlider {
266    extern_methods!(
267        /// Creates a continuous horizontal slider over the range 0.0 to 1.0. The default value is 0.0.
268        ///
269        /// Parameter `target`: The target object that receives action messages from the control.
270        ///
271        /// Parameter `action`: The action message sent by the control.
272        ///
273        /// Returns: An initialized slider control.
274        #[unsafe(method(sliderWithTarget:action:))]
275        #[unsafe(method_family = none)]
276        pub unsafe fn sliderWithTarget_action(
277            target: Option<&AnyObject>,
278            action: Option<Sel>,
279            mtm: MainThreadMarker,
280        ) -> Retained<Self>;
281
282        /// Creates a continuous horizontal slider that represents values over a specified range.
283        ///
284        /// Parameter `value`: The initial value displayed by the control.
285        ///
286        /// Parameter `minValue`: The minimum value represented by the control.
287        ///
288        /// Parameter `maxValue`: The maximum value represented by the control.
289        ///
290        /// Parameter `target`: The target object that receives action messages from the control.
291        ///
292        /// Parameter `action`: The action message sent by the control.
293        ///
294        /// Returns: An initialized slider control.
295        #[unsafe(method(sliderWithValue:minValue:maxValue:target:action:))]
296        #[unsafe(method_family = none)]
297        pub unsafe fn sliderWithValue_minValue_maxValue_target_action(
298            value: c_double,
299            min_value: c_double,
300            max_value: c_double,
301            target: Option<&AnyObject>,
302            action: Option<Sel>,
303            mtm: MainThreadMarker,
304        ) -> Retained<Self>;
305    );
306}
307
308/// NSSliderDeprecated.
309#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
310impl NSSlider {
311    extern_methods!(
312        #[cfg(feature = "NSCell")]
313        #[deprecated = "-setTitleCell: had no effect since 10.0"]
314        #[unsafe(method(setTitleCell:))]
315        #[unsafe(method_family = none)]
316        pub unsafe fn setTitleCell(&self, cell: Option<&NSCell>);
317
318        #[deprecated = "-titleCell has returned nil since 10.0"]
319        #[unsafe(method(titleCell))]
320        #[unsafe(method_family = none)]
321        pub unsafe fn titleCell(&self) -> Option<Retained<AnyObject>>;
322
323        #[cfg(feature = "NSColor")]
324        #[deprecated = "-setTitleColor: had no effect since 10.0"]
325        #[unsafe(method(setTitleColor:))]
326        #[unsafe(method_family = none)]
327        pub unsafe fn setTitleColor(&self, new_color: Option<&NSColor>);
328
329        #[cfg(feature = "NSColor")]
330        #[deprecated = "-titleColor has returned nil since 10.0"]
331        #[unsafe(method(titleColor))]
332        #[unsafe(method_family = none)]
333        pub unsafe fn titleColor(&self) -> Option<Retained<NSColor>>;
334
335        #[cfg(feature = "NSFont")]
336        #[deprecated = "-setTitleFont: had no effect since 10.0"]
337        #[unsafe(method(setTitleFont:))]
338        #[unsafe(method_family = none)]
339        pub unsafe fn setTitleFont(&self, font_obj: Option<&NSFont>);
340
341        #[cfg(feature = "NSFont")]
342        #[deprecated = "-titleFont has returned nil since 10.0"]
343        #[unsafe(method(titleFont))]
344        #[unsafe(method_family = none)]
345        pub unsafe fn titleFont(&self) -> Option<Retained<NSFont>>;
346
347        #[deprecated = "-title has returned nil since 10.0"]
348        #[unsafe(method(title))]
349        #[unsafe(method_family = none)]
350        pub unsafe fn title(&self) -> Option<Retained<NSString>>;
351
352        #[deprecated = "-setTitle: had no effect since 10.0"]
353        #[unsafe(method(setTitle:))]
354        #[unsafe(method_family = none)]
355        pub unsafe fn setTitle(&self, string: Option<&NSString>);
356
357        #[cfg(feature = "objc2-core-foundation")]
358        #[deprecated = "-knobThickness has returned 0 since 10.0"]
359        #[unsafe(method(setKnobThickness:))]
360        #[unsafe(method_family = none)]
361        pub unsafe fn setKnobThickness(&self, thickness: CGFloat);
362
363        #[cfg(feature = "NSImage")]
364        #[deprecated = "-setImage: had no effect since 10.0"]
365        #[unsafe(method(setImage:))]
366        #[unsafe(method_family = none)]
367        pub unsafe fn setImage(&self, background_image: Option<&NSImage>);
368
369        #[cfg(feature = "NSImage")]
370        #[deprecated = "-image has returned nil since 10.0"]
371        #[unsafe(method(image))]
372        #[unsafe(method_family = none)]
373        pub unsafe fn image(&self) -> Option<Retained<NSImage>>;
374    );
375}