//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsclipview?language=objc)
    #[unsafe(super(NSView, NSResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
    pub struct NSClipView;
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSResponder",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSAccessibility for NSClipView {}
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSResponder",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSAccessibilityElementProtocol for NSClipView {}
);

#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
    unsafe impl NSAnimatablePropertyContainer for NSClipView {}
);

#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
    unsafe impl NSAppearanceCustomization for NSClipView {}
);

#[cfg(all(feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
    unsafe impl NSCoding for NSClipView {}
);

#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
    unsafe impl NSDraggingDestination for NSClipView {}
);

#[cfg(all(feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for NSClipView {}
);

#[cfg(all(
    feature = "NSResponder",
    feature = "NSUserInterfaceItemIdentification",
    feature = "NSView"
))]
extern_conformance!(
    unsafe impl NSUserInterfaceItemIdentification for NSClipView {}
);

#[cfg(all(feature = "NSResponder", feature = "NSView"))]
impl NSClipView {
    extern_methods!(
        #[cfg(feature = "NSColor")]
        #[unsafe(method(backgroundColor))]
        #[unsafe(method_family = none)]
        pub fn backgroundColor(&self) -> Retained<NSColor>;

        #[cfg(feature = "NSColor")]
        /// Setter for [`backgroundColor`][Self::backgroundColor].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setBackgroundColor:))]
        #[unsafe(method_family = none)]
        pub fn setBackgroundColor(&self, background_color: &NSColor);

        #[unsafe(method(drawsBackground))]
        #[unsafe(method_family = none)]
        pub fn drawsBackground(&self) -> bool;

        /// Setter for [`drawsBackground`][Self::drawsBackground].
        #[unsafe(method(setDrawsBackground:))]
        #[unsafe(method_family = none)]
        pub fn setDrawsBackground(&self, draws_background: bool);

        #[unsafe(method(documentView))]
        #[unsafe(method_family = none)]
        pub fn documentView(&self) -> Option<Retained<NSView>>;

        /// Setter for [`documentView`][Self::documentView].
        #[unsafe(method(setDocumentView:))]
        #[unsafe(method_family = none)]
        pub fn setDocumentView(&self, document_view: Option<&NSView>);

        #[unsafe(method(documentRect))]
        #[unsafe(method_family = none)]
        pub fn documentRect(&self) -> NSRect;

        #[cfg(feature = "NSCursor")]
        #[unsafe(method(documentCursor))]
        #[unsafe(method_family = none)]
        pub fn documentCursor(&self) -> Option<Retained<NSCursor>>;

        #[cfg(feature = "NSCursor")]
        /// Setter for [`documentCursor`][Self::documentCursor].
        #[unsafe(method(setDocumentCursor:))]
        #[unsafe(method_family = none)]
        pub fn setDocumentCursor(&self, document_cursor: Option<&NSCursor>);

        #[unsafe(method(documentVisibleRect))]
        #[unsafe(method_family = none)]
        pub fn documentVisibleRect(&self) -> NSRect;

        #[unsafe(method(viewFrameChanged:))]
        #[unsafe(method_family = none)]
        pub fn viewFrameChanged(&self, notification: &NSNotification);

        #[unsafe(method(viewBoundsChanged:))]
        #[unsafe(method_family = none)]
        pub fn viewBoundsChanged(&self, notification: &NSNotification);

        #[cfg(feature = "NSEvent")]
        #[unsafe(method(autoscroll:))]
        #[unsafe(method_family = none)]
        pub fn autoscroll(&self, event: &NSEvent) -> bool;

        #[unsafe(method(scrollToPoint:))]
        #[unsafe(method_family = none)]
        pub fn scrollToPoint(&self, new_origin: NSPoint);

        #[unsafe(method(constrainBoundsRect:))]
        #[unsafe(method_family = none)]
        pub fn constrainBoundsRect(&self, proposed_bounds: NSRect) -> NSRect;

        #[unsafe(method(contentInsets))]
        #[unsafe(method_family = none)]
        pub fn contentInsets(&self) -> NSEdgeInsets;

        /// Setter for [`contentInsets`][Self::contentInsets].
        #[unsafe(method(setContentInsets:))]
        #[unsafe(method_family = none)]
        pub fn setContentInsets(&self, content_insets: NSEdgeInsets);

        #[unsafe(method(automaticallyAdjustsContentInsets))]
        #[unsafe(method_family = none)]
        pub fn automaticallyAdjustsContentInsets(&self) -> bool;

        /// Setter for [`automaticallyAdjustsContentInsets`][Self::automaticallyAdjustsContentInsets].
        #[unsafe(method(setAutomaticallyAdjustsContentInsets:))]
        #[unsafe(method_family = none)]
        pub fn setAutomaticallyAdjustsContentInsets(
            &self,
            automatically_adjusts_content_insets: bool,
        );
    );
}

/// Methods declared on superclass `NSView`.
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
impl NSClipView {
    extern_methods!(
        #[unsafe(method(initWithFrame:))]
        #[unsafe(method_family = init)]
        pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

/// Methods declared on superclass `NSResponder`.
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
impl NSClipView {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
impl NSClipView {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}

/// NSClipViewSuperview.
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
impl NSView {
    extern_methods!(
        #[unsafe(method(reflectScrolledClipView:))]
        #[unsafe(method_family = none)]
        pub fn reflectScrolledClipView(&self, clip_view: &NSClipView);

        #[unsafe(method(scrollClipView:toPoint:))]
        #[unsafe(method_family = none)]
        pub fn scrollClipView_toPoint(&self, clip_view: &NSClipView, point: NSPoint);
    );
}

#[cfg(all(feature = "NSResponder", feature = "NSView"))]
impl NSClipView {
    extern_methods!(
        #[deprecated = "Use -constrainBoundsRect: instead."]
        #[unsafe(method(constrainScrollPoint:))]
        #[unsafe(method_family = none)]
        pub fn constrainScrollPoint(&self, new_origin: NSPoint) -> NSPoint;

        #[deprecated = "Setting this property has no effect.  NSClipView will always minimize the area of the document view that is invalidated.  To force invalidation of the document view, use -[NSView setNeedsDisplayInRect:]."]
        #[unsafe(method(copiesOnScroll))]
        #[unsafe(method_family = none)]
        pub fn copiesOnScroll(&self) -> bool;

        /// Setter for [`copiesOnScroll`][Self::copiesOnScroll].
        #[deprecated = "Setting this property has no effect.  NSClipView will always minimize the area of the document view that is invalidated.  To force invalidation of the document view, use -[NSView setNeedsDisplayInRect:]."]
        #[unsafe(method(setCopiesOnScroll:))]
        #[unsafe(method_family = none)]
        pub fn setCopiesOnScroll(&self, copies_on_scroll: bool);
    );
}
