icrate 0.1.2

Bindings to Apple's frameworks
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use crate::common::*;
use crate::AppKit::*;
use crate::CoreData::*;
use crate::Foundation::*;

ns_options!(
    #[underlying(NSUInteger)]
    pub enum NSTextStorageEditActions {
        NSTextStorageEditedAttributes = 1 << 0,
        NSTextStorageEditedCharacters = 1 << 1,
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "AppKit_NSTextStorage")]
    pub struct NSTextStorage;

    #[cfg(feature = "AppKit_NSTextStorage")]
    unsafe impl ClassType for NSTextStorage {
        #[inherits(NSAttributedString, NSObject)]
        type Super = NSMutableAttributedString;
        type Mutability = Mutable;
    }
);

#[cfg(feature = "AppKit_NSTextStorage")]
unsafe impl NSCoding for NSTextStorage {}

#[cfg(feature = "AppKit_NSTextStorage")]
unsafe impl NSObjectProtocol for NSTextStorage {}

#[cfg(feature = "AppKit_NSTextStorage")]
unsafe impl NSSecureCoding for NSTextStorage {}

extern_methods!(
    #[cfg(feature = "AppKit_NSTextStorage")]
    unsafe impl NSTextStorage {
        #[cfg(all(feature = "AppKit_NSLayoutManager", feature = "Foundation_NSArray"))]
        #[method_id(@__retain_semantics Other layoutManagers)]
        pub unsafe fn layoutManagers(&self) -> Id<NSArray<NSLayoutManager>>;

        #[cfg(feature = "AppKit_NSLayoutManager")]
        #[method(addLayoutManager:)]
        pub unsafe fn addLayoutManager(&mut self, a_layout_manager: &NSLayoutManager);

        #[cfg(feature = "AppKit_NSLayoutManager")]
        #[method(removeLayoutManager:)]
        pub unsafe fn removeLayoutManager(&mut self, a_layout_manager: &NSLayoutManager);

        #[method(editedMask)]
        pub unsafe fn editedMask(&self) -> NSTextStorageEditActions;

        #[method(editedRange)]
        pub unsafe fn editedRange(&self) -> NSRange;

        #[method(changeInLength)]
        pub unsafe fn changeInLength(&self) -> NSInteger;

        #[method_id(@__retain_semantics Other delegate)]
        pub unsafe fn delegate(&self) -> Option<Id<ProtocolObject<dyn NSTextStorageDelegate>>>;

        #[method(setDelegate:)]
        pub unsafe fn setDelegate(
            &mut self,
            delegate: Option<&ProtocolObject<dyn NSTextStorageDelegate>>,
        );

        #[method(edited:range:changeInLength:)]
        pub unsafe fn edited_range_changeInLength(
            &mut self,
            edited_mask: NSTextStorageEditActions,
            edited_range: NSRange,
            delta: NSInteger,
        );

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

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

        #[method(invalidateAttributesInRange:)]
        pub unsafe fn invalidateAttributesInRange(&mut self, range: NSRange);

        #[method(ensureAttributesAreFixedInRange:)]
        pub unsafe fn ensureAttributesAreFixedInRange(&mut self, range: NSRange);

        #[method_id(@__retain_semantics Other textStorageObserver)]
        pub unsafe fn textStorageObserver(
            &self,
        ) -> Option<Id<ProtocolObject<dyn NSTextStorageObserving>>>;

        #[method(setTextStorageObserver:)]
        pub unsafe fn setTextStorageObserver(
            &mut self,
            text_storage_observer: Option<&ProtocolObject<dyn NSTextStorageObserving>>,
        );
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(feature = "AppKit_NSTextStorage")]
    unsafe impl NSTextStorage {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;

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

extern_protocol!(
    pub unsafe trait NSTextStorageDelegate: NSObjectProtocol {
        #[cfg(feature = "AppKit_NSTextStorage")]
        #[optional]
        #[method(textStorage:willProcessEditing:range:changeInLength:)]
        unsafe fn textStorage_willProcessEditing_range_changeInLength(
            &self,
            text_storage: &NSTextStorage,
            edited_mask: NSTextStorageEditActions,
            edited_range: NSRange,
            delta: NSInteger,
        );

        #[cfg(feature = "AppKit_NSTextStorage")]
        #[optional]
        #[method(textStorage:didProcessEditing:range:changeInLength:)]
        unsafe fn textStorage_didProcessEditing_range_changeInLength(
            &self,
            text_storage: &NSTextStorage,
            edited_mask: NSTextStorageEditActions,
            edited_range: NSRange,
            delta: NSInteger,
        );
    }

    unsafe impl ProtocolType for dyn NSTextStorageDelegate {}
);

extern_static!(NSTextStorageWillProcessEditingNotification: &'static NSNotificationName);

extern_static!(NSTextStorageDidProcessEditingNotification: &'static NSNotificationName);

extern_protocol!(
    pub unsafe trait NSTextStorageObserving: NSObjectProtocol {
        #[cfg(feature = "AppKit_NSTextStorage")]
        #[method_id(@__retain_semantics Other textStorage)]
        unsafe fn textStorage(&self) -> Option<Id<NSTextStorage>>;

        #[cfg(feature = "AppKit_NSTextStorage")]
        #[method(setTextStorage:)]
        unsafe fn setTextStorage(&self, text_storage: Option<&NSTextStorage>);

        #[cfg(feature = "AppKit_NSTextStorage")]
        #[method(processEditingForTextStorage:edited:range:changeInLength:invalidatedRange:)]
        unsafe fn processEditingForTextStorage_edited_range_changeInLength_invalidatedRange(
            &self,
            text_storage: &NSTextStorage,
            edit_mask: NSTextStorageEditActions,
            new_char_range: NSRange,
            delta: NSInteger,
            invalidated_char_range: NSRange,
        );

        #[cfg(feature = "AppKit_NSTextStorage")]
        #[method(performEditingTransactionForTextStorage:usingBlock:)]
        unsafe fn performEditingTransactionForTextStorage_usingBlock(
            &self,
            text_storage: &NSTextStorage,
            transaction: &Block<(), ()>,
        );
    }

    unsafe impl ProtocolType for dyn NSTextStorageObserving {}
);

pub type NSTextStorageEditedOptions = NSUInteger;