icrate/generated/AppKit/
NSTextStorage.rs1use crate::common::*;
4use crate::AppKit::*;
5use crate::CoreData::*;
6use crate::Foundation::*;
7
8ns_options!(
9 #[underlying(NSUInteger)]
10 pub enum NSTextStorageEditActions {
11 NSTextStorageEditedAttributes = 1 << 0,
12 NSTextStorageEditedCharacters = 1 << 1,
13 }
14);
15
16extern_class!(
17 #[derive(Debug, PartialEq, Eq, Hash)]
18 #[cfg(feature = "AppKit_NSTextStorage")]
19 pub struct NSTextStorage;
20
21 #[cfg(feature = "AppKit_NSTextStorage")]
22 unsafe impl ClassType for NSTextStorage {
23 #[inherits(NSAttributedString, NSObject)]
24 type Super = NSMutableAttributedString;
25 type Mutability = Mutable;
26 }
27);
28
29#[cfg(feature = "AppKit_NSTextStorage")]
30unsafe impl NSCoding for NSTextStorage {}
31
32#[cfg(feature = "AppKit_NSTextStorage")]
33unsafe impl NSObjectProtocol for NSTextStorage {}
34
35#[cfg(feature = "AppKit_NSTextStorage")]
36unsafe impl NSSecureCoding for NSTextStorage {}
37
38extern_methods!(
39 #[cfg(feature = "AppKit_NSTextStorage")]
40 unsafe impl NSTextStorage {
41 #[cfg(all(feature = "AppKit_NSLayoutManager", feature = "Foundation_NSArray"))]
42 #[method_id(@__retain_semantics Other layoutManagers)]
43 pub unsafe fn layoutManagers(&self) -> Id<NSArray<NSLayoutManager>>;
44
45 #[cfg(feature = "AppKit_NSLayoutManager")]
46 #[method(addLayoutManager:)]
47 pub unsafe fn addLayoutManager(&mut self, a_layout_manager: &NSLayoutManager);
48
49 #[cfg(feature = "AppKit_NSLayoutManager")]
50 #[method(removeLayoutManager:)]
51 pub unsafe fn removeLayoutManager(&mut self, a_layout_manager: &NSLayoutManager);
52
53 #[method(editedMask)]
54 pub unsafe fn editedMask(&self) -> NSTextStorageEditActions;
55
56 #[method(editedRange)]
57 pub unsafe fn editedRange(&self) -> NSRange;
58
59 #[method(changeInLength)]
60 pub unsafe fn changeInLength(&self) -> NSInteger;
61
62 #[method_id(@__retain_semantics Other delegate)]
63 pub unsafe fn delegate(&self) -> Option<Id<ProtocolObject<dyn NSTextStorageDelegate>>>;
64
65 #[method(setDelegate:)]
66 pub unsafe fn setDelegate(
67 &mut self,
68 delegate: Option<&ProtocolObject<dyn NSTextStorageDelegate>>,
69 );
70
71 #[method(edited:range:changeInLength:)]
72 pub unsafe fn edited_range_changeInLength(
73 &mut self,
74 edited_mask: NSTextStorageEditActions,
75 edited_range: NSRange,
76 delta: NSInteger,
77 );
78
79 #[method(processEditing)]
80 pub unsafe fn processEditing(&mut self);
81
82 #[method(fixesAttributesLazily)]
83 pub unsafe fn fixesAttributesLazily(&self) -> bool;
84
85 #[method(invalidateAttributesInRange:)]
86 pub unsafe fn invalidateAttributesInRange(&mut self, range: NSRange);
87
88 #[method(ensureAttributesAreFixedInRange:)]
89 pub unsafe fn ensureAttributesAreFixedInRange(&mut self, range: NSRange);
90
91 #[method_id(@__retain_semantics Other textStorageObserver)]
92 pub unsafe fn textStorageObserver(
93 &self,
94 ) -> Option<Id<ProtocolObject<dyn NSTextStorageObserving>>>;
95
96 #[method(setTextStorageObserver:)]
97 pub unsafe fn setTextStorageObserver(
98 &mut self,
99 text_storage_observer: Option<&ProtocolObject<dyn NSTextStorageObserving>>,
100 );
101 }
102);
103
104extern_methods!(
105 #[cfg(feature = "AppKit_NSTextStorage")]
107 unsafe impl NSTextStorage {
108 #[method_id(@__retain_semantics Init init)]
109 pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
110
111 #[method_id(@__retain_semantics New new)]
112 pub unsafe fn new() -> Id<Self>;
113 }
114);
115
116extern_protocol!(
117 pub unsafe trait NSTextStorageDelegate: NSObjectProtocol {
118 #[cfg(feature = "AppKit_NSTextStorage")]
119 #[optional]
120 #[method(textStorage:willProcessEditing:range:changeInLength:)]
121 unsafe fn textStorage_willProcessEditing_range_changeInLength(
122 &self,
123 text_storage: &NSTextStorage,
124 edited_mask: NSTextStorageEditActions,
125 edited_range: NSRange,
126 delta: NSInteger,
127 );
128
129 #[cfg(feature = "AppKit_NSTextStorage")]
130 #[optional]
131 #[method(textStorage:didProcessEditing:range:changeInLength:)]
132 unsafe fn textStorage_didProcessEditing_range_changeInLength(
133 &self,
134 text_storage: &NSTextStorage,
135 edited_mask: NSTextStorageEditActions,
136 edited_range: NSRange,
137 delta: NSInteger,
138 );
139 }
140
141 unsafe impl ProtocolType for dyn NSTextStorageDelegate {}
142);
143
144extern_static!(NSTextStorageWillProcessEditingNotification: &'static NSNotificationName);
145
146extern_static!(NSTextStorageDidProcessEditingNotification: &'static NSNotificationName);
147
148extern_protocol!(
149 pub unsafe trait NSTextStorageObserving: NSObjectProtocol {
150 #[cfg(feature = "AppKit_NSTextStorage")]
151 #[method_id(@__retain_semantics Other textStorage)]
152 unsafe fn textStorage(&self) -> Option<Id<NSTextStorage>>;
153
154 #[cfg(feature = "AppKit_NSTextStorage")]
155 #[method(setTextStorage:)]
156 unsafe fn setTextStorage(&self, text_storage: Option<&NSTextStorage>);
157
158 #[cfg(feature = "AppKit_NSTextStorage")]
159 #[method(processEditingForTextStorage:edited:range:changeInLength:invalidatedRange:)]
160 unsafe fn processEditingForTextStorage_edited_range_changeInLength_invalidatedRange(
161 &self,
162 text_storage: &NSTextStorage,
163 edit_mask: NSTextStorageEditActions,
164 new_char_range: NSRange,
165 delta: NSInteger,
166 invalidated_char_range: NSRange,
167 );
168
169 #[cfg(feature = "AppKit_NSTextStorage")]
170 #[method(performEditingTransactionForTextStorage:usingBlock:)]
171 unsafe fn performEditingTransactionForTextStorage_usingBlock(
172 &self,
173 text_storage: &NSTextStorage,
174 transaction: &Block<(), ()>,
175 );
176 }
177
178 unsafe impl ProtocolType for dyn NSTextStorageObserving {}
179);
180
181pub type NSTextStorageEditedOptions = NSUInteger;