objc2-messages 0.3.2

Bindings to the Messages framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
#[cfg(feature = "objc2-quartz-core")]
use objc2_quartz_core::*;
#[cfg(feature = "objc2-ui-kit")]
use objc2_ui_kit::*;

use crate::*;

extern_class!(
    /// A UIView subclass that can display sticker assets.
    ///
    /// This class is a UIView subclass intended to display stickers. It provides
    /// drag and drop functionality so that user may drag the displayed sticker from this
    /// view and place it in the Messages transcript.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/messages/msstickerview?language=objc)
    #[unsafe(super(UIView, UIResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "objc2-ui-kit")]
    pub struct MSStickerView;
);

#[cfg(all(feature = "objc2-quartz-core", feature = "objc2-ui-kit"))]
extern_conformance!(
    unsafe impl CALayerDelegate for MSStickerView {}
);

#[cfg(feature = "objc2-ui-kit")]
extern_conformance!(
    unsafe impl NSCoding for MSStickerView {}
);

#[cfg(feature = "objc2-ui-kit")]
extern_conformance!(
    unsafe impl NSObjectProtocol for MSStickerView {}
);

#[cfg(feature = "objc2-ui-kit")]
extern_conformance!(
    unsafe impl UIAppearance for MSStickerView {}
);

#[cfg(feature = "objc2-ui-kit")]
extern_conformance!(
    unsafe impl UIAppearanceContainer for MSStickerView {}
);

#[cfg(feature = "objc2-ui-kit")]
extern_conformance!(
    unsafe impl UICoordinateSpace for MSStickerView {}
);

#[cfg(feature = "objc2-ui-kit")]
extern_conformance!(
    unsafe impl UIDynamicItem for MSStickerView {}
);

#[cfg(feature = "objc2-ui-kit")]
extern_conformance!(
    unsafe impl UIFocusEnvironment for MSStickerView {}
);

#[cfg(feature = "objc2-ui-kit")]
extern_conformance!(
    unsafe impl UIFocusItem for MSStickerView {}
);

#[cfg(feature = "objc2-ui-kit")]
extern_conformance!(
    unsafe impl UIFocusItemContainer for MSStickerView {}
);

#[cfg(feature = "objc2-ui-kit")]
extern_conformance!(
    unsafe impl UIResponderStandardEditActions for MSStickerView {}
);

#[cfg(feature = "objc2-ui-kit")]
extern_conformance!(
    unsafe impl UITraitEnvironment for MSStickerView {}
);

#[cfg(feature = "objc2-ui-kit")]
impl MSStickerView {
    extern_methods!(
        #[cfg(all(feature = "MSSticker", feature = "objc2-core-foundation"))]
        /// Initializes a MSStickerView with a frame and a MSSticker conforming object to display.
        #[unsafe(method(initWithFrame:sticker:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithFrame_sticker(
            this: Allocated<Self>,
            frame: CGRect,
            sticker: Option<&MSSticker>,
        ) -> Retained<Self>;

        #[cfg(feature = "MSSticker")]
        /// The MSSticker object to display.
        ///
        /// Set this property to nil to remove the current sticker. Setting the
        /// sticker property does not change the size of a MSStickerView. Call sizeToFit to
        /// adjust the size of the view to match the sticker.
        #[unsafe(method(sticker))]
        #[unsafe(method_family = none)]
        pub unsafe fn sticker(&self) -> Option<Retained<MSSticker>>;

        #[cfg(feature = "MSSticker")]
        /// Setter for [`sticker`][Self::sticker].
        #[unsafe(method(setSticker:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSticker(&self, sticker: Option<&MSSticker>);

        /// The amount of time it takes to go through one cycle of the sticker animation.
        #[unsafe(method(animationDuration))]
        #[unsafe(method_family = none)]
        pub unsafe fn animationDuration(&self) -> NSTimeInterval;

        /// Starts animating the sticker in the receiver.
        ///
        /// This method always starts the animation from the first frame.
        #[unsafe(method(startAnimating))]
        #[unsafe(method_family = none)]
        pub unsafe fn startAnimating(&self);

        /// Stops animating the sticker in the receiver.
        #[unsafe(method(stopAnimating))]
        #[unsafe(method_family = none)]
        pub unsafe fn stopAnimating(&self);

        /// Returns a Boolean value indicating whether the animation is running.
        #[unsafe(method(isAnimating))]
        #[unsafe(method_family = none)]
        pub unsafe fn isAnimating(&self) -> bool;
    );
}

/// Methods declared on superclass `UIView`.
#[cfg(feature = "objc2-ui-kit")]
impl MSStickerView {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(initWithFrame:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "objc2-ui-kit")]
impl MSStickerView {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}