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))]
46unsafe impl NSAccessibility for NSLevelIndicator {}
47
48#[cfg(all(
49    feature = "NSAccessibilityProtocols",
50    feature = "NSControl",
51    feature = "NSResponder",
52    feature = "NSView"
53))]
54unsafe impl NSAccessibilityElementProtocol for NSLevelIndicator {}
55
56#[cfg(all(
57    feature = "NSAnimation",
58    feature = "NSControl",
59    feature = "NSResponder",
60    feature = "NSView"
61))]
62unsafe impl NSAnimatablePropertyContainer for NSLevelIndicator {}
63
64#[cfg(all(
65    feature = "NSAppearance",
66    feature = "NSControl",
67    feature = "NSResponder",
68    feature = "NSView"
69))]
70unsafe impl NSAppearanceCustomization for NSLevelIndicator {}
71
72#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
73unsafe impl NSCoding for NSLevelIndicator {}
74
75#[cfg(all(
76    feature = "NSControl",
77    feature = "NSDragging",
78    feature = "NSResponder",
79    feature = "NSView"
80))]
81unsafe impl NSDraggingDestination for NSLevelIndicator {}
82
83#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
84unsafe impl NSObjectProtocol for NSLevelIndicator {}
85
86#[cfg(all(
87    feature = "NSControl",
88    feature = "NSResponder",
89    feature = "NSUserInterfaceItemIdentification",
90    feature = "NSView"
91))]
92unsafe impl NSUserInterfaceItemIdentification for NSLevelIndicator {}
93
94#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
95impl NSLevelIndicator {
96    extern_methods!(
97        #[cfg(feature = "NSLevelIndicatorCell")]
98        #[unsafe(method(levelIndicatorStyle))]
99        #[unsafe(method_family = none)]
100        pub unsafe fn levelIndicatorStyle(&self) -> NSLevelIndicatorStyle;
101
102        #[cfg(feature = "NSLevelIndicatorCell")]
103        /// Setter for [`levelIndicatorStyle`][Self::levelIndicatorStyle].
104        #[unsafe(method(setLevelIndicatorStyle:))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn setLevelIndicatorStyle(&self, level_indicator_style: NSLevelIndicatorStyle);
107
108        #[unsafe(method(isEditable))]
109        #[unsafe(method_family = none)]
110        pub unsafe fn isEditable(&self) -> bool;
111
112        /// Setter for [`isEditable`][Self::isEditable].
113        #[unsafe(method(setEditable:))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn setEditable(&self, editable: bool);
116
117        #[unsafe(method(minValue))]
118        #[unsafe(method_family = none)]
119        pub unsafe fn minValue(&self) -> c_double;
120
121        /// Setter for [`minValue`][Self::minValue].
122        #[unsafe(method(setMinValue:))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn setMinValue(&self, min_value: c_double);
125
126        #[unsafe(method(maxValue))]
127        #[unsafe(method_family = none)]
128        pub unsafe fn maxValue(&self) -> c_double;
129
130        /// Setter for [`maxValue`][Self::maxValue].
131        #[unsafe(method(setMaxValue:))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn setMaxValue(&self, max_value: c_double);
134
135        #[unsafe(method(warningValue))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn warningValue(&self) -> c_double;
138
139        /// Setter for [`warningValue`][Self::warningValue].
140        #[unsafe(method(setWarningValue:))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn setWarningValue(&self, warning_value: c_double);
143
144        #[unsafe(method(criticalValue))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn criticalValue(&self) -> c_double;
147
148        /// Setter for [`criticalValue`][Self::criticalValue].
149        #[unsafe(method(setCriticalValue:))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn setCriticalValue(&self, critical_value: c_double);
152
153        #[cfg(feature = "NSSliderCell")]
154        #[unsafe(method(tickMarkPosition))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn tickMarkPosition(&self) -> NSTickMarkPosition;
157
158        #[cfg(feature = "NSSliderCell")]
159        /// Setter for [`tickMarkPosition`][Self::tickMarkPosition].
160        #[unsafe(method(setTickMarkPosition:))]
161        #[unsafe(method_family = none)]
162        pub unsafe fn setTickMarkPosition(&self, tick_mark_position: NSTickMarkPosition);
163
164        #[unsafe(method(numberOfTickMarks))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn numberOfTickMarks(&self) -> NSInteger;
167
168        /// Setter for [`numberOfTickMarks`][Self::numberOfTickMarks].
169        #[unsafe(method(setNumberOfTickMarks:))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn setNumberOfTickMarks(&self, number_of_tick_marks: NSInteger);
172
173        #[unsafe(method(numberOfMajorTickMarks))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn numberOfMajorTickMarks(&self) -> NSInteger;
176
177        /// Setter for [`numberOfMajorTickMarks`][Self::numberOfMajorTickMarks].
178        #[unsafe(method(setNumberOfMajorTickMarks:))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn setNumberOfMajorTickMarks(&self, number_of_major_tick_marks: NSInteger);
181
182        #[unsafe(method(tickMarkValueAtIndex:))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn tickMarkValueAtIndex(&self, index: NSInteger) -> c_double;
185
186        #[unsafe(method(rectOfTickMarkAtIndex:))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn rectOfTickMarkAtIndex(&self, index: NSInteger) -> NSRect;
189
190        #[cfg(feature = "NSColor")]
191        /// 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.
192        #[unsafe(method(fillColor))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn fillColor(&self) -> Retained<NSColor>;
195
196        #[cfg(feature = "NSColor")]
197        /// Setter for [`fillColor`][Self::fillColor].
198        #[unsafe(method(setFillColor:))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn setFillColor(&self, fill_color: Option<&NSColor>);
201
202        #[cfg(feature = "NSColor")]
203        /// 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.
204        #[unsafe(method(warningFillColor))]
205        #[unsafe(method_family = none)]
206        pub unsafe fn warningFillColor(&self) -> Retained<NSColor>;
207
208        #[cfg(feature = "NSColor")]
209        /// Setter for [`warningFillColor`][Self::warningFillColor].
210        #[unsafe(method(setWarningFillColor:))]
211        #[unsafe(method_family = none)]
212        pub unsafe fn setWarningFillColor(&self, warning_fill_color: Option<&NSColor>);
213
214        #[cfg(feature = "NSColor")]
215        /// 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.
216        #[unsafe(method(criticalFillColor))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn criticalFillColor(&self) -> Retained<NSColor>;
219
220        #[cfg(feature = "NSColor")]
221        /// Setter for [`criticalFillColor`][Self::criticalFillColor].
222        #[unsafe(method(setCriticalFillColor:))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn setCriticalFillColor(&self, critical_fill_color: Option<&NSColor>);
225
226        #[unsafe(method(drawsTieredCapacityLevels))]
227        #[unsafe(method_family = none)]
228        pub unsafe fn drawsTieredCapacityLevels(&self) -> bool;
229
230        /// Setter for [`drawsTieredCapacityLevels`][Self::drawsTieredCapacityLevels].
231        #[unsafe(method(setDrawsTieredCapacityLevels:))]
232        #[unsafe(method_family = none)]
233        pub unsafe fn setDrawsTieredCapacityLevels(&self, draws_tiered_capacity_levels: bool);
234
235        /// 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
236        /// `NSLevelIndicatorPlaceholderVisibilityAutomatic.`
237        #[unsafe(method(placeholderVisibility))]
238        #[unsafe(method_family = none)]
239        pub unsafe fn placeholderVisibility(&self) -> NSLevelIndicatorPlaceholderVisibility;
240
241        /// Setter for [`placeholderVisibility`][Self::placeholderVisibility].
242        #[unsafe(method(setPlaceholderVisibility:))]
243        #[unsafe(method_family = none)]
244        pub unsafe fn setPlaceholderVisibility(
245            &self,
246            placeholder_visibility: NSLevelIndicatorPlaceholderVisibility,
247        );
248
249        #[cfg(feature = "NSImage")]
250        /// If non-nil, sets the image used by the Rating indicator style in place of the default star image. The default value is nil.
251        #[unsafe(method(ratingImage))]
252        #[unsafe(method_family = none)]
253        pub unsafe fn ratingImage(&self) -> Option<Retained<NSImage>>;
254
255        #[cfg(feature = "NSImage")]
256        /// Setter for [`ratingImage`][Self::ratingImage].
257        #[unsafe(method(setRatingImage:))]
258        #[unsafe(method_family = none)]
259        pub unsafe fn setRatingImage(&self, rating_image: Option<&NSImage>);
260
261        #[cfg(feature = "NSImage")]
262        /// 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.
263        ///
264        /// If the custom placeholder is a template image, its fill opacity can be adjusted by modifying the opacity of the template image.
265        ///
266        /// 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).
267        #[unsafe(method(ratingPlaceholderImage))]
268        #[unsafe(method_family = none)]
269        pub unsafe fn ratingPlaceholderImage(&self) -> Option<Retained<NSImage>>;
270
271        #[cfg(feature = "NSImage")]
272        /// Setter for [`ratingPlaceholderImage`][Self::ratingPlaceholderImage].
273        #[unsafe(method(setRatingPlaceholderImage:))]
274        #[unsafe(method_family = none)]
275        pub unsafe fn setRatingPlaceholderImage(&self, rating_placeholder_image: Option<&NSImage>);
276    );
277}
278
279/// Methods declared on superclass `NSControl`.
280#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
281impl NSLevelIndicator {
282    extern_methods!(
283        #[unsafe(method(initWithFrame:))]
284        #[unsafe(method_family = init)]
285        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
286
287        #[unsafe(method(initWithCoder:))]
288        #[unsafe(method_family = init)]
289        pub unsafe fn initWithCoder(
290            this: Allocated<Self>,
291            coder: &NSCoder,
292        ) -> Option<Retained<Self>>;
293    );
294}
295
296/// Methods declared on superclass `NSResponder`.
297#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
298impl NSLevelIndicator {
299    extern_methods!(
300        #[unsafe(method(init))]
301        #[unsafe(method_family = init)]
302        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
303    );
304}
305
306/// Methods declared on superclass `NSObject`.
307#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
308impl NSLevelIndicator {
309    extern_methods!(
310        #[unsafe(method(new))]
311        #[unsafe(method_family = new)]
312        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
313    );
314}