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::*;

/// Sticker size is used to control the display size of the stickers in the Sticker Browser View.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/messages/msstickersize?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MSStickerSize(pub NSInteger);
impl MSStickerSize {
    #[doc(alias = "MSStickerSizeSmall")]
    pub const Small: Self = Self(0);
    #[doc(alias = "MSStickerSizeRegular")]
    pub const Regular: Self = Self(1);
    #[doc(alias = "MSStickerSizeLarge")]
    pub const Large: Self = Self(2);
}

unsafe impl Encode for MSStickerSize {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for MSStickerSize {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

#[cfg(feature = "objc2-ui-kit")]
impl MSStickerBrowserView {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        /// Initializes a MSStickerBrowserView with a frame using the regular size class.
        #[unsafe(method(initWithFrame:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;

        #[cfg(feature = "objc2-core-foundation")]
        /// Initializes a MSStickerBrowserView with a frame and sticker size class.
        ///
        /// Sticker images will be laid out in a grid similar to a UICollectionView
        /// configured with flow layout.
        ///
        /// vary based on the device. Sticker images will be scaled down to fit in the grid cell. If the
        /// sticker image is smaller than the cell size measured in pixels then it will be  centered
        /// in the grid cell.
        #[unsafe(method(initWithFrame:stickerSize:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithFrame_stickerSize(
            this: Allocated<Self>,
            frame: CGRect,
            sticker_size: MSStickerSize,
        ) -> Retained<Self>;

        /// The sticker size class.
        #[unsafe(method(stickerSize))]
        #[unsafe(method_family = none)]
        pub unsafe fn stickerSize(&self) -> MSStickerSize;

        #[cfg(feature = "MSStickerBrowserViewDataSource")]
        /// The Sticker Browser View data source.
        #[unsafe(method(dataSource))]
        #[unsafe(method_family = none)]
        pub unsafe fn dataSource(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn MSStickerBrowserViewDataSource>>>;

        #[cfg(feature = "MSStickerBrowserViewDataSource")]
        /// Setter for [`dataSource`][Self::dataSource].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setDataSource:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDataSource(
            &self,
            data_source: Option<&ProtocolObject<dyn MSStickerBrowserViewDataSource>>,
        );

        #[cfg(feature = "objc2-core-foundation")]
        /// The Sticker Browser View content offset.
        #[unsafe(method(contentOffset))]
        #[unsafe(method_family = none)]
        pub unsafe fn contentOffset(&self) -> CGPoint;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`contentOffset`][Self::contentOffset].
        #[unsafe(method(setContentOffset:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setContentOffset(&self, content_offset: CGPoint);

        /// The Sticker Browser View content inset.
        #[unsafe(method(contentInset))]
        #[unsafe(method_family = none)]
        pub unsafe fn contentInset(&self) -> UIEdgeInsets;

        /// Setter for [`contentInset`][Self::contentInset].
        #[unsafe(method(setContentInset:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setContentInset(&self, content_inset: UIEdgeInsets);

        #[cfg(feature = "objc2-core-foundation")]
        /// animate Sticker Browser View at constant velocity to new offset.
        #[unsafe(method(setContentOffset:animated:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setContentOffset_animated(&self, content_offset: CGPoint, animated: bool);

        /// Asks the Sticker Browser View to reload its data from its data source.
        #[unsafe(method(reloadData))]
        #[unsafe(method_family = none)]
        pub unsafe fn reloadData(&self);
    );
}

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