objc2_app_kit/generated/
NSSliderCell.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/nstickmarkposition?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct NSTickMarkPosition(pub NSUInteger);
17impl NSTickMarkPosition {
18    #[doc(alias = "NSTickMarkPositionBelow")]
19    pub const Below: Self = Self(0);
20    #[doc(alias = "NSTickMarkPositionAbove")]
21    pub const Above: Self = Self(1);
22    #[doc(alias = "NSTickMarkPositionLeading")]
23    pub const Leading: Self = Self(NSTickMarkPosition::Above.0);
24    #[doc(alias = "NSTickMarkPositionTrailing")]
25    pub const Trailing: Self = Self(NSTickMarkPosition::Below.0);
26}
27
28unsafe impl Encode for NSTickMarkPosition {
29    const ENCODING: Encoding = NSUInteger::ENCODING;
30}
31
32unsafe impl RefEncode for NSTickMarkPosition {
33    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
34}
35
36/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsslidertype?language=objc)
37// NS_ENUM
38#[repr(transparent)]
39#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
40pub struct NSSliderType(pub NSUInteger);
41impl NSSliderType {
42    #[doc(alias = "NSSliderTypeLinear")]
43    pub const Linear: Self = Self(0);
44    #[doc(alias = "NSSliderTypeCircular")]
45    pub const Circular: Self = Self(1);
46}
47
48unsafe impl Encode for NSSliderType {
49    const ENCODING: Encoding = NSUInteger::ENCODING;
50}
51
52unsafe impl RefEncode for NSSliderType {
53    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
54}
55
56extern_class!(
57    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsslidercell?language=objc)
58    #[unsafe(super(NSActionCell, NSCell, NSObject))]
59    #[derive(Debug, PartialEq, Eq, Hash)]
60    #[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
61    pub struct NSSliderCell;
62);
63
64#[cfg(all(
65    feature = "NSAccessibilityProtocols",
66    feature = "NSActionCell",
67    feature = "NSCell"
68))]
69unsafe impl NSAccessibility for NSSliderCell {}
70
71#[cfg(all(
72    feature = "NSAccessibilityProtocols",
73    feature = "NSActionCell",
74    feature = "NSCell"
75))]
76unsafe impl NSAccessibilityElementProtocol for NSSliderCell {}
77
78#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
79unsafe impl NSCoding for NSSliderCell {}
80
81#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
82unsafe impl NSCopying for NSSliderCell {}
83
84#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
85unsafe impl CopyingHelper for NSSliderCell {
86    type Result = Self;
87}
88
89#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
90unsafe impl NSObjectProtocol for NSSliderCell {}
91
92#[cfg(all(
93    feature = "NSActionCell",
94    feature = "NSCell",
95    feature = "NSUserInterfaceItemIdentification"
96))]
97unsafe impl NSUserInterfaceItemIdentification for NSSliderCell {}
98
99#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
100impl NSSliderCell {
101    extern_methods!(
102        #[unsafe(method(prefersTrackingUntilMouseUp))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn prefersTrackingUntilMouseUp(mtm: MainThreadMarker) -> bool;
105
106        #[unsafe(method(minValue))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn minValue(&self) -> c_double;
109
110        /// Setter for [`minValue`][Self::minValue].
111        #[unsafe(method(setMinValue:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn setMinValue(&self, min_value: c_double);
114
115        #[unsafe(method(maxValue))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn maxValue(&self) -> c_double;
118
119        /// Setter for [`maxValue`][Self::maxValue].
120        #[unsafe(method(setMaxValue:))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn setMaxValue(&self, max_value: c_double);
123
124        #[unsafe(method(altIncrementValue))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn altIncrementValue(&self) -> c_double;
127
128        /// Setter for [`altIncrementValue`][Self::altIncrementValue].
129        #[unsafe(method(setAltIncrementValue:))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn setAltIncrementValue(&self, alt_increment_value: c_double);
132
133        #[unsafe(method(sliderType))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn sliderType(&self) -> NSSliderType;
136
137        /// Setter for [`sliderType`][Self::sliderType].
138        #[unsafe(method(setSliderType:))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn setSliderType(&self, slider_type: NSSliderType);
141
142        /// Setter for [`isVertical`][Self::isVertical].
143        #[unsafe(method(setVertical:))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn setVertical(&self, vertical: bool);
146
147        #[unsafe(method(trackRect))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn trackRect(&self) -> NSRect;
150
151        #[cfg(feature = "objc2-core-foundation")]
152        #[unsafe(method(knobThickness))]
153        #[unsafe(method_family = none)]
154        pub unsafe fn knobThickness(&self) -> CGFloat;
155
156        #[unsafe(method(knobRectFlipped:))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn knobRectFlipped(&self, flipped: bool) -> NSRect;
159
160        #[unsafe(method(barRectFlipped:))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn barRectFlipped(&self, flipped: bool) -> NSRect;
163
164        #[unsafe(method(drawKnob:))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn drawKnob_(&self, knob_rect: NSRect);
167
168        #[unsafe(method(drawKnob))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn drawKnob(&self);
171
172        #[unsafe(method(drawBarInside:flipped:))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn drawBarInside_flipped(&self, rect: NSRect, flipped: bool);
175    );
176}
177
178/// Methods declared on superclass `NSCell`.
179#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
180impl NSSliderCell {
181    extern_methods!(
182        #[unsafe(method(init))]
183        #[unsafe(method_family = init)]
184        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
185
186        #[unsafe(method(initTextCell:))]
187        #[unsafe(method_family = init)]
188        pub unsafe fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
189
190        #[cfg(feature = "NSImage")]
191        #[unsafe(method(initImageCell:))]
192        #[unsafe(method_family = init)]
193        pub unsafe fn initImageCell(
194            this: Allocated<Self>,
195            image: Option<&NSImage>,
196        ) -> Retained<Self>;
197
198        #[unsafe(method(initWithCoder:))]
199        #[unsafe(method_family = init)]
200        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
201    );
202}
203
204/// Methods declared on superclass `NSObject`.
205#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
206impl NSSliderCell {
207    extern_methods!(
208        #[unsafe(method(new))]
209        #[unsafe(method_family = new)]
210        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
211    );
212}
213
214/// NSSliderCellVerticalGetter.
215#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
216impl NSSliderCell {
217    extern_methods!();
218}
219
220/// NSTickMarkSupport.
221#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
222impl NSSliderCell {
223    extern_methods!(
224        #[unsafe(method(numberOfTickMarks))]
225        #[unsafe(method_family = none)]
226        pub unsafe fn numberOfTickMarks(&self) -> NSInteger;
227
228        /// Setter for [`numberOfTickMarks`][Self::numberOfTickMarks].
229        #[unsafe(method(setNumberOfTickMarks:))]
230        #[unsafe(method_family = none)]
231        pub unsafe fn setNumberOfTickMarks(&self, number_of_tick_marks: NSInteger);
232
233        #[unsafe(method(tickMarkPosition))]
234        #[unsafe(method_family = none)]
235        pub unsafe fn tickMarkPosition(&self) -> NSTickMarkPosition;
236
237        /// Setter for [`tickMarkPosition`][Self::tickMarkPosition].
238        #[unsafe(method(setTickMarkPosition:))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn setTickMarkPosition(&self, tick_mark_position: NSTickMarkPosition);
241
242        #[unsafe(method(allowsTickMarkValuesOnly))]
243        #[unsafe(method_family = none)]
244        pub unsafe fn allowsTickMarkValuesOnly(&self) -> bool;
245
246        /// Setter for [`allowsTickMarkValuesOnly`][Self::allowsTickMarkValuesOnly].
247        #[unsafe(method(setAllowsTickMarkValuesOnly:))]
248        #[unsafe(method_family = none)]
249        pub unsafe fn setAllowsTickMarkValuesOnly(&self, allows_tick_mark_values_only: bool);
250
251        #[unsafe(method(tickMarkValueAtIndex:))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn tickMarkValueAtIndex(&self, index: NSInteger) -> c_double;
254
255        #[unsafe(method(rectOfTickMarkAtIndex:))]
256        #[unsafe(method_family = none)]
257        pub unsafe fn rectOfTickMarkAtIndex(&self, index: NSInteger) -> NSRect;
258
259        #[unsafe(method(indexOfTickMarkAtPoint:))]
260        #[unsafe(method_family = none)]
261        pub unsafe fn indexOfTickMarkAtPoint(&self, point: NSPoint) -> NSInteger;
262
263        #[unsafe(method(closestTickMarkValueToValue:))]
264        #[unsafe(method_family = none)]
265        pub unsafe fn closestTickMarkValueToValue(&self, value: c_double) -> c_double;
266
267        #[unsafe(method(drawTickMarks))]
268        #[unsafe(method_family = none)]
269        pub unsafe fn drawTickMarks(&self);
270    );
271}
272
273/// NSDeprecated.
274#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
275impl NSSliderCell {
276    extern_methods!(
277        #[deprecated = "-setTitleCell: had no effect since 10.0"]
278        #[unsafe(method(setTitleCell:))]
279        #[unsafe(method_family = none)]
280        pub unsafe fn setTitleCell(&self, cell: Option<&NSCell>);
281
282        #[deprecated = "-titleCell has returned nil since 10.0"]
283        #[unsafe(method(titleCell))]
284        #[unsafe(method_family = none)]
285        pub unsafe fn titleCell(&self) -> Option<Retained<AnyObject>>;
286
287        #[cfg(feature = "NSColor")]
288        #[deprecated = "-setTitleColor: had no effect since 10.0"]
289        #[unsafe(method(setTitleColor:))]
290        #[unsafe(method_family = none)]
291        pub unsafe fn setTitleColor(&self, new_color: Option<&NSColor>);
292
293        #[cfg(feature = "NSColor")]
294        #[deprecated = "-titleColor has returned nil since 10.0"]
295        #[unsafe(method(titleColor))]
296        #[unsafe(method_family = none)]
297        pub unsafe fn titleColor(&self) -> Option<Retained<NSColor>>;
298
299        #[cfg(feature = "NSFont")]
300        #[deprecated = "-setTitleFont: had no effect since 10.0"]
301        #[unsafe(method(setTitleFont:))]
302        #[unsafe(method_family = none)]
303        pub unsafe fn setTitleFont(&self, font_obj: Option<&NSFont>);
304
305        #[cfg(feature = "NSFont")]
306        #[deprecated = "-titleFont has returned nil since 10.0"]
307        #[unsafe(method(titleFont))]
308        #[unsafe(method_family = none)]
309        pub unsafe fn titleFont(&self) -> Option<Retained<NSFont>>;
310
311        #[deprecated = "-title has returned nil since 10.0"]
312        #[unsafe(method(title))]
313        #[unsafe(method_family = none)]
314        pub unsafe fn title(&self) -> Option<Retained<NSString>>;
315
316        #[deprecated = "-setTitle: had no effect since 10.0"]
317        #[unsafe(method(setTitle:))]
318        #[unsafe(method_family = none)]
319        pub unsafe fn setTitle(&self, string: Option<&NSString>);
320
321        #[cfg(feature = "objc2-core-foundation")]
322        #[deprecated = "-knobThickness has returned 0 since 10.0"]
323        #[unsafe(method(setKnobThickness:))]
324        #[unsafe(method_family = none)]
325        pub unsafe fn setKnobThickness(&self, thickness: CGFloat);
326
327        #[cfg(feature = "NSImage")]
328        #[deprecated = "-setImage: had no effect since 10.0"]
329        #[unsafe(method(setImage:))]
330        #[unsafe(method_family = none)]
331        pub unsafe fn setImage(&self, background_image: Option<&NSImage>);
332
333        #[cfg(feature = "NSImage")]
334        #[deprecated = "-image has returned nil since 10.0"]
335        #[unsafe(method(image))]
336        #[unsafe(method_family = none)]
337        pub unsafe fn image(&self) -> Option<Retained<NSImage>>;
338    );
339}
340
341/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstickmarkbelow?language=objc)
342pub static NSTickMarkBelow: NSTickMarkPosition = NSTickMarkPosition(NSTickMarkPosition::Below.0);
343
344/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstickmarkabove?language=objc)
345pub static NSTickMarkAbove: NSTickMarkPosition = NSTickMarkPosition(NSTickMarkPosition::Above.0);
346
347/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstickmarkleft?language=objc)
348pub static NSTickMarkLeft: NSTickMarkPosition = NSTickMarkPosition(NSTickMarkPosition::Leading.0);
349
350/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstickmarkright?language=objc)
351pub static NSTickMarkRight: NSTickMarkPosition = NSTickMarkPosition(NSTickMarkPosition::Trailing.0);
352
353/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nslinearslider?language=objc)
354pub static NSLinearSlider: NSSliderType = NSSliderType(NSSliderType::Linear.0);
355
356/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nscircularslider?language=objc)
357pub static NSCircularSlider: NSSliderType = NSSliderType(NSSliderType::Circular.0);