use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDatePickerStyle(pub NSUInteger);
impl NSDatePickerStyle {
#[doc(alias = "NSDatePickerStyleTextFieldAndStepper")]
pub const TextFieldAndStepper: Self = Self(0);
#[doc(alias = "NSDatePickerStyleClockAndCalendar")]
pub const ClockAndCalendar: Self = Self(1);
#[doc(alias = "NSDatePickerStyleTextField")]
pub const TextField: Self = Self(2);
}
unsafe impl Encode for NSDatePickerStyle {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSDatePickerStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDatePickerMode(pub NSUInteger);
impl NSDatePickerMode {
#[doc(alias = "NSDatePickerModeSingle")]
pub const Single: Self = Self(0);
#[doc(alias = "NSDatePickerModeRange")]
pub const Range: Self = Self(1);
}
unsafe impl Encode for NSDatePickerMode {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSDatePickerMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDatePickerElementFlags(pub NSUInteger);
bitflags::bitflags! {
impl NSDatePickerElementFlags: NSUInteger {
#[doc(alias = "NSDatePickerElementFlagHourMinute")]
const HourMinute = 0x000c;
#[doc(alias = "NSDatePickerElementFlagHourMinuteSecond")]
const HourMinuteSecond = 0x000e;
#[doc(alias = "NSDatePickerElementFlagTimeZone")]
const TimeZone = 0x0010;
#[doc(alias = "NSDatePickerElementFlagYearMonth")]
const YearMonth = 0x00c0;
#[doc(alias = "NSDatePickerElementFlagYearMonthDay")]
const YearMonthDay = 0x00e0;
#[doc(alias = "NSDatePickerElementFlagEra")]
const Era = 0x0100;
}
}
unsafe impl Encode for NSDatePickerElementFlags {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSDatePickerElementFlags {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSActionCell, NSCell, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
pub struct NSDatePickerCell;
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSActionCell",
feature = "NSCell"
))]
extern_conformance!(
unsafe impl NSAccessibility for NSDatePickerCell {}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSActionCell",
feature = "NSCell"
))]
extern_conformance!(
unsafe impl NSAccessibilityElementProtocol for NSDatePickerCell {}
);
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
extern_conformance!(
unsafe impl NSCoding for NSDatePickerCell {}
);
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
extern_conformance!(
unsafe impl NSCopying for NSDatePickerCell {}
);
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl CopyingHelper for NSDatePickerCell {
type Result = Self;
}
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
extern_conformance!(
unsafe impl NSObjectProtocol for NSDatePickerCell {}
);
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSUserInterfaceItemIdentification"
))]
extern_conformance!(
unsafe impl NSUserInterfaceItemIdentification for NSDatePickerCell {}
);
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
impl NSDatePickerCell {
extern_methods!(
#[unsafe(method(initTextCell:))]
#[unsafe(method_family = init)]
pub fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
#[cfg(feature = "NSImage")]
#[unsafe(method(initImageCell:))]
#[unsafe(method_family = init)]
pub unsafe fn initImageCell(
this: Allocated<Self>,
image: Option<&NSImage>,
) -> Retained<Self>;
#[unsafe(method(datePickerStyle))]
#[unsafe(method_family = none)]
pub fn datePickerStyle(&self) -> NSDatePickerStyle;
#[unsafe(method(setDatePickerStyle:))]
#[unsafe(method_family = none)]
pub fn setDatePickerStyle(&self, date_picker_style: NSDatePickerStyle);
#[unsafe(method(drawsBackground))]
#[unsafe(method_family = none)]
pub fn drawsBackground(&self) -> bool;
#[unsafe(method(setDrawsBackground:))]
#[unsafe(method_family = none)]
pub fn setDrawsBackground(&self, draws_background: bool);
#[cfg(feature = "NSColor")]
#[unsafe(method(backgroundColor))]
#[unsafe(method_family = none)]
pub fn backgroundColor(&self) -> Retained<NSColor>;
#[cfg(feature = "NSColor")]
#[unsafe(method(setBackgroundColor:))]
#[unsafe(method_family = none)]
pub fn setBackgroundColor(&self, background_color: &NSColor);
#[cfg(feature = "NSColor")]
#[unsafe(method(textColor))]
#[unsafe(method_family = none)]
pub fn textColor(&self) -> Retained<NSColor>;
#[cfg(feature = "NSColor")]
#[unsafe(method(setTextColor:))]
#[unsafe(method_family = none)]
pub fn setTextColor(&self, text_color: &NSColor);
#[unsafe(method(datePickerMode))]
#[unsafe(method_family = none)]
pub fn datePickerMode(&self) -> NSDatePickerMode;
#[unsafe(method(setDatePickerMode:))]
#[unsafe(method_family = none)]
pub fn setDatePickerMode(&self, date_picker_mode: NSDatePickerMode);
#[unsafe(method(datePickerElements))]
#[unsafe(method_family = none)]
pub fn datePickerElements(&self) -> NSDatePickerElementFlags;
#[unsafe(method(setDatePickerElements:))]
#[unsafe(method_family = none)]
pub fn setDatePickerElements(&self, date_picker_elements: NSDatePickerElementFlags);
#[unsafe(method(calendar))]
#[unsafe(method_family = none)]
pub fn calendar(&self) -> Option<Retained<NSCalendar>>;
#[unsafe(method(setCalendar:))]
#[unsafe(method_family = none)]
pub fn setCalendar(&self, calendar: Option<&NSCalendar>);
#[unsafe(method(locale))]
#[unsafe(method_family = none)]
pub fn locale(&self) -> Option<Retained<NSLocale>>;
#[unsafe(method(setLocale:))]
#[unsafe(method_family = none)]
pub fn setLocale(&self, locale: Option<&NSLocale>);
#[unsafe(method(timeZone))]
#[unsafe(method_family = none)]
pub fn timeZone(&self) -> Option<Retained<NSTimeZone>>;
#[unsafe(method(setTimeZone:))]
#[unsafe(method_family = none)]
pub fn setTimeZone(&self, time_zone: Option<&NSTimeZone>);
#[unsafe(method(dateValue))]
#[unsafe(method_family = none)]
pub fn dateValue(&self) -> Retained<NSDate>;
#[unsafe(method(setDateValue:))]
#[unsafe(method_family = none)]
pub fn setDateValue(&self, date_value: &NSDate);
#[unsafe(method(timeInterval))]
#[unsafe(method_family = none)]
pub fn timeInterval(&self) -> NSTimeInterval;
#[unsafe(method(setTimeInterval:))]
#[unsafe(method_family = none)]
pub fn setTimeInterval(&self, time_interval: NSTimeInterval);
#[unsafe(method(minDate))]
#[unsafe(method_family = none)]
pub fn minDate(&self) -> Option<Retained<NSDate>>;
#[unsafe(method(setMinDate:))]
#[unsafe(method_family = none)]
pub fn setMinDate(&self, min_date: Option<&NSDate>);
#[unsafe(method(maxDate))]
#[unsafe(method_family = none)]
pub fn maxDate(&self) -> Option<Retained<NSDate>>;
#[unsafe(method(setMaxDate:))]
#[unsafe(method_family = none)]
pub fn setMaxDate(&self, max_date: Option<&NSDate>);
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSDatePickerCellDelegate>>>;
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSDatePickerCellDelegate>>);
);
}
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
impl NSDatePickerCell {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
impl NSDatePickerCell {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
extern_protocol!(
pub unsafe trait NSDatePickerCellDelegate: NSObjectProtocol + MainThreadOnly {
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
#[optional]
#[unsafe(method(datePickerCell:validateProposedDateValue:timeInterval:))]
#[unsafe(method_family = none)]
unsafe fn datePickerCell_validateProposedDateValue_timeInterval(
&self,
date_picker_cell: &NSDatePickerCell,
proposed_date_value: &mut Retained<NSDate>,
proposed_time_interval: *mut NSTimeInterval,
);
}
);
#[deprecated]
pub static NSTextFieldAndStepperDatePickerStyle: NSDatePickerStyle =
NSDatePickerStyle(NSDatePickerStyle::TextFieldAndStepper.0);
#[deprecated]
pub static NSClockAndCalendarDatePickerStyle: NSDatePickerStyle =
NSDatePickerStyle(NSDatePickerStyle::ClockAndCalendar.0);
#[deprecated]
pub static NSTextFieldDatePickerStyle: NSDatePickerStyle =
NSDatePickerStyle(NSDatePickerStyle::TextField.0);
#[deprecated]
pub static NSSingleDateMode: NSDatePickerMode = NSDatePickerMode(NSDatePickerMode::Single.0);
#[deprecated]
pub static NSRangeDateMode: NSDatePickerMode = NSDatePickerMode(NSDatePickerMode::Range.0);
#[deprecated]
pub static NSHourMinuteDatePickerElementFlag: NSDatePickerElementFlags =
NSDatePickerElementFlags(NSDatePickerElementFlags::HourMinute.0);
#[deprecated]
pub static NSHourMinuteSecondDatePickerElementFlag: NSDatePickerElementFlags =
NSDatePickerElementFlags(NSDatePickerElementFlags::HourMinuteSecond.0);
#[deprecated]
pub static NSTimeZoneDatePickerElementFlag: NSDatePickerElementFlags =
NSDatePickerElementFlags(NSDatePickerElementFlags::TimeZone.0);
#[deprecated]
pub static NSYearMonthDatePickerElementFlag: NSDatePickerElementFlags =
NSDatePickerElementFlags(NSDatePickerElementFlags::YearMonth.0);
#[deprecated]
pub static NSYearMonthDayDatePickerElementFlag: NSDatePickerElementFlags =
NSDatePickerElementFlags(NSDatePickerElementFlags::YearMonthDay.0);
#[deprecated]
pub static NSEraDatePickerElementFlag: NSDatePickerElementFlags =
NSDatePickerElementFlags(NSDatePickerElementFlags::Era.0);