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
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 unsafe 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 unsafe fn delegate(
81            &self,
82        ) -> Option<Retained<ProtocolObject<dyn NSTextViewportLayoutControllerDelegate>>>;
83
84        /// This is a [weak property][objc2::topics::weak_property].
85        /// Setter for [`delegate`][Self::delegate].
86        #[unsafe(method(setDelegate:))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn setDelegate(
89            &self,
90            delegate: Option<&ProtocolObject<dyn NSTextViewportLayoutControllerDelegate>>,
91        );
92
93        #[cfg(feature = "NSTextLayoutManager")]
94        #[unsafe(method(textLayoutManager))]
95        #[unsafe(method_family = none)]
96        pub unsafe fn textLayoutManager(&self) -> Option<Retained<NSTextLayoutManager>>;
97
98        #[cfg(feature = "objc2-core-foundation")]
99        #[unsafe(method(viewportBounds))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn viewportBounds(&self) -> CGRect;
102
103        #[cfg(feature = "NSTextRange")]
104        #[unsafe(method(viewportRange))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn viewportRange(&self) -> Option<Retained<NSTextRange>>;
107
108        #[unsafe(method(layoutViewport))]
109        #[unsafe(method_family = none)]
110        pub unsafe fn layoutViewport(&self);
111
112        #[cfg(all(feature = "NSTextRange", feature = "objc2-core-foundation"))]
113        #[unsafe(method(relocateViewportToTextLocation:))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn relocateViewportToTextLocation(
116            &self,
117            text_location: &ProtocolObject<dyn NSTextLocation>,
118        ) -> CGFloat;
119
120        #[cfg(feature = "objc2-core-foundation")]
121        #[unsafe(method(adjustViewportByVerticalOffset:))]
122        #[unsafe(method_family = none)]
123        pub unsafe fn adjustViewportByVerticalOffset(&self, vertical_offset: CGFloat);
124    );
125}