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    #[deprecated = "Scroller arrows are not used anymore."]
21    #[doc(alias = "NSOnlyScrollerArrows")]
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    #[deprecated = "Scroller arrows are not used anymore."]
50    #[doc(alias = "NSScrollerDecrementLine")]
51    pub const DecrementLine: Self = Self(4);
52    #[deprecated = "Scroller arrows are not used anymore."]
53    #[doc(alias = "NSScrollerIncrementLine")]
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))]
123unsafe impl NSAccessibility for NSScroller {}
124
125#[cfg(all(
126    feature = "NSAccessibilityProtocols",
127    feature = "NSControl",
128    feature = "NSResponder",
129    feature = "NSView"
130))]
131unsafe impl NSAccessibilityElementProtocol for NSScroller {}
132
133#[cfg(all(
134    feature = "NSAnimation",
135    feature = "NSControl",
136    feature = "NSResponder",
137    feature = "NSView"
138))]
139unsafe impl NSAnimatablePropertyContainer for NSScroller {}
140
141#[cfg(all(
142    feature = "NSAppearance",
143    feature = "NSControl",
144    feature = "NSResponder",
145    feature = "NSView"
146))]
147unsafe impl NSAppearanceCustomization for NSScroller {}
148
149#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
150unsafe impl NSCoding for NSScroller {}
151
152#[cfg(all(
153    feature = "NSControl",
154    feature = "NSDragging",
155    feature = "NSResponder",
156    feature = "NSView"
157))]
158unsafe impl NSDraggingDestination for NSScroller {}
159
160#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
161unsafe impl NSObjectProtocol for NSScroller {}
162
163#[cfg(all(
164    feature = "NSControl",
165    feature = "NSResponder",
166    feature = "NSUserInterfaceItemIdentification",
167    feature = "NSView"
168))]
169unsafe impl NSUserInterfaceItemIdentification for NSScroller {}
170
171#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
172impl NSScroller {
173    extern_methods!(
174        #[unsafe(method(isCompatibleWithOverlayScrollers))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn isCompatibleWithOverlayScrollers(mtm: MainThreadMarker) -> bool;
177
178        #[cfg(all(feature = "NSCell", feature = "objc2-core-foundation"))]
179        #[unsafe(method(scrollerWidthForControlSize:scrollerStyle:))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn scrollerWidthForControlSize_scrollerStyle(
182            control_size: NSControlSize,
183            scroller_style: NSScrollerStyle,
184            mtm: MainThreadMarker,
185        ) -> CGFloat;
186
187        #[unsafe(method(preferredScrollerStyle))]
188        #[unsafe(method_family = none)]
189        pub unsafe fn preferredScrollerStyle(mtm: MainThreadMarker) -> NSScrollerStyle;
190
191        #[unsafe(method(scrollerStyle))]
192        #[unsafe(method_family = none)]
193        pub unsafe fn scrollerStyle(&self) -> NSScrollerStyle;
194
195        /// Setter for [`scrollerStyle`][Self::scrollerStyle].
196        #[unsafe(method(setScrollerStyle:))]
197        #[unsafe(method_family = none)]
198        pub unsafe fn setScrollerStyle(&self, scroller_style: NSScrollerStyle);
199
200        #[unsafe(method(knobStyle))]
201        #[unsafe(method_family = none)]
202        pub unsafe fn knobStyle(&self) -> NSScrollerKnobStyle;
203
204        /// Setter for [`knobStyle`][Self::knobStyle].
205        #[unsafe(method(setKnobStyle:))]
206        #[unsafe(method_family = none)]
207        pub unsafe fn setKnobStyle(&self, knob_style: NSScrollerKnobStyle);
208
209        #[unsafe(method(rectForPart:))]
210        #[unsafe(method_family = none)]
211        pub unsafe fn rectForPart(&self, part_code: NSScrollerPart) -> NSRect;
212
213        #[unsafe(method(checkSpaceForParts))]
214        #[unsafe(method_family = none)]
215        pub unsafe fn checkSpaceForParts(&self);
216
217        #[unsafe(method(usableParts))]
218        #[unsafe(method_family = none)]
219        pub unsafe fn usableParts(&self) -> NSUsableScrollerParts;
220
221        #[cfg(feature = "NSCell")]
222        #[unsafe(method(controlSize))]
223        #[unsafe(method_family = none)]
224        pub unsafe fn controlSize(&self) -> NSControlSize;
225
226        #[cfg(feature = "NSCell")]
227        /// Setter for [`controlSize`][Self::controlSize].
228        #[unsafe(method(setControlSize:))]
229        #[unsafe(method_family = none)]
230        pub unsafe fn setControlSize(&self, control_size: NSControlSize);
231
232        #[unsafe(method(drawKnob))]
233        #[unsafe(method_family = none)]
234        pub unsafe fn drawKnob(&self);
235
236        #[unsafe(method(drawKnobSlotInRect:highlight:))]
237        #[unsafe(method_family = none)]
238        pub unsafe fn drawKnobSlotInRect_highlight(&self, slot_rect: NSRect, flag: bool);
239
240        #[unsafe(method(testPart:))]
241        #[unsafe(method_family = none)]
242        pub unsafe fn testPart(&self, point: NSPoint) -> NSScrollerPart;
243
244        #[cfg(feature = "NSEvent")]
245        #[unsafe(method(trackKnob:))]
246        #[unsafe(method_family = none)]
247        pub unsafe fn trackKnob(&self, event: &NSEvent);
248
249        #[unsafe(method(hitPart))]
250        #[unsafe(method_family = none)]
251        pub unsafe fn hitPart(&self) -> NSScrollerPart;
252
253        #[cfg(feature = "objc2-core-foundation")]
254        #[unsafe(method(knobProportion))]
255        #[unsafe(method_family = none)]
256        pub unsafe fn knobProportion(&self) -> CGFloat;
257
258        #[cfg(feature = "objc2-core-foundation")]
259        /// Setter for [`knobProportion`][Self::knobProportion].
260        #[unsafe(method(setKnobProportion:))]
261        #[unsafe(method_family = none)]
262        pub unsafe fn setKnobProportion(&self, knob_proportion: CGFloat);
263    );
264}
265
266/// Methods declared on superclass `NSControl`.
267#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
268impl NSScroller {
269    extern_methods!(
270        #[unsafe(method(initWithFrame:))]
271        #[unsafe(method_family = init)]
272        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
273
274        #[unsafe(method(initWithCoder:))]
275        #[unsafe(method_family = init)]
276        pub unsafe fn initWithCoder(
277            this: Allocated<Self>,
278            coder: &NSCoder,
279        ) -> Option<Retained<Self>>;
280    );
281}
282
283/// Methods declared on superclass `NSResponder`.
284#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
285impl NSScroller {
286    extern_methods!(
287        #[unsafe(method(init))]
288        #[unsafe(method_family = init)]
289        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
290    );
291}
292
293/// Methods declared on superclass `NSObject`.
294#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
295impl NSScroller {
296    extern_methods!(
297        #[unsafe(method(new))]
298        #[unsafe(method_family = new)]
299        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
300    );
301}
302
303extern "C" {
304    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nspreferredscrollerstyledidchangenotification?language=objc)
305    pub static NSPreferredScrollerStyleDidChangeNotification: &'static NSNotificationName;
306}
307
308/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscrollarrowposition?language=objc)
309// NS_ENUM
310#[deprecated = "Scroller arrows are not used anymore."]
311#[repr(transparent)]
312#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
313pub struct NSScrollArrowPosition(pub NSUInteger);
314impl NSScrollArrowPosition {
315    #[doc(alias = "NSScrollerArrowsMaxEnd")]
316    pub const ScrollerArrowsMaxEnd: Self = Self(0);
317    #[doc(alias = "NSScrollerArrowsMinEnd")]
318    pub const ScrollerArrowsMinEnd: Self = Self(1);
319    #[doc(alias = "NSScrollerArrowsDefaultSetting")]
320    pub const ScrollerArrowsDefaultSetting: Self = Self(0);
321    #[doc(alias = "NSScrollerArrowsNone")]
322    pub const ScrollerArrowsNone: Self = Self(2);
323}
324
325unsafe impl Encode for NSScrollArrowPosition {
326    const ENCODING: Encoding = NSUInteger::ENCODING;
327}
328
329unsafe impl RefEncode for NSScrollArrowPosition {
330    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
331}
332
333/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscrollerarrow?language=objc)
334// NS_ENUM
335#[deprecated = "Scroller arrows are not used anymore."]
336#[repr(transparent)]
337#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
338pub struct NSScrollerArrow(pub NSUInteger);
339impl NSScrollerArrow {
340    #[doc(alias = "NSScrollerIncrementArrow")]
341    pub const IncrementArrow: Self = Self(0);
342    #[doc(alias = "NSScrollerDecrementArrow")]
343    pub const DecrementArrow: Self = Self(1);
344}
345
346unsafe impl Encode for NSScrollerArrow {
347    const ENCODING: Encoding = NSUInteger::ENCODING;
348}
349
350unsafe impl RefEncode for NSScrollerArrow {
351    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
352}
353
354/// NSDeprecated.
355#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
356impl NSScroller {
357    extern_methods!(
358        #[cfg(all(feature = "NSCell", feature = "objc2-core-foundation"))]
359        #[deprecated = "Use +scrollerWidthForControlSize:scrollerStyle: instead"]
360        #[unsafe(method(scrollerWidthForControlSize:))]
361        #[unsafe(method_family = none)]
362        pub unsafe fn scrollerWidthForControlSize(
363            control_size: NSControlSize,
364            mtm: MainThreadMarker,
365        ) -> CGFloat;
366
367        #[cfg(feature = "objc2-core-foundation")]
368        #[deprecated = "Use +scrollerWidthForControlSize:scrollerStyle: instead"]
369        #[unsafe(method(scrollerWidth))]
370        #[unsafe(method_family = none)]
371        pub unsafe fn scrollerWidth(mtm: MainThreadMarker) -> CGFloat;
372
373        #[cfg(feature = "objc2-core-foundation")]
374        #[deprecated]
375        #[unsafe(method(setFloatValue:knobProportion:))]
376        #[unsafe(method_family = none)]
377        pub unsafe fn setFloatValue_knobProportion(&self, value: c_float, proportion: CGFloat);
378
379        #[deprecated = "Has had no effect since 10.7"]
380        #[unsafe(method(arrowsPosition))]
381        #[unsafe(method_family = none)]
382        pub unsafe fn arrowsPosition(&self) -> NSScrollArrowPosition;
383
384        /// Setter for [`arrowsPosition`][Self::arrowsPosition].
385        #[deprecated = "Has had no effect since 10.7"]
386        #[unsafe(method(setArrowsPosition:))]
387        #[unsafe(method_family = none)]
388        pub unsafe fn setArrowsPosition(&self, arrows_position: NSScrollArrowPosition);
389
390        #[cfg(feature = "NSCell")]
391        #[deprecated = "Has had no effect since 10.7"]
392        #[unsafe(method(controlTint))]
393        #[unsafe(method_family = none)]
394        pub unsafe fn controlTint(&self) -> NSControlTint;
395
396        #[cfg(feature = "NSCell")]
397        /// Setter for [`controlTint`][Self::controlTint].
398        #[deprecated = "Has had no effect since 10.7"]
399        #[unsafe(method(setControlTint:))]
400        #[unsafe(method_family = none)]
401        pub unsafe fn setControlTint(&self, control_tint: NSControlTint);
402
403        #[deprecated = "Has had no effect since 10.7"]
404        #[unsafe(method(highlight:))]
405        #[unsafe(method_family = none)]
406        pub unsafe fn highlight(&self, flag: bool);
407
408        #[cfg(feature = "NSEvent")]
409        #[deprecated = "Not invoked since 10.7"]
410        #[unsafe(method(trackScrollButtons:))]
411        #[unsafe(method_family = none)]
412        pub unsafe fn trackScrollButtons(&self, event: &NSEvent);
413
414        #[deprecated = "Not invoked on any macOS version"]
415        #[unsafe(method(drawParts))]
416        #[unsafe(method_family = none)]
417        pub unsafe fn drawParts(&self);
418
419        #[deprecated = "Scrollers don't have arrows as of 10.7"]
420        #[unsafe(method(drawArrow:highlight:))]
421        #[unsafe(method_family = none)]
422        pub unsafe fn drawArrow_highlight(&self, which_arrow: NSScrollerArrow, flag: bool);
423    );
424}