objc2_ui_kit/generated/
UISlider.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#[cfg(feature = "objc2-quartz-core")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_quartz_core::*;
12
13use crate::*;
14
15/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uisliderstyle?language=objc)
16// NS_ENUM
17#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct UISliderStyle(pub NSInteger);
20impl UISliderStyle {
21    #[doc(alias = "UISliderStyleDefault")]
22    pub const Default: Self = Self(0);
23    #[doc(alias = "UISliderStyleThumbless")]
24    pub const Thumbless: Self = Self(1);
25}
26
27unsafe impl Encode for UISliderStyle {
28    const ENCODING: Encoding = NSInteger::ENCODING;
29}
30
31unsafe impl RefEncode for UISliderStyle {
32    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35extern_class!(
36    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uislider?language=objc)
37    #[unsafe(super(UIControl, UIView, UIResponder, NSObject))]
38    #[thread_kind = MainThreadOnly]
39    #[derive(Debug, PartialEq, Eq, Hash)]
40    #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
41    pub struct UISlider;
42);
43
44#[cfg(all(
45    feature = "UIControl",
46    feature = "UIResponder",
47    feature = "UIView",
48    feature = "objc2-quartz-core"
49))]
50#[cfg(not(target_os = "watchos"))]
51extern_conformance!(
52    unsafe impl CALayerDelegate for UISlider {}
53);
54
55#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
56extern_conformance!(
57    unsafe impl NSCoding for UISlider {}
58);
59
60#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
61extern_conformance!(
62    unsafe impl NSObjectProtocol for UISlider {}
63);
64
65#[cfg(all(
66    feature = "UIAppearance",
67    feature = "UIControl",
68    feature = "UIResponder",
69    feature = "UIView"
70))]
71extern_conformance!(
72    unsafe impl UIAppearance for UISlider {}
73);
74
75#[cfg(all(
76    feature = "UIAppearance",
77    feature = "UIControl",
78    feature = "UIResponder",
79    feature = "UIView"
80))]
81extern_conformance!(
82    unsafe impl UIAppearanceContainer for UISlider {}
83);
84
85#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
86extern_conformance!(
87    unsafe impl UICoordinateSpace for UISlider {}
88);
89
90#[cfg(all(
91    feature = "UIControl",
92    feature = "UIDynamicBehavior",
93    feature = "UIResponder",
94    feature = "UIView"
95))]
96extern_conformance!(
97    unsafe impl UIDynamicItem for UISlider {}
98);
99
100#[cfg(all(
101    feature = "UIControl",
102    feature = "UIFocus",
103    feature = "UIResponder",
104    feature = "UIView"
105))]
106extern_conformance!(
107    unsafe impl UIFocusEnvironment for UISlider {}
108);
109
110#[cfg(all(
111    feature = "UIControl",
112    feature = "UIFocus",
113    feature = "UIResponder",
114    feature = "UIView"
115))]
116extern_conformance!(
117    unsafe impl UIFocusItem for UISlider {}
118);
119
120#[cfg(all(
121    feature = "UIControl",
122    feature = "UIFocus",
123    feature = "UIResponder",
124    feature = "UIView"
125))]
126extern_conformance!(
127    unsafe impl UIFocusItemContainer for UISlider {}
128);
129
130#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
131extern_conformance!(
132    unsafe impl UIResponderStandardEditActions for UISlider {}
133);
134
135#[cfg(all(
136    feature = "UIControl",
137    feature = "UIResponder",
138    feature = "UITraitCollection",
139    feature = "UIView"
140))]
141extern_conformance!(
142    unsafe impl UITraitEnvironment for UISlider {}
143);
144
145#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
146impl UISlider {
147    extern_methods!(
148        #[unsafe(method(value))]
149        #[unsafe(method_family = none)]
150        pub fn value(&self) -> c_float;
151
152        /// Setter for [`value`][Self::value].
153        #[unsafe(method(setValue:))]
154        #[unsafe(method_family = none)]
155        pub fn setValue(&self, value: c_float);
156
157        #[unsafe(method(minimumValue))]
158        #[unsafe(method_family = none)]
159        pub fn minimumValue(&self) -> c_float;
160
161        /// Setter for [`minimumValue`][Self::minimumValue].
162        #[unsafe(method(setMinimumValue:))]
163        #[unsafe(method_family = none)]
164        pub fn setMinimumValue(&self, minimum_value: c_float);
165
166        #[unsafe(method(maximumValue))]
167        #[unsafe(method_family = none)]
168        pub fn maximumValue(&self) -> c_float;
169
170        /// Setter for [`maximumValue`][Self::maximumValue].
171        #[unsafe(method(setMaximumValue:))]
172        #[unsafe(method_family = none)]
173        pub fn setMaximumValue(&self, maximum_value: c_float);
174
175        #[cfg(feature = "UIImage")]
176        #[unsafe(method(minimumValueImage))]
177        #[unsafe(method_family = none)]
178        pub fn minimumValueImage(&self) -> Option<Retained<UIImage>>;
179
180        #[cfg(feature = "UIImage")]
181        /// Setter for [`minimumValueImage`][Self::minimumValueImage].
182        #[unsafe(method(setMinimumValueImage:))]
183        #[unsafe(method_family = none)]
184        pub fn setMinimumValueImage(&self, minimum_value_image: Option<&UIImage>);
185
186        #[cfg(feature = "UIImage")]
187        #[unsafe(method(maximumValueImage))]
188        #[unsafe(method_family = none)]
189        pub fn maximumValueImage(&self) -> Option<Retained<UIImage>>;
190
191        #[cfg(feature = "UIImage")]
192        /// Setter for [`maximumValueImage`][Self::maximumValueImage].
193        #[unsafe(method(setMaximumValueImage:))]
194        #[unsafe(method_family = none)]
195        pub fn setMaximumValueImage(&self, maximum_value_image: Option<&UIImage>);
196
197        #[unsafe(method(isContinuous))]
198        #[unsafe(method_family = none)]
199        pub fn isContinuous(&self) -> bool;
200
201        /// Setter for [`isContinuous`][Self::isContinuous].
202        #[unsafe(method(setContinuous:))]
203        #[unsafe(method_family = none)]
204        pub fn setContinuous(&self, continuous: bool);
205
206        #[cfg(feature = "UISliderTrackConfiguration")]
207        #[unsafe(method(trackConfiguration))]
208        #[unsafe(method_family = none)]
209        pub fn trackConfiguration(&self) -> Option<Retained<UISliderTrackConfiguration>>;
210
211        #[cfg(feature = "UISliderTrackConfiguration")]
212        /// Setter for [`trackConfiguration`][Self::trackConfiguration].
213        ///
214        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
215        #[unsafe(method(setTrackConfiguration:))]
216        #[unsafe(method_family = none)]
217        pub fn setTrackConfiguration(
218            &self,
219            track_configuration: Option<&UISliderTrackConfiguration>,
220        );
221
222        #[unsafe(method(sliderStyle))]
223        #[unsafe(method_family = none)]
224        pub fn sliderStyle(&self) -> UISliderStyle;
225
226        /// Setter for [`sliderStyle`][Self::sliderStyle].
227        #[unsafe(method(setSliderStyle:))]
228        #[unsafe(method_family = none)]
229        pub fn setSliderStyle(&self, slider_style: UISliderStyle);
230
231        #[cfg(feature = "UIColor")]
232        #[unsafe(method(minimumTrackTintColor))]
233        #[unsafe(method_family = none)]
234        pub fn minimumTrackTintColor(&self) -> Option<Retained<UIColor>>;
235
236        #[cfg(feature = "UIColor")]
237        /// Setter for [`minimumTrackTintColor`][Self::minimumTrackTintColor].
238        #[unsafe(method(setMinimumTrackTintColor:))]
239        #[unsafe(method_family = none)]
240        pub fn setMinimumTrackTintColor(&self, minimum_track_tint_color: Option<&UIColor>);
241
242        #[cfg(feature = "UIColor")]
243        #[unsafe(method(maximumTrackTintColor))]
244        #[unsafe(method_family = none)]
245        pub fn maximumTrackTintColor(&self) -> Option<Retained<UIColor>>;
246
247        #[cfg(feature = "UIColor")]
248        /// Setter for [`maximumTrackTintColor`][Self::maximumTrackTintColor].
249        #[unsafe(method(setMaximumTrackTintColor:))]
250        #[unsafe(method_family = none)]
251        pub fn setMaximumTrackTintColor(&self, maximum_track_tint_color: Option<&UIColor>);
252
253        #[cfg(feature = "UIColor")]
254        #[unsafe(method(thumbTintColor))]
255        #[unsafe(method_family = none)]
256        pub fn thumbTintColor(&self) -> Option<Retained<UIColor>>;
257
258        #[cfg(feature = "UIColor")]
259        /// Setter for [`thumbTintColor`][Self::thumbTintColor].
260        #[unsafe(method(setThumbTintColor:))]
261        #[unsafe(method_family = none)]
262        pub fn setThumbTintColor(&self, thumb_tint_color: Option<&UIColor>);
263
264        #[unsafe(method(setValue:animated:))]
265        #[unsafe(method_family = none)]
266        pub fn setValue_animated(&self, value: c_float, animated: bool);
267
268        #[cfg(feature = "UIImage")]
269        #[unsafe(method(setThumbImage:forState:))]
270        #[unsafe(method_family = none)]
271        pub fn setThumbImage_forState(&self, image: Option<&UIImage>, state: UIControlState);
272
273        #[cfg(feature = "UIImage")]
274        #[unsafe(method(setMinimumTrackImage:forState:))]
275        #[unsafe(method_family = none)]
276        pub fn setMinimumTrackImage_forState(&self, image: Option<&UIImage>, state: UIControlState);
277
278        #[cfg(feature = "UIImage")]
279        #[unsafe(method(setMaximumTrackImage:forState:))]
280        #[unsafe(method_family = none)]
281        pub fn setMaximumTrackImage_forState(&self, image: Option<&UIImage>, state: UIControlState);
282
283        #[cfg(feature = "UIImage")]
284        #[unsafe(method(thumbImageForState:))]
285        #[unsafe(method_family = none)]
286        pub fn thumbImageForState(&self, state: UIControlState) -> Option<Retained<UIImage>>;
287
288        #[cfg(feature = "UIImage")]
289        #[unsafe(method(minimumTrackImageForState:))]
290        #[unsafe(method_family = none)]
291        pub fn minimumTrackImageForState(&self, state: UIControlState)
292            -> Option<Retained<UIImage>>;
293
294        #[cfg(feature = "UIImage")]
295        #[unsafe(method(maximumTrackImageForState:))]
296        #[unsafe(method_family = none)]
297        pub fn maximumTrackImageForState(&self, state: UIControlState)
298            -> Option<Retained<UIImage>>;
299
300        #[cfg(feature = "UIImage")]
301        #[unsafe(method(currentThumbImage))]
302        #[unsafe(method_family = none)]
303        pub fn currentThumbImage(&self) -> Option<Retained<UIImage>>;
304
305        #[cfg(feature = "UIImage")]
306        #[unsafe(method(currentMinimumTrackImage))]
307        #[unsafe(method_family = none)]
308        pub fn currentMinimumTrackImage(&self) -> Option<Retained<UIImage>>;
309
310        #[cfg(feature = "UIImage")]
311        #[unsafe(method(currentMaximumTrackImage))]
312        #[unsafe(method_family = none)]
313        pub fn currentMaximumTrackImage(&self) -> Option<Retained<UIImage>>;
314
315        #[cfg(feature = "objc2-core-foundation")]
316        #[unsafe(method(minimumValueImageRectForBounds:))]
317        #[unsafe(method_family = none)]
318        pub fn minimumValueImageRectForBounds(&self, bounds: CGRect) -> CGRect;
319
320        #[cfg(feature = "objc2-core-foundation")]
321        #[unsafe(method(maximumValueImageRectForBounds:))]
322        #[unsafe(method_family = none)]
323        pub fn maximumValueImageRectForBounds(&self, bounds: CGRect) -> CGRect;
324
325        #[cfg(feature = "objc2-core-foundation")]
326        #[unsafe(method(trackRectForBounds:))]
327        #[unsafe(method_family = none)]
328        pub fn trackRectForBounds(&self, bounds: CGRect) -> CGRect;
329
330        #[cfg(feature = "objc2-core-foundation")]
331        #[unsafe(method(thumbRectForBounds:trackRect:value:))]
332        #[unsafe(method_family = none)]
333        pub fn thumbRectForBounds_trackRect_value(
334            &self,
335            bounds: CGRect,
336            rect: CGRect,
337            value: c_float,
338        ) -> CGRect;
339    );
340}
341
342/// Methods declared on superclass `UIControl`.
343#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
344impl UISlider {
345    extern_methods!(
346        #[cfg(feature = "objc2-core-foundation")]
347        #[unsafe(method(initWithFrame:))]
348        #[unsafe(method_family = init)]
349        pub fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
350
351        /// # Safety
352        ///
353        /// `coder` possibly has further requirements.
354        #[unsafe(method(initWithCoder:))]
355        #[unsafe(method_family = init)]
356        pub unsafe fn initWithCoder(
357            this: Allocated<Self>,
358            coder: &NSCoder,
359        ) -> Option<Retained<Self>>;
360
361        #[cfg(all(
362            feature = "UIAction",
363            feature = "UIMenuElement",
364            feature = "objc2-core-foundation"
365        ))]
366        /// Initializes the control and adds primaryAction for the UIControlEventPrimaryActionTriggered control event. Subclasses of UIControl may alter or add behaviors around the usage of primaryAction, see subclass documentation of this initializer for additional information.
367        #[unsafe(method(initWithFrame:primaryAction:))]
368        #[unsafe(method_family = init)]
369        pub fn initWithFrame_primaryAction(
370            this: Allocated<Self>,
371            frame: CGRect,
372            primary_action: Option<&UIAction>,
373        ) -> Retained<Self>;
374    );
375}
376
377/// Methods declared on superclass `UIView`.
378#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
379impl UISlider {
380    extern_methods!(
381        #[unsafe(method(init))]
382        #[unsafe(method_family = init)]
383        pub fn init(this: Allocated<Self>) -> Retained<Self>;
384    );
385}
386
387/// Methods declared on superclass `NSObject`.
388#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
389impl UISlider {
390    extern_methods!(
391        #[unsafe(method(new))]
392        #[unsafe(method_family = new)]
393        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
394    );
395}