use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTextCursorAccessoryPlacement(pub NSInteger);
impl NSTextCursorAccessoryPlacement {
#[doc(alias = "NSTextCursorAccessoryPlacementUnspecified")]
pub const Unspecified: Self = Self(0);
#[doc(alias = "NSTextCursorAccessoryPlacementBackward")]
pub const Backward: Self = Self(1);
#[doc(alias = "NSTextCursorAccessoryPlacementForward")]
pub const Forward: Self = Self(2);
#[doc(alias = "NSTextCursorAccessoryPlacementInvisible")]
pub const Invisible: Self = Self(3);
#[doc(alias = "NSTextCursorAccessoryPlacementCenter")]
pub const Center: Self = Self(4);
#[doc(alias = "NSTextCursorAccessoryPlacementOffscreenLeft")]
pub const OffscreenLeft: Self = Self(5);
#[doc(alias = "NSTextCursorAccessoryPlacementOffscreenTop")]
pub const OffscreenTop: Self = Self(6);
#[doc(alias = "NSTextCursorAccessoryPlacementOffscreenRight")]
pub const OffscreenRight: Self = Self(7);
#[doc(alias = "NSTextCursorAccessoryPlacementOffscreenBottom")]
pub const OffscreenBottom: Self = Self(8);
}
unsafe impl Encode for NSTextCursorAccessoryPlacement {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSTextCursorAccessoryPlacement {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
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;
#[method_id(@__retain_semantics Other attributedSubstringForProposedRange:actualRange:)]
unsafe fn attributedSubstringForProposedRange_actualRange(
&self,
range: NSRange,
actual_range: NSRangePointer,
) -> Option<Retained<NSAttributedString>>;
#[method_id(@__retain_semantics Other validAttributesForMarkedText)]
unsafe fn validAttributesForMarkedText(&self) -> Retained<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;
#[optional]
#[method_id(@__retain_semantics Other attributedString)]
unsafe fn attributedString(&self) -> Retained<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 {}
);