objc2_app_kit/generated/
NSDatePickerCell.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/nsdatepickerstyle?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSDatePickerStyle(pub NSUInteger);
15impl NSDatePickerStyle {
16    #[doc(alias = "NSDatePickerStyleTextFieldAndStepper")]
17    pub const TextFieldAndStepper: Self = Self(0);
18    #[doc(alias = "NSDatePickerStyleClockAndCalendar")]
19    pub const ClockAndCalendar: Self = Self(1);
20    #[doc(alias = "NSDatePickerStyleTextField")]
21    pub const TextField: Self = Self(2);
22}
23
24unsafe impl Encode for NSDatePickerStyle {
25    const ENCODING: Encoding = NSUInteger::ENCODING;
26}
27
28unsafe impl RefEncode for NSDatePickerStyle {
29    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdatepickermode?language=objc)
33// NS_ENUM
34#[repr(transparent)]
35#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
36pub struct NSDatePickerMode(pub NSUInteger);
37impl NSDatePickerMode {
38    #[doc(alias = "NSDatePickerModeSingle")]
39    pub const Single: Self = Self(0);
40    #[doc(alias = "NSDatePickerModeRange")]
41    pub const Range: Self = Self(1);
42}
43
44unsafe impl Encode for NSDatePickerMode {
45    const ENCODING: Encoding = NSUInteger::ENCODING;
46}
47
48unsafe impl RefEncode for NSDatePickerMode {
49    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
50}
51
52/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdatepickerelementflags?language=objc)
53// NS_OPTIONS
54#[repr(transparent)]
55#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
56pub struct NSDatePickerElementFlags(pub NSUInteger);
57bitflags::bitflags! {
58    impl NSDatePickerElementFlags: NSUInteger {
59        #[doc(alias = "NSDatePickerElementFlagHourMinute")]
60        const HourMinute = 0x000c;
61        #[doc(alias = "NSDatePickerElementFlagHourMinuteSecond")]
62        const HourMinuteSecond = 0x000e;
63        #[doc(alias = "NSDatePickerElementFlagTimeZone")]
64        const TimeZone = 0x0010;
65        #[doc(alias = "NSDatePickerElementFlagYearMonth")]
66        const YearMonth = 0x00c0;
67        #[doc(alias = "NSDatePickerElementFlagYearMonthDay")]
68        const YearMonthDay = 0x00e0;
69        #[doc(alias = "NSDatePickerElementFlagEra")]
70        const Era = 0x0100;
71    }
72}
73
74unsafe impl Encode for NSDatePickerElementFlags {
75    const ENCODING: Encoding = NSUInteger::ENCODING;
76}
77
78unsafe impl RefEncode for NSDatePickerElementFlags {
79    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
80}
81
82extern_class!(
83    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdatepickercell?language=objc)
84    #[unsafe(super(NSActionCell, NSCell, NSObject))]
85    #[derive(Debug, PartialEq, Eq, Hash)]
86    #[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
87    pub struct NSDatePickerCell;
88);
89
90#[cfg(all(
91    feature = "NSAccessibilityProtocols",
92    feature = "NSActionCell",
93    feature = "NSCell"
94))]
95unsafe impl NSAccessibility for NSDatePickerCell {}
96
97#[cfg(all(
98    feature = "NSAccessibilityProtocols",
99    feature = "NSActionCell",
100    feature = "NSCell"
101))]
102unsafe impl NSAccessibilityElementProtocol for NSDatePickerCell {}
103
104#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
105unsafe impl NSCoding for NSDatePickerCell {}
106
107#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
108unsafe impl NSCopying for NSDatePickerCell {}
109
110#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
111unsafe impl CopyingHelper for NSDatePickerCell {
112    type Result = Self;
113}
114
115#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
116unsafe impl NSObjectProtocol for NSDatePickerCell {}
117
118#[cfg(all(
119    feature = "NSActionCell",
120    feature = "NSCell",
121    feature = "NSUserInterfaceItemIdentification"
122))]
123unsafe impl NSUserInterfaceItemIdentification for NSDatePickerCell {}
124
125#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
126impl NSDatePickerCell {
127    extern_methods!(
128        #[unsafe(method(initTextCell:))]
129        #[unsafe(method_family = init)]
130        pub unsafe fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
131
132        #[unsafe(method(initWithCoder:))]
133        #[unsafe(method_family = init)]
134        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
135
136        #[cfg(feature = "NSImage")]
137        #[unsafe(method(initImageCell:))]
138        #[unsafe(method_family = init)]
139        pub unsafe fn initImageCell(
140            this: Allocated<Self>,
141            image: Option<&NSImage>,
142        ) -> Retained<Self>;
143
144        #[unsafe(method(datePickerStyle))]
145        #[unsafe(method_family = none)]
146        pub unsafe fn datePickerStyle(&self) -> NSDatePickerStyle;
147
148        /// Setter for [`datePickerStyle`][Self::datePickerStyle].
149        #[unsafe(method(setDatePickerStyle:))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn setDatePickerStyle(&self, date_picker_style: NSDatePickerStyle);
152
153        #[unsafe(method(drawsBackground))]
154        #[unsafe(method_family = none)]
155        pub unsafe fn drawsBackground(&self) -> bool;
156
157        /// Setter for [`drawsBackground`][Self::drawsBackground].
158        #[unsafe(method(setDrawsBackground:))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn setDrawsBackground(&self, draws_background: bool);
161
162        #[cfg(feature = "NSColor")]
163        #[unsafe(method(backgroundColor))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn backgroundColor(&self) -> Retained<NSColor>;
166
167        #[cfg(feature = "NSColor")]
168        /// Setter for [`backgroundColor`][Self::backgroundColor].
169        #[unsafe(method(setBackgroundColor:))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn setBackgroundColor(&self, background_color: &NSColor);
172
173        #[cfg(feature = "NSColor")]
174        #[unsafe(method(textColor))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn textColor(&self) -> Retained<NSColor>;
177
178        #[cfg(feature = "NSColor")]
179        /// Setter for [`textColor`][Self::textColor].
180        #[unsafe(method(setTextColor:))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn setTextColor(&self, text_color: &NSColor);
183
184        #[unsafe(method(datePickerMode))]
185        #[unsafe(method_family = none)]
186        pub unsafe fn datePickerMode(&self) -> NSDatePickerMode;
187
188        /// Setter for [`datePickerMode`][Self::datePickerMode].
189        #[unsafe(method(setDatePickerMode:))]
190        #[unsafe(method_family = none)]
191        pub unsafe fn setDatePickerMode(&self, date_picker_mode: NSDatePickerMode);
192
193        #[unsafe(method(datePickerElements))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn datePickerElements(&self) -> NSDatePickerElementFlags;
196
197        /// Setter for [`datePickerElements`][Self::datePickerElements].
198        #[unsafe(method(setDatePickerElements:))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn setDatePickerElements(&self, date_picker_elements: NSDatePickerElementFlags);
201
202        #[unsafe(method(calendar))]
203        #[unsafe(method_family = none)]
204        pub unsafe fn calendar(&self) -> Option<Retained<NSCalendar>>;
205
206        /// Setter for [`calendar`][Self::calendar].
207        #[unsafe(method(setCalendar:))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn setCalendar(&self, calendar: Option<&NSCalendar>);
210
211        #[unsafe(method(locale))]
212        #[unsafe(method_family = none)]
213        pub unsafe fn locale(&self) -> Option<Retained<NSLocale>>;
214
215        /// Setter for [`locale`][Self::locale].
216        #[unsafe(method(setLocale:))]
217        #[unsafe(method_family = none)]
218        pub unsafe fn setLocale(&self, locale: Option<&NSLocale>);
219
220        #[unsafe(method(timeZone))]
221        #[unsafe(method_family = none)]
222        pub unsafe fn timeZone(&self) -> Option<Retained<NSTimeZone>>;
223
224        /// Setter for [`timeZone`][Self::timeZone].
225        #[unsafe(method(setTimeZone:))]
226        #[unsafe(method_family = none)]
227        pub unsafe fn setTimeZone(&self, time_zone: Option<&NSTimeZone>);
228
229        #[unsafe(method(dateValue))]
230        #[unsafe(method_family = none)]
231        pub unsafe fn dateValue(&self) -> Retained<NSDate>;
232
233        /// Setter for [`dateValue`][Self::dateValue].
234        #[unsafe(method(setDateValue:))]
235        #[unsafe(method_family = none)]
236        pub unsafe fn setDateValue(&self, date_value: &NSDate);
237
238        #[unsafe(method(timeInterval))]
239        #[unsafe(method_family = none)]
240        pub unsafe fn timeInterval(&self) -> NSTimeInterval;
241
242        /// Setter for [`timeInterval`][Self::timeInterval].
243        #[unsafe(method(setTimeInterval:))]
244        #[unsafe(method_family = none)]
245        pub unsafe fn setTimeInterval(&self, time_interval: NSTimeInterval);
246
247        #[unsafe(method(minDate))]
248        #[unsafe(method_family = none)]
249        pub unsafe fn minDate(&self) -> Option<Retained<NSDate>>;
250
251        /// Setter for [`minDate`][Self::minDate].
252        #[unsafe(method(setMinDate:))]
253        #[unsafe(method_family = none)]
254        pub unsafe fn setMinDate(&self, min_date: Option<&NSDate>);
255
256        #[unsafe(method(maxDate))]
257        #[unsafe(method_family = none)]
258        pub unsafe fn maxDate(&self) -> Option<Retained<NSDate>>;
259
260        /// Setter for [`maxDate`][Self::maxDate].
261        #[unsafe(method(setMaxDate:))]
262        #[unsafe(method_family = none)]
263        pub unsafe fn setMaxDate(&self, max_date: Option<&NSDate>);
264
265        #[unsafe(method(delegate))]
266        #[unsafe(method_family = none)]
267        pub unsafe fn delegate(
268            &self,
269        ) -> Option<Retained<ProtocolObject<dyn NSDatePickerCellDelegate>>>;
270
271        /// This is a [weak property][objc2::topics::weak_property].
272        /// Setter for [`delegate`][Self::delegate].
273        #[unsafe(method(setDelegate:))]
274        #[unsafe(method_family = none)]
275        pub unsafe fn setDelegate(
276            &self,
277            delegate: Option<&ProtocolObject<dyn NSDatePickerCellDelegate>>,
278        );
279    );
280}
281
282/// Methods declared on superclass `NSCell`.
283#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
284impl NSDatePickerCell {
285    extern_methods!(
286        #[unsafe(method(init))]
287        #[unsafe(method_family = init)]
288        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
289    );
290}
291
292/// Methods declared on superclass `NSObject`.
293#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
294impl NSDatePickerCell {
295    extern_methods!(
296        #[unsafe(method(new))]
297        #[unsafe(method_family = new)]
298        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
299    );
300}
301
302extern_protocol!(
303    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsdatepickercelldelegate?language=objc)
304    pub unsafe trait NSDatePickerCellDelegate: NSObjectProtocol + MainThreadOnly {
305        #[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
306        #[optional]
307        #[unsafe(method(datePickerCell:validateProposedDateValue:timeInterval:))]
308        #[unsafe(method_family = none)]
309        unsafe fn datePickerCell_validateProposedDateValue_timeInterval(
310            &self,
311            date_picker_cell: &NSDatePickerCell,
312            proposed_date_value: &mut Retained<NSDate>,
313            proposed_time_interval: *mut NSTimeInterval,
314        );
315    }
316);
317
318/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextfieldandstepperdatepickerstyle?language=objc)
319pub static NSTextFieldAndStepperDatePickerStyle: NSDatePickerStyle =
320    NSDatePickerStyle(NSDatePickerStyle::TextFieldAndStepper.0);
321
322/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsclockandcalendardatepickerstyle?language=objc)
323pub static NSClockAndCalendarDatePickerStyle: NSDatePickerStyle =
324    NSDatePickerStyle(NSDatePickerStyle::ClockAndCalendar.0);
325
326/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextfielddatepickerstyle?language=objc)
327pub static NSTextFieldDatePickerStyle: NSDatePickerStyle =
328    NSDatePickerStyle(NSDatePickerStyle::TextField.0);
329
330/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nssingledatemode?language=objc)
331pub static NSSingleDateMode: NSDatePickerMode = NSDatePickerMode(NSDatePickerMode::Single.0);
332
333/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrangedatemode?language=objc)
334pub static NSRangeDateMode: NSDatePickerMode = NSDatePickerMode(NSDatePickerMode::Range.0);
335
336/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nshourminutedatepickerelementflag?language=objc)
337pub static NSHourMinuteDatePickerElementFlag: NSDatePickerElementFlags =
338    NSDatePickerElementFlags(NSDatePickerElementFlags::HourMinute.0);
339
340/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nshourminuteseconddatepickerelementflag?language=objc)
341pub static NSHourMinuteSecondDatePickerElementFlag: NSDatePickerElementFlags =
342    NSDatePickerElementFlags(NSDatePickerElementFlags::HourMinuteSecond.0);
343
344/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstimezonedatepickerelementflag?language=objc)
345pub static NSTimeZoneDatePickerElementFlag: NSDatePickerElementFlags =
346    NSDatePickerElementFlags(NSDatePickerElementFlags::TimeZone.0);
347
348/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsyearmonthdatepickerelementflag?language=objc)
349pub static NSYearMonthDatePickerElementFlag: NSDatePickerElementFlags =
350    NSDatePickerElementFlags(NSDatePickerElementFlags::YearMonth.0);
351
352/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsyearmonthdaydatepickerelementflag?language=objc)
353pub static NSYearMonthDayDatePickerElementFlag: NSDatePickerElementFlags =
354    NSDatePickerElementFlags(NSDatePickerElementFlags::YearMonthDay.0);
355
356/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nseradatepickerelementflag?language=objc)
357pub static NSEraDatePickerElementFlag: NSDatePickerElementFlags =
358    NSDatePickerElementFlags(NSDatePickerElementFlags::Era.0);