objc2_ui_kit/generated/
UIBehavioralStyle.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use objc2::__framework_prelude::*;
5
6use crate::*;
7
8/// Behavioral Styles are values that determine how a class — such as a view or control — behaves. This includes how the control is drawn, and what behaviors it supports. For example, handling certain customizations in one style, but not another.
9///
10/// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uibehavioralstyle?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct UIBehavioralStyle(pub NSUInteger);
15impl UIBehavioralStyle {
16    /// The system will choose the most appropriate style for the targetted platform.
17    #[doc(alias = "UIBehavioralStyleAutomatic")]
18    pub const Automatic: Self = Self(0);
19    /// A style and set of behaviors best for iOS/iPadOS applications
20    #[doc(alias = "UIBehavioralStylePad")]
21    pub const Pad: Self = Self(1);
22    /// A style and set of behaviors best for macOS applications
23    #[doc(alias = "UIBehavioralStyleMac")]
24    pub const Mac: Self = Self(2);
25}
26
27unsafe impl Encode for UIBehavioralStyle {
28    const ENCODING: Encoding = NSUInteger::ENCODING;
29}
30
31unsafe impl RefEncode for UIBehavioralStyle {
32    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35/// UIBehavioralStyle.
36#[cfg(all(
37    feature = "UIButton",
38    feature = "UIControl",
39    feature = "UIResponder",
40    feature = "UIView"
41))]
42impl UIButton {
43    extern_methods!(
44        /// The button's behavioral style. This property always returns a concrete, resolved style (never UIBehavioralStyleAutomatic).
45        #[unsafe(method(behavioralStyle))]
46        #[unsafe(method_family = none)]
47        pub unsafe fn behavioralStyle(&self) -> UIBehavioralStyle;
48
49        /// Request a style for the button. If the style changed, the button will redraw and its metrics may change.
50        #[unsafe(method(preferredBehavioralStyle))]
51        #[unsafe(method_family = none)]
52        pub unsafe fn preferredBehavioralStyle(&self) -> UIBehavioralStyle;
53
54        /// Setter for [`preferredBehavioralStyle`][Self::preferredBehavioralStyle].
55        #[unsafe(method(setPreferredBehavioralStyle:))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn setPreferredBehavioralStyle(
58            &self,
59            preferred_behavioral_style: UIBehavioralStyle,
60        );
61    );
62}
63
64/// UIBehavioralStyle.
65#[cfg(all(
66    feature = "UIControl",
67    feature = "UIResponder",
68    feature = "UISlider",
69    feature = "UIView"
70))]
71impl UISlider {
72    extern_methods!(
73        /// The slider's behavioral style. This property always returns a concrete, resolved style (never UIBehavioralStyleAutomatic).
74        #[unsafe(method(behavioralStyle))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn behavioralStyle(&self) -> UIBehavioralStyle;
77
78        /// Request a style for the slider. If the style changes, the slider will redraw and its metrics may change.
79        #[unsafe(method(preferredBehavioralStyle))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn preferredBehavioralStyle(&self) -> UIBehavioralStyle;
82
83        /// Setter for [`preferredBehavioralStyle`][Self::preferredBehavioralStyle].
84        #[unsafe(method(setPreferredBehavioralStyle:))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn setPreferredBehavioralStyle(
87            &self,
88            preferred_behavioral_style: UIBehavioralStyle,
89        );
90    );
91}