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"))]
115extern_conformance!(
116 unsafe impl CALayerDelegate for UIPageControl {}
117);
118
119#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
120extern_conformance!(
121 unsafe impl NSCoding for UIPageControl {}
122);
123
124#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
125extern_conformance!(
126 unsafe impl NSObjectProtocol for UIPageControl {}
127);
128
129#[cfg(all(
130 feature = "UIAppearance",
131 feature = "UIControl",
132 feature = "UIResponder",
133 feature = "UIView"
134))]
135extern_conformance!(
136 unsafe impl UIAppearance for UIPageControl {}
137);
138
139#[cfg(all(
140 feature = "UIAppearance",
141 feature = "UIControl",
142 feature = "UIResponder",
143 feature = "UIView"
144))]
145extern_conformance!(
146 unsafe impl UIAppearanceContainer for UIPageControl {}
147);
148
149#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
150extern_conformance!(
151 unsafe impl UICoordinateSpace for UIPageControl {}
152);
153
154#[cfg(all(
155 feature = "UIControl",
156 feature = "UIDynamicBehavior",
157 feature = "UIResponder",
158 feature = "UIView"
159))]
160extern_conformance!(
161 unsafe impl UIDynamicItem for UIPageControl {}
162);
163
164#[cfg(all(
165 feature = "UIControl",
166 feature = "UIFocus",
167 feature = "UIResponder",
168 feature = "UIView"
169))]
170extern_conformance!(
171 unsafe impl UIFocusEnvironment for UIPageControl {}
172);
173
174#[cfg(all(
175 feature = "UIControl",
176 feature = "UIFocus",
177 feature = "UIResponder",
178 feature = "UIView"
179))]
180extern_conformance!(
181 unsafe impl UIFocusItem for UIPageControl {}
182);
183
184#[cfg(all(
185 feature = "UIControl",
186 feature = "UIFocus",
187 feature = "UIResponder",
188 feature = "UIView"
189))]
190extern_conformance!(
191 unsafe impl UIFocusItemContainer for UIPageControl {}
192);
193
194#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
195extern_conformance!(
196 unsafe impl UIResponderStandardEditActions for UIPageControl {}
197);
198
199#[cfg(all(
200 feature = "UIControl",
201 feature = "UIResponder",
202 feature = "UITraitCollection",
203 feature = "UIView"
204))]
205extern_conformance!(
206 unsafe impl UITraitEnvironment for UIPageControl {}
207);
208
209#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
210impl UIPageControl {
211 extern_methods!(
212 #[unsafe(method(numberOfPages))]
214 #[unsafe(method_family = none)]
215 pub unsafe fn numberOfPages(&self) -> NSInteger;
216
217 #[unsafe(method(setNumberOfPages:))]
219 #[unsafe(method_family = none)]
220 pub unsafe fn setNumberOfPages(&self, number_of_pages: NSInteger);
221
222 #[unsafe(method(currentPage))]
224 #[unsafe(method_family = none)]
225 pub unsafe fn currentPage(&self) -> NSInteger;
226
227 #[unsafe(method(setCurrentPage:))]
229 #[unsafe(method_family = none)]
230 pub unsafe fn setCurrentPage(&self, current_page: NSInteger);
231
232 #[unsafe(method(hidesForSinglePage))]
234 #[unsafe(method_family = none)]
235 pub unsafe fn hidesForSinglePage(&self) -> bool;
236
237 #[unsafe(method(setHidesForSinglePage:))]
239 #[unsafe(method_family = none)]
240 pub unsafe fn setHidesForSinglePage(&self, hides_for_single_page: bool);
241
242 #[cfg(feature = "UIPageControlProgress")]
243 #[unsafe(method(progress))]
245 #[unsafe(method_family = none)]
246 pub unsafe fn progress(&self) -> Option<Retained<UIPageControlProgress>>;
247
248 #[cfg(feature = "UIPageControlProgress")]
249 #[unsafe(method(setProgress:))]
251 #[unsafe(method_family = none)]
252 pub unsafe fn setProgress(&self, progress: Option<&UIPageControlProgress>);
253
254 #[cfg(feature = "UIColor")]
255 #[unsafe(method(pageIndicatorTintColor))]
257 #[unsafe(method_family = none)]
258 pub unsafe fn pageIndicatorTintColor(&self) -> Option<Retained<UIColor>>;
259
260 #[cfg(feature = "UIColor")]
261 #[unsafe(method(setPageIndicatorTintColor:))]
263 #[unsafe(method_family = none)]
264 pub unsafe fn setPageIndicatorTintColor(&self, page_indicator_tint_color: Option<&UIColor>);
265
266 #[cfg(feature = "UIColor")]
267 #[unsafe(method(currentPageIndicatorTintColor))]
269 #[unsafe(method_family = none)]
270 pub unsafe fn currentPageIndicatorTintColor(&self) -> Option<Retained<UIColor>>;
271
272 #[cfg(feature = "UIColor")]
273 #[unsafe(method(setCurrentPageIndicatorTintColor:))]
275 #[unsafe(method_family = none)]
276 pub unsafe fn setCurrentPageIndicatorTintColor(
277 &self,
278 current_page_indicator_tint_color: Option<&UIColor>,
279 );
280
281 #[unsafe(method(backgroundStyle))]
283 #[unsafe(method_family = none)]
284 pub unsafe fn backgroundStyle(&self) -> UIPageControlBackgroundStyle;
285
286 #[unsafe(method(setBackgroundStyle:))]
288 #[unsafe(method_family = none)]
289 pub unsafe fn setBackgroundStyle(&self, background_style: UIPageControlBackgroundStyle);
290
291 #[unsafe(method(direction))]
294 #[unsafe(method_family = none)]
295 pub unsafe fn direction(&self) -> UIPageControlDirection;
296
297 #[unsafe(method(setDirection:))]
299 #[unsafe(method_family = none)]
300 pub unsafe fn setDirection(&self, direction: UIPageControlDirection);
301
302 #[unsafe(method(interactionState))]
304 #[unsafe(method_family = none)]
305 pub unsafe fn interactionState(&self) -> UIPageControlInteractionState;
306
307 #[unsafe(method(allowsContinuousInteraction))]
309 #[unsafe(method_family = none)]
310 pub unsafe fn allowsContinuousInteraction(&self) -> bool;
311
312 #[unsafe(method(setAllowsContinuousInteraction:))]
314 #[unsafe(method_family = none)]
315 pub unsafe fn setAllowsContinuousInteraction(&self, allows_continuous_interaction: bool);
316
317 #[cfg(feature = "UIImage")]
318 #[unsafe(method(preferredIndicatorImage))]
320 #[unsafe(method_family = none)]
321 pub unsafe fn preferredIndicatorImage(&self) -> Option<Retained<UIImage>>;
322
323 #[cfg(feature = "UIImage")]
324 #[unsafe(method(setPreferredIndicatorImage:))]
326 #[unsafe(method_family = none)]
327 pub unsafe fn setPreferredIndicatorImage(
328 &self,
329 preferred_indicator_image: Option<&UIImage>,
330 );
331
332 #[cfg(feature = "UIImage")]
333 #[unsafe(method(indicatorImageForPage:))]
337 #[unsafe(method_family = none)]
338 pub unsafe fn indicatorImageForPage(&self, page: NSInteger) -> Option<Retained<UIImage>>;
339
340 #[cfg(feature = "UIImage")]
341 #[unsafe(method(setIndicatorImage:forPage:))]
347 #[unsafe(method_family = none)]
348 pub unsafe fn setIndicatorImage_forPage(&self, image: Option<&UIImage>, page: NSInteger);
349
350 #[cfg(feature = "UIImage")]
351 #[unsafe(method(preferredCurrentPageIndicatorImage))]
356 #[unsafe(method_family = none)]
357 pub unsafe fn preferredCurrentPageIndicatorImage(&self) -> Option<Retained<UIImage>>;
358
359 #[cfg(feature = "UIImage")]
360 #[unsafe(method(setPreferredCurrentPageIndicatorImage:))]
362 #[unsafe(method_family = none)]
363 pub unsafe fn setPreferredCurrentPageIndicatorImage(
364 &self,
365 preferred_current_page_indicator_image: Option<&UIImage>,
366 );
367
368 #[cfg(feature = "UIImage")]
369 #[unsafe(method(currentPageIndicatorImageForPage:))]
373 #[unsafe(method_family = none)]
374 pub unsafe fn currentPageIndicatorImageForPage(
375 &self,
376 page: NSInteger,
377 ) -> Option<Retained<UIImage>>;
378
379 #[cfg(feature = "UIImage")]
380 #[unsafe(method(setCurrentPageIndicatorImage:forPage:))]
386 #[unsafe(method_family = none)]
387 pub unsafe fn setCurrentPageIndicatorImage_forPage(
388 &self,
389 image: Option<&UIImage>,
390 page: NSInteger,
391 );
392
393 #[cfg(feature = "objc2-core-foundation")]
394 #[unsafe(method(sizeForNumberOfPages:))]
396 #[unsafe(method_family = none)]
397 pub unsafe fn sizeForNumberOfPages(&self, page_count: NSInteger) -> CGSize;
398
399 #[deprecated = "defersCurrentPageDisplay no longer does anything reasonable with the new interaction mode."]
401 #[unsafe(method(defersCurrentPageDisplay))]
402 #[unsafe(method_family = none)]
403 pub unsafe fn defersCurrentPageDisplay(&self) -> bool;
404
405 #[deprecated = "defersCurrentPageDisplay no longer does anything reasonable with the new interaction mode."]
407 #[unsafe(method(setDefersCurrentPageDisplay:))]
408 #[unsafe(method_family = none)]
409 pub unsafe fn setDefersCurrentPageDisplay(&self, defers_current_page_display: bool);
410
411 #[deprecated = "updateCurrentPageDisplay no longer does anything reasonable with the new interaction mode."]
413 #[unsafe(method(updateCurrentPageDisplay))]
414 #[unsafe(method_family = none)]
415 pub unsafe fn updateCurrentPageDisplay(&self);
416 );
417}
418
419#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
421impl UIPageControl {
422 extern_methods!(
423 #[cfg(feature = "objc2-core-foundation")]
424 #[unsafe(method(initWithFrame:))]
425 #[unsafe(method_family = init)]
426 pub unsafe fn initWithFrame(this: Allocated<Self>, frame: CGRect) -> Retained<Self>;
427
428 #[unsafe(method(initWithCoder:))]
429 #[unsafe(method_family = init)]
430 pub unsafe fn initWithCoder(
431 this: Allocated<Self>,
432 coder: &NSCoder,
433 ) -> Option<Retained<Self>>;
434
435 #[cfg(all(
436 feature = "UIAction",
437 feature = "UIMenuElement",
438 feature = "objc2-core-foundation"
439 ))]
440 #[unsafe(method(initWithFrame:primaryAction:))]
442 #[unsafe(method_family = init)]
443 pub unsafe fn initWithFrame_primaryAction(
444 this: Allocated<Self>,
445 frame: CGRect,
446 primary_action: Option<&UIAction>,
447 ) -> Retained<Self>;
448 );
449}
450
451#[cfg(all(feature = "UIControl", feature = "UIResponder", feature = "UIView"))]
453impl UIPageControl {
454 extern_methods!(
455 #[unsafe(method(init))]
456 #[unsafe(method_family = init)]
457 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
458
459 #[unsafe(method(new))]
460 #[unsafe(method_family = new)]
461 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
462 );
463}