1use 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")]
10#[cfg(not(target_os = "watchos"))]
11use objc2_quartz_core::*;
12
13use crate::*;
14
15#[repr(transparent)]
18#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
19pub struct UIPageControlInteractionState(pub NSInteger);
20impl UIPageControlInteractionState {
21 #[doc(alias = "UIPageControlInteractionStateNone")]
23 pub const None: Self = Self(0);
24 #[doc(alias = "UIPageControlInteractionStateDiscrete")]
26 pub const Discrete: Self = Self(1);
27 #[doc(alias = "UIPageControlInteractionStateContinuous")]
29 pub const Continuous: Self = Self(2);
30}
31
32unsafe impl Encode for UIPageControlInteractionState {
33 const ENCODING: Encoding = NSInteger::ENCODING;
34}
35
36unsafe impl RefEncode for UIPageControlInteractionState {
37 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
38}
39
40#[repr(transparent)]
43#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
44pub struct UIPageControlBackgroundStyle(pub NSInteger);
45impl UIPageControlBackgroundStyle {
46 #[doc(alias = "UIPageControlBackgroundStyleAutomatic")]
48 pub const Automatic: Self = Self(0);
49 #[doc(alias = "UIPageControlBackgroundStyleProminent")]
51 pub const Prominent: Self = Self(1);
52 #[doc(alias = "UIPageControlBackgroundStyleMinimal")]
54 pub const Minimal: Self = Self(2);
55}
56
57unsafe impl Encode for UIPageControlBackgroundStyle {
58 const ENCODING: Encoding = NSInteger::ENCODING;
59}
60
61unsafe impl RefEncode for UIPageControlBackgroundStyle {
62 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
63}
64
65#[repr(transparent)]
68#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
69pub struct UIPageControlDirection(pub NSInteger);
70impl UIPageControlDirection {
71 #[doc(alias = "UIPageControlDirectionNatural")]
76 pub const Natural: Self = Self(0);
77 #[doc(alias = "UIPageControlDirectionLeftToRight")]
79 pub const LeftToRight: Self = Self(1);
80 #[doc(alias = "UIPageControlDirectionRightToLeft")]
82 pub const RightToLeft: Self = Self(2);
83 #[doc(alias = "UIPageControlDirectionTopToBottom")]
85 pub const TopToBottom: Self = Self(3);
86 #[doc(alias = "UIPageControlDirectionBottomToTop")]
88 pub const BottomToTop: Self = Self(4);
89}
90
91unsafe impl Encode for UIPageControlDirection {
92 const ENCODING: Encoding = NSInteger::ENCODING;
93}
94
95unsafe impl RefEncode for UIPageControlDirection {
96 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
97}
98
99extern_class!(
100 #[unsafe(super(UIControl, UIView, UIResponder, NSObject))]
102 #[thread_kind = MainThreadOnly]
103 #[derive(Debug, PartialEq, Eq, Hash)]
104 #[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
105 pub struct UIPageControl;
106);
107
108#[cfg(all(
109 feature = "UIControl",
110 feature = "UIResponder",
111 feature = "UIView",
112 feature = "objc2-quartz-core"
113))]
114#[cfg(not(target_os = "watchos"))]
115unsafe impl CALayerDelegate for UIPageControl {}
116
117#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
118unsafe impl NSCoding for UIPageControl {}
119
120#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
121unsafe impl NSObjectProtocol for UIPageControl {}
122
123#[cfg(all(
124 feature = "UIAppearance",
125 feature = "UIControl",
126 feature = "UIResponder",
127 feature = "UIView"
128))]
129unsafe impl UIAppearance for UIPageControl {}
130
131#[cfg(all(
132 feature = "UIAppearance",
133 feature = "UIControl",
134 feature = "UIResponder",
135 feature = "UIView"
136))]
137unsafe impl UIAppearanceContainer for UIPageControl {}
138
139#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
140unsafe impl UICoordinateSpace for UIPageControl {}
141
142#[cfg(all(
143 feature = "UIControl",
144 feature = "UIDynamicBehavior",
145 feature = "UIResponder",
146 feature = "UIView"
147))]
148unsafe impl UIDynamicItem for UIPageControl {}
149
150#[cfg(all(
151 feature = "UIControl",
152 feature = "UIFocus",
153 feature = "UIResponder",
154 feature = "UIView"
155))]
156unsafe impl UIFocusEnvironment for UIPageControl {}
157
158#[cfg(all(
159 feature = "UIControl",
160 feature = "UIFocus",
161 feature = "UIResponder",
162 feature = "UIView"
163))]
164unsafe impl UIFocusItem for UIPageControl {}
165
166#[cfg(all(
167 feature = "UIControl",
168 feature = "UIFocus",
169 feature = "UIResponder",
170 feature = "UIView"
171))]
172unsafe impl UIFocusItemContainer for UIPageControl {}
173
174#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
175unsafe impl UIResponderStandardEditActions for UIPageControl {}
176
177#[cfg(all(
178 feature = "UIControl",
179 feature = "UIResponder",
180 feature = "UITraitCollection",
181 feature = "UIView"
182))]
183unsafe impl UITraitEnvironment for UIPageControl {}
184
185#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
186impl UIPageControl {
187 extern_methods!(
188 #[unsafe(method(numberOfPages))]
190 #[unsafe(method_family = none)]
191 pub unsafe fn numberOfPages(&self) -> NSInteger;
192
193 #[unsafe(method(setNumberOfPages:))]
195 #[unsafe(method_family = none)]
196 pub unsafe fn setNumberOfPages(&self, number_of_pages: NSInteger);
197
198 #[unsafe(method(currentPage))]
200 #[unsafe(method_family = none)]
201 pub unsafe fn currentPage(&self) -> NSInteger;
202
203 #[unsafe(method(setCurrentPage:))]
205 #[unsafe(method_family = none)]
206 pub unsafe fn setCurrentPage(&self, current_page: NSInteger);
207
208 #[unsafe(method(hidesForSinglePage))]
210 #[unsafe(method_family = none)]
211 pub unsafe fn hidesForSinglePage(&self) -> bool;
212
213 #[unsafe(method(setHidesForSinglePage:))]
215 #[unsafe(method_family = none)]
216 pub unsafe fn setHidesForSinglePage(&self, hides_for_single_page: bool);
217
218 #[cfg(feature = "UIPageControlProgress")]
219 #[unsafe(method(progress))]
221 #[unsafe(method_family = none)]
222 pub unsafe fn progress(&self) -> Option<Retained<UIPageControlProgress>>;
223
224 #[cfg(feature = "UIPageControlProgress")]
225 #[unsafe(method(setProgress:))]
227 #[unsafe(method_family = none)]
228 pub unsafe fn setProgress(&self, progress: Option<&UIPageControlProgress>);
229
230 #[cfg(feature = "UIColor")]
231 #[unsafe(method(pageIndicatorTintColor))]
233 #[unsafe(method_family = none)]
234 pub unsafe fn pageIndicatorTintColor(&self) -> Option<Retained<UIColor>>;
235
236 #[cfg(feature = "UIColor")]
237 #[unsafe(method(setPageIndicatorTintColor:))]
239 #[unsafe(method_family = none)]
240 pub unsafe fn setPageIndicatorTintColor(&self, page_indicator_tint_color: Option<&UIColor>);
241
242 #[cfg(feature = "UIColor")]
243 #[unsafe(method(currentPageIndicatorTintColor))]
245 #[unsafe(method_family = none)]
246 pub unsafe fn currentPageIndicatorTintColor(&self) -> Option<Retained<UIColor>>;
247
248 #[cfg(feature = "UIColor")]
249 #[unsafe(method(setCurrentPageIndicatorTintColor:))]
251 #[unsafe(method_family = none)]
252 pub unsafe fn setCurrentPageIndicatorTintColor(
253 &self,
254 current_page_indicator_tint_color: Option<&UIColor>,
255 );
256
257 #[unsafe(method(backgroundStyle))]
259 #[unsafe(method_family = none)]
260 pub unsafe fn backgroundStyle(&self) -> UIPageControlBackgroundStyle;
261
262 #[unsafe(method(setBackgroundStyle:))]
264 #[unsafe(method_family = none)]
265 pub unsafe fn setBackgroundStyle(&self, background_style: UIPageControlBackgroundStyle);
266
267 #[unsafe(method(direction))]
270 #[unsafe(method_family = none)]
271 pub unsafe fn direction(&self) -> UIPageControlDirection;
272
273 #[unsafe(method(setDirection:))]
275 #[unsafe(method_family = none)]
276 pub unsafe fn setDirection(&self, direction: UIPageControlDirection);
277
278 #[unsafe(method(interactionState))]
280 #[unsafe(method_family = none)]
281 pub unsafe fn interactionState(&self) -> UIPageControlInteractionState;
282
283 #[unsafe(method(allowsContinuousInteraction))]
285 #[unsafe(method_family = none)]
286 pub unsafe fn allowsContinuousInteraction(&self) -> bool;
287
288 #[unsafe(method(setAllowsContinuousInteraction:))]
290 #[unsafe(method_family = none)]
291 pub unsafe fn setAllowsContinuousInteraction(&self, allows_continuous_interaction: bool);
292
293 #[cfg(feature = "UIImage")]
294 #[unsafe(method(preferredIndicatorImage))]
296 #[unsafe(method_family = none)]
297 pub unsafe fn preferredIndicatorImage(&self) -> Option<Retained<UIImage>>;
298
299 #[cfg(feature = "UIImage")]
300 #[unsafe(method(setPreferredIndicatorImage:))]
302 #[unsafe(method_family = none)]
303 pub unsafe fn setPreferredIndicatorImage(
304 &self,
305 preferred_indicator_image: Option<&UIImage>,
306 );
307
308 #[cfg(feature = "UIImage")]
309 #[unsafe(method(indicatorImageForPage:))]
313 #[unsafe(method_family = none)]
314 pub unsafe fn indicatorImageForPage(&self, page: NSInteger) -> Option<Retained<UIImage>>;
315
316 #[cfg(feature = "UIImage")]
317 #[unsafe(method(setIndicatorImage:forPage:))]
323 #[unsafe(method_family = none)]
324 pub unsafe fn setIndicatorImage_forPage(&self, image: Option<&UIImage>, page: NSInteger);
325
326 #[cfg(feature = "UIImage")]
327 #[unsafe(method(preferredCurrentPageIndicatorImage))]
332 #[unsafe(method_family = none)]
333 pub unsafe fn preferredCurrentPageIndicatorImage(&self) -> Option<Retained<UIImage>>;
334
335 #[cfg(feature = "UIImage")]
336 #[unsafe(method(setPreferredCurrentPageIndicatorImage:))]
338 #[unsafe(method_family = none)]
339 pub unsafe fn setPreferredCurrentPageIndicatorImage(
340 &self,
341 preferred_current_page_indicator_image: Option<&UIImage>,
342 );
343
344 #[cfg(feature = "UIImage")]
345 #[unsafe(method(currentPageIndicatorImageForPage:))]
349 #[unsafe(method_family = none)]
350 pub unsafe fn currentPageIndicatorImageForPage(
351 &self,
352 page: NSInteger,
353 ) -> Option<Retained<UIImage>>;
354
355 #[cfg(feature = "UIImage")]
356 #[unsafe(method(setCurrentPageIndicatorImage:forPage:))]
362 #[unsafe(method_family = none)]
363 pub unsafe fn setCurrentPageIndicatorImage_forPage(
364 &self,
365 image: Option<&UIImage>,
366 page: NSInteger,
367 );
368
369 #[cfg(feature = "objc2-core-foundation")]
370 #[unsafe(method(sizeForNumberOfPages:))]
372 #[unsafe(method_family = none)]
373 pub unsafe fn sizeForNumberOfPages(&self, page_count: NSInteger) -> CGSize;
374
375 #[deprecated = "defersCurrentPageDisplay no longer does anything reasonable with the new interaction mode."]
377 #[unsafe(method(defersCurrentPageDisplay))]
378 #[unsafe(method_family = none)]
379 pub unsafe fn defersCurrentPageDisplay(&self) -> bool;
380
381 #[deprecated = "defersCurrentPageDisplay no longer does anything reasonable with the new interaction mode."]
383 #[unsafe(method(setDefersCurrentPageDisplay:))]
384 #[unsafe(method_family = none)]
385 pub unsafe fn setDefersCurrentPageDisplay(&self, defers_current_page_display: bool);
386
387 #[deprecated = "updateCurrentPageDisplay no longer does anything reasonable with the new interaction mode."]
389 #[unsafe(method(updateCurrentPageDisplay))]
390 #[unsafe(method_family = none)]
391 pub unsafe fn updateCurrentPageDisplay(&self);
392 );
393}
394
395#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
397impl UIPageControl {
398 extern_methods!(
399 #[cfg(feature = "objc2-core-foundation")]
400 #[unsafe(method(initWithFrame:))]
401 #[unsafe(method_family = init)]
402 pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
403
404 #[unsafe(method(initWithCoder:))]
405 #[unsafe(method_family = init)]
406 pub unsafe fn initWithCoder(
407 this: Allocated<Self>,
408 coder: &NSCoder,
409 ) -> Option<Retained<Self>>;
410
411 #[cfg(all(
412 feature = "UIAction",
413 feature = "UIMenuElement",
414 feature = "objc2-core-foundation"
415 ))]
416 #[unsafe(method(initWithFrame:primaryAction:))]
418 #[unsafe(method_family = init)]
419 pub unsafe fn initWithFrame_primaryAction(
420 this: Allocated<Self>,
421 frame: CGRect,
422 primary_action: Option<&UIAction>,
423 ) -> Retained<Self>;
424 );
425}
426
427#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
429impl UIPageControl {
430 extern_methods!(
431 #[unsafe(method(init))]
432 #[unsafe(method_family = init)]
433 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
434
435 #[unsafe(method(new))]
436 #[unsafe(method_family = new)]
437 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
438 );
439}