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        unsafe 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        unsafe 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        unsafe fn textViewportLayoutControllerWillLayout(
35            &self,
36            text_viewport_layout_controller: &NSTextViewportLayoutController,
37        );
38
39        #[optional]
40        #[unsafe(method(textViewportLayoutControllerDidLayout:))]
41        #[unsafe(method_family = none)]
42        unsafe 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
56unsafe impl NSObjectProtocol for NSTextViewportLayoutController {}
57
58impl NSTextViewportLayoutController {
59    extern_methods!(
60        #[cfg(feature = "NSTextLayoutManager")]
61        #[unsafe(method(initWithTextLayoutManager:))]
62        #[unsafe(method_family = init)]
63        pub unsafe fn initWithTextLayoutManager(
64            this: Allocated<Self>,
65            text_layout_manager: &NSTextLayoutManager,
66        ) -> Retained<Self>;
67
68        #[unsafe(method(new))]
69        #[unsafe(method_family = new)]
70        pub unsafe fn new() -> Retained<Self>;
71
72        #[unsafe(method(init))]
73        #[unsafe(method_family = init)]
74        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
75
76        #[unsafe(method(delegate))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn delegate(
79            &self,
80        ) -> Option<Retained<ProtocolObject<dyn NSTextViewportLayoutControllerDelegate>>>;
81
82        /// This is a [weak property][objc2::topics::weak_property].
83        /// Setter for [`delegate`][Self::delegate].
84        #[unsafe(method(setDelegate:))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn setDelegate(
87            &self,
88            delegate: Option<&ProtocolObject<dyn NSTextViewportLayoutControllerDelegate>>,
89        );
90
91        #[cfg(feature = "NSTextLayoutManager")]
92        #[unsafe(method(textLayoutManager))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn textLayoutManager(&self) -> Option<Retained<NSTextLayoutManager>>;
95
96        #[cfg(feature = "objc2-core-foundation")]
97        #[unsafe(method(viewportBounds))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn viewportBounds(&self) -> CGRect;
100
101        #[cfg(feature = "NSTextRange")]
102        #[unsafe(method(viewportRange))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn viewportRange(&self) -> Option<Retained<NSTextRange>>;
105
106        #[unsafe(method(layoutViewport))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn layoutViewport(&self);
109
110        #[cfg(all(feature = "NSTextRange", feature = "objc2-core-foundation"))]
111        #[unsafe(method(relocateViewportToTextLocation:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn relocateViewportToTextLocation(
114            &self,
115            text_location: &ProtocolObject<dyn NSTextLocation>,
116        ) -> CGFloat;
117
118        #[cfg(feature = "objc2-core-foundation")]
119        #[unsafe(method(adjustViewportByVerticalOffset:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn adjustViewportByVerticalOffset(&self, vertical_offset: CGFloat);
122    );
123}