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 unsafe 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 unsafe fn setLevelIndicatorStyle(&self, level_indicator_style: NSLevelIndicatorStyle);
123
124        #[unsafe(method(isEditable))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn isEditable(&self) -> bool;
127
128        /// Setter for [`isEditable`][Self::isEditable].
129        #[unsafe(method(setEditable:))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn setEditable(&self, editable: bool);
132
133        #[unsafe(method(minValue))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn minValue(&self) -> c_double;
136
137        /// Setter for [`minValue`][Self::minValue].
138        #[unsafe(method(setMinValue:))]
139        #[unsafe(method_family = none)]
140        pub unsafe fn setMinValue(&self, min_value: c_double);
141
142        #[unsafe(method(maxValue))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn maxValue(&self) -> c_double;
145
146        /// Setter for [`maxValue`][Self::maxValue].
147        #[unsafe(method(setMaxValue:))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn setMaxValue(&self, max_value: c_double);
150
151        #[unsafe(method(warningValue))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn warningValue(&self) -> c_double;
154
155        /// Setter for [`warningValue`][Self::warningValue].
156        #[unsafe(method(setWarningValue:))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn setWarningValue(&self, warning_value: c_double);
159
160        #[unsafe(method(criticalValue))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn criticalValue(&self) -> c_double;
163
164        /// Setter for [`criticalValue`][Self::criticalValue].
165        #[unsafe(method(setCriticalValue:))]
166        #[unsafe(method_family = none)]
167        pub unsafe fn setCriticalValue(&self, critical_value: c_double);
168
169        #[cfg(feature = "NSSliderCell")]
170        #[unsafe(method(tickMarkPosition))]
171        #[unsafe(method_family = none)]
172        pub unsafe 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 unsafe fn setTickMarkPosition(&self, tick_mark_position: NSTickMarkPosition);
179
180        #[unsafe(method(numberOfTickMarks))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn numberOfTickMarks(&self) -> NSInteger;
183
184        /// Setter for [`numberOfTickMarks`][Self::numberOfTickMarks].
185        #[unsafe(method(setNumberOfTickMarks:))]
186        #[unsafe(method_family = none)]
187        pub unsafe fn setNumberOfTickMarks(&self, number_of_tick_marks: NSInteger);
188
189        #[unsafe(method(numberOfMajorTickMarks))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn numberOfMajorTickMarks(&self) -> NSInteger;
192
193        /// Setter for [`numberOfMajorTickMarks`][Self::numberOfMajorTickMarks].
194        #[unsafe(method(setNumberOfMajorTickMarks:))]
195        #[unsafe(method_family = none)]
196        pub unsafe fn setNumberOfMajorTickMarks(&self, number_of_major_tick_marks: NSInteger);
197
198        #[unsafe(method(tickMarkValueAtIndex:))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn tickMarkValueAtIndex(&self, index: NSInteger) -> c_double;
201
202        #[unsafe(method(rectOfTickMarkAtIndex:))]
203        #[unsafe(method_family = none)]
204        pub unsafe 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 unsafe fn fillColor(&self) -> Retained<NSColor>;
211
212        #[cfg(feature = "NSColor")]
213        /// Setter for [`fillColor`][Self::fillColor].
214        #[unsafe(method(setFillColor:))]
215        #[unsafe(method_family = none)]
216        pub unsafe fn setFillColor(&self, fill_color: Option<&NSColor>);
217
218        #[cfg(feature = "NSColor")]
219        /// 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.
220        #[unsafe(method(warningFillColor))]
221        #[unsafe(method_family = none)]
222        pub unsafe fn warningFillColor(&self) -> Retained<NSColor>;
223
224        #[cfg(feature = "NSColor")]
225        /// Setter for [`warningFillColor`][Self::warningFillColor].
226        #[unsafe(method(setWarningFillColor:))]
227        #[unsafe(method_family = none)]
228        pub unsafe fn setWarningFillColor(&self, warning_fill_color: Option<&NSColor>);
229
230        #[cfg(feature = "NSColor")]
231        /// 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.
232        #[unsafe(method(criticalFillColor))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn criticalFillColor(&self) -> Retained<NSColor>;
235
236        #[cfg(feature = "NSColor")]
237        /// Setter for [`criticalFillColor`][Self::criticalFillColor].
238        #[unsafe(method(setCriticalFillColor:))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn setCriticalFillColor(&self, critical_fill_color: Option<&NSColor>);
241
242        #[unsafe(method(drawsTieredCapacityLevels))]
243        #[unsafe(method_family = none)]
244        pub unsafe fn drawsTieredCapacityLevels(&self) -> bool;
245
246        /// Setter for [`drawsTieredCapacityLevels`][Self::drawsTieredCapacityLevels].
247        #[unsafe(method(setDrawsTieredCapacityLevels:))]
248        #[unsafe(method_family = none)]
249        pub unsafe fn setDrawsTieredCapacityLevels(&self, draws_tiered_capacity_levels: bool);
250
251        /// 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
252        /// `NSLevelIndicatorPlaceholderVisibilityAutomatic.`
253        #[unsafe(method(placeholderVisibility))]
254        #[unsafe(method_family = none)]
255        pub unsafe fn placeholderVisibility(&self) -> NSLevelIndicatorPlaceholderVisibility;
256
257        /// Setter for [`placeholderVisibility`][Self::placeholderVisibility].
258        #[unsafe(method(setPlaceholderVisibility:))]
259        #[unsafe(method_family = none)]
260        pub unsafe fn setPlaceholderVisibility(
261            &self,
262            placeholder_visibility: NSLevelIndicatorPlaceholderVisibility,
263        );
264
265        #[cfg(feature = "NSImage")]
266        /// If non-nil, sets the image used by the Rating indicator style in place of the default star image. The default value is nil.
267        #[unsafe(method(ratingImage))]
268        #[unsafe(method_family = none)]
269        pub unsafe fn ratingImage(&self) -> Option<Retained<NSImage>>;
270
271        #[cfg(feature = "NSImage")]
272        /// Setter for [`ratingImage`][Self::ratingImage].
273        #[unsafe(method(setRatingImage:))]
274        #[unsafe(method_family = none)]
275        pub unsafe fn setRatingImage(&self, rating_image: Option<&NSImage>);
276
277        #[cfg(feature = "NSImage")]
278        /// 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.
279        ///
280        /// If the custom placeholder is a template image, its fill opacity can be adjusted by modifying the opacity of the template image.
281        ///
282        /// 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).
283        #[unsafe(method(ratingPlaceholderImage))]
284        #[unsafe(method_family = none)]
285        pub unsafe fn ratingPlaceholderImage(&self) -> Option<Retained<NSImage>>;
286
287        #[cfg(feature = "NSImage")]
288        /// Setter for [`ratingPlaceholderImage`][Self::ratingPlaceholderImage].
289        #[unsafe(method(setRatingPlaceholderImage:))]
290        #[unsafe(method_family = none)]
291        pub unsafe fn setRatingPlaceholderImage(&self, rating_placeholder_image: Option<&NSImage>);
292    );
293}
294
295/// Methods declared on superclass `NSControl`.
296#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
297impl NSLevelIndicator {
298    extern_methods!(
299        #[unsafe(method(initWithFrame:))]
300        #[unsafe(method_family = init)]
301        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
302
303        #[unsafe(method(initWithCoder:))]
304        #[unsafe(method_family = init)]
305        pub unsafe fn initWithCoder(
306            this: Allocated<Self>,
307            coder: &NSCoder,
308        ) -> Option<Retained<Self>>;
309    );
310}
311
312/// Methods declared on superclass `NSResponder`.
313#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
314impl NSLevelIndicator {
315    extern_methods!(
316        #[unsafe(method(init))]
317        #[unsafe(method_family = init)]
318        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
319    );
320}
321
322/// Methods declared on superclass `NSObject`.
323#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
324impl NSLevelIndicator {
325    extern_methods!(
326        #[unsafe(method(new))]
327        #[unsafe(method_family = new)]
328        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
329    );
330}