//! 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::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrulermarker?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSRulerMarker;
);

extern_conformance!(
    unsafe impl NSCoding for NSRulerMarker {}
);

extern_conformance!(
    unsafe impl NSCopying for NSRulerMarker {}
);

unsafe impl CopyingHelper for NSRulerMarker {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for NSRulerMarker {}
);

impl NSRulerMarker {
    extern_methods!(
        #[cfg(all(
            feature = "NSImage",
            feature = "NSResponder",
            feature = "NSRulerView",
            feature = "NSView",
            feature = "objc2-core-foundation"
        ))]
        /// ************************** Initialization ***************************
        #[unsafe(method(initWithRulerView:markerLocation:image:imageOrigin:))]
        #[unsafe(method_family = init)]
        pub fn initWithRulerView_markerLocation_image_imageOrigin(
            this: Allocated<Self>,
            ruler: &NSRulerView,
            location: CGFloat,
            image: &NSImage,
            image_origin: NSPoint,
        ) -> Retained<Self>;

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

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(all(feature = "NSResponder", feature = "NSRulerView", feature = "NSView"))]
        /// ********************* Query/Set basic attributes **********************
        #[unsafe(method(ruler))]
        #[unsafe(method_family = none)]
        pub fn ruler(&self, mtm: MainThreadMarker) -> Option<Retained<NSRulerView>>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(markerLocation))]
        #[unsafe(method_family = none)]
        pub fn markerLocation(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`markerLocation`][Self::markerLocation].
        #[unsafe(method(setMarkerLocation:))]
        #[unsafe(method_family = none)]
        pub fn setMarkerLocation(&self, marker_location: CGFloat);

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

        #[cfg(feature = "NSImage")]
        /// Setter for [`image`][Self::image].
        #[unsafe(method(setImage:))]
        #[unsafe(method_family = none)]
        pub fn setImage(&self, image: &NSImage);

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

        /// Setter for [`imageOrigin`][Self::imageOrigin].
        #[unsafe(method(setImageOrigin:))]
        #[unsafe(method_family = none)]
        pub fn setImageOrigin(&self, image_origin: NSPoint);

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

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

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

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

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

        #[unsafe(method(representedObject))]
        #[unsafe(method_family = none)]
        pub fn representedObject(&self) -> Option<Retained<ProtocolObject<dyn NSCopying>>>;

        /// Setter for [`representedObject`][Self::representedObject].
        ///
        /// # Safety
        ///
        /// `represented_object` should be of the correct type.
        #[unsafe(method(setRepresentedObject:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setRepresentedObject(
            &self,
            represented_object: Option<&ProtocolObject<dyn NSCopying>>,
        );

        /// ************************ Ruler facilities *************************
        #[unsafe(method(imageRectInRuler))]
        #[unsafe(method_family = none)]
        pub fn imageRectInRuler(&self) -> NSRect;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(thicknessRequiredInRuler))]
        #[unsafe(method_family = none)]
        pub fn thicknessRequiredInRuler(&self) -> CGFloat;

        #[unsafe(method(drawRect:))]
        #[unsafe(method_family = none)]
        pub fn drawRect(&self, rect: NSRect);

        #[cfg(feature = "NSEvent")]
        #[unsafe(method(trackMouse:adding:))]
        #[unsafe(method_family = none)]
        pub fn trackMouse_adding(&self, mouse_down_event: &NSEvent, is_adding: bool) -> bool;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSRulerMarker {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}
