icrate/generated/AppKit/
NSTextInputClient.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use crate::common::*;
4use crate::AppKit::*;
5use crate::CoreData::*;
6use crate::Foundation::*;
7
8ns_enum!(
9    #[underlying(NSInteger)]
10    pub enum NSTextCursorAccessoryPlacement {
11        NSTextCursorAccessoryPlacementUnspecified = 0,
12        NSTextCursorAccessoryPlacementBackward = 1,
13        NSTextCursorAccessoryPlacementForward = 2,
14        NSTextCursorAccessoryPlacementInvisible = 3,
15        NSTextCursorAccessoryPlacementCenter = 4,
16        NSTextCursorAccessoryPlacementOffscreenLeft = 5,
17        NSTextCursorAccessoryPlacementOffscreenTop = 6,
18        NSTextCursorAccessoryPlacementOffscreenRight = 7,
19        NSTextCursorAccessoryPlacementOffscreenBottom = 8,
20    }
21);
22
23extern_protocol!(
24    pub unsafe trait NSTextInputClient {
25        #[method(insertText:replacementRange:)]
26        unsafe fn insertText_replacementRange(
27            &self,
28            string: &AnyObject,
29            replacement_range: NSRange,
30        );
31
32        #[method(doCommandBySelector:)]
33        unsafe fn doCommandBySelector(&self, selector: Sel);
34
35        #[method(setMarkedText:selectedRange:replacementRange:)]
36        unsafe fn setMarkedText_selectedRange_replacementRange(
37            &self,
38            string: &AnyObject,
39            selected_range: NSRange,
40            replacement_range: NSRange,
41        );
42
43        #[method(unmarkText)]
44        unsafe fn unmarkText(&self);
45
46        #[method(selectedRange)]
47        unsafe fn selectedRange(&self) -> NSRange;
48
49        #[method(markedRange)]
50        unsafe fn markedRange(&self) -> NSRange;
51
52        #[method(hasMarkedText)]
53        unsafe fn hasMarkedText(&self) -> bool;
54
55        #[cfg(feature = "Foundation_NSAttributedString")]
56        #[method_id(@__retain_semantics Other attributedSubstringForProposedRange:actualRange:)]
57        unsafe fn attributedSubstringForProposedRange_actualRange(
58            &self,
59            range: NSRange,
60            actual_range: NSRangePointer,
61        ) -> Option<Id<NSAttributedString>>;
62
63        #[cfg(feature = "Foundation_NSArray")]
64        #[method_id(@__retain_semantics Other validAttributesForMarkedText)]
65        unsafe fn validAttributesForMarkedText(&self) -> Id<NSArray<NSAttributedStringKey>>;
66
67        #[method(firstRectForCharacterRange:actualRange:)]
68        unsafe fn firstRectForCharacterRange_actualRange(
69            &self,
70            range: NSRange,
71            actual_range: NSRangePointer,
72        ) -> NSRect;
73
74        #[method(characterIndexForPoint:)]
75        unsafe fn characterIndexForPoint(&self, point: NSPoint) -> NSUInteger;
76
77        #[cfg(feature = "Foundation_NSAttributedString")]
78        #[optional]
79        #[method_id(@__retain_semantics Other attributedString)]
80        unsafe fn attributedString(&self) -> Id<NSAttributedString>;
81
82        #[optional]
83        #[method(fractionOfDistanceThroughGlyphForPoint:)]
84        unsafe fn fractionOfDistanceThroughGlyphForPoint(&self, point: NSPoint) -> CGFloat;
85
86        #[optional]
87        #[method(baselineDeltaForCharacterAtIndex:)]
88        unsafe fn baselineDeltaForCharacterAtIndex(&self, an_index: NSUInteger) -> CGFloat;
89
90        #[optional]
91        #[method(windowLevel)]
92        unsafe fn windowLevel(&self) -> NSInteger;
93
94        #[optional]
95        #[method(drawsVerticallyForCharacterAtIndex:)]
96        unsafe fn drawsVerticallyForCharacterAtIndex(&self, char_index: NSUInteger) -> bool;
97
98        #[optional]
99        #[method(preferredTextAccessoryPlacement)]
100        unsafe fn preferredTextAccessoryPlacement(&self) -> NSTextCursorAccessoryPlacement;
101
102        #[optional]
103        #[method(unionRectInVisibleSelectedRange)]
104        unsafe fn unionRectInVisibleSelectedRange(&self) -> NSRect;
105
106        #[optional]
107        #[method(documentVisibleRect)]
108        unsafe fn documentVisibleRect(&self) -> NSRect;
109    }
110
111    unsafe impl ProtocolType for dyn NSTextInputClient {}
112);