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