1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9#[cfg(feature = "objc2-quartz-core")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_quartz_core::*;
12
13use crate::*;
14
15extern_protocol!(
16 #[cfg(feature = "UIScrollView")]
18 pub unsafe trait UITextViewDelegate:
19 NSObjectProtocol + UIScrollViewDelegate + MainThreadOnly
20 {
21 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
22 #[optional]
23 #[unsafe(method(textViewShouldBeginEditing:))]
24 #[unsafe(method_family = none)]
25 unsafe fn textViewShouldBeginEditing(&self, text_view: &UITextView) -> bool;
26
27 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
28 #[optional]
29 #[unsafe(method(textViewShouldEndEditing:))]
30 #[unsafe(method_family = none)]
31 unsafe fn textViewShouldEndEditing(&self, text_view: &UITextView) -> bool;
32
33 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
34 #[optional]
35 #[unsafe(method(textViewDidBeginEditing:))]
36 #[unsafe(method_family = none)]
37 unsafe fn textViewDidBeginEditing(&self, text_view: &UITextView);
38
39 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
40 #[optional]
41 #[unsafe(method(textViewDidEndEditing:))]
42 #[unsafe(method_family = none)]
43 unsafe fn textViewDidEndEditing(&self, text_view: &UITextView);
44
45 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
46 #[optional]
47 #[unsafe(method(textView:shouldChangeTextInRange:replacementText:))]
48 #[unsafe(method_family = none)]
49 unsafe fn textView_shouldChangeTextInRange_replacementText(
50 &self,
51 text_view: &UITextView,
52 range: NSRange,
53 text: &NSString,
54 ) -> bool;
55
56 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
57 #[optional]
58 #[unsafe(method(textViewDidChange:))]
59 #[unsafe(method_family = none)]
60 unsafe fn textViewDidChange(&self, text_view: &UITextView);
61
62 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
63 #[optional]
64 #[unsafe(method(textViewDidChangeSelection:))]
65 #[unsafe(method_family = none)]
66 unsafe fn textViewDidChangeSelection(&self, text_view: &UITextView);
67
68 #[cfg(all(
69 feature = "UIMenu",
70 feature = "UIMenuElement",
71 feature = "UIResponder",
72 feature = "UIView"
73 ))]
74 #[optional]
87 #[unsafe(method(textView:editMenuForTextInRange:suggestedActions:))]
88 #[unsafe(method_family = none)]
89 unsafe fn textView_editMenuForTextInRange_suggestedActions(
90 &self,
91 text_view: &UITextView,
92 range: NSRange,
93 suggested_actions: &NSArray<UIMenuElement>,
94 ) -> Option<Retained<UIMenu>>;
95
96 #[cfg(all(
97 feature = "UIEditMenuInteraction",
98 feature = "UIResponder",
99 feature = "UIView"
100 ))]
101 #[optional]
108 #[unsafe(method(textView:willPresentEditMenuWithAnimator:))]
109 #[unsafe(method_family = none)]
110 unsafe fn textView_willPresentEditMenuWithAnimator(
111 &self,
112 text_view: &UITextView,
113 animator: &ProtocolObject<dyn UIEditMenuInteractionAnimating>,
114 );
115
116 #[cfg(all(
117 feature = "UIEditMenuInteraction",
118 feature = "UIResponder",
119 feature = "UIView"
120 ))]
121 #[optional]
128 #[unsafe(method(textView:willDismissEditMenuWithAnimator:))]
129 #[unsafe(method_family = none)]
130 unsafe fn textView_willDismissEditMenuWithAnimator(
131 &self,
132 text_view: &UITextView,
133 animator: &ProtocolObject<dyn UIEditMenuInteractionAnimating>,
134 );
135
136 #[cfg(all(
137 feature = "UIAction",
138 feature = "UIMenuElement",
139 feature = "UIResponder",
140 feature = "UITextItem",
141 feature = "UIView"
142 ))]
143 #[optional]
157 #[unsafe(method(textView:primaryActionForTextItem:defaultAction:))]
158 #[unsafe(method_family = none)]
159 unsafe fn textView_primaryActionForTextItem_defaultAction(
160 &self,
161 text_view: &UITextView,
162 text_item: &UITextItem,
163 default_action: &UIAction,
164 ) -> Option<Retained<UIAction>>;
165
166 #[cfg(all(
167 feature = "UIMenu",
168 feature = "UIMenuElement",
169 feature = "UIResponder",
170 feature = "UITextItem",
171 feature = "UIView"
172 ))]
173 #[optional]
186 #[unsafe(method(textView:menuConfigurationForTextItem:defaultMenu:))]
187 #[unsafe(method_family = none)]
188 unsafe fn textView_menuConfigurationForTextItem_defaultMenu(
189 &self,
190 text_view: &UITextView,
191 text_item: &UITextItem,
192 default_menu: &UIMenu,
193 ) -> Option<Retained<UITextItemMenuConfiguration>>;
194
195 #[cfg(all(
196 feature = "UIContextMenuInteraction",
197 feature = "UIResponder",
198 feature = "UITextItem",
199 feature = "UIView"
200 ))]
201 #[optional]
210 #[unsafe(method(textView:textItemMenuWillDisplayForTextItem:animator:))]
211 #[unsafe(method_family = none)]
212 unsafe fn textView_textItemMenuWillDisplayForTextItem_animator(
213 &self,
214 text_view: &UITextView,
215 text_item: &UITextItem,
216 animator: &ProtocolObject<dyn UIContextMenuInteractionAnimating>,
217 );
218
219 #[cfg(all(
220 feature = "UIContextMenuInteraction",
221 feature = "UIResponder",
222 feature = "UITextItem",
223 feature = "UIView"
224 ))]
225 #[optional]
234 #[unsafe(method(textView:textItemMenuWillEndForTextItem:animator:))]
235 #[unsafe(method_family = none)]
236 unsafe fn textView_textItemMenuWillEndForTextItem_animator(
237 &self,
238 text_view: &UITextView,
239 text_item: &UITextItem,
240 animator: &ProtocolObject<dyn UIContextMenuInteractionAnimating>,
241 );
242
243 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
244 #[optional]
249 #[unsafe(method(textViewWritingToolsWillBegin:))]
250 #[unsafe(method_family = none)]
251 unsafe fn textViewWritingToolsWillBegin(&self, text_view: &UITextView);
252
253 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
254 #[optional]
259 #[unsafe(method(textViewWritingToolsDidEnd:))]
260 #[unsafe(method_family = none)]
261 unsafe fn textViewWritingToolsDidEnd(&self, text_view: &UITextView);
262
263 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
264 #[optional]
273 #[unsafe(method(textView:writingToolsIgnoredRangesInEnclosingRange:))]
274 #[unsafe(method_family = none)]
275 unsafe fn textView_writingToolsIgnoredRangesInEnclosingRange(
276 &self,
277 text_view: &UITextView,
278 enclosing_range: NSRange,
279 ) -> Retained<NSArray<NSValue>>;
280
281 #[cfg(all(
282 feature = "UIResponder",
283 feature = "UITextItemInteraction",
284 feature = "UIView"
285 ))]
286 #[deprecated = "Replaced by primaryActionForTextItem: and menuConfigurationForTextItem: for additional customization options."]
287 #[optional]
288 #[unsafe(method(textView:shouldInteractWithURL:inRange:interaction:))]
289 #[unsafe(method_family = none)]
290 unsafe fn textView_shouldInteractWithURL_inRange_interaction(
291 &self,
292 text_view: &UITextView,
293 url: &NSURL,
294 character_range: NSRange,
295 interaction: UITextItemInteraction,
296 ) -> bool;
297
298 #[cfg(all(
299 feature = "NSTextAttachment",
300 feature = "UIResponder",
301 feature = "UITextItemInteraction",
302 feature = "UIView"
303 ))]
304 #[deprecated = "Replaced by primaryActionForTextItem: and menuConfigurationForTextItem: for additional customization options."]
305 #[optional]
306 #[unsafe(method(textView:shouldInteractWithTextAttachment:inRange:interaction:))]
307 #[unsafe(method_family = none)]
308 unsafe fn textView_shouldInteractWithTextAttachment_inRange_interaction(
309 &self,
310 text_view: &UITextView,
311 text_attachment: &NSTextAttachment,
312 character_range: NSRange,
313 interaction: UITextItemInteraction,
314 ) -> bool;
315
316 #[cfg(all(feature = "UIResponder", feature = "UIView"))]
317 #[deprecated]
318 #[optional]
319 #[unsafe(method(textView:shouldInteractWithURL:inRange:))]
320 #[unsafe(method_family = none)]
321 unsafe fn textView_shouldInteractWithURL_inRange(
322 &self,
323 text_view: &UITextView,
324 url: &NSURL,
325 character_range: NSRange,
326 ) -> bool;
327
328 #[cfg(all(
329 feature = "NSTextAttachment",
330 feature = "UIResponder",
331 feature = "UIView"
332 ))]
333 #[deprecated]
334 #[optional]
335 #[unsafe(method(textView:shouldInteractWithTextAttachment:inRange:))]
336 #[unsafe(method_family = none)]
337 unsafe fn textView_shouldInteractWithTextAttachment_inRange(
338 &self,
339 text_view: &UITextView,
340 text_attachment: &NSTextAttachment,
341 character_range: NSRange,
342 ) -> bool;
343
344 #[cfg(all(
345 feature = "UIResponder",
346 feature = "UITextFormattingViewController",
347 feature = "UIView",
348 feature = "UIViewController"
349 ))]
350 #[optional]
355 #[unsafe(method(textView:willBeginFormattingWithViewController:))]
356 #[unsafe(method_family = none)]
357 unsafe fn textView_willBeginFormattingWithViewController(
358 &self,
359 text_view: &UITextView,
360 view_controller: &UITextFormattingViewController,
361 );
362
363 #[cfg(all(
364 feature = "UIResponder",
365 feature = "UITextFormattingViewController",
366 feature = "UIView",
367 feature = "UIViewController"
368 ))]
369 #[optional]
374 #[unsafe(method(textView:didBeginFormattingWithViewController:))]
375 #[unsafe(method_family = none)]
376 unsafe fn textView_didBeginFormattingWithViewController(
377 &self,
378 text_view: &UITextView,
379 view_controller: &UITextFormattingViewController,
380 );
381
382 #[cfg(all(
383 feature = "UIResponder",
384 feature = "UITextFormattingViewController",
385 feature = "UIView",
386 feature = "UIViewController"
387 ))]
388 #[optional]
393 #[unsafe(method(textView:willEndFormattingWithViewController:))]
394 #[unsafe(method_family = none)]
395 unsafe fn textView_willEndFormattingWithViewController(
396 &self,
397 text_view: &UITextView,
398 view_controller: &UITextFormattingViewController,
399 );
400
401 #[cfg(all(
402 feature = "UIResponder",
403 feature = "UITextFormattingViewController",
404 feature = "UIView",
405 feature = "UIViewController"
406 ))]
407 #[optional]
412 #[unsafe(method(textView:didEndFormattingWithViewController:))]
413 #[unsafe(method_family = none)]
414 unsafe fn textView_didEndFormattingWithViewController(
415 &self,
416 text_view: &UITextView,
417 view_controller: &UITextFormattingViewController,
418 );
419 }
420);
421
422#[repr(transparent)]
427#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
428pub struct UITextViewBorderStyle(pub NSInteger);
429impl UITextViewBorderStyle {
430 #[doc(alias = "UITextViewBorderStyleNone")]
432 pub const None: Self = Self(0);
433 #[doc(alias = "UITextViewBorderStyleRoundedRect")]
435 pub const RoundedRect: Self = Self(1);
436}
437
438unsafe impl Encode for UITextViewBorderStyle {
439 const ENCODING: Encoding = NSInteger::ENCODING;
440}
441
442unsafe impl RefEncode for UITextViewBorderStyle {
443 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
444}
445
446extern_class!(
447 #[unsafe(super(UIScrollView, UIView, UIResponder, NSObject))]
449 #[thread_kind = MainThreadOnly]
450 #[derive(Debug, PartialEq, Eq, Hash)]
451 #[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
452 pub struct UITextView;
453);
454
455#[cfg(all(
456 feature = "UIResponder",
457 feature = "UIScrollView",
458 feature = "UIView",
459 feature = "objc2-quartz-core"
460))]
461#[cfg(not(target_os = "watchos"))]
462unsafe impl CALayerDelegate for UITextView {}
463
464#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
465unsafe impl NSCoding for UITextView {}
466
467#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
468unsafe impl NSObjectProtocol for UITextView {}
469
470#[cfg(all(
471 feature = "UIAppearance",
472 feature = "UIResponder",
473 feature = "UIScrollView",
474 feature = "UIView"
475))]
476unsafe impl UIAppearance for UITextView {}
477
478#[cfg(all(
479 feature = "UIAppearance",
480 feature = "UIResponder",
481 feature = "UIScrollView",
482 feature = "UIView"
483))]
484unsafe impl UIAppearanceContainer for UITextView {}
485
486#[cfg(all(
487 feature = "UIContentSizeCategoryAdjusting",
488 feature = "UIResponder",
489 feature = "UIScrollView",
490 feature = "UIView"
491))]
492unsafe impl UIContentSizeCategoryAdjusting for UITextView {}
493
494#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
495unsafe impl UICoordinateSpace for UITextView {}
496
497#[cfg(all(
498 feature = "UIDynamicBehavior",
499 feature = "UIResponder",
500 feature = "UIScrollView",
501 feature = "UIView"
502))]
503unsafe impl UIDynamicItem for UITextView {}
504
505#[cfg(all(
506 feature = "UIFocus",
507 feature = "UIResponder",
508 feature = "UIScrollView",
509 feature = "UIView"
510))]
511unsafe impl UIFocusEnvironment for UITextView {}
512
513#[cfg(all(
514 feature = "UIFocus",
515 feature = "UIResponder",
516 feature = "UIScrollView",
517 feature = "UIView"
518))]
519unsafe impl UIFocusItem for UITextView {}
520
521#[cfg(all(
522 feature = "UIFocus",
523 feature = "UIResponder",
524 feature = "UIScrollView",
525 feature = "UIView"
526))]
527unsafe impl UIFocusItemContainer for UITextView {}
528
529#[cfg(all(
530 feature = "UIFocus",
531 feature = "UIResponder",
532 feature = "UIScrollView",
533 feature = "UIView"
534))]
535unsafe impl UIFocusItemScrollableContainer for UITextView {}
536
537#[cfg(all(
538 feature = "UIResponder",
539 feature = "UIScrollView",
540 feature = "UITextInput",
541 feature = "UITextInputTraits",
542 feature = "UIView"
543))]
544unsafe impl UIKeyInput for UITextView {}
545
546#[cfg(all(
547 feature = "UILetterformAwareAdjusting",
548 feature = "UIResponder",
549 feature = "UIScrollView",
550 feature = "UIView"
551))]
552unsafe impl UILetterformAwareAdjusting for UITextView {}
553
554#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
555unsafe impl UIResponderStandardEditActions for UITextView {}
556
557#[cfg(all(
558 feature = "UIResponder",
559 feature = "UIScrollView",
560 feature = "UITextInput",
561 feature = "UITextInputTraits",
562 feature = "UIView"
563))]
564unsafe impl UITextInput for UITextView {}
565
566#[cfg(all(
567 feature = "UIResponder",
568 feature = "UIScrollView",
569 feature = "UITextInputTraits",
570 feature = "UIView"
571))]
572unsafe impl UITextInputTraits for UITextView {}
573
574#[cfg(all(
575 feature = "UIResponder",
576 feature = "UIScrollView",
577 feature = "UITraitCollection",
578 feature = "UIView"
579))]
580unsafe impl UITraitEnvironment for UITextView {}
581
582#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
583impl UITextView {
584 extern_methods!(
585 #[unsafe(method(delegate))]
586 #[unsafe(method_family = none)]
587 pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UITextViewDelegate>>>;
588
589 #[unsafe(method(setDelegate:))]
592 #[unsafe(method_family = none)]
593 pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn UITextViewDelegate>>);
594
595 #[unsafe(method(text))]
596 #[unsafe(method_family = none)]
597 pub unsafe fn text(&self) -> Retained<NSString>;
598
599 #[unsafe(method(setText:))]
601 #[unsafe(method_family = none)]
602 pub unsafe fn setText(&self, text: Option<&NSString>);
603
604 #[cfg(feature = "UIFont")]
605 #[unsafe(method(font))]
606 #[unsafe(method_family = none)]
607 pub unsafe fn font(&self) -> Option<Retained<UIFont>>;
608
609 #[cfg(feature = "UIFont")]
610 #[unsafe(method(setFont:))]
612 #[unsafe(method_family = none)]
613 pub unsafe fn setFont(&self, font: Option<&UIFont>);
614
615 #[cfg(feature = "UIColor")]
616 #[unsafe(method(textColor))]
617 #[unsafe(method_family = none)]
618 pub unsafe fn textColor(&self) -> Option<Retained<UIColor>>;
619
620 #[cfg(feature = "UIColor")]
621 #[unsafe(method(setTextColor:))]
623 #[unsafe(method_family = none)]
624 pub unsafe fn setTextColor(&self, text_color: Option<&UIColor>);
625
626 #[cfg(feature = "NSText")]
627 #[unsafe(method(textAlignment))]
628 #[unsafe(method_family = none)]
629 pub unsafe fn textAlignment(&self) -> NSTextAlignment;
630
631 #[cfg(feature = "NSText")]
632 #[unsafe(method(setTextAlignment:))]
634 #[unsafe(method_family = none)]
635 pub unsafe fn setTextAlignment(&self, text_alignment: NSTextAlignment);
636
637 #[unsafe(method(selectedRange))]
638 #[unsafe(method_family = none)]
639 pub unsafe fn selectedRange(&self) -> NSRange;
640
641 #[unsafe(method(setSelectedRange:))]
643 #[unsafe(method_family = none)]
644 pub unsafe fn setSelectedRange(&self, selected_range: NSRange);
645
646 #[unsafe(method(isEditable))]
647 #[unsafe(method_family = none)]
648 pub unsafe fn isEditable(&self) -> bool;
649
650 #[unsafe(method(setEditable:))]
652 #[unsafe(method_family = none)]
653 pub unsafe fn setEditable(&self, editable: bool);
654
655 #[unsafe(method(isSelectable))]
656 #[unsafe(method_family = none)]
657 pub unsafe fn isSelectable(&self) -> bool;
658
659 #[unsafe(method(setSelectable:))]
661 #[unsafe(method_family = none)]
662 pub unsafe fn setSelectable(&self, selectable: bool);
663
664 #[cfg(feature = "UIDataDetectors")]
665 #[unsafe(method(dataDetectorTypes))]
666 #[unsafe(method_family = none)]
667 pub unsafe fn dataDetectorTypes(&self) -> UIDataDetectorTypes;
668
669 #[cfg(feature = "UIDataDetectors")]
670 #[unsafe(method(setDataDetectorTypes:))]
672 #[unsafe(method_family = none)]
673 pub unsafe fn setDataDetectorTypes(&self, data_detector_types: UIDataDetectorTypes);
674
675 #[unsafe(method(allowsEditingTextAttributes))]
676 #[unsafe(method_family = none)]
677 pub unsafe fn allowsEditingTextAttributes(&self) -> bool;
678
679 #[unsafe(method(setAllowsEditingTextAttributes:))]
681 #[unsafe(method_family = none)]
682 pub unsafe fn setAllowsEditingTextAttributes(&self, allows_editing_text_attributes: bool);
683
684 #[unsafe(method(attributedText))]
685 #[unsafe(method_family = none)]
686 pub unsafe fn attributedText(&self) -> Retained<NSAttributedString>;
687
688 #[unsafe(method(setAttributedText:))]
690 #[unsafe(method_family = none)]
691 pub unsafe fn setAttributedText(&self, attributed_text: Option<&NSAttributedString>);
692
693 #[unsafe(method(typingAttributes))]
694 #[unsafe(method_family = none)]
695 pub unsafe fn typingAttributes(
696 &self,
697 ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
698
699 #[unsafe(method(setTypingAttributes:))]
701 #[unsafe(method_family = none)]
702 pub unsafe fn setTypingAttributes(
703 &self,
704 typing_attributes: &NSDictionary<NSAttributedStringKey, AnyObject>,
705 );
706
707 #[unsafe(method(scrollRangeToVisible:))]
708 #[unsafe(method_family = none)]
709 pub unsafe fn scrollRangeToVisible(&self, range: NSRange);
710
711 #[unsafe(method(inputView))]
712 #[unsafe(method_family = none)]
713 pub unsafe fn inputView(&self) -> Option<Retained<UIView>>;
714
715 #[unsafe(method(setInputView:))]
717 #[unsafe(method_family = none)]
718 pub unsafe fn setInputView(&self, input_view: Option<&UIView>);
719
720 #[unsafe(method(inputAccessoryView))]
721 #[unsafe(method_family = none)]
722 pub unsafe fn inputAccessoryView(&self) -> Option<Retained<UIView>>;
723
724 #[unsafe(method(setInputAccessoryView:))]
726 #[unsafe(method_family = none)]
727 pub unsafe fn setInputAccessoryView(&self, input_accessory_view: Option<&UIView>);
728
729 #[unsafe(method(clearsOnInsertion))]
730 #[unsafe(method_family = none)]
731 pub unsafe fn clearsOnInsertion(&self) -> bool;
732
733 #[unsafe(method(setClearsOnInsertion:))]
735 #[unsafe(method_family = none)]
736 pub unsafe fn setClearsOnInsertion(&self, clears_on_insertion: bool);
737
738 #[cfg(all(feature = "NSTextContainer", feature = "objc2-core-foundation"))]
739 #[unsafe(method(initWithFrame:textContainer:))]
740 #[unsafe(method_family = init)]
741 pub unsafe fn initWithFrame_textContainer(
742 this: Allocated<Self>,
743 frame: CGRect,
744 text_container: Option<&NSTextContainer>,
745 ) -> Retained<Self>;
746
747 #[unsafe(method(textViewUsingTextLayoutManager:))]
748 #[unsafe(method_family = none)]
749 pub unsafe fn textViewUsingTextLayoutManager(
750 using_text_layout_manager: bool,
751 mtm: MainThreadMarker,
752 ) -> Retained<Self>;
753
754 #[unsafe(method(initWithCoder:))]
755 #[unsafe(method_family = init)]
756 pub unsafe fn initWithCoder(
757 this: Allocated<Self>,
758 coder: &NSCoder,
759 ) -> Option<Retained<Self>>;
760
761 #[cfg(feature = "NSTextContainer")]
762 #[unsafe(method(textContainer))]
763 #[unsafe(method_family = none)]
764 pub unsafe fn textContainer(&self) -> Retained<NSTextContainer>;
765
766 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
767 #[unsafe(method(textContainerInset))]
768 #[unsafe(method_family = none)]
769 pub unsafe fn textContainerInset(&self) -> UIEdgeInsets;
770
771 #[cfg(all(feature = "UIGeometry", feature = "objc2-core-foundation"))]
772 #[unsafe(method(setTextContainerInset:))]
774 #[unsafe(method_family = none)]
775 pub unsafe fn setTextContainerInset(&self, text_container_inset: UIEdgeInsets);
776
777 #[cfg(feature = "NSTextLayoutManager")]
778 #[unsafe(method(textLayoutManager))]
779 #[unsafe(method_family = none)]
780 pub unsafe fn textLayoutManager(&self) -> Option<Retained<NSTextLayoutManager>>;
781
782 #[cfg(feature = "NSLayoutManager")]
783 #[unsafe(method(layoutManager))]
784 #[unsafe(method_family = none)]
785 pub unsafe fn layoutManager(&self) -> Retained<NSLayoutManager>;
786
787 #[cfg(feature = "NSTextStorage")]
788 #[unsafe(method(textStorage))]
789 #[unsafe(method_family = none)]
790 pub unsafe fn textStorage(&self) -> Retained<NSTextStorage>;
791
792 #[unsafe(method(linkTextAttributes))]
793 #[unsafe(method_family = none)]
794 pub unsafe fn linkTextAttributes(
795 &self,
796 ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
797
798 #[unsafe(method(setLinkTextAttributes:))]
800 #[unsafe(method_family = none)]
801 pub unsafe fn setLinkTextAttributes(
802 &self,
803 link_text_attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
804 );
805
806 #[unsafe(method(usesStandardTextScaling))]
807 #[unsafe(method_family = none)]
808 pub unsafe fn usesStandardTextScaling(&self) -> bool;
809
810 #[unsafe(method(setUsesStandardTextScaling:))]
812 #[unsafe(method_family = none)]
813 pub unsafe fn setUsesStandardTextScaling(&self, uses_standard_text_scaling: bool);
814
815 #[cfg(feature = "UIFindInteraction")]
816 #[unsafe(method(findInteraction))]
818 #[unsafe(method_family = none)]
819 pub unsafe fn findInteraction(&self) -> Option<Retained<UIFindInteraction>>;
820
821 #[unsafe(method(isFindInteractionEnabled))]
823 #[unsafe(method_family = none)]
824 pub unsafe fn isFindInteractionEnabled(&self) -> bool;
825
826 #[unsafe(method(setFindInteractionEnabled:))]
828 #[unsafe(method_family = none)]
829 pub unsafe fn setFindInteractionEnabled(&self, find_interaction_enabled: bool);
830
831 #[unsafe(method(borderStyle))]
833 #[unsafe(method_family = none)]
834 pub unsafe fn borderStyle(&self) -> UITextViewBorderStyle;
835
836 #[unsafe(method(setBorderStyle:))]
838 #[unsafe(method_family = none)]
839 pub unsafe fn setBorderStyle(&self, border_style: UITextViewBorderStyle);
840
841 #[unsafe(method(textHighlightAttributes))]
842 #[unsafe(method_family = none)]
843 pub unsafe fn textHighlightAttributes(
844 &self,
845 ) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
846
847 #[unsafe(method(setTextHighlightAttributes:))]
849 #[unsafe(method_family = none)]
850 pub unsafe fn setTextHighlightAttributes(
851 &self,
852 text_highlight_attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
853 );
854
855 #[cfg(all(feature = "NSTextRange", feature = "objc2-core-foundation"))]
856 #[unsafe(method(drawTextHighlightBackgroundForTextRange:origin:))]
857 #[unsafe(method_family = none)]
858 pub unsafe fn drawTextHighlightBackgroundForTextRange_origin(
859 &self,
860 text_range: &NSTextRange,
861 origin: CGPoint,
862 );
863
864 #[unsafe(method(isWritingToolsActive))]
872 #[unsafe(method_family = none)]
873 pub unsafe fn isWritingToolsActive(&self) -> bool;
874
875 #[cfg(feature = "UITextInputTraits")]
876 #[unsafe(method(writingToolsBehavior))]
877 #[unsafe(method_family = none)]
878 pub unsafe fn writingToolsBehavior(&self) -> UIWritingToolsBehavior;
879
880 #[cfg(feature = "UITextInputTraits")]
881 #[unsafe(method(setWritingToolsBehavior:))]
883 #[unsafe(method_family = none)]
884 pub unsafe fn setWritingToolsBehavior(
885 &self,
886 writing_tools_behavior: UIWritingToolsBehavior,
887 );
888
889 #[cfg(feature = "UITextInputTraits")]
890 #[unsafe(method(allowedWritingToolsResultOptions))]
891 #[unsafe(method_family = none)]
892 pub unsafe fn allowedWritingToolsResultOptions(&self) -> UIWritingToolsResultOptions;
893
894 #[cfg(feature = "UITextInputTraits")]
895 #[unsafe(method(setAllowedWritingToolsResultOptions:))]
897 #[unsafe(method_family = none)]
898 pub unsafe fn setAllowedWritingToolsResultOptions(
899 &self,
900 allowed_writing_tools_result_options: UIWritingToolsResultOptions,
901 );
902
903 #[cfg(feature = "UIWritingToolsCoordinator")]
904 #[unsafe(method(writingToolsCoordinator))]
905 #[unsafe(method_family = none)]
906 pub unsafe fn writingToolsCoordinator(&self) -> Retained<UIWritingToolsCoordinator>;
907
908 #[cfg(feature = "UITextFormattingViewControllerConfiguration")]
909 #[unsafe(method(textFormattingConfiguration))]
915 #[unsafe(method_family = none)]
916 pub unsafe fn textFormattingConfiguration(
917 &self,
918 ) -> Option<Retained<UITextFormattingViewControllerConfiguration>>;
919
920 #[cfg(feature = "UITextFormattingViewControllerConfiguration")]
921 #[unsafe(method(setTextFormattingConfiguration:))]
923 #[unsafe(method_family = none)]
924 pub unsafe fn setTextFormattingConfiguration(
925 &self,
926 text_formatting_configuration: Option<&UITextFormattingViewControllerConfiguration>,
927 );
928 );
929}
930
931#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
933impl UITextView {
934 extern_methods!(
935 #[cfg(feature = "objc2-core-foundation")]
936 #[unsafe(method(initWithFrame:))]
937 #[unsafe(method_family = init)]
938 pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
939 );
940}
941
942#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
944impl UITextView {
945 extern_methods!(
946 #[unsafe(method(init))]
947 #[unsafe(method_family = init)]
948 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
949
950 #[unsafe(method(new))]
951 #[unsafe(method_family = new)]
952 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
953 );
954}
955
956#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
957impl UITextView {
958 extern_methods!();
959}
960
961#[cfg(all(
962 feature = "UIFindInteraction",
963 feature = "UIResponder",
964 feature = "UIScrollView",
965 feature = "UIView"
966))]
967unsafe impl UIFindInteractionDelegate for UITextView {}
968
969#[cfg(all(
970 feature = "UIResponder",
971 feature = "UIScrollView",
972 feature = "UITextDragging",
973 feature = "UITextInput",
974 feature = "UITextInputTraits",
975 feature = "UIView"
976))]
977unsafe impl UITextDraggable for UITextView {}
978
979#[cfg(all(
980 feature = "UIPasteConfigurationSupporting",
981 feature = "UIResponder",
982 feature = "UIScrollView",
983 feature = "UITextDropping",
984 feature = "UITextInput",
985 feature = "UITextInputTraits",
986 feature = "UITextPasteConfigurationSupporting",
987 feature = "UIView"
988))]
989unsafe impl UITextDroppable for UITextView {}
990
991#[cfg(all(
992 feature = "UIPasteConfigurationSupporting",
993 feature = "UIResponder",
994 feature = "UIScrollView",
995 feature = "UITextPasteConfigurationSupporting",
996 feature = "UIView"
997))]
998unsafe impl UITextPasteConfigurationSupporting for UITextView {}
999
1000#[cfg(all(
1001 feature = "UIResponder",
1002 feature = "UIScrollView",
1003 feature = "UITextSearching",
1004 feature = "UIView"
1005))]
1006unsafe impl UITextSearching for UITextView {}
1007
1008#[cfg(all(feature = "UIResponder", feature = "UIScrollView", feature = "UIView"))]
1010impl UITextView {
1011 extern_methods!(
1012 #[unsafe(method(interactionState))]
1013 #[unsafe(method_family = none)]
1014 pub unsafe fn interactionState(&self) -> Retained<AnyObject>;
1015
1016 #[unsafe(method(setInteractionState:))]
1018 #[unsafe(method_family = none)]
1019 pub unsafe fn setInteractionState(&self, interaction_state: &AnyObject);
1020 );
1021}
1022
1023extern "C" {
1024 pub static UITextViewTextDidBeginEditingNotification: &'static NSNotificationName;
1026}
1027
1028extern "C" {
1029 pub static UITextViewTextDidChangeNotification: &'static NSNotificationName;
1031}
1032
1033extern "C" {
1034 pub static UITextViewTextDidEndEditingNotification: &'static NSNotificationName;
1036}