use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use crate::*;
extern_protocol!(
pub unsafe trait NSTextViewportLayoutControllerDelegate: NSObjectProtocol {
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(viewportBoundsForTextViewportLayoutController:))]
#[unsafe(method_family = none)]
fn viewportBoundsForTextViewportLayoutController(
&self,
text_viewport_layout_controller: &NSTextViewportLayoutController,
) -> CGRect;
#[cfg(feature = "NSTextLayoutFragment")]
#[unsafe(method(textViewportLayoutController:configureRenderingSurfaceForTextLayoutFragment:))]
#[unsafe(method_family = none)]
fn textViewportLayoutController_configureRenderingSurfaceForTextLayoutFragment(
&self,
text_viewport_layout_controller: &NSTextViewportLayoutController,
text_layout_fragment: &NSTextLayoutFragment,
);
#[optional]
#[unsafe(method(textViewportLayoutControllerWillLayout:))]
#[unsafe(method_family = none)]
fn textViewportLayoutControllerWillLayout(
&self,
text_viewport_layout_controller: &NSTextViewportLayoutController,
);
#[optional]
#[unsafe(method(textViewportLayoutControllerDidLayout:))]
#[unsafe(method_family = none)]
fn textViewportLayoutControllerDidLayout(
&self,
text_viewport_layout_controller: &NSTextViewportLayoutController,
);
}
);
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSTextViewportLayoutController;
);
extern_conformance!(
unsafe impl NSObjectProtocol for NSTextViewportLayoutController {}
);
impl NSTextViewportLayoutController {
extern_methods!(
#[cfg(feature = "NSTextLayoutManager")]
#[unsafe(method(initWithTextLayoutManager:))]
#[unsafe(method_family = init)]
pub fn initWithTextLayoutManager(
this: Allocated<Self>,
text_layout_manager: &NSTextLayoutManager,
) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn NSTextViewportLayoutControllerDelegate>>>;
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn NSTextViewportLayoutControllerDelegate>>,
);
#[cfg(feature = "NSTextLayoutManager")]
#[unsafe(method(textLayoutManager))]
#[unsafe(method_family = none)]
pub fn textLayoutManager(&self) -> Option<Retained<NSTextLayoutManager>>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(viewportBounds))]
#[unsafe(method_family = none)]
pub fn viewportBounds(&self) -> CGRect;
#[cfg(feature = "NSTextRange")]
#[unsafe(method(viewportRange))]
#[unsafe(method_family = none)]
pub fn viewportRange(&self) -> Option<Retained<NSTextRange>>;
#[unsafe(method(layoutViewport))]
#[unsafe(method_family = none)]
pub fn layoutViewport(&self);
#[cfg(all(feature = "NSTextRange", feature = "objc2-core-foundation"))]
#[unsafe(method(relocateViewportToTextLocation:))]
#[unsafe(method_family = none)]
pub fn relocateViewportToTextLocation(
&self,
text_location: &ProtocolObject<dyn NSTextLocation>,
) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(adjustViewportByVerticalOffset:))]
#[unsafe(method_family = none)]
pub fn adjustViewportByVerticalOffset(&self, vertical_offset: CGFloat);
);
}