objc2-app-kit 0.2.2

Bindings to the AppKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSScrubberLayoutAttributes;

    unsafe impl ClassType for NSScrubberLayoutAttributes {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl NSCopying for NSScrubberLayoutAttributes {}

unsafe impl NSObjectProtocol for NSScrubberLayoutAttributes {}

extern_methods!(
    unsafe impl NSScrubberLayoutAttributes {
        #[method(itemIndex)]
        pub unsafe fn itemIndex(&self) -> NSInteger;

        #[method(setItemIndex:)]
        pub unsafe fn setItemIndex(&self, item_index: NSInteger);

        #[method(frame)]
        pub unsafe fn frame(&self) -> NSRect;

        #[method(setFrame:)]
        pub unsafe fn setFrame(&self, frame: NSRect);

        #[method(alpha)]
        pub unsafe fn alpha(&self) -> CGFloat;

        #[method(setAlpha:)]
        pub unsafe fn setAlpha(&self, alpha: CGFloat);

        #[method_id(@__retain_semantics Other layoutAttributesForItemAtIndex:)]
        pub unsafe fn layoutAttributesForItemAtIndex(index: NSInteger) -> Retained<Self>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl NSScrubberLayoutAttributes {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSScrubberLayout;

    unsafe impl ClassType for NSScrubberLayout {
        type Super = NSObject;
        type Mutability = MainThreadOnly;
    }
);

unsafe impl NSCoding for NSScrubberLayout {}

unsafe impl NSObjectProtocol for NSScrubberLayout {}

extern_methods!(
    unsafe impl NSScrubberLayout {
        #[method(layoutAttributesClass)]
        pub unsafe fn layoutAttributesClass(mtm: MainThreadMarker) -> &'static AnyClass;

        #[cfg(all(feature = "NSResponder", feature = "NSScrubber", feature = "NSView"))]
        #[method_id(@__retain_semantics Other scrubber)]
        pub unsafe fn scrubber(&self) -> Option<Retained<NSScrubber>>;

        #[method(visibleRect)]
        pub unsafe fn visibleRect(&self) -> NSRect;

        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;

        #[method(invalidateLayout)]
        pub unsafe fn invalidateLayout(&self);

        #[method(prepareLayout)]
        pub unsafe fn prepareLayout(&self);

        #[method(scrubberContentSize)]
        pub unsafe fn scrubberContentSize(&self) -> NSSize;

        #[method_id(@__retain_semantics Other layoutAttributesForItemAtIndex:)]
        pub unsafe fn layoutAttributesForItemAtIndex(
            &self,
            index: NSInteger,
        ) -> Option<Retained<NSScrubberLayoutAttributes>>;

        #[method_id(@__retain_semantics Other layoutAttributesForItemsInRect:)]
        pub unsafe fn layoutAttributesForItemsInRect(
            &self,
            rect: NSRect,
        ) -> Retained<NSSet<NSScrubberLayoutAttributes>>;

        #[method(shouldInvalidateLayoutForSelectionChange)]
        pub unsafe fn shouldInvalidateLayoutForSelectionChange(&self) -> bool;

        #[method(shouldInvalidateLayoutForHighlightChange)]
        pub unsafe fn shouldInvalidateLayoutForHighlightChange(&self) -> bool;

        #[method(shouldInvalidateLayoutForChangeFromVisibleRect:toVisibleRect:)]
        pub unsafe fn shouldInvalidateLayoutForChangeFromVisibleRect_toVisibleRect(
            &self,
            from_visible_rect: NSRect,
            to_visible_rect: NSRect,
        ) -> bool;

        #[method(automaticallyMirrorsInRightToLeftLayout)]
        pub unsafe fn automaticallyMirrorsInRightToLeftLayout(&self) -> bool;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl NSScrubberLayout {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    }
);

extern_protocol!(
    #[cfg(feature = "NSScrubber")]
    pub unsafe trait NSScrubberFlowLayoutDelegate: NSScrubberDelegate {
        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method(scrubber:layout:sizeForItemAtIndex:)]
        unsafe fn scrubber_layout_sizeForItemAtIndex(
            &self,
            scrubber: &NSScrubber,
            layout: &NSScrubberFlowLayout,
            item_index: NSInteger,
        ) -> NSSize;
    }

    #[cfg(feature = "NSScrubber")]
    unsafe impl ProtocolType for dyn NSScrubberFlowLayoutDelegate {}
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSScrubberFlowLayout;

    unsafe impl ClassType for NSScrubberFlowLayout {
        #[inherits(NSObject)]
        type Super = NSScrubberLayout;
        type Mutability = MainThreadOnly;
    }
);

unsafe impl NSCoding for NSScrubberFlowLayout {}

unsafe impl NSObjectProtocol for NSScrubberFlowLayout {}

extern_methods!(
    unsafe impl NSScrubberFlowLayout {
        #[method(itemSpacing)]
        pub unsafe fn itemSpacing(&self) -> CGFloat;

        #[method(setItemSpacing:)]
        pub unsafe fn setItemSpacing(&self, item_spacing: CGFloat);

        #[method(itemSize)]
        pub unsafe fn itemSize(&self) -> NSSize;

        #[method(setItemSize:)]
        pub unsafe fn setItemSize(&self, item_size: NSSize);

        #[method(invalidateLayoutForItemsAtIndexes:)]
        pub unsafe fn invalidateLayoutForItemsAtIndexes(&self, invalid_item_indexes: &NSIndexSet);
    }
);

extern_methods!(
    /// Methods declared on superclass `NSScrubberLayout`
    unsafe impl NSScrubberFlowLayout {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl NSScrubberFlowLayout {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSScrubberProportionalLayout;

    unsafe impl ClassType for NSScrubberProportionalLayout {
        #[inherits(NSObject)]
        type Super = NSScrubberLayout;
        type Mutability = MainThreadOnly;
    }
);

unsafe impl NSCoding for NSScrubberProportionalLayout {}

unsafe impl NSObjectProtocol for NSScrubberProportionalLayout {}

extern_methods!(
    unsafe impl NSScrubberProportionalLayout {
        #[method(numberOfVisibleItems)]
        pub unsafe fn numberOfVisibleItems(&self) -> NSInteger;

        #[method(setNumberOfVisibleItems:)]
        pub unsafe fn setNumberOfVisibleItems(&self, number_of_visible_items: NSInteger);

        #[method_id(@__retain_semantics Init initWithNumberOfVisibleItems:)]
        pub unsafe fn initWithNumberOfVisibleItems(
            this: Allocated<Self>,
            number_of_visible_items: NSInteger,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSScrubberLayout`
    unsafe impl NSScrubberProportionalLayout {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl NSScrubberProportionalLayout {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    }
);