objc2_app_kit/generated/
NSDatePickerCell.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[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#[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#[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 #[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))]
95extern_conformance!(
96 unsafe impl NSAccessibility for NSDatePickerCell {}
97);
98
99#[cfg(all(
100 feature = "NSAccessibilityProtocols",
101 feature = "NSActionCell",
102 feature = "NSCell"
103))]
104extern_conformance!(
105 unsafe impl NSAccessibilityElementProtocol for NSDatePickerCell {}
106);
107
108#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
109extern_conformance!(
110 unsafe impl NSCoding for NSDatePickerCell {}
111);
112
113#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
114extern_conformance!(
115 unsafe impl NSCopying for NSDatePickerCell {}
116);
117
118#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
119unsafe impl CopyingHelper for NSDatePickerCell {
120 type Result = Self;
121}
122
123#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
124extern_conformance!(
125 unsafe impl NSObjectProtocol for NSDatePickerCell {}
126);
127
128#[cfg(all(
129 feature = "NSActionCell",
130 feature = "NSCell",
131 feature = "NSUserInterfaceItemIdentification"
132))]
133extern_conformance!(
134 unsafe impl NSUserInterfaceItemIdentification for NSDatePickerCell {}
135);
136
137#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
138impl NSDatePickerCell {
139 extern_methods!(
140 #[unsafe(method(initTextCell:))]
141 #[unsafe(method_family = init)]
142 pub fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
143
144 #[unsafe(method(initWithCoder:))]
148 #[unsafe(method_family = init)]
149 pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
150
151 #[cfg(feature = "NSImage")]
152 #[unsafe(method(initImageCell:))]
153 #[unsafe(method_family = init)]
154 pub unsafe fn initImageCell(
155 this: Allocated<Self>,
156 image: Option<&NSImage>,
157 ) -> Retained<Self>;
158
159 #[unsafe(method(datePickerStyle))]
160 #[unsafe(method_family = none)]
161 pub fn datePickerStyle(&self) -> NSDatePickerStyle;
162
163 #[unsafe(method(setDatePickerStyle:))]
165 #[unsafe(method_family = none)]
166 pub fn setDatePickerStyle(&self, date_picker_style: NSDatePickerStyle);
167
168 #[unsafe(method(drawsBackground))]
169 #[unsafe(method_family = none)]
170 pub fn drawsBackground(&self) -> bool;
171
172 #[unsafe(method(setDrawsBackground:))]
174 #[unsafe(method_family = none)]
175 pub fn setDrawsBackground(&self, draws_background: bool);
176
177 #[cfg(feature = "NSColor")]
178 #[unsafe(method(backgroundColor))]
179 #[unsafe(method_family = none)]
180 pub fn backgroundColor(&self) -> Retained<NSColor>;
181
182 #[cfg(feature = "NSColor")]
183 #[unsafe(method(setBackgroundColor:))]
187 #[unsafe(method_family = none)]
188 pub fn setBackgroundColor(&self, background_color: &NSColor);
189
190 #[cfg(feature = "NSColor")]
191 #[unsafe(method(textColor))]
192 #[unsafe(method_family = none)]
193 pub fn textColor(&self) -> Retained<NSColor>;
194
195 #[cfg(feature = "NSColor")]
196 #[unsafe(method(setTextColor:))]
200 #[unsafe(method_family = none)]
201 pub fn setTextColor(&self, text_color: &NSColor);
202
203 #[unsafe(method(datePickerMode))]
204 #[unsafe(method_family = none)]
205 pub fn datePickerMode(&self) -> NSDatePickerMode;
206
207 #[unsafe(method(setDatePickerMode:))]
209 #[unsafe(method_family = none)]
210 pub fn setDatePickerMode(&self, date_picker_mode: NSDatePickerMode);
211
212 #[unsafe(method(datePickerElements))]
213 #[unsafe(method_family = none)]
214 pub fn datePickerElements(&self) -> NSDatePickerElementFlags;
215
216 #[unsafe(method(setDatePickerElements:))]
218 #[unsafe(method_family = none)]
219 pub fn setDatePickerElements(&self, date_picker_elements: NSDatePickerElementFlags);
220
221 #[unsafe(method(calendar))]
222 #[unsafe(method_family = none)]
223 pub fn calendar(&self) -> Option<Retained<NSCalendar>>;
224
225 #[unsafe(method(setCalendar:))]
229 #[unsafe(method_family = none)]
230 pub fn setCalendar(&self, calendar: Option<&NSCalendar>);
231
232 #[unsafe(method(locale))]
233 #[unsafe(method_family = none)]
234 pub fn locale(&self) -> Option<Retained<NSLocale>>;
235
236 #[unsafe(method(setLocale:))]
240 #[unsafe(method_family = none)]
241 pub fn setLocale(&self, locale: Option<&NSLocale>);
242
243 #[unsafe(method(timeZone))]
244 #[unsafe(method_family = none)]
245 pub fn timeZone(&self) -> Option<Retained<NSTimeZone>>;
246
247 #[unsafe(method(setTimeZone:))]
251 #[unsafe(method_family = none)]
252 pub fn setTimeZone(&self, time_zone: Option<&NSTimeZone>);
253
254 #[unsafe(method(dateValue))]
255 #[unsafe(method_family = none)]
256 pub fn dateValue(&self) -> Retained<NSDate>;
257
258 #[unsafe(method(setDateValue:))]
262 #[unsafe(method_family = none)]
263 pub fn setDateValue(&self, date_value: &NSDate);
264
265 #[unsafe(method(timeInterval))]
266 #[unsafe(method_family = none)]
267 pub fn timeInterval(&self) -> NSTimeInterval;
268
269 #[unsafe(method(setTimeInterval:))]
271 #[unsafe(method_family = none)]
272 pub fn setTimeInterval(&self, time_interval: NSTimeInterval);
273
274 #[unsafe(method(minDate))]
275 #[unsafe(method_family = none)]
276 pub fn minDate(&self) -> Option<Retained<NSDate>>;
277
278 #[unsafe(method(setMinDate:))]
282 #[unsafe(method_family = none)]
283 pub fn setMinDate(&self, min_date: Option<&NSDate>);
284
285 #[unsafe(method(maxDate))]
286 #[unsafe(method_family = none)]
287 pub fn maxDate(&self) -> Option<Retained<NSDate>>;
288
289 #[unsafe(method(setMaxDate:))]
293 #[unsafe(method_family = none)]
294 pub fn setMaxDate(&self, max_date: Option<&NSDate>);
295
296 #[unsafe(method(delegate))]
297 #[unsafe(method_family = none)]
298 pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSDatePickerCellDelegate>>>;
299
300 #[unsafe(method(setDelegate:))]
304 #[unsafe(method_family = none)]
305 pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSDatePickerCellDelegate>>);
306 );
307}
308
309#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
311impl NSDatePickerCell {
312 extern_methods!(
313 #[unsafe(method(init))]
314 #[unsafe(method_family = init)]
315 pub fn init(this: Allocated<Self>) -> Retained<Self>;
316 );
317}
318
319#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
321impl NSDatePickerCell {
322 extern_methods!(
323 #[unsafe(method(new))]
324 #[unsafe(method_family = new)]
325 pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
326 );
327}
328
329extern_protocol!(
330 pub unsafe trait NSDatePickerCellDelegate: NSObjectProtocol + MainThreadOnly {
332 #[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
333 #[optional]
337 #[unsafe(method(datePickerCell:validateProposedDateValue:timeInterval:))]
338 #[unsafe(method_family = none)]
339 unsafe fn datePickerCell_validateProposedDateValue_timeInterval(
340 &self,
341 date_picker_cell: &NSDatePickerCell,
342 proposed_date_value: &mut Retained<NSDate>,
343 proposed_time_interval: *mut NSTimeInterval,
344 );
345 }
346);
347
348#[deprecated]
350pub static NSTextFieldAndStepperDatePickerStyle: NSDatePickerStyle =
351 NSDatePickerStyle(NSDatePickerStyle::TextFieldAndStepper.0);
352
353#[deprecated]
355pub static NSClockAndCalendarDatePickerStyle: NSDatePickerStyle =
356 NSDatePickerStyle(NSDatePickerStyle::ClockAndCalendar.0);
357
358#[deprecated]
360pub static NSTextFieldDatePickerStyle: NSDatePickerStyle =
361 NSDatePickerStyle(NSDatePickerStyle::TextField.0);
362
363#[deprecated]
365pub static NSSingleDateMode: NSDatePickerMode = NSDatePickerMode(NSDatePickerMode::Single.0);
366
367#[deprecated]
369pub static NSRangeDateMode: NSDatePickerMode = NSDatePickerMode(NSDatePickerMode::Range.0);
370
371#[deprecated]
373pub static NSHourMinuteDatePickerElementFlag: NSDatePickerElementFlags =
374 NSDatePickerElementFlags(NSDatePickerElementFlags::HourMinute.0);
375
376#[deprecated]
378pub static NSHourMinuteSecondDatePickerElementFlag: NSDatePickerElementFlags =
379 NSDatePickerElementFlags(NSDatePickerElementFlags::HourMinuteSecond.0);
380
381#[deprecated]
383pub static NSTimeZoneDatePickerElementFlag: NSDatePickerElementFlags =
384 NSDatePickerElementFlags(NSDatePickerElementFlags::TimeZone.0);
385
386#[deprecated]
388pub static NSYearMonthDatePickerElementFlag: NSDatePickerElementFlags =
389 NSDatePickerElementFlags(NSDatePickerElementFlags::YearMonth.0);
390
391#[deprecated]
393pub static NSYearMonthDayDatePickerElementFlag: NSDatePickerElementFlags =
394 NSDatePickerElementFlags(NSDatePickerElementFlags::YearMonthDay.0);
395
396#[deprecated]
398pub static NSEraDatePickerElementFlag: NSDatePickerElementFlags =
399 NSDatePickerElementFlags(NSDatePickerElementFlags::Era.0);