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_enum!(
    #[underlying(NSInteger)]
    pub enum NSTextCursorAccessoryPlacement {
        NSTextCursorAccessoryPlacementUnspecified = 0,
        NSTextCursorAccessoryPlacementBackward = 1,
        NSTextCursorAccessoryPlacementForward = 2,
        NSTextCursorAccessoryPlacementInvisible = 3,
        NSTextCursorAccessoryPlacementCenter = 4,
        NSTextCursorAccessoryPlacementOffscreenLeft = 5,
        NSTextCursorAccessoryPlacementOffscreenTop = 6,
        NSTextCursorAccessoryPlacementOffscreenRight = 7,
        NSTextCursorAccessoryPlacementOffscreenBottom = 8,
    }
);

extern_protocol!(
    pub unsafe trait NSTextInputClient {
        #[method(insertText:replacementRange:)]
        unsafe fn insertText_replacementRange(
            &self,
            string: &AnyObject,
            replacement_range: NSRange,
        );

        #[method(doCommandBySelector:)]
        unsafe fn doCommandBySelector(&self, selector: Sel);

        #[method(setMarkedText:selectedRange:replacementRange:)]
        unsafe fn setMarkedText_selectedRange_replacementRange(
            &self,
            string: &AnyObject,
            selected_range: NSRange,
            replacement_range: NSRange,
        );

        #[method(unmarkText)]
        unsafe fn unmarkText(&self);

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

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

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

        #[cfg(feature = "Foundation_NSAttributedString")]
        #[method_id(@__retain_semantics Other attributedSubstringForProposedRange:actualRange:)]
        unsafe fn attributedSubstringForProposedRange_actualRange(
            &self,
            range: NSRange,
            actual_range: NSRangePointer,
        ) -> Option<Id<NSAttributedString>>;

        #[cfg(feature = "Foundation_NSArray")]
        #[method_id(@__retain_semantics Other validAttributesForMarkedText)]
        unsafe fn validAttributesForMarkedText(&self) -> Id<NSArray<NSAttributedStringKey>>;

        #[method(firstRectForCharacterRange:actualRange:)]
        unsafe fn firstRectForCharacterRange_actualRange(
            &self,
            range: NSRange,
            actual_range: NSRangePointer,
        ) -> NSRect;

        #[method(characterIndexForPoint:)]
        unsafe fn characterIndexForPoint(&self, point: NSPoint) -> NSUInteger;

        #[cfg(feature = "Foundation_NSAttributedString")]
        #[optional]
        #[method_id(@__retain_semantics Other attributedString)]
        unsafe fn attributedString(&self) -> Id<NSAttributedString>;

        #[optional]
        #[method(fractionOfDistanceThroughGlyphForPoint:)]
        unsafe fn fractionOfDistanceThroughGlyphForPoint(&self, point: NSPoint) -> CGFloat;

        #[optional]
        #[method(baselineDeltaForCharacterAtIndex:)]
        unsafe fn baselineDeltaForCharacterAtIndex(&self, an_index: NSUInteger) -> CGFloat;

        #[optional]
        #[method(windowLevel)]
        unsafe fn windowLevel(&self) -> NSInteger;

        #[optional]
        #[method(drawsVerticallyForCharacterAtIndex:)]
        unsafe fn drawsVerticallyForCharacterAtIndex(&self, char_index: NSUInteger) -> bool;

        #[optional]
        #[method(preferredTextAccessoryPlacement)]
        unsafe fn preferredTextAccessoryPlacement(&self) -> NSTextCursorAccessoryPlacement;

        #[optional]
        #[method(unionRectInVisibleSelectedRange)]
        unsafe fn unionRectInVisibleSelectedRange(&self) -> NSRect;

        #[optional]
        #[method(documentVisibleRect)]
        unsafe fn documentVisibleRect(&self) -> NSRect;
    }

    unsafe impl ProtocolType for dyn NSTextInputClient {}
);