//! 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::*;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrulerorientation?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSRulerOrientation(pub NSUInteger);
impl NSRulerOrientation {
    #[doc(alias = "NSHorizontalRuler")]
    pub const HorizontalRuler: Self = Self(0);
    #[doc(alias = "NSVerticalRuler")]
    pub const VerticalRuler: Self = Self(1);
}

unsafe impl Encode for NSRulerOrientation {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSRulerOrientation {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrulerviewunitname?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
pub type NSRulerViewUnitName = NSString;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrulerviewunitinches?language=objc)
    pub static NSRulerViewUnitInches: &'static NSRulerViewUnitName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrulerviewunitcentimeters?language=objc)
    pub static NSRulerViewUnitCentimeters: &'static NSRulerViewUnitName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrulerviewunitpoints?language=objc)
    pub static NSRulerViewUnitPoints: &'static NSRulerViewUnitName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsrulerviewunitpicas?language=objc)
    pub static NSRulerViewUnitPicas: &'static NSRulerViewUnitName;
}

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

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

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

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

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

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

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

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

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

#[cfg(all(feature = "NSResponder", feature = "NSView"))]
impl NSRulerView {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        /// *********************** Registering new units ************************
        #[unsafe(method(registerUnitWithName:abbreviation:unitToPointsConversionFactor:stepUpCycle:stepDownCycle:))]
        #[unsafe(method_family = none)]
        pub fn registerUnitWithName_abbreviation_unitToPointsConversionFactor_stepUpCycle_stepDownCycle(
            unit_name: &NSRulerViewUnitName,
            abbreviation: &NSString,
            conversion_factor: CGFloat,
            step_up_cycle: &NSArray<NSNumber>,
            step_down_cycle: &NSArray<NSNumber>,
            mtm: MainThreadMarker,
        );

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

        #[cfg(feature = "NSScrollView")]
        #[unsafe(method(initWithScrollView:orientation:))]
        #[unsafe(method_family = init)]
        pub fn initWithScrollView_orientation(
            this: Allocated<Self>,
            scroll_view: Option<&NSScrollView>,
            orientation: NSRulerOrientation,
        ) -> Retained<Self>;

        #[cfg(feature = "NSScrollView")]
        /// ************************** Basic setup ***************************
        #[unsafe(method(scrollView))]
        #[unsafe(method_family = none)]
        pub fn scrollView(&self) -> Option<Retained<NSScrollView>>;

        #[cfg(feature = "NSScrollView")]
        /// Setter for [`scrollView`][Self::scrollView].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setScrollView:))]
        #[unsafe(method_family = none)]
        pub fn setScrollView(&self, scroll_view: Option<&NSScrollView>);

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

        /// Setter for [`orientation`][Self::orientation].
        #[unsafe(method(setOrientation:))]
        #[unsafe(method_family = none)]
        pub fn setOrientation(&self, orientation: NSRulerOrientation);

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

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

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

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

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

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

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

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

        /// ************************** Rule configuration ***************************
        #[unsafe(method(measurementUnits))]
        #[unsafe(method_family = none)]
        pub fn measurementUnits(&self) -> Retained<NSRulerViewUnitName>;

        /// Setter for [`measurementUnits`][Self::measurementUnits].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setMeasurementUnits:))]
        #[unsafe(method_family = none)]
        pub fn setMeasurementUnits(&self, measurement_units: &NSRulerViewUnitName);

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

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

        /// ************************** Client view setup ***************************
        #[unsafe(method(clientView))]
        #[unsafe(method_family = none)]
        pub fn clientView(&self) -> Option<Retained<NSView>>;

        /// Setter for [`clientView`][Self::clientView].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setClientView:))]
        #[unsafe(method_family = none)]
        pub fn setClientView(&self, client_view: Option<&NSView>);

        #[cfg(feature = "NSRulerMarker")]
        #[unsafe(method(addMarker:))]
        #[unsafe(method_family = none)]
        pub fn addMarker(&self, marker: &NSRulerMarker);

        #[cfg(feature = "NSRulerMarker")]
        #[unsafe(method(removeMarker:))]
        #[unsafe(method_family = none)]
        pub fn removeMarker(&self, marker: &NSRulerMarker);

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

        #[cfg(feature = "NSRulerMarker")]
        /// Setter for [`markers`][Self::markers].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setMarkers:))]
        #[unsafe(method_family = none)]
        pub fn setMarkers(&self, markers: Option<&NSArray<NSRulerMarker>>);

        #[cfg(all(feature = "NSEvent", feature = "NSRulerMarker"))]
        #[unsafe(method(trackMarker:withMouseEvent:))]
        #[unsafe(method_family = none)]
        pub fn trackMarker_withMouseEvent(&self, marker: &NSRulerMarker, event: &NSEvent) -> bool;

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

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

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(moveRulerlineFromLocation:toLocation:))]
        #[unsafe(method_family = none)]
        pub fn moveRulerlineFromLocation_toLocation(
            &self,
            old_location: CGFloat,
            new_location: CGFloat,
        );

        /// ********************* Drawing and hash invalidation **********************
        #[unsafe(method(invalidateHashMarks))]
        #[unsafe(method_family = none)]
        pub fn invalidateHashMarks(&self);

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

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

        /// ************************** Key overrides ***************************
        #[unsafe(method(isFlipped))]
        #[unsafe(method_family = none)]
        pub fn isFlipped(&self) -> bool;
    );
}

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

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

/// NSRulerMarkerClientViewDelegation.
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
impl NSView {
    extern_methods!(
        #[cfg(feature = "NSRulerMarker")]
        #[unsafe(method(rulerView:shouldMoveMarker:))]
        #[unsafe(method_family = none)]
        pub fn rulerView_shouldMoveMarker(
            &self,
            ruler: &NSRulerView,
            marker: &NSRulerMarker,
        ) -> bool;

        #[cfg(all(feature = "NSRulerMarker", feature = "objc2-core-foundation"))]
        #[unsafe(method(rulerView:willMoveMarker:toLocation:))]
        #[unsafe(method_family = none)]
        pub fn rulerView_willMoveMarker_toLocation(
            &self,
            ruler: &NSRulerView,
            marker: &NSRulerMarker,
            location: CGFloat,
        ) -> CGFloat;

        #[cfg(feature = "NSRulerMarker")]
        #[unsafe(method(rulerView:didMoveMarker:))]
        #[unsafe(method_family = none)]
        pub fn rulerView_didMoveMarker(&self, ruler: &NSRulerView, marker: &NSRulerMarker);

        #[cfg(feature = "NSRulerMarker")]
        #[unsafe(method(rulerView:shouldRemoveMarker:))]
        #[unsafe(method_family = none)]
        pub fn rulerView_shouldRemoveMarker(
            &self,
            ruler: &NSRulerView,
            marker: &NSRulerMarker,
        ) -> bool;

        #[cfg(feature = "NSRulerMarker")]
        #[unsafe(method(rulerView:didRemoveMarker:))]
        #[unsafe(method_family = none)]
        pub fn rulerView_didRemoveMarker(&self, ruler: &NSRulerView, marker: &NSRulerMarker);

        #[cfg(feature = "NSRulerMarker")]
        #[unsafe(method(rulerView:shouldAddMarker:))]
        #[unsafe(method_family = none)]
        pub fn rulerView_shouldAddMarker(
            &self,
            ruler: &NSRulerView,
            marker: &NSRulerMarker,
        ) -> bool;

        #[cfg(all(feature = "NSRulerMarker", feature = "objc2-core-foundation"))]
        #[unsafe(method(rulerView:willAddMarker:atLocation:))]
        #[unsafe(method_family = none)]
        pub fn rulerView_willAddMarker_atLocation(
            &self,
            ruler: &NSRulerView,
            marker: &NSRulerMarker,
            location: CGFloat,
        ) -> CGFloat;

        #[cfg(feature = "NSRulerMarker")]
        #[unsafe(method(rulerView:didAddMarker:))]
        #[unsafe(method_family = none)]
        pub fn rulerView_didAddMarker(&self, ruler: &NSRulerView, marker: &NSRulerMarker);

        #[cfg(feature = "NSEvent")]
        #[unsafe(method(rulerView:handleMouseDown:))]
        #[unsafe(method_family = none)]
        pub fn rulerView_handleMouseDown(&self, ruler: &NSRulerView, event: &NSEvent);

        #[unsafe(method(rulerView:willSetClientView:))]
        #[unsafe(method_family = none)]
        pub fn rulerView_willSetClientView(&self, ruler: &NSRulerView, new_client: &NSView);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(rulerView:locationForPoint:))]
        #[unsafe(method_family = none)]
        pub fn rulerView_locationForPoint(&self, ruler: &NSRulerView, point: NSPoint) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(rulerView:pointForLocation:))]
        #[unsafe(method_family = none)]
        pub fn rulerView_pointForLocation(&self, ruler: &NSRulerView, point: CGFloat) -> NSPoint;
    );
}
