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 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 fn preferredBehavioralStyle(&self) -> UIBehavioralStyle;
53
54        /// Setter for [`preferredBehavioralStyle`][Self::preferredBehavioralStyle].
55        #[unsafe(method(setPreferredBehavioralStyle:))]
56        #[unsafe(method_family = none)]
57        pub fn setPreferredBehavioralStyle(&self, preferred_behavioral_style: UIBehavioralStyle);
58    );
59}
60
61/// UIBehavioralStyle.
62#[cfg(all(
63    feature = "UIControl",
64    feature = "UIResponder",
65    feature = "UISlider",
66    feature = "UIView"
67))]
68impl UISlider {
69    extern_methods!(
70        /// The slider's behavioral style. This property always returns a concrete, resolved style (never UIBehavioralStyleAutomatic).
71        #[unsafe(method(behavioralStyle))]
72        #[unsafe(method_family = none)]
73        pub fn behavioralStyle(&self) -> UIBehavioralStyle;
74
75        /// Request a style for the slider. If the style changes, the slider will redraw and its metrics may change.
76        #[unsafe(method(preferredBehavioralStyle))]
77        #[unsafe(method_family = none)]
78        pub fn preferredBehavioralStyle(&self) -> UIBehavioralStyle;
79
80        /// Setter for [`preferredBehavioralStyle`][Self::preferredBehavioralStyle].
81        #[unsafe(method(setPreferredBehavioralStyle:))]
82        #[unsafe(method_family = none)]
83        pub fn setPreferredBehavioralStyle(&self, preferred_behavioral_style: UIBehavioralStyle);
84    );
85}