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        #[unsafe(method(setContentText:))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn setContentText(&self, content_text: Option<&NSString>);
157
158        /// The title text
159        #[unsafe(method(title))]
160        #[unsafe(method_family = none)]
161        pub unsafe fn title(&self) -> Option<Retained<NSString>>;
162
163        /// Setter for [`title`][Self::title].
164        #[unsafe(method(setTitle:))]
165        #[unsafe(method_family = none)]
166        pub unsafe fn setTitle(&self, title: Option<&NSString>);
167
168        /// The subtitle text
169        #[unsafe(method(subtitle))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn subtitle(&self) -> Option<Retained<NSString>>;
172
173        /// Setter for [`subtitle`][Self::subtitle].
174        #[unsafe(method(setSubtitle:))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn setSubtitle(&self, subtitle: Option<&NSString>);
177    );
178}
179
180/// Methods declared on superclass `UIControl`.
181#[cfg(feature = "TVLockupView")]
182impl TVCaptionButtonView {
183    extern_methods!(
184        #[cfg(feature = "objc2-core-foundation")]
185        #[unsafe(method(initWithFrame:))]
186        #[unsafe(method_family = init)]
187        pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
188
189        #[unsafe(method(initWithCoder:))]
190        #[unsafe(method_family = init)]
191        pub unsafe fn initWithCoder(
192            this: Allocated<Self>,
193            coder: &NSCoder,
194        ) -> Option<Retained<Self>>;
195
196        #[cfg(feature = "objc2-core-foundation")]
197        /// 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.
198        #[unsafe(method(initWithFrame:primaryAction:))]
199        #[unsafe(method_family = init)]
200        pub unsafe fn initWithFrame_primaryAction(
201            this: Allocated<Self>,
202            frame: CGRect,
203            primary_action: Option<&UIAction>,
204        ) -> Retained<Self>;
205    );
206}
207
208/// Methods declared on superclass `NSObject`.
209#[cfg(feature = "TVLockupView")]
210impl TVCaptionButtonView {
211    extern_methods!(
212        #[unsafe(method(init))]
213        #[unsafe(method_family = init)]
214        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
215
216        #[unsafe(method(new))]
217        #[unsafe(method_family = new)]
218        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
219    );
220}