objc2_messages/generated/
MSStickerBrowserView.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::*;
8use objc2_foundation::*;
9#[cfg(feature = "objc2-quartz-core")]
10use objc2_quartz_core::*;
11#[cfg(feature = "objc2-ui-kit")]
12use objc2_ui_kit::*;
13
14use crate::*;
15
16/// Sticker size is used to control the display size of the stickers in the Sticker Browser View.
17///
18/// See also [Apple's documentation](https://developer.apple.com/documentation/messages/msstickersize?language=objc)
19// NS_ENUM
20#[repr(transparent)]
21#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
22pub struct MSStickerSize(pub NSInteger);
23impl MSStickerSize {
24    #[doc(alias = "MSStickerSizeSmall")]
25    pub const Small: Self = Self(0);
26    #[doc(alias = "MSStickerSizeRegular")]
27    pub const Regular: Self = Self(1);
28    #[doc(alias = "MSStickerSizeLarge")]
29    pub const Large: Self = Self(2);
30}
31
32unsafe impl Encode for MSStickerSize {
33    const ENCODING: Encoding = NSInteger::ENCODING;
34}
35
36unsafe impl RefEncode for MSStickerSize {
37    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
38}
39
40extern_class!(
41    /// A UIView subclass that can display a collection of sticker assets.
42    ///
43    /// This class is a UIView subclass intended to display a collection of
44    /// stickers. It provides drag and drop functionality so that user may drag an individual
45    /// stickers from this view and place it in the Messages transcript. Stickers may also be
46    /// tapped to add them directly to Messages input field.
47    ///
48    /// See also [Apple's documentation](https://developer.apple.com/documentation/messages/msstickerbrowserview?language=objc)
49    #[unsafe(super(UIView, UIResponder, NSObject))]
50    #[derive(Debug, PartialEq, Eq, Hash)]
51    #[cfg(feature = "objc2-ui-kit")]
52    pub struct MSStickerBrowserView;
53);
54
55#[cfg(all(feature = "objc2-quartz-core", feature = "objc2-ui-kit"))]
56extern_conformance!(
57    unsafe impl CALayerDelegate for MSStickerBrowserView {}
58);
59
60#[cfg(feature = "objc2-ui-kit")]
61extern_conformance!(
62    unsafe impl NSCoding for MSStickerBrowserView {}
63);
64
65#[cfg(feature = "objc2-ui-kit")]
66extern_conformance!(
67    unsafe impl NSObjectProtocol for MSStickerBrowserView {}
68);
69
70#[cfg(feature = "objc2-ui-kit")]
71extern_conformance!(
72    unsafe impl UIAppearance for MSStickerBrowserView {}
73);
74
75#[cfg(feature = "objc2-ui-kit")]
76extern_conformance!(
77    unsafe impl UIAppearanceContainer for MSStickerBrowserView {}
78);
79
80#[cfg(feature = "objc2-ui-kit")]
81extern_conformance!(
82    unsafe impl UICoordinateSpace for MSStickerBrowserView {}
83);
84
85#[cfg(feature = "objc2-ui-kit")]
86extern_conformance!(
87    unsafe impl UIDynamicItem for MSStickerBrowserView {}
88);
89
90#[cfg(feature = "objc2-ui-kit")]
91extern_conformance!(
92    unsafe impl UIFocusEnvironment for MSStickerBrowserView {}
93);
94
95#[cfg(feature = "objc2-ui-kit")]
96extern_conformance!(
97    unsafe impl UIFocusItem for MSStickerBrowserView {}
98);
99
100#[cfg(feature = "objc2-ui-kit")]
101extern_conformance!(
102    unsafe impl UIFocusItemContainer for MSStickerBrowserView {}
103);
104
105#[cfg(feature = "objc2-ui-kit")]
106extern_conformance!(
107    unsafe impl UIResponderStandardEditActions for MSStickerBrowserView {}
108);
109
110#[cfg(feature = "objc2-ui-kit")]
111extern_conformance!(
112    unsafe impl UITraitEnvironment for MSStickerBrowserView {}
113);
114
115#[cfg(feature = "objc2-ui-kit")]
116impl MSStickerBrowserView {
117    extern_methods!(
118        #[cfg(feature = "objc2-core-foundation")]
119        /// Initializes a MSStickerBrowserView with a frame using the regular size class.
120        #[unsafe(method(initWithFrame:))]
121        #[unsafe(method_family = init)]
122        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
123
124        #[cfg(feature = "objc2-core-foundation")]
125        /// Initializes a MSStickerBrowserView with a frame and sticker size class.
126        ///
127        /// Sticker images will be laid out in a grid similar to a UICollectionView
128        /// configured with flow layout.
129        ///
130        /// vary based on the device. Sticker images will be scaled down to fit in the grid cell. If the
131        /// sticker image is smaller than the cell size measured in pixels then it will be  centered
132        /// in the grid cell.
133        #[unsafe(method(initWithFrame:stickerSize:))]
134        #[unsafe(method_family = init)]
135        pub unsafe fn initWithFrame_stickerSize(
136            this: Allocated<Self>,
137            frame: CGRect,
138            sticker_size: MSStickerSize,
139        ) -> Retained<Self>;
140
141        /// The sticker size class.
142        #[unsafe(method(stickerSize))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn stickerSize(&self) -> MSStickerSize;
145
146        #[cfg(feature = "MSStickerBrowserViewDataSource")]
147        /// The Sticker Browser View data source.
148        #[unsafe(method(dataSource))]
149        #[unsafe(method_family = none)]
150        pub unsafe fn dataSource(
151            &self,
152        ) -> Option<Retained<ProtocolObject<dyn MSStickerBrowserViewDataSource>>>;
153
154        #[cfg(feature = "MSStickerBrowserViewDataSource")]
155        /// This is a [weak property][objc2::topics::weak_property].
156        /// Setter for [`dataSource`][Self::dataSource].
157        #[unsafe(method(setDataSource:))]
158        #[unsafe(method_family = none)]
159        pub unsafe fn setDataSource(
160            &self,
161            data_source: Option<&ProtocolObject<dyn MSStickerBrowserViewDataSource>>,
162        );
163
164        #[cfg(feature = "objc2-core-foundation")]
165        /// The Sticker Browser View content offset.
166        #[unsafe(method(contentOffset))]
167        #[unsafe(method_family = none)]
168        pub unsafe fn contentOffset(&self) -> CGPoint;
169
170        #[cfg(feature = "objc2-core-foundation")]
171        /// Setter for [`contentOffset`][Self::contentOffset].
172        #[unsafe(method(setContentOffset:))]
173        #[unsafe(method_family = none)]
174        pub unsafe fn setContentOffset(&self, content_offset: CGPoint);
175
176        /// The Sticker Browser View content inset.
177        #[unsafe(method(contentInset))]
178        #[unsafe(method_family = none)]
179        pub unsafe fn contentInset(&self) -> UIEdgeInsets;
180
181        /// Setter for [`contentInset`][Self::contentInset].
182        #[unsafe(method(setContentInset:))]
183        #[unsafe(method_family = none)]
184        pub unsafe fn setContentInset(&self, content_inset: UIEdgeInsets);
185
186        #[cfg(feature = "objc2-core-foundation")]
187        /// animate Sticker Browser View at constant velocity to new offset.
188        #[unsafe(method(setContentOffset:animated:))]
189        #[unsafe(method_family = none)]
190        pub unsafe fn setContentOffset_animated(&self, content_offset: CGPoint, animated: bool);
191
192        /// Asks the Sticker Browser View to reload its data from its data source.
193        #[unsafe(method(reloadData))]
194        #[unsafe(method_family = none)]
195        pub unsafe fn reloadData(&self);
196    );
197}
198
199/// Methods declared on superclass `UIView`.
200#[cfg(feature = "objc2-ui-kit")]
201impl MSStickerBrowserView {
202    extern_methods!(
203        #[unsafe(method(initWithCoder:))]
204        #[unsafe(method_family = init)]
205        pub unsafe fn initWithCoder(
206            this: Allocated<Self>,
207            coder: &NSCoder,
208        ) -> Option<Retained<Self>>;
209    );
210}
211
212/// Methods declared on superclass `NSObject`.
213#[cfg(feature = "objc2-ui-kit")]
214impl MSStickerBrowserView {
215    extern_methods!(
216        #[unsafe(method(init))]
217        #[unsafe(method_family = init)]
218        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
219
220        #[unsafe(method(new))]
221        #[unsafe(method_family = new)]
222        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
223    );
224}