objc2_app_kit/generated/
NSTextViewportLayoutController.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8
9use crate::*;
10
11extern_protocol!(
12    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextviewportlayoutcontrollerdelegate?language=objc)
13    pub unsafe trait NSTextViewportLayoutControllerDelegate: NSObjectProtocol {
14        #[cfg(feature = "objc2-core-foundation")]
15        #[unsafe(method(viewportBoundsForTextViewportLayoutController:))]
16        #[unsafe(method_family = none)]
17        fn viewportBoundsForTextViewportLayoutController(
18            &self,
19            text_viewport_layout_controller: &NSTextViewportLayoutController,
20        ) -> CGRect;
21
22        #[cfg(feature = "NSTextLayoutFragment")]
23        #[unsafe(method(textViewportLayoutController:configureRenderingSurfaceForTextLayoutFragment:))]
24        #[unsafe(method_family = none)]
25        fn textViewportLayoutController_configureRenderingSurfaceForTextLayoutFragment(
26            &self,
27            text_viewport_layout_controller: &NSTextViewportLayoutController,
28            text_layout_fragment: &NSTextLayoutFragment,
29        );
30
31        #[optional]
32        #[unsafe(method(textViewportLayoutControllerWillLayout:))]
33        #[unsafe(method_family = none)]
34        fn textViewportLayoutControllerWillLayout(
35            &self,
36            text_viewport_layout_controller: &NSTextViewportLayoutController,
37        );
38
39        #[optional]
40        #[unsafe(method(textViewportLayoutControllerDidLayout:))]
41        #[unsafe(method_family = none)]
42        fn textViewportLayoutControllerDidLayout(
43            &self,
44            text_viewport_layout_controller: &NSTextViewportLayoutController,
45        );
46    }
47);
48
49extern_class!(
50    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextviewportlayoutcontroller?language=objc)
51    #[unsafe(super(NSObject))]
52    #[derive(Debug, PartialEq, Eq, Hash)]
53    pub struct NSTextViewportLayoutController;
54);
55
56extern_conformance!(
57    unsafe impl NSObjectProtocol for NSTextViewportLayoutController {}
58);
59
60impl NSTextViewportLayoutController {
61    extern_methods!(
62        #[cfg(feature = "NSTextLayoutManager")]
63        #[unsafe(method(initWithTextLayoutManager:))]
64        #[unsafe(method_family = init)]
65        pub fn initWithTextLayoutManager(
66            this: Allocated<Self>,
67            text_layout_manager: &NSTextLayoutManager,
68        ) -> Retained<Self>;
69
70        #[unsafe(method(new))]
71        #[unsafe(method_family = new)]
72        pub unsafe fn new() -> Retained<Self>;
73
74        #[unsafe(method(init))]
75        #[unsafe(method_family = init)]
76        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
77
78        #[unsafe(method(delegate))]
79        #[unsafe(method_family = none)]
80        pub fn delegate(
81            &self,
82        ) -> Option<Retained<ProtocolObject<dyn NSTextViewportLayoutControllerDelegate>>>;
83
84        /// Setter for [`delegate`][Self::delegate].
85        ///
86        /// This is a [weak property][objc2::topics::weak_property].
87        #[unsafe(method(setDelegate:))]
88        #[unsafe(method_family = none)]
89        pub fn setDelegate(
90            &self,
91            delegate: Option<&ProtocolObject<dyn NSTextViewportLayoutControllerDelegate>>,
92        );
93
94        #[cfg(feature = "NSTextLayoutManager")]
95        #[unsafe(method(textLayoutManager))]
96        #[unsafe(method_family = none)]
97        pub fn textLayoutManager(&self) -> Option<Retained<NSTextLayoutManager>>;
98
99        #[cfg(feature = "objc2-core-foundation")]
100        #[unsafe(method(viewportBounds))]
101        #[unsafe(method_family = none)]
102        pub fn viewportBounds(&self) -> CGRect;
103
104        #[cfg(feature = "NSTextRange")]
105        #[unsafe(method(viewportRange))]
106        #[unsafe(method_family = none)]
107        pub fn viewportRange(&self) -> Option<Retained<NSTextRange>>;
108
109        #[unsafe(method(layoutViewport))]
110        #[unsafe(method_family = none)]
111        pub fn layoutViewport(&self);
112
113        #[cfg(all(feature = "NSTextRange", feature = "objc2-core-foundation"))]
114        #[unsafe(method(relocateViewportToTextLocation:))]
115        #[unsafe(method_family = none)]
116        pub fn relocateViewportToTextLocation(
117            &self,
118            text_location: &ProtocolObject<dyn NSTextLocation>,
119        ) -> CGFloat;
120
121        #[cfg(feature = "objc2-core-foundation")]
122        #[unsafe(method(adjustViewportByVerticalOffset:))]
123        #[unsafe(method_family = none)]
124        pub fn adjustViewportByVerticalOffset(&self, vertical_offset: CGFloat);
125    );
126}