use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDrawerState(pub NSUInteger);
impl NSDrawerState {
#[doc(alias = "NSDrawerClosedState")]
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
pub const ClosedState: Self = Self(0);
#[doc(alias = "NSDrawerOpeningState")]
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
pub const OpeningState: Self = Self(1);
#[doc(alias = "NSDrawerOpenState")]
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
pub const OpenState: Self = Self(2);
#[doc(alias = "NSDrawerClosingState")]
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
pub const ClosingState: Self = Self(3);
}
unsafe impl Encode for NSDrawerState {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSDrawerState {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSResponder, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSResponder")]
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
pub struct NSDrawer;
);
#[cfg(all(feature = "NSAccessibilityProtocols", feature = "NSResponder"))]
extern_conformance!(
unsafe impl NSAccessibility for NSDrawer {}
);
#[cfg(all(feature = "NSAccessibilityProtocols", feature = "NSResponder"))]
extern_conformance!(
unsafe impl NSAccessibilityElementProtocol for NSDrawer {}
);
#[cfg(feature = "NSResponder")]
extern_conformance!(
unsafe impl NSCoding for NSDrawer {}
);
#[cfg(feature = "NSResponder")]
extern_conformance!(
unsafe impl NSObjectProtocol for NSDrawer {}
);
#[cfg(feature = "NSResponder")]
impl NSDrawer {
extern_methods!(
#[unsafe(method(initWithContentSize:preferredEdge:))]
#[unsafe(method_family = init)]
pub fn initWithContentSize_preferredEdge(
this: Allocated<Self>,
content_size: NSSize,
edge: NSRectEdge,
) -> Retained<Self>;
#[cfg(feature = "NSWindow")]
#[unsafe(method(parentWindow))]
#[unsafe(method_family = none)]
pub unsafe fn parentWindow(&self) -> Option<Retained<NSWindow>>;
#[cfg(feature = "NSWindow")]
#[unsafe(method(setParentWindow:))]
#[unsafe(method_family = none)]
pub unsafe fn setParentWindow(&self, parent_window: Option<&NSWindow>);
#[cfg(feature = "NSView")]
#[unsafe(method(contentView))]
#[unsafe(method_family = none)]
pub fn contentView(&self) -> Option<Retained<NSView>>;
#[cfg(feature = "NSView")]
#[unsafe(method(setContentView:))]
#[unsafe(method_family = none)]
pub fn setContentView(&self, content_view: Option<&NSView>);
#[unsafe(method(preferredEdge))]
#[unsafe(method_family = none)]
pub fn preferredEdge(&self) -> NSRectEdge;
#[unsafe(method(setPreferredEdge:))]
#[unsafe(method_family = none)]
pub fn setPreferredEdge(&self, preferred_edge: NSRectEdge);
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSDrawerDelegate>>>;
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSDrawerDelegate>>);
#[unsafe(method(open))]
#[unsafe(method_family = none)]
pub fn open(&self);
#[unsafe(method(openOnEdge:))]
#[unsafe(method_family = none)]
pub fn openOnEdge(&self, edge: NSRectEdge);
#[unsafe(method(close))]
#[unsafe(method_family = none)]
pub fn close(&self);
#[unsafe(method(open:))]
#[unsafe(method_family = none)]
pub unsafe fn open_(&self, sender: Option<&AnyObject>);
#[unsafe(method(close:))]
#[unsafe(method_family = none)]
pub unsafe fn close_(&self, sender: Option<&AnyObject>);
#[unsafe(method(toggle:))]
#[unsafe(method_family = none)]
pub unsafe fn toggle(&self, sender: Option<&AnyObject>);
#[unsafe(method(state))]
#[unsafe(method_family = none)]
pub fn state(&self) -> NSInteger;
#[unsafe(method(edge))]
#[unsafe(method_family = none)]
pub fn edge(&self) -> NSRectEdge;
#[unsafe(method(contentSize))]
#[unsafe(method_family = none)]
pub fn contentSize(&self) -> NSSize;
#[unsafe(method(setContentSize:))]
#[unsafe(method_family = none)]
pub fn setContentSize(&self, content_size: NSSize);
#[unsafe(method(minContentSize))]
#[unsafe(method_family = none)]
pub fn minContentSize(&self) -> NSSize;
#[unsafe(method(setMinContentSize:))]
#[unsafe(method_family = none)]
pub fn setMinContentSize(&self, min_content_size: NSSize);
#[unsafe(method(maxContentSize))]
#[unsafe(method_family = none)]
pub fn maxContentSize(&self) -> NSSize;
#[unsafe(method(setMaxContentSize:))]
#[unsafe(method_family = none)]
pub fn setMaxContentSize(&self, max_content_size: NSSize);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(leadingOffset))]
#[unsafe(method_family = none)]
pub fn leadingOffset(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setLeadingOffset:))]
#[unsafe(method_family = none)]
pub fn setLeadingOffset(&self, leading_offset: CGFloat);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(trailingOffset))]
#[unsafe(method_family = none)]
pub fn trailingOffset(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setTrailingOffset:))]
#[unsafe(method_family = none)]
pub fn setTrailingOffset(&self, trailing_offset: CGFloat);
);
}
#[cfg(feature = "NSResponder")]
impl NSDrawer {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
);
}
#[cfg(feature = "NSResponder")]
impl NSDrawer {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
impl NSWindow {
extern_methods!(
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
#[unsafe(method(drawers))]
#[unsafe(method_family = none)]
pub fn drawers(&self) -> Option<Retained<NSArray<NSDrawer>>>;
);
}
extern_protocol!(
pub unsafe trait NSDrawerDelegate: NSObjectProtocol {
#[cfg(feature = "NSResponder")]
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
#[optional]
#[unsafe(method(drawerShouldOpen:))]
#[unsafe(method_family = none)]
fn drawerShouldOpen(&self, sender: &NSDrawer) -> bool;
#[cfg(feature = "NSResponder")]
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
#[optional]
#[unsafe(method(drawerShouldClose:))]
#[unsafe(method_family = none)]
fn drawerShouldClose(&self, sender: &NSDrawer) -> bool;
#[cfg(feature = "NSResponder")]
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
#[optional]
#[unsafe(method(drawerWillResizeContents:toSize:))]
#[unsafe(method_family = none)]
fn drawerWillResizeContents_toSize(
&self,
sender: &NSDrawer,
content_size: NSSize,
) -> NSSize;
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
#[optional]
#[unsafe(method(drawerWillOpen:))]
#[unsafe(method_family = none)]
fn drawerWillOpen(&self, notification: &NSNotification);
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
#[optional]
#[unsafe(method(drawerDidOpen:))]
#[unsafe(method_family = none)]
fn drawerDidOpen(&self, notification: &NSNotification);
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
#[optional]
#[unsafe(method(drawerWillClose:))]
#[unsafe(method_family = none)]
fn drawerWillClose(&self, notification: &NSNotification);
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
#[optional]
#[unsafe(method(drawerDidClose:))]
#[unsafe(method_family = none)]
fn drawerDidClose(&self, notification: &NSNotification);
}
);
extern "C" {
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
pub static NSDrawerWillOpenNotification: &'static NSNotificationName;
}
extern "C" {
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
pub static NSDrawerDidOpenNotification: &'static NSNotificationName;
}
extern "C" {
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
pub static NSDrawerWillCloseNotification: &'static NSNotificationName;
}
extern "C" {
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
pub static NSDrawerDidCloseNotification: &'static NSNotificationName;
}