icrate/generated/AppKit/
NSTextSelection.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 NSTextSelectionGranularity {
11        NSTextSelectionGranularityCharacter = 0,
12        NSTextSelectionGranularityWord = 1,
13        NSTextSelectionGranularityParagraph = 2,
14        NSTextSelectionGranularityLine = 3,
15        NSTextSelectionGranularitySentence = 4,
16    }
17);
18
19ns_enum!(
20    #[underlying(NSInteger)]
21    pub enum NSTextSelectionAffinity {
22        NSTextSelectionAffinityUpstream = 0,
23        NSTextSelectionAffinityDownstream = 1,
24    }
25);
26
27extern_class!(
28    #[derive(Debug, PartialEq, Eq, Hash)]
29    #[cfg(feature = "AppKit_NSTextSelection")]
30    pub struct NSTextSelection;
31
32    #[cfg(feature = "AppKit_NSTextSelection")]
33    unsafe impl ClassType for NSTextSelection {
34        type Super = NSObject;
35        type Mutability = InteriorMutable;
36    }
37);
38
39#[cfg(feature = "AppKit_NSTextSelection")]
40unsafe impl NSCoding for NSTextSelection {}
41
42#[cfg(feature = "AppKit_NSTextSelection")]
43unsafe impl NSObjectProtocol for NSTextSelection {}
44
45#[cfg(feature = "AppKit_NSTextSelection")]
46unsafe impl NSSecureCoding for NSTextSelection {}
47
48extern_methods!(
49    #[cfg(feature = "AppKit_NSTextSelection")]
50    unsafe impl NSTextSelection {
51        #[cfg(all(feature = "AppKit_NSTextRange", feature = "Foundation_NSArray"))]
52        #[method_id(@__retain_semantics Init initWithRanges:affinity:granularity:)]
53        pub unsafe fn initWithRanges_affinity_granularity(
54            this: Allocated<Self>,
55            text_ranges: &NSArray<NSTextRange>,
56            affinity: NSTextSelectionAffinity,
57            granularity: NSTextSelectionGranularity,
58        ) -> Id<Self>;
59
60        #[cfg(feature = "Foundation_NSCoder")]
61        #[method_id(@__retain_semantics Init initWithCoder:)]
62        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Option<Id<Self>>;
63
64        #[cfg(feature = "AppKit_NSTextRange")]
65        #[method_id(@__retain_semantics Init initWithRange:affinity:granularity:)]
66        pub unsafe fn initWithRange_affinity_granularity(
67            this: Allocated<Self>,
68            range: &NSTextRange,
69            affinity: NSTextSelectionAffinity,
70            granularity: NSTextSelectionGranularity,
71        ) -> Id<Self>;
72
73        #[method_id(@__retain_semantics Init initWithLocation:affinity:)]
74        pub unsafe fn initWithLocation_affinity(
75            this: Allocated<Self>,
76            location: &ProtocolObject<dyn NSTextLocation>,
77            affinity: NSTextSelectionAffinity,
78        ) -> Id<Self>;
79
80        #[method_id(@__retain_semantics Init init)]
81        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
82
83        #[cfg(all(feature = "AppKit_NSTextRange", feature = "Foundation_NSArray"))]
84        #[method_id(@__retain_semantics Other textRanges)]
85        pub unsafe fn textRanges(&self) -> Id<NSArray<NSTextRange>>;
86
87        #[method(granularity)]
88        pub unsafe fn granularity(&self) -> NSTextSelectionGranularity;
89
90        #[method(affinity)]
91        pub unsafe fn affinity(&self) -> NSTextSelectionAffinity;
92
93        #[method(isTransient)]
94        pub unsafe fn isTransient(&self) -> bool;
95
96        #[method(anchorPositionOffset)]
97        pub unsafe fn anchorPositionOffset(&self) -> CGFloat;
98
99        #[method(setAnchorPositionOffset:)]
100        pub unsafe fn setAnchorPositionOffset(&self, anchor_position_offset: CGFloat);
101
102        #[method(isLogical)]
103        pub unsafe fn isLogical(&self) -> bool;
104
105        #[method(setLogical:)]
106        pub unsafe fn setLogical(&self, logical: bool);
107
108        #[method_id(@__retain_semantics Other secondarySelectionLocation)]
109        pub unsafe fn secondarySelectionLocation(
110            &self,
111        ) -> Option<Id<ProtocolObject<dyn NSTextLocation>>>;
112
113        #[method(setSecondarySelectionLocation:)]
114        pub unsafe fn setSecondarySelectionLocation(
115            &self,
116            secondary_selection_location: Option<&ProtocolObject<dyn NSTextLocation>>,
117        );
118
119        #[cfg(feature = "Foundation_NSDictionary")]
120        #[method_id(@__retain_semantics Other typingAttributes)]
121        pub unsafe fn typingAttributes(&self)
122            -> Id<NSDictionary<NSAttributedStringKey, AnyObject>>;
123
124        #[cfg(feature = "Foundation_NSDictionary")]
125        #[method(setTypingAttributes:)]
126        pub unsafe fn setTypingAttributes(
127            &self,
128            typing_attributes: &NSDictionary<NSAttributedStringKey, AnyObject>,
129        );
130
131        #[cfg(all(feature = "AppKit_NSTextRange", feature = "Foundation_NSArray"))]
132        #[method_id(@__retain_semantics Other textSelectionWithTextRanges:)]
133        pub unsafe fn textSelectionWithTextRanges(
134            &self,
135            text_ranges: &NSArray<NSTextRange>,
136        ) -> Id<NSTextSelection>;
137    }
138);
139
140extern_methods!(
141    /// Methods declared on superclass `NSObject`
142    #[cfg(feature = "AppKit_NSTextSelection")]
143    unsafe impl NSTextSelection {
144        #[method_id(@__retain_semantics New new)]
145        pub unsafe fn new() -> Id<Self>;
146    }
147);