objc2_app_kit/generated/
NSLevelIndicator.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nslevelindicatorplaceholdervisibility?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSLevelIndicatorPlaceholderVisibility(pub NSInteger);
15impl NSLevelIndicatorPlaceholderVisibility {
16    #[doc(alias = "NSLevelIndicatorPlaceholderVisibilityAutomatic")]
17    pub const Automatic: Self = Self(0);
18    #[doc(alias = "NSLevelIndicatorPlaceholderVisibilityAlways")]
19    pub const Always: Self = Self(1);
20    #[doc(alias = "NSLevelIndicatorPlaceholderVisibilityWhileEditing")]
21    pub const WhileEditing: Self = Self(2);
22}
23
24unsafe impl Encode for NSLevelIndicatorPlaceholderVisibility {
25    const ENCODING: Encoding = NSInteger::ENCODING;
26}
27
28unsafe impl RefEncode for NSLevelIndicatorPlaceholderVisibility {
29    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32extern_class!(
33    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nslevelindicator?language=objc)
34    #[unsafe(super(NSControl, NSView, NSResponder, NSObject))]
35    #[derive(Debug, PartialEq, Eq, Hash)]
36    #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
37    pub struct NSLevelIndicator;
38);
39
40#[cfg(all(
41    feature = "NSAccessibilityProtocols",
42    feature = "NSControl",
43    feature = "NSResponder",
44    feature = "NSView"
45))]
46extern_conformance!(
47    unsafe impl NSAccessibility for NSLevelIndicator {}
48);
49
50#[cfg(all(
51    feature = "NSAccessibilityProtocols",
52    feature = "NSControl",
53    feature = "NSResponder",
54    feature = "NSView"
55))]
56extern_conformance!(
57    unsafe impl NSAccessibilityElementProtocol for NSLevelIndicator {}
58);
59
60#[cfg(all(
61    feature = "NSAnimation",
62    feature = "NSControl",
63    feature = "NSResponder",
64    feature = "NSView"
65))]
66extern_conformance!(
67    unsafe impl NSAnimatablePropertyContainer for NSLevelIndicator {}
68);
69
70#[cfg(all(
71    feature = "NSAppearance",
72    feature = "NSControl",
73    feature = "NSResponder",
74    feature = "NSView"
75))]
76extern_conformance!(
77    unsafe impl NSAppearanceCustomization for NSLevelIndicator {}
78);
79
80#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
81extern_conformance!(
82    unsafe impl NSCoding for NSLevelIndicator {}
83);
84
85#[cfg(all(
86    feature = "NSControl",
87    feature = "NSDragging",
88    feature = "NSResponder",
89    feature = "NSView"
90))]
91extern_conformance!(
92    unsafe impl NSDraggingDestination for NSLevelIndicator {}
93);
94
95#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
96extern_conformance!(
97    unsafe impl NSObjectProtocol for NSLevelIndicator {}
98);
99
100#[cfg(all(
101    feature = "NSControl",
102    feature = "NSResponder",
103    feature = "NSUserInterfaceItemIdentification",
104    feature = "NSView"
105))]
106extern_conformance!(
107    unsafe impl NSUserInterfaceItemIdentification for NSLevelIndicator {}
108);
109
110#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
111impl NSLevelIndicator {
112    extern_methods!(
113        #[cfg(feature = "NSLevelIndicatorCell")]
114        #[unsafe(method(levelIndicatorStyle))]
115        #[unsafe(method_family = none)]
116        pub fn levelIndicatorStyle(&self) -> NSLevelIndicatorStyle;
117
118        #[cfg(feature = "NSLevelIndicatorCell")]
119        /// Setter for [`levelIndicatorStyle`][Self::levelIndicatorStyle].
120        #[unsafe(method(setLevelIndicatorStyle:))]
121        #[unsafe(method_family = none)]
122        pub fn setLevelIndicatorStyle(&self, level_indicator_style: NSLevelIndicatorStyle);
123
124        #[unsafe(method(isEditable))]
125        #[unsafe(method_family = none)]
126        pub fn isEditable(&self) -> bool;
127
128        /// Setter for [`isEditable`][Self::isEditable].
129        #[unsafe(method(setEditable:))]
130        #[unsafe(method_family = none)]
131        pub fn setEditable(&self, editable: bool);
132
133        #[unsafe(method(minValue))]
134        #[unsafe(method_family = none)]
135        pub fn minValue(&self) -> c_double;
136
137        /// Setter for [`minValue`][Self::minValue].
138        #[unsafe(method(setMinValue:))]
139        #[unsafe(method_family = none)]
140        pub fn setMinValue(&self, min_value: c_double);
141
142        #[unsafe(method(maxValue))]
143        #[unsafe(method_family = none)]
144        pub fn maxValue(&self) -> c_double;
145
146        /// Setter for [`maxValue`][Self::maxValue].
147        #[unsafe(method(setMaxValue:))]
148        #[unsafe(method_family = none)]
149        pub fn setMaxValue(&self, max_value: c_double);
150
151        #[unsafe(method(warningValue))]
152        #[unsafe(method_family = none)]
153        pub fn warningValue(&self) -> c_double;
154
155        /// Setter for [`warningValue`][Self::warningValue].
156        #[unsafe(method(setWarningValue:))]
157        #[unsafe(method_family = none)]
158        pub fn setWarningValue(&self, warning_value: c_double);
159
160        #[unsafe(method(criticalValue))]
161        #[unsafe(method_family = none)]
162        pub fn criticalValue(&self) -> c_double;
163
164        /// Setter for [`criticalValue`][Self::criticalValue].
165        #[unsafe(method(setCriticalValue:))]
166        #[unsafe(method_family = none)]
167        pub fn setCriticalValue(&self, critical_value: c_double);
168
169        #[cfg(feature = "NSSliderCell")]
170        #[unsafe(method(tickMarkPosition))]
171        #[unsafe(method_family = none)]
172        pub fn tickMarkPosition(&self) -> NSTickMarkPosition;
173
174        #[cfg(feature = "NSSliderCell")]
175        /// Setter for [`tickMarkPosition`][Self::tickMarkPosition].
176        #[unsafe(method(setTickMarkPosition:))]
177        #[unsafe(method_family = none)]
178        pub fn setTickMarkPosition(&self, tick_mark_position: NSTickMarkPosition);
179
180        #[unsafe(method(numberOfTickMarks))]
181        #[unsafe(method_family = none)]
182        pub fn numberOfTickMarks(&self) -> NSInteger;
183
184        /// Setter for [`numberOfTickMarks`][Self::numberOfTickMarks].
185        #[unsafe(method(setNumberOfTickMarks:))]
186        #[unsafe(method_family = none)]
187        pub fn setNumberOfTickMarks(&self, number_of_tick_marks: NSInteger);
188
189        #[unsafe(method(numberOfMajorTickMarks))]
190        #[unsafe(method_family = none)]
191        pub fn numberOfMajorTickMarks(&self) -> NSInteger;
192
193        /// Setter for [`numberOfMajorTickMarks`][Self::numberOfMajorTickMarks].
194        #[unsafe(method(setNumberOfMajorTickMarks:))]
195        #[unsafe(method_family = none)]
196        pub fn setNumberOfMajorTickMarks(&self, number_of_major_tick_marks: NSInteger);
197
198        #[unsafe(method(tickMarkValueAtIndex:))]
199        #[unsafe(method_family = none)]
200        pub fn tickMarkValueAtIndex(&self, index: NSInteger) -> c_double;
201
202        #[unsafe(method(rectOfTickMarkAtIndex:))]
203        #[unsafe(method_family = none)]
204        pub fn rectOfTickMarkAtIndex(&self, index: NSInteger) -> NSRect;
205
206        #[cfg(feature = "NSColor")]
207        /// Sets the fill color used by Continuous and Discrete Capacity indicators when drawing the "normal" state, and by the Rating indicator when drawing stars. The default value is a system-defined color which may vary between level indicator styles and OS releases.
208        #[unsafe(method(fillColor))]
209        #[unsafe(method_family = none)]
210        pub fn fillColor(&self) -> Retained<NSColor>;
211
212        #[cfg(feature = "NSColor")]
213        /// Setter for [`fillColor`][Self::fillColor].
214        ///
215        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
216        #[unsafe(method(setFillColor:))]
217        #[unsafe(method_family = none)]
218        pub fn setFillColor(&self, fill_color: Option<&NSColor>);
219
220        #[cfg(feature = "NSColor")]
221        /// Sets the fill color used by Continuous and Discrete Capacity indicators when drawing values above the "warning" threshold. The default value is a system-defined color which may vary between level indicator styles and OS releases.
222        #[unsafe(method(warningFillColor))]
223        #[unsafe(method_family = none)]
224        pub fn warningFillColor(&self) -> Retained<NSColor>;
225
226        #[cfg(feature = "NSColor")]
227        /// Setter for [`warningFillColor`][Self::warningFillColor].
228        ///
229        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
230        #[unsafe(method(setWarningFillColor:))]
231        #[unsafe(method_family = none)]
232        pub fn setWarningFillColor(&self, warning_fill_color: Option<&NSColor>);
233
234        #[cfg(feature = "NSColor")]
235        /// Sets the fill color used by Continuous and Discrete Capacity indicators when drawing values above the "critical" threshold. The default value is a system-defined color which may vary between level indicator styles and OS releases.
236        #[unsafe(method(criticalFillColor))]
237        #[unsafe(method_family = none)]
238        pub fn criticalFillColor(&self) -> Retained<NSColor>;
239
240        #[cfg(feature = "NSColor")]
241        /// Setter for [`criticalFillColor`][Self::criticalFillColor].
242        ///
243        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
244        #[unsafe(method(setCriticalFillColor:))]
245        #[unsafe(method_family = none)]
246        pub fn setCriticalFillColor(&self, critical_fill_color: Option<&NSColor>);
247
248        #[unsafe(method(drawsTieredCapacityLevels))]
249        #[unsafe(method_family = none)]
250        pub fn drawsTieredCapacityLevels(&self) -> bool;
251
252        /// Setter for [`drawsTieredCapacityLevels`][Self::drawsTieredCapacityLevels].
253        #[unsafe(method(setDrawsTieredCapacityLevels:))]
254        #[unsafe(method_family = none)]
255        pub fn setDrawsTieredCapacityLevels(&self, draws_tiered_capacity_levels: bool);
256
257        /// For a Rating-style indicator, sets the conditions under which Rating placeholders are displayed. This property currently has no effect for other indicator styles. The default value is
258        /// `NSLevelIndicatorPlaceholderVisibilityAutomatic.`
259        #[unsafe(method(placeholderVisibility))]
260        #[unsafe(method_family = none)]
261        pub fn placeholderVisibility(&self) -> NSLevelIndicatorPlaceholderVisibility;
262
263        /// Setter for [`placeholderVisibility`][Self::placeholderVisibility].
264        #[unsafe(method(setPlaceholderVisibility:))]
265        #[unsafe(method_family = none)]
266        pub fn setPlaceholderVisibility(
267            &self,
268            placeholder_visibility: NSLevelIndicatorPlaceholderVisibility,
269        );
270
271        #[cfg(feature = "NSImage")]
272        /// If non-nil, sets the image used by the Rating indicator style in place of the default star image. The default value is nil.
273        #[unsafe(method(ratingImage))]
274        #[unsafe(method_family = none)]
275        pub fn ratingImage(&self) -> Option<Retained<NSImage>>;
276
277        #[cfg(feature = "NSImage")]
278        /// Setter for [`ratingImage`][Self::ratingImage].
279        #[unsafe(method(setRatingImage:))]
280        #[unsafe(method_family = none)]
281        pub fn setRatingImage(&self, rating_image: Option<&NSImage>);
282
283        #[cfg(feature = "NSImage")]
284        /// If non-nil, sets the image used by the Rating indicator style in place of the default faded placeholder image. The default value is nil.
285        ///
286        /// If the custom placeholder is a template image, its fill opacity can be adjusted by modifying the opacity of the template image.
287        ///
288        /// If both a ratingImage and ratingPlaceholderImage are set, each rating position is sized such that either image will fit without scaling (i.e. sized to the maximum width and height of both images).
289        #[unsafe(method(ratingPlaceholderImage))]
290        #[unsafe(method_family = none)]
291        pub fn ratingPlaceholderImage(&self) -> Option<Retained<NSImage>>;
292
293        #[cfg(feature = "NSImage")]
294        /// Setter for [`ratingPlaceholderImage`][Self::ratingPlaceholderImage].
295        #[unsafe(method(setRatingPlaceholderImage:))]
296        #[unsafe(method_family = none)]
297        pub fn setRatingPlaceholderImage(&self, rating_placeholder_image: Option<&NSImage>);
298    );
299}
300
301/// Methods declared on superclass `NSControl`.
302#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
303impl NSLevelIndicator {
304    extern_methods!(
305        #[unsafe(method(initWithFrame:))]
306        #[unsafe(method_family = init)]
307        pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
308
309        /// # Safety
310        ///
311        /// `coder` possibly has further requirements.
312        #[unsafe(method(initWithCoder:))]
313        #[unsafe(method_family = init)]
314        pub unsafe fn initWithCoder(
315            this: Allocated<Self>,
316            coder: &NSCoder,
317        ) -> Option<Retained<Self>>;
318    );
319}
320
321/// Methods declared on superclass `NSResponder`.
322#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
323impl NSLevelIndicator {
324    extern_methods!(
325        #[unsafe(method(init))]
326        #[unsafe(method_family = init)]
327        pub fn init(this: Allocated<Self>) -> Retained<Self>;
328    );
329}
330
331/// Methods declared on superclass `NSObject`.
332#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
333impl NSLevelIndicator {
334    extern_methods!(
335        #[unsafe(method(new))]
336        #[unsafe(method_family = new)]
337        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
338    );
339}