objc2_app_kit/generated/
NSScroller.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/nsusablescrollerparts?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct NSUsableScrollerParts(pub NSUInteger);
17impl NSUsableScrollerParts {
18    #[doc(alias = "NSNoScrollerParts")]
19    pub const NoScrollerParts: Self = Self(0);
20    #[doc(alias = "NSOnlyScrollerArrows")]
21    #[deprecated = "Scroller arrows are not used anymore."]
22    pub const OnlyScrollerArrows: Self = Self(1);
23    #[doc(alias = "NSAllScrollerParts")]
24    pub const AllScrollerParts: Self = Self(2);
25}
26
27unsafe impl Encode for NSUsableScrollerParts {
28    const ENCODING: Encoding = NSUInteger::ENCODING;
29}
30
31unsafe impl RefEncode for NSUsableScrollerParts {
32    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscrollerpart?language=objc)
36// NS_ENUM
37#[repr(transparent)]
38#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
39pub struct NSScrollerPart(pub NSUInteger);
40impl NSScrollerPart {
41    #[doc(alias = "NSScrollerNoPart")]
42    pub const NoPart: Self = Self(0);
43    #[doc(alias = "NSScrollerDecrementPage")]
44    pub const DecrementPage: Self = Self(1);
45    #[doc(alias = "NSScrollerKnob")]
46    pub const Knob: Self = Self(2);
47    #[doc(alias = "NSScrollerIncrementPage")]
48    pub const IncrementPage: Self = Self(3);
49    #[doc(alias = "NSScrollerDecrementLine")]
50    #[deprecated = "Scroller arrows are not used anymore."]
51    pub const DecrementLine: Self = Self(4);
52    #[doc(alias = "NSScrollerIncrementLine")]
53    #[deprecated = "Scroller arrows are not used anymore."]
54    pub const IncrementLine: Self = Self(5);
55    #[doc(alias = "NSScrollerKnobSlot")]
56    pub const KnobSlot: Self = Self(6);
57}
58
59unsafe impl Encode for NSScrollerPart {
60    const ENCODING: Encoding = NSUInteger::ENCODING;
61}
62
63unsafe impl RefEncode for NSScrollerPart {
64    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
65}
66
67/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscrollerstyle?language=objc)
68// NS_ENUM
69#[repr(transparent)]
70#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
71pub struct NSScrollerStyle(pub NSInteger);
72impl NSScrollerStyle {
73    #[doc(alias = "NSScrollerStyleLegacy")]
74    pub const Legacy: Self = Self(0);
75    #[doc(alias = "NSScrollerStyleOverlay")]
76    pub const Overlay: Self = Self(1);
77}
78
79unsafe impl Encode for NSScrollerStyle {
80    const ENCODING: Encoding = NSInteger::ENCODING;
81}
82
83unsafe impl RefEncode for NSScrollerStyle {
84    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
85}
86
87/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscrollerknobstyle?language=objc)
88// NS_ENUM
89#[repr(transparent)]
90#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
91pub struct NSScrollerKnobStyle(pub NSInteger);
92impl NSScrollerKnobStyle {
93    #[doc(alias = "NSScrollerKnobStyleDefault")]
94    pub const Default: Self = Self(0);
95    #[doc(alias = "NSScrollerKnobStyleDark")]
96    pub const Dark: Self = Self(1);
97    #[doc(alias = "NSScrollerKnobStyleLight")]
98    pub const Light: Self = Self(2);
99}
100
101unsafe impl Encode for NSScrollerKnobStyle {
102    const ENCODING: Encoding = NSInteger::ENCODING;
103}
104
105unsafe impl RefEncode for NSScrollerKnobStyle {
106    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
107}
108
109extern_class!(
110    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscroller?language=objc)
111    #[unsafe(super(NSControl, NSView, NSResponder, NSObject))]
112    #[derive(Debug, PartialEq, Eq, Hash)]
113    #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
114    pub struct NSScroller;
115);
116
117#[cfg(all(
118    feature = "NSAccessibilityProtocols",
119    feature = "NSControl",
120    feature = "NSResponder",
121    feature = "NSView"
122))]
123extern_conformance!(
124    unsafe impl NSAccessibility for NSScroller {}
125);
126
127#[cfg(all(
128    feature = "NSAccessibilityProtocols",
129    feature = "NSControl",
130    feature = "NSResponder",
131    feature = "NSView"
132))]
133extern_conformance!(
134    unsafe impl NSAccessibilityElementProtocol for NSScroller {}
135);
136
137#[cfg(all(
138    feature = "NSAnimation",
139    feature = "NSControl",
140    feature = "NSResponder",
141    feature = "NSView"
142))]
143extern_conformance!(
144    unsafe impl NSAnimatablePropertyContainer for NSScroller {}
145);
146
147#[cfg(all(
148    feature = "NSAppearance",
149    feature = "NSControl",
150    feature = "NSResponder",
151    feature = "NSView"
152))]
153extern_conformance!(
154    unsafe impl NSAppearanceCustomization for NSScroller {}
155);
156
157#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
158extern_conformance!(
159    unsafe impl NSCoding for NSScroller {}
160);
161
162#[cfg(all(
163    feature = "NSControl",
164    feature = "NSDragging",
165    feature = "NSResponder",
166    feature = "NSView"
167))]
168extern_conformance!(
169    unsafe impl NSDraggingDestination for NSScroller {}
170);
171
172#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
173extern_conformance!(
174    unsafe impl NSObjectProtocol for NSScroller {}
175);
176
177#[cfg(all(
178    feature = "NSControl",
179    feature = "NSResponder",
180    feature = "NSUserInterfaceItemIdentification",
181    feature = "NSView"
182))]
183extern_conformance!(
184    unsafe impl NSUserInterfaceItemIdentification for NSScroller {}
185);
186
187#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
188impl NSScroller {
189    extern_methods!(
190        #[unsafe(method(isCompatibleWithOverlayScrollers))]
191        #[unsafe(method_family = none)]
192        pub fn isCompatibleWithOverlayScrollers(mtm: MainThreadMarker) -> bool;
193
194        #[cfg(all(feature = "NSCell", feature = "objc2-core-foundation"))]
195        #[unsafe(method(scrollerWidthForControlSize:scrollerStyle:))]
196        #[unsafe(method_family = none)]
197        pub fn scrollerWidthForControlSize_scrollerStyle(
198            control_size: NSControlSize,
199            scroller_style: NSScrollerStyle,
200            mtm: MainThreadMarker,
201        ) -> CGFloat;
202
203        #[unsafe(method(preferredScrollerStyle))]
204        #[unsafe(method_family = none)]
205        pub fn preferredScrollerStyle(mtm: MainThreadMarker) -> NSScrollerStyle;
206
207        #[unsafe(method(scrollerStyle))]
208        #[unsafe(method_family = none)]
209        pub fn scrollerStyle(&self) -> NSScrollerStyle;
210
211        /// Setter for [`scrollerStyle`][Self::scrollerStyle].
212        #[unsafe(method(setScrollerStyle:))]
213        #[unsafe(method_family = none)]
214        pub fn setScrollerStyle(&self, scroller_style: NSScrollerStyle);
215
216        #[unsafe(method(knobStyle))]
217        #[unsafe(method_family = none)]
218        pub fn knobStyle(&self) -> NSScrollerKnobStyle;
219
220        /// Setter for [`knobStyle`][Self::knobStyle].
221        #[unsafe(method(setKnobStyle:))]
222        #[unsafe(method_family = none)]
223        pub fn setKnobStyle(&self, knob_style: NSScrollerKnobStyle);
224
225        #[unsafe(method(rectForPart:))]
226        #[unsafe(method_family = none)]
227        pub fn rectForPart(&self, part_code: NSScrollerPart) -> NSRect;
228
229        #[unsafe(method(checkSpaceForParts))]
230        #[unsafe(method_family = none)]
231        pub fn checkSpaceForParts(&self);
232
233        #[unsafe(method(usableParts))]
234        #[unsafe(method_family = none)]
235        pub fn usableParts(&self) -> NSUsableScrollerParts;
236
237        #[cfg(feature = "NSCell")]
238        #[unsafe(method(controlSize))]
239        #[unsafe(method_family = none)]
240        pub fn controlSize(&self) -> NSControlSize;
241
242        #[cfg(feature = "NSCell")]
243        /// Setter for [`controlSize`][Self::controlSize].
244        #[unsafe(method(setControlSize:))]
245        #[unsafe(method_family = none)]
246        pub fn setControlSize(&self, control_size: NSControlSize);
247
248        #[unsafe(method(drawKnob))]
249        #[unsafe(method_family = none)]
250        pub fn drawKnob(&self);
251
252        #[unsafe(method(drawKnobSlotInRect:highlight:))]
253        #[unsafe(method_family = none)]
254        pub fn drawKnobSlotInRect_highlight(&self, slot_rect: NSRect, flag: bool);
255
256        #[unsafe(method(testPart:))]
257        #[unsafe(method_family = none)]
258        pub fn testPart(&self, point: NSPoint) -> NSScrollerPart;
259
260        #[cfg(feature = "NSEvent")]
261        #[unsafe(method(trackKnob:))]
262        #[unsafe(method_family = none)]
263        pub fn trackKnob(&self, event: &NSEvent);
264
265        #[unsafe(method(hitPart))]
266        #[unsafe(method_family = none)]
267        pub fn hitPart(&self) -> NSScrollerPart;
268
269        #[cfg(feature = "objc2-core-foundation")]
270        #[unsafe(method(knobProportion))]
271        #[unsafe(method_family = none)]
272        pub fn knobProportion(&self) -> CGFloat;
273
274        #[cfg(feature = "objc2-core-foundation")]
275        /// Setter for [`knobProportion`][Self::knobProportion].
276        #[unsafe(method(setKnobProportion:))]
277        #[unsafe(method_family = none)]
278        pub fn setKnobProportion(&self, knob_proportion: CGFloat);
279    );
280}
281
282/// Methods declared on superclass `NSControl`.
283#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
284impl NSScroller {
285    extern_methods!(
286        #[unsafe(method(initWithFrame:))]
287        #[unsafe(method_family = init)]
288        pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
289
290        /// # Safety
291        ///
292        /// `coder` possibly has further requirements.
293        #[unsafe(method(initWithCoder:))]
294        #[unsafe(method_family = init)]
295        pub unsafe fn initWithCoder(
296            this: Allocated<Self>,
297            coder: &NSCoder,
298        ) -> Option<Retained<Self>>;
299    );
300}
301
302/// Methods declared on superclass `NSResponder`.
303#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
304impl NSScroller {
305    extern_methods!(
306        #[unsafe(method(init))]
307        #[unsafe(method_family = init)]
308        pub fn init(this: Allocated<Self>) -> Retained<Self>;
309    );
310}
311
312/// Methods declared on superclass `NSObject`.
313#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
314impl NSScroller {
315    extern_methods!(
316        #[unsafe(method(new))]
317        #[unsafe(method_family = new)]
318        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
319    );
320}
321
322extern "C" {
323    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspreferredscrollerstyledidchangenotification?language=objc)
324    pub static NSPreferredScrollerStyleDidChangeNotification: &'static NSNotificationName;
325}
326
327/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscrollarrowposition?language=objc)
328// NS_ENUM
329#[deprecated = "Scroller arrows are not used anymore."]
330#[repr(transparent)]
331#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
332pub struct NSScrollArrowPosition(pub NSUInteger);
333impl NSScrollArrowPosition {
334    #[doc(alias = "NSScrollerArrowsMaxEnd")]
335    pub const ScrollerArrowsMaxEnd: Self = Self(0);
336    #[doc(alias = "NSScrollerArrowsMinEnd")]
337    pub const ScrollerArrowsMinEnd: Self = Self(1);
338    #[doc(alias = "NSScrollerArrowsDefaultSetting")]
339    pub const ScrollerArrowsDefaultSetting: Self = Self(0);
340    #[doc(alias = "NSScrollerArrowsNone")]
341    pub const ScrollerArrowsNone: Self = Self(2);
342}
343
344unsafe impl Encode for NSScrollArrowPosition {
345    const ENCODING: Encoding = NSUInteger::ENCODING;
346}
347
348unsafe impl RefEncode for NSScrollArrowPosition {
349    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
350}
351
352/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscrollerarrow?language=objc)
353// NS_ENUM
354#[deprecated = "Scroller arrows are not used anymore."]
355#[repr(transparent)]
356#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
357pub struct NSScrollerArrow(pub NSUInteger);
358impl NSScrollerArrow {
359    #[doc(alias = "NSScrollerIncrementArrow")]
360    pub const IncrementArrow: Self = Self(0);
361    #[doc(alias = "NSScrollerDecrementArrow")]
362    pub const DecrementArrow: Self = Self(1);
363}
364
365unsafe impl Encode for NSScrollerArrow {
366    const ENCODING: Encoding = NSUInteger::ENCODING;
367}
368
369unsafe impl RefEncode for NSScrollerArrow {
370    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
371}
372
373/// NSDeprecated.
374#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
375impl NSScroller {
376    extern_methods!(
377        #[cfg(all(feature = "NSCell", feature = "objc2-core-foundation"))]
378        #[deprecated = "Use +scrollerWidthForControlSize:scrollerStyle: instead"]
379        #[unsafe(method(scrollerWidthForControlSize:))]
380        #[unsafe(method_family = none)]
381        pub fn scrollerWidthForControlSize(
382            control_size: NSControlSize,
383            mtm: MainThreadMarker,
384        ) -> CGFloat;
385
386        #[cfg(feature = "objc2-core-foundation")]
387        #[deprecated = "Use +scrollerWidthForControlSize:scrollerStyle: instead"]
388        #[unsafe(method(scrollerWidth))]
389        #[unsafe(method_family = none)]
390        pub fn scrollerWidth(mtm: MainThreadMarker) -> CGFloat;
391
392        #[cfg(feature = "objc2-core-foundation")]
393        #[deprecated]
394        #[unsafe(method(setFloatValue:knobProportion:))]
395        #[unsafe(method_family = none)]
396        pub fn setFloatValue_knobProportion(&self, value: c_float, proportion: CGFloat);
397
398        #[deprecated = "Has had no effect since 10.7"]
399        #[unsafe(method(arrowsPosition))]
400        #[unsafe(method_family = none)]
401        pub fn arrowsPosition(&self) -> NSScrollArrowPosition;
402
403        /// Setter for [`arrowsPosition`][Self::arrowsPosition].
404        #[deprecated = "Has had no effect since 10.7"]
405        #[unsafe(method(setArrowsPosition:))]
406        #[unsafe(method_family = none)]
407        pub fn setArrowsPosition(&self, arrows_position: NSScrollArrowPosition);
408
409        #[cfg(feature = "NSCell")]
410        #[deprecated = "Has had no effect since 10.7"]
411        #[unsafe(method(controlTint))]
412        #[unsafe(method_family = none)]
413        pub fn controlTint(&self) -> NSControlTint;
414
415        #[cfg(feature = "NSCell")]
416        /// Setter for [`controlTint`][Self::controlTint].
417        #[deprecated = "Has had no effect since 10.7"]
418        #[unsafe(method(setControlTint:))]
419        #[unsafe(method_family = none)]
420        pub fn setControlTint(&self, control_tint: NSControlTint);
421
422        #[deprecated = "Has had no effect since 10.7"]
423        #[unsafe(method(highlight:))]
424        #[unsafe(method_family = none)]
425        pub fn highlight(&self, flag: bool);
426
427        #[cfg(feature = "NSEvent")]
428        #[deprecated = "Not invoked since 10.7"]
429        #[unsafe(method(trackScrollButtons:))]
430        #[unsafe(method_family = none)]
431        pub fn trackScrollButtons(&self, event: &NSEvent);
432
433        #[deprecated = "Not invoked on any macOS version"]
434        #[unsafe(method(drawParts))]
435        #[unsafe(method_family = none)]
436        pub fn drawParts(&self);
437
438        #[deprecated = "Scrollers don't have arrows as of 10.7"]
439        #[unsafe(method(drawArrow:highlight:))]
440        #[unsafe(method_family = none)]
441        pub fn drawArrow_highlight(&self, which_arrow: NSScrollerArrow, flag: bool);
442    );
443}