objc2_app_kit/generated/
NSStepperTouchBarItem.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
10extern_class!(
11    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssteppertouchbaritem?language=objc)
12    #[unsafe(super(NSTouchBarItem, NSObject))]
13    #[derive(Debug, PartialEq, Eq, Hash)]
14    #[cfg(feature = "NSTouchBarItem")]
15    pub struct NSStepperTouchBarItem;
16);
17
18#[cfg(feature = "NSTouchBarItem")]
19unsafe impl NSCoding for NSStepperTouchBarItem {}
20
21#[cfg(feature = "NSTouchBarItem")]
22unsafe impl NSObjectProtocol for NSStepperTouchBarItem {}
23
24#[cfg(feature = "NSTouchBarItem")]
25impl NSStepperTouchBarItem {
26    extern_methods!(
27        /// Creates an `NSStepperTouchBarItem` with a `formatter` to display the stepper's value as text
28        ///
29        ///
30        /// Parameter `formatter`: A formatter used to display a textual representation of the stepper's value
31        #[unsafe(method(stepperTouchBarItemWithIdentifier:formatter:))]
32        #[unsafe(method_family = none)]
33        pub unsafe fn stepperTouchBarItemWithIdentifier_formatter(
34            identifier: &NSTouchBarItemIdentifier,
35            formatter: &NSFormatter,
36            mtm: MainThreadMarker,
37        ) -> Retained<Self>;
38
39        #[cfg(feature = "block2")]
40        /// Creates an `NSStepperTouchBarItem` using the result of `drawingHandler` to display the stepper's value as an image
41        ///
42        ///
43        /// Parameter `drawingHandler`: A block that draws a graphical representation of the stepper's value in the specified rectangle. The coordinates of this rectangle are specified in points.
44        #[unsafe(method(stepperTouchBarItemWithIdentifier:drawingHandler:))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn stepperTouchBarItemWithIdentifier_drawingHandler(
47            identifier: &NSTouchBarItemIdentifier,
48            drawing_handler: &block2::Block<dyn Fn(NSRect, c_double)>,
49            mtm: MainThreadMarker,
50        ) -> Retained<Self>;
51
52        /// The stepper's maximum value. The default is 59.0.
53        #[unsafe(method(maxValue))]
54        #[unsafe(method_family = none)]
55        pub unsafe fn maxValue(&self) -> c_double;
56
57        /// Setter for [`maxValue`][Self::maxValue].
58        #[unsafe(method(setMaxValue:))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn setMaxValue(&self, max_value: c_double);
61
62        /// The stepper's minimum value. The default is 0.0.
63        #[unsafe(method(minValue))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn minValue(&self) -> c_double;
66
67        /// Setter for [`minValue`][Self::minValue].
68        #[unsafe(method(setMinValue:))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn setMinValue(&self, min_value: c_double);
71
72        /// The stepper's increment value. The default is 1.0.
73        #[unsafe(method(increment))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn increment(&self) -> c_double;
76
77        /// Setter for [`increment`][Self::increment].
78        #[unsafe(method(setIncrement:))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn setIncrement(&self, increment: c_double);
81
82        /// The current value of the stepper.
83        #[unsafe(method(value))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn value(&self) -> c_double;
86
87        /// Setter for [`value`][Self::value].
88        #[unsafe(method(setValue:))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn setValue(&self, value: c_double);
91
92        /// The target object that receives action messages from the stepper.
93        #[unsafe(method(target))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn target(&self) -> Option<Retained<AnyObject>>;
96
97        /// This is a [weak property][objc2::topics::weak_property].
98        /// Setter for [`target`][Self::target].
99        #[unsafe(method(setTarget:))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
102
103        /// The action-message selector associated with the stepper.
104        #[unsafe(method(action))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn action(&self) -> Option<Sel>;
107
108        /// Setter for [`action`][Self::action].
109        #[unsafe(method(setAction:))]
110        #[unsafe(method_family = none)]
111        pub unsafe fn setAction(&self, action: Option<Sel>);
112
113        /// The localized string labelling this item during user customization. The default value is empty string.
114        #[unsafe(method(customizationLabel))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn customizationLabel(&self) -> Retained<NSString>;
117
118        /// Setter for [`customizationLabel`][Self::customizationLabel].
119        #[unsafe(method(setCustomizationLabel:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn setCustomizationLabel(&self, customization_label: Option<&NSString>);
122    );
123}
124
125/// Methods declared on superclass `NSTouchBarItem`.
126#[cfg(feature = "NSTouchBarItem")]
127impl NSStepperTouchBarItem {
128    extern_methods!(
129        #[unsafe(method(initWithIdentifier:))]
130        #[unsafe(method_family = init)]
131        pub unsafe fn initWithIdentifier(
132            this: Allocated<Self>,
133            identifier: &NSTouchBarItemIdentifier,
134        ) -> Retained<Self>;
135
136        #[unsafe(method(initWithCoder:))]
137        #[unsafe(method_family = init)]
138        pub unsafe fn initWithCoder(
139            this: Allocated<Self>,
140            coder: &NSCoder,
141        ) -> Option<Retained<Self>>;
142
143        #[unsafe(method(init))]
144        #[unsafe(method_family = init)]
145        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
146    );
147}
148
149/// Methods declared on superclass `NSObject`.
150#[cfg(feature = "NSTouchBarItem")]
151impl NSStepperTouchBarItem {
152    extern_methods!(
153        #[unsafe(method(new))]
154        #[unsafe(method_family = new)]
155        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
156    );
157}