objc2_tv_ui_kit/generated/
TVCaptionButtonView.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::*;
11use objc2_ui_kit::*;
12
13use crate::*;
14
15/// Set of options for focus motion direction
16///
17/// These options alter the motion axis of the floating view.
18///
19/// See also [Apple's documentation](https://developer.apple.com/documentation/tvuikit/tvcaptionbuttonviewmotiondirection?language=objc)
20// NS_ENUM
21#[repr(transparent)]
22#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
23pub struct TVCaptionButtonViewMotionDirection(pub NSInteger);
24impl TVCaptionButtonViewMotionDirection {
25    /// The floating view will not have any motion. *
26    #[doc(alias = "TVCaptionButtonViewMotionDirectionNone")]
27    pub const None: Self = Self(0);
28    /// The floating view will slide horizontally. *
29    #[doc(alias = "TVCaptionButtonViewMotionDirectionHorizontal")]
30    pub const Horizontal: Self = Self(1);
31    /// The floating view will slide vertically. *
32    #[doc(alias = "TVCaptionButtonViewMotionDirectionVertical")]
33    pub const Vertical: Self = Self(2);
34    /// The floating view will slide in both axes. *
35    #[doc(alias = "TVCaptionButtonViewMotionDirectionAll")]
36    pub const All: Self = Self(3);
37}
38
39unsafe impl Encode for TVCaptionButtonViewMotionDirection {
40    const ENCODING: Encoding = NSInteger::ENCODING;
41}
42
43unsafe impl RefEncode for TVCaptionButtonViewMotionDirection {
44    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
45}
46
47extern_class!(
48    /// TVCaptionButtonView is a button-like lockup view with a caption (or a footer), which itself consists of a title and a subtitle.
49    ///
50    /// The caption button view can have either a content image or content text. The system adds it to a floating view with a knock-out effect. When in focus, the floating view will scale up in the .leading, .top., and .trailing directions by a fixed amount determined by the system. Overriding .focusSizeIncrease has no visible effect.
51    ///
52    /// See also [Apple's documentation](https://developer.apple.com/documentation/tvuikit/tvcaptionbuttonview?language=objc)
53    #[unsafe(super(TVLockupView, UIControl, UIView, UIResponder, NSObject))]
54    #[derive(Debug, PartialEq, Eq, Hash)]
55    #[cfg(feature = "TVLockupView")]
56    pub struct TVCaptionButtonView;
57);
58
59#[cfg(all(feature = "TVLockupView", feature = "objc2-quartz-core"))]
60extern_conformance!(
61    unsafe impl CALayerDelegate for TVCaptionButtonView {}
62);
63
64#[cfg(feature = "TVLockupView")]
65extern_conformance!(
66    unsafe impl NSCoding for TVCaptionButtonView {}
67);
68
69#[cfg(feature = "TVLockupView")]
70extern_conformance!(
71    unsafe impl NSObjectProtocol for TVCaptionButtonView {}
72);
73
74#[cfg(feature = "TVLockupView")]
75extern_conformance!(
76    unsafe impl UIAppearance for TVCaptionButtonView {}
77);
78
79#[cfg(feature = "TVLockupView")]
80extern_conformance!(
81    unsafe impl UIAppearanceContainer for TVCaptionButtonView {}
82);
83
84#[cfg(feature = "TVLockupView")]
85extern_conformance!(
86    unsafe impl UICoordinateSpace for TVCaptionButtonView {}
87);
88
89#[cfg(feature = "TVLockupView")]
90extern_conformance!(
91    unsafe impl UIDynamicItem for TVCaptionButtonView {}
92);
93
94#[cfg(feature = "TVLockupView")]
95extern_conformance!(
96    unsafe impl UIFocusEnvironment for TVCaptionButtonView {}
97);
98
99#[cfg(feature = "TVLockupView")]
100extern_conformance!(
101    unsafe impl UIFocusItem for TVCaptionButtonView {}
102);
103
104#[cfg(feature = "TVLockupView")]
105extern_conformance!(
106    unsafe impl UIFocusItemContainer for TVCaptionButtonView {}
107);
108
109#[cfg(feature = "TVLockupView")]
110extern_conformance!(
111    unsafe impl UIResponderStandardEditActions for TVCaptionButtonView {}
112);
113
114#[cfg(feature = "TVLockupView")]
115extern_conformance!(
116    unsafe impl UITraitEnvironment for TVCaptionButtonView {}
117);
118
119#[cfg(feature = "TVLockupView")]
120impl TVCaptionButtonView {
121    extern_methods!(
122        #[unsafe(method(motionDirection))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn motionDirection(&self) -> TVCaptionButtonViewMotionDirection;
125
126        /// Setter for [`motionDirection`][Self::motionDirection].
127        #[unsafe(method(setMotionDirection:))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn setMotionDirection(
130            &self,
131            motion_direction: TVCaptionButtonViewMotionDirection,
132        );
133
134        /// The content image
135        ///
136        /// If a contentText exists, setting contentImage will remove it and take its place. By default, the system creates a template image from the alpha values in the source image. To prevent system coloring, provide the source image with UIImageRenderingModeAlwaysOriginal.
137        #[unsafe(method(contentImage))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn contentImage(&self) -> Option<Retained<UIImage>>;
140
141        /// Setter for [`contentImage`][Self::contentImage].
142        #[unsafe(method(setContentImage:))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn setContentImage(&self, content_image: Option<&UIImage>);
145
146        /// The content text
147        ///
148        /// If a contentImage exists, setting contentText will remove it and take its place.
149        #[unsafe(method(contentText))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn contentText(&self) -> Option<Retained<NSString>>;
152
153        /// Setter for [`contentText`][Self::contentText].
154        ///
155        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
156        #[unsafe(method(setContentText:))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn setContentText(&self, content_text: Option<&NSString>);
159
160        /// The title text
161        #[unsafe(method(title))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn title(&self) -> Option<Retained<NSString>>;
164
165        /// Setter for [`title`][Self::title].
166        ///
167        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
168        #[unsafe(method(setTitle:))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn setTitle(&self, title: Option<&NSString>);
171
172        /// The subtitle text
173        #[unsafe(method(subtitle))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn subtitle(&self) -> Option<Retained<NSString>>;
176
177        /// Setter for [`subtitle`][Self::subtitle].
178        ///
179        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
180        #[unsafe(method(setSubtitle:))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn setSubtitle(&self, subtitle: Option<&NSString>);
183    );
184}
185
186/// Methods declared on superclass `UIControl`.
187#[cfg(feature = "TVLockupView")]
188impl TVCaptionButtonView {
189    extern_methods!(
190        #[cfg(feature = "objc2-core-foundation")]
191        #[unsafe(method(initWithFrame:))]
192        #[unsafe(method_family = init)]
193        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
194
195        /// # Safety
196        ///
197        /// `coder` possibly has further requirements.
198        #[unsafe(method(initWithCoder:))]
199        #[unsafe(method_family = init)]
200        pub unsafe fn initWithCoder(
201            this: Allocated<Self>,
202            coder: &NSCoder,
203        ) -> Option<Retained<Self>>;
204
205        #[cfg(feature = "objc2-core-foundation")]
206        /// Initializes the control and adds primaryAction for the UIControlEventPrimaryActionTriggered control event. Subclasses of UIControl may alter or add behaviors around the usage of primaryAction, see subclass documentation of this initializer for additional information.
207        #[unsafe(method(initWithFrame:primaryAction:))]
208        #[unsafe(method_family = init)]
209        pub unsafe fn initWithFrame_primaryAction(
210            this: Allocated<Self>,
211            frame: CGRect,
212            primary_action: Option<&UIAction>,
213        ) -> Retained<Self>;
214    );
215}
216
217/// Methods declared on superclass `UIView`.
218#[cfg(feature = "TVLockupView")]
219impl TVCaptionButtonView {
220    extern_methods!(
221        #[unsafe(method(init))]
222        #[unsafe(method_family = init)]
223        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
224    );
225}
226
227/// Methods declared on superclass `NSObject`.
228#[cfg(feature = "TVLockupView")]
229impl TVCaptionButtonView {
230    extern_methods!(
231        #[unsafe(method(new))]
232        #[unsafe(method_family = new)]
233        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
234    );
235}