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 unsafe fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
143
144 #[unsafe(method(initWithCoder:))]
145 #[unsafe(method_family = init)]
146 pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
147
148 #[cfg(feature = "NSImage")]
149 #[unsafe(method(initImageCell:))]
150 #[unsafe(method_family = init)]
151 pub unsafe fn initImageCell(
152 this: Allocated<Self>,
153 image: Option<&NSImage>,
154 ) -> Retained<Self>;
155
156 #[unsafe(method(datePickerStyle))]
157 #[unsafe(method_family = none)]
158 pub unsafe fn datePickerStyle(&self) -> NSDatePickerStyle;
159
160 #[unsafe(method(setDatePickerStyle:))]
162 #[unsafe(method_family = none)]
163 pub unsafe fn setDatePickerStyle(&self, date_picker_style: NSDatePickerStyle);
164
165 #[unsafe(method(drawsBackground))]
166 #[unsafe(method_family = none)]
167 pub unsafe fn drawsBackground(&self) -> bool;
168
169 #[unsafe(method(setDrawsBackground:))]
171 #[unsafe(method_family = none)]
172 pub unsafe fn setDrawsBackground(&self, draws_background: bool);
173
174 #[cfg(feature = "NSColor")]
175 #[unsafe(method(backgroundColor))]
176 #[unsafe(method_family = none)]
177 pub unsafe fn backgroundColor(&self) -> Retained<NSColor>;
178
179 #[cfg(feature = "NSColor")]
180 #[unsafe(method(setBackgroundColor:))]
182 #[unsafe(method_family = none)]
183 pub unsafe fn setBackgroundColor(&self, background_color: &NSColor);
184
185 #[cfg(feature = "NSColor")]
186 #[unsafe(method(textColor))]
187 #[unsafe(method_family = none)]
188 pub unsafe fn textColor(&self) -> Retained<NSColor>;
189
190 #[cfg(feature = "NSColor")]
191 #[unsafe(method(setTextColor:))]
193 #[unsafe(method_family = none)]
194 pub unsafe fn setTextColor(&self, text_color: &NSColor);
195
196 #[unsafe(method(datePickerMode))]
197 #[unsafe(method_family = none)]
198 pub unsafe fn datePickerMode(&self) -> NSDatePickerMode;
199
200 #[unsafe(method(setDatePickerMode:))]
202 #[unsafe(method_family = none)]
203 pub unsafe fn setDatePickerMode(&self, date_picker_mode: NSDatePickerMode);
204
205 #[unsafe(method(datePickerElements))]
206 #[unsafe(method_family = none)]
207 pub unsafe fn datePickerElements(&self) -> NSDatePickerElementFlags;
208
209 #[unsafe(method(setDatePickerElements:))]
211 #[unsafe(method_family = none)]
212 pub unsafe fn setDatePickerElements(&self, date_picker_elements: NSDatePickerElementFlags);
213
214 #[unsafe(method(calendar))]
215 #[unsafe(method_family = none)]
216 pub unsafe fn calendar(&self) -> Option<Retained<NSCalendar>>;
217
218 #[unsafe(method(setCalendar:))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn setCalendar(&self, calendar: Option<&NSCalendar>);
222
223 #[unsafe(method(locale))]
224 #[unsafe(method_family = none)]
225 pub unsafe fn locale(&self) -> Option<Retained<NSLocale>>;
226
227 #[unsafe(method(setLocale:))]
229 #[unsafe(method_family = none)]
230 pub unsafe fn setLocale(&self, locale: Option<&NSLocale>);
231
232 #[unsafe(method(timeZone))]
233 #[unsafe(method_family = none)]
234 pub unsafe fn timeZone(&self) -> Option<Retained<NSTimeZone>>;
235
236 #[unsafe(method(setTimeZone:))]
238 #[unsafe(method_family = none)]
239 pub unsafe fn setTimeZone(&self, time_zone: Option<&NSTimeZone>);
240
241 #[unsafe(method(dateValue))]
242 #[unsafe(method_family = none)]
243 pub unsafe fn dateValue(&self) -> Retained<NSDate>;
244
245 #[unsafe(method(setDateValue:))]
247 #[unsafe(method_family = none)]
248 pub unsafe fn setDateValue(&self, date_value: &NSDate);
249
250 #[unsafe(method(timeInterval))]
251 #[unsafe(method_family = none)]
252 pub unsafe fn timeInterval(&self) -> NSTimeInterval;
253
254 #[unsafe(method(setTimeInterval:))]
256 #[unsafe(method_family = none)]
257 pub unsafe fn setTimeInterval(&self, time_interval: NSTimeInterval);
258
259 #[unsafe(method(minDate))]
260 #[unsafe(method_family = none)]
261 pub unsafe fn minDate(&self) -> Option<Retained<NSDate>>;
262
263 #[unsafe(method(setMinDate:))]
265 #[unsafe(method_family = none)]
266 pub unsafe fn setMinDate(&self, min_date: Option<&NSDate>);
267
268 #[unsafe(method(maxDate))]
269 #[unsafe(method_family = none)]
270 pub unsafe fn maxDate(&self) -> Option<Retained<NSDate>>;
271
272 #[unsafe(method(setMaxDate:))]
274 #[unsafe(method_family = none)]
275 pub unsafe fn setMaxDate(&self, max_date: Option<&NSDate>);
276
277 #[unsafe(method(delegate))]
278 #[unsafe(method_family = none)]
279 pub unsafe fn delegate(
280 &self,
281 ) -> Option<Retained<ProtocolObject<dyn NSDatePickerCellDelegate>>>;
282
283 #[unsafe(method(setDelegate:))]
286 #[unsafe(method_family = none)]
287 pub unsafe fn setDelegate(
288 &self,
289 delegate: Option<&ProtocolObject<dyn NSDatePickerCellDelegate>>,
290 );
291 );
292}
293
294#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
296impl NSDatePickerCell {
297 extern_methods!(
298 #[unsafe(method(init))]
299 #[unsafe(method_family = init)]
300 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
301 );
302}
303
304#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
306impl NSDatePickerCell {
307 extern_methods!(
308 #[unsafe(method(new))]
309 #[unsafe(method_family = new)]
310 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
311 );
312}
313
314extern_protocol!(
315 pub unsafe trait NSDatePickerCellDelegate: NSObjectProtocol + MainThreadOnly {
317 #[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
318 #[optional]
319 #[unsafe(method(datePickerCell:validateProposedDateValue:timeInterval:))]
320 #[unsafe(method_family = none)]
321 unsafe fn datePickerCell_validateProposedDateValue_timeInterval(
322 &self,
323 date_picker_cell: &NSDatePickerCell,
324 proposed_date_value: &mut Retained<NSDate>,
325 proposed_time_interval: *mut NSTimeInterval,
326 );
327 }
328);
329
330pub static NSTextFieldAndStepperDatePickerStyle: NSDatePickerStyle =
332 NSDatePickerStyle(NSDatePickerStyle::TextFieldAndStepper.0);
333
334pub static NSClockAndCalendarDatePickerStyle: NSDatePickerStyle =
336 NSDatePickerStyle(NSDatePickerStyle::ClockAndCalendar.0);
337
338pub static NSTextFieldDatePickerStyle: NSDatePickerStyle =
340 NSDatePickerStyle(NSDatePickerStyle::TextField.0);
341
342pub static NSSingleDateMode: NSDatePickerMode = NSDatePickerMode(NSDatePickerMode::Single.0);
344
345pub static NSRangeDateMode: NSDatePickerMode = NSDatePickerMode(NSDatePickerMode::Range.0);
347
348pub static NSHourMinuteDatePickerElementFlag: NSDatePickerElementFlags =
350 NSDatePickerElementFlags(NSDatePickerElementFlags::HourMinute.0);
351
352pub static NSHourMinuteSecondDatePickerElementFlag: NSDatePickerElementFlags =
354 NSDatePickerElementFlags(NSDatePickerElementFlags::HourMinuteSecond.0);
355
356pub static NSTimeZoneDatePickerElementFlag: NSDatePickerElementFlags =
358 NSDatePickerElementFlags(NSDatePickerElementFlags::TimeZone.0);
359
360pub static NSYearMonthDatePickerElementFlag: NSDatePickerElementFlags =
362 NSDatePickerElementFlags(NSDatePickerElementFlags::YearMonth.0);
363
364pub static NSYearMonthDayDatePickerElementFlag: NSDatePickerElementFlags =
366 NSDatePickerElementFlags(NSDatePickerElementFlags::YearMonthDay.0);
367
368pub static NSEraDatePickerElementFlag: NSDatePickerElementFlags =
370 NSDatePickerElementFlags(NSDatePickerElementFlags::Era.0);