use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct UITraitCollection;
);
unsafe impl Send for UITraitCollection {}
unsafe impl Sync for UITraitCollection {}
extern_conformance!(
unsafe impl NSCoding for UITraitCollection {}
);
extern_conformance!(
unsafe impl NSCopying for UITraitCollection {}
);
unsafe impl CopyingHelper for UITraitCollection {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for UITraitCollection {}
);
extern_conformance!(
unsafe impl NSSecureCoding for UITraitCollection {}
);
impl UITraitCollection {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[deprecated = "Compare values for specific traits in the trait collections instead"]
#[unsafe(method(containsTraitsInCollection:))]
#[unsafe(method_family = none)]
pub fn containsTraitsInCollection(&self, r#trait: Option<&UITraitCollection>) -> bool;
#[deprecated = "Use +[UITraitCollection traitCollectionWithTraits:] and -[UITraitCollection traitCollectionByModifyingTraits:] to create and modify trait collections"]
#[unsafe(method(traitCollectionWithTraitsFromCollections:))]
#[unsafe(method_family = none)]
pub fn traitCollectionWithTraitsFromCollections(
trait_collections: &NSArray<UITraitCollection>,
) -> Retained<UITraitCollection>;
#[cfg(feature = "UIDevice")]
#[unsafe(method(traitCollectionWithUserInterfaceIdiom:))]
#[unsafe(method_family = none)]
pub fn traitCollectionWithUserInterfaceIdiom(
idiom: UIUserInterfaceIdiom,
) -> Retained<UITraitCollection>;
#[cfg(feature = "UIDevice")]
#[unsafe(method(userInterfaceIdiom))]
#[unsafe(method_family = none)]
pub unsafe fn userInterfaceIdiom(&self) -> UIUserInterfaceIdiom;
#[cfg(feature = "UIInterface")]
#[unsafe(method(traitCollectionWithUserInterfaceStyle:))]
#[unsafe(method_family = none)]
pub fn traitCollectionWithUserInterfaceStyle(
user_interface_style: UIUserInterfaceStyle,
) -> Retained<UITraitCollection>;
#[cfg(feature = "UIInterface")]
#[unsafe(method(userInterfaceStyle))]
#[unsafe(method_family = none)]
pub unsafe fn userInterfaceStyle(&self) -> UIUserInterfaceStyle;
#[cfg(feature = "UIInterface")]
#[unsafe(method(traitCollectionWithLayoutDirection:))]
#[unsafe(method_family = none)]
pub fn traitCollectionWithLayoutDirection(
layout_direction: UITraitEnvironmentLayoutDirection,
) -> Retained<UITraitCollection>;
#[cfg(feature = "UIInterface")]
#[unsafe(method(layoutDirection))]
#[unsafe(method_family = none)]
pub unsafe fn layoutDirection(&self) -> UITraitEnvironmentLayoutDirection;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(traitCollectionWithDisplayScale:))]
#[unsafe(method_family = none)]
pub fn traitCollectionWithDisplayScale(scale: CGFloat) -> Retained<UITraitCollection>;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(displayScale))]
#[unsafe(method_family = none)]
pub unsafe fn displayScale(&self) -> CGFloat;
#[cfg(feature = "UIInterface")]
#[unsafe(method(traitCollectionWithHorizontalSizeClass:))]
#[unsafe(method_family = none)]
pub fn traitCollectionWithHorizontalSizeClass(
horizontal_size_class: UIUserInterfaceSizeClass,
) -> Retained<UITraitCollection>;
#[cfg(feature = "UIInterface")]
#[unsafe(method(horizontalSizeClass))]
#[unsafe(method_family = none)]
pub unsafe fn horizontalSizeClass(&self) -> UIUserInterfaceSizeClass;
#[cfg(feature = "UIInterface")]
#[unsafe(method(traitCollectionWithVerticalSizeClass:))]
#[unsafe(method_family = none)]
pub fn traitCollectionWithVerticalSizeClass(
vertical_size_class: UIUserInterfaceSizeClass,
) -> Retained<UITraitCollection>;
#[cfg(feature = "UIInterface")]
#[unsafe(method(verticalSizeClass))]
#[unsafe(method_family = none)]
pub unsafe fn verticalSizeClass(&self) -> UIUserInterfaceSizeClass;
#[cfg(feature = "UITouch")]
#[unsafe(method(traitCollectionWithForceTouchCapability:))]
#[unsafe(method_family = none)]
pub fn traitCollectionWithForceTouchCapability(
capability: UIForceTouchCapability,
) -> Retained<UITraitCollection>;
#[cfg(feature = "UITouch")]
#[unsafe(method(forceTouchCapability))]
#[unsafe(method_family = none)]
pub fn forceTouchCapability(&self) -> UIForceTouchCapability;
#[cfg(feature = "UIContentSizeCategory")]
#[unsafe(method(traitCollectionWithPreferredContentSizeCategory:))]
#[unsafe(method_family = none)]
pub fn traitCollectionWithPreferredContentSizeCategory(
preferred_content_size_category: &UIContentSizeCategory,
) -> Retained<UITraitCollection>;
#[cfg(feature = "UIContentSizeCategory")]
#[unsafe(method(preferredContentSizeCategory))]
#[unsafe(method_family = none)]
pub unsafe fn preferredContentSizeCategory(&self) -> Retained<UIContentSizeCategory>;
#[cfg(feature = "UIInterface")]
#[unsafe(method(traitCollectionWithDisplayGamut:))]
#[unsafe(method_family = none)]
pub fn traitCollectionWithDisplayGamut(
display_gamut: UIDisplayGamut,
) -> Retained<UITraitCollection>;
#[cfg(feature = "UIInterface")]
#[unsafe(method(displayGamut))]
#[unsafe(method_family = none)]
pub unsafe fn displayGamut(&self) -> UIDisplayGamut;
#[cfg(feature = "UIInterface")]
#[unsafe(method(traitCollectionWithAccessibilityContrast:))]
#[unsafe(method_family = none)]
pub fn traitCollectionWithAccessibilityContrast(
accessibility_contrast: UIAccessibilityContrast,
) -> Retained<UITraitCollection>;
#[cfg(feature = "UIInterface")]
#[unsafe(method(accessibilityContrast))]
#[unsafe(method_family = none)]
pub unsafe fn accessibilityContrast(&self) -> UIAccessibilityContrast;
#[cfg(feature = "UIInterface")]
#[unsafe(method(traitCollectionWithUserInterfaceLevel:))]
#[unsafe(method_family = none)]
pub fn traitCollectionWithUserInterfaceLevel(
user_interface_level: UIUserInterfaceLevel,
) -> Retained<UITraitCollection>;
#[cfg(feature = "UIInterface")]
#[unsafe(method(userInterfaceLevel))]
#[unsafe(method_family = none)]
pub unsafe fn userInterfaceLevel(&self) -> UIUserInterfaceLevel;
#[cfg(feature = "UIInterface")]
#[unsafe(method(traitCollectionWithLegibilityWeight:))]
#[unsafe(method_family = none)]
pub fn traitCollectionWithLegibilityWeight(
legibility_weight: UILegibilityWeight,
) -> Retained<UITraitCollection>;
#[cfg(feature = "UIInterface")]
#[unsafe(method(legibilityWeight))]
#[unsafe(method_family = none)]
pub unsafe fn legibilityWeight(&self) -> UILegibilityWeight;
#[cfg(feature = "UIInterface")]
#[unsafe(method(traitCollectionWithActiveAppearance:))]
#[unsafe(method_family = none)]
pub fn traitCollectionWithActiveAppearance(
user_interface_active_appearance: UIUserInterfaceActiveAppearance,
) -> Retained<UITraitCollection>;
#[cfg(feature = "UIInterface")]
#[unsafe(method(activeAppearance))]
#[unsafe(method_family = none)]
pub unsafe fn activeAppearance(&self) -> UIUserInterfaceActiveAppearance;
#[cfg(feature = "UIInterface")]
#[unsafe(method(traitCollectionWithToolbarItemPresentationSize:))]
#[unsafe(method_family = none)]
pub fn traitCollectionWithToolbarItemPresentationSize(
toolbar_item_presentation_size: UINSToolbarItemPresentationSize,
) -> Retained<UITraitCollection>;
#[cfg(feature = "UIInterface")]
#[unsafe(method(toolbarItemPresentationSize))]
#[unsafe(method_family = none)]
pub unsafe fn toolbarItemPresentationSize(&self) -> UINSToolbarItemPresentationSize;
#[cfg(feature = "UIInterface")]
#[unsafe(method(traitCollectionWithImageDynamicRange:))]
#[unsafe(method_family = none)]
pub fn traitCollectionWithImageDynamicRange(
image_dynamic_range: UIImageDynamicRange,
) -> Retained<UITraitCollection>;
#[cfg(feature = "UIInterface")]
#[unsafe(method(imageDynamicRange))]
#[unsafe(method_family = none)]
pub unsafe fn imageDynamicRange(&self) -> UIImageDynamicRange;
#[unsafe(method(traitCollectionWithTypesettingLanguage:))]
#[unsafe(method_family = none)]
pub fn traitCollectionWithTypesettingLanguage(
language: &NSString,
) -> Retained<UITraitCollection>;
#[unsafe(method(typesettingLanguage))]
#[unsafe(method_family = none)]
pub unsafe fn typesettingLanguage(&self) -> Retained<NSString>;
#[cfg(feature = "UISceneDefinitions")]
#[unsafe(method(traitCollectionWithSceneCaptureState:))]
#[unsafe(method_family = none)]
pub fn traitCollectionWithSceneCaptureState(
scene_capture_state: UISceneCaptureState,
) -> Retained<UITraitCollection>;
#[cfg(feature = "UISceneDefinitions")]
#[unsafe(method(sceneCaptureState))]
#[unsafe(method_family = none)]
pub unsafe fn sceneCaptureState(&self) -> UISceneCaptureState;
#[cfg(feature = "UITraitListEnvironment")]
#[unsafe(method(traitCollectionWithListEnvironment:))]
#[unsafe(method_family = none)]
pub fn traitCollectionWithListEnvironment(
list_environment: UIListEnvironment,
) -> Retained<UITraitCollection>;
#[cfg(feature = "UITraitListEnvironment")]
#[unsafe(method(listEnvironment))]
#[unsafe(method_family = none)]
pub unsafe fn listEnvironment(&self) -> UIListEnvironment;
#[cfg(feature = "UITabAccessory")]
#[unsafe(method(traitCollectionWithTabAccessoryEnvironment:))]
#[unsafe(method_family = none)]
pub fn traitCollectionWithTabAccessoryEnvironment(
tab_accessory_environment: UITabAccessoryEnvironment,
) -> Retained<UITraitCollection>;
#[cfg(feature = "UITabAccessory")]
#[unsafe(method(tabAccessoryEnvironment))]
#[unsafe(method_family = none)]
pub unsafe fn tabAccessoryEnvironment(&self) -> UITabAccessoryEnvironment;
#[cfg(feature = "UISplitViewControllerLayoutEnvironment")]
#[unsafe(method(splitViewControllerLayoutEnvironment))]
#[unsafe(method_family = none)]
pub unsafe fn splitViewControllerLayoutEnvironment(
&self,
) -> UISplitViewControllerLayoutEnvironment;
#[cfg(feature = "UIInterface")]
#[unsafe(method(hdrHeadroomUsageLimit))]
#[unsafe(method_family = none)]
pub unsafe fn hdrHeadroomUsageLimit(&self) -> UIHDRHeadroomUsageLimit;
#[cfg(feature = "UIInterface")]
#[unsafe(method(traitCollectionWithHDRHeadroomUsageLimit:))]
#[unsafe(method_family = none)]
pub fn traitCollectionWithHDRHeadroomUsageLimit(
hdr_headroom_usage_limit: UIHDRHeadroomUsageLimit,
) -> Retained<UITraitCollection>;
#[unsafe(method(traitCollectionWithResolvesNaturalAlignmentWithBaseWritingDirection:))]
#[unsafe(method_family = none)]
pub fn traitCollectionWithResolvesNaturalAlignmentWithBaseWritingDirection(
resolves_natural_alignment_with_base_writing_direction: bool,
) -> Retained<UITraitCollection>;
#[unsafe(method(resolvesNaturalAlignmentWithBaseWritingDirection))]
#[unsafe(method_family = none)]
pub unsafe fn resolvesNaturalAlignmentWithBaseWritingDirection(&self) -> bool;
);
}
impl UITraitCollection {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for UITraitCollection {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_protocol!(
pub unsafe trait UIMutableTraits: NSObjectProtocol + MainThreadOnly {
#[cfg(all(feature = "UITrait", feature = "objc2-core-foundation"))]
#[unsafe(method(setCGFloatValue:forTrait:))]
#[unsafe(method_family = none)]
unsafe fn setCGFloatValue_forTrait(&self, value: CGFloat, r#trait: &UICGFloatTrait);
#[cfg(all(feature = "UITrait", feature = "objc2-core-foundation"))]
#[unsafe(method(valueForCGFloatTrait:))]
#[unsafe(method_family = none)]
unsafe fn valueForCGFloatTrait(&self, r#trait: &UICGFloatTrait) -> CGFloat;
#[cfg(feature = "UITrait")]
#[unsafe(method(setNSIntegerValue:forTrait:))]
#[unsafe(method_family = none)]
unsafe fn setNSIntegerValue_forTrait(&self, value: NSInteger, r#trait: &UINSIntegerTrait);
#[cfg(feature = "UITrait")]
#[unsafe(method(valueForNSIntegerTrait:))]
#[unsafe(method_family = none)]
unsafe fn valueForNSIntegerTrait(&self, r#trait: &UINSIntegerTrait) -> NSInteger;
#[cfg(feature = "UITrait")]
#[unsafe(method(setObject:forTrait:))]
#[unsafe(method_family = none)]
unsafe fn setObject_forTrait(
&self,
object: Option<&ProtocolObject<dyn NSObjectProtocol>>,
r#trait: &UIObjectTrait,
);
#[cfg(feature = "UITrait")]
#[unsafe(method(objectForTrait:))]
#[unsafe(method_family = none)]
unsafe fn objectForTrait(
&self,
r#trait: &UIObjectTrait,
) -> Option<Retained<ProtocolObject<dyn NSObjectProtocol>>>;
#[cfg(feature = "UIDevice")]
#[unsafe(method(userInterfaceIdiom))]
#[unsafe(method_family = none)]
fn userInterfaceIdiom(&self) -> UIUserInterfaceIdiom;
#[cfg(feature = "UIDevice")]
#[unsafe(method(setUserInterfaceIdiom:))]
#[unsafe(method_family = none)]
fn setUserInterfaceIdiom(&self, user_interface_idiom: UIUserInterfaceIdiom);
#[cfg(feature = "UIInterface")]
#[unsafe(method(userInterfaceStyle))]
#[unsafe(method_family = none)]
fn userInterfaceStyle(&self) -> UIUserInterfaceStyle;
#[cfg(feature = "UIInterface")]
#[unsafe(method(setUserInterfaceStyle:))]
#[unsafe(method_family = none)]
fn setUserInterfaceStyle(&self, user_interface_style: UIUserInterfaceStyle);
#[cfg(feature = "UIInterface")]
#[unsafe(method(layoutDirection))]
#[unsafe(method_family = none)]
fn layoutDirection(&self) -> UITraitEnvironmentLayoutDirection;
#[cfg(feature = "UIInterface")]
#[unsafe(method(setLayoutDirection:))]
#[unsafe(method_family = none)]
fn setLayoutDirection(&self, layout_direction: UITraitEnvironmentLayoutDirection);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(displayScale))]
#[unsafe(method_family = none)]
fn displayScale(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(setDisplayScale:))]
#[unsafe(method_family = none)]
fn setDisplayScale(&self, display_scale: CGFloat);
#[cfg(feature = "UIInterface")]
#[unsafe(method(horizontalSizeClass))]
#[unsafe(method_family = none)]
fn horizontalSizeClass(&self) -> UIUserInterfaceSizeClass;
#[cfg(feature = "UIInterface")]
#[unsafe(method(setHorizontalSizeClass:))]
#[unsafe(method_family = none)]
fn setHorizontalSizeClass(&self, horizontal_size_class: UIUserInterfaceSizeClass);
#[cfg(feature = "UIInterface")]
#[unsafe(method(verticalSizeClass))]
#[unsafe(method_family = none)]
fn verticalSizeClass(&self) -> UIUserInterfaceSizeClass;
#[cfg(feature = "UIInterface")]
#[unsafe(method(setVerticalSizeClass:))]
#[unsafe(method_family = none)]
fn setVerticalSizeClass(&self, vertical_size_class: UIUserInterfaceSizeClass);
#[cfg(feature = "UITouch")]
#[unsafe(method(forceTouchCapability))]
#[unsafe(method_family = none)]
fn forceTouchCapability(&self) -> UIForceTouchCapability;
#[cfg(feature = "UITouch")]
#[unsafe(method(setForceTouchCapability:))]
#[unsafe(method_family = none)]
fn setForceTouchCapability(&self, force_touch_capability: UIForceTouchCapability);
#[cfg(feature = "UIContentSizeCategory")]
#[unsafe(method(preferredContentSizeCategory))]
#[unsafe(method_family = none)]
fn preferredContentSizeCategory(&self) -> Retained<UIContentSizeCategory>;
#[cfg(feature = "UIContentSizeCategory")]
#[unsafe(method(setPreferredContentSizeCategory:))]
#[unsafe(method_family = none)]
fn setPreferredContentSizeCategory(
&self,
preferred_content_size_category: &UIContentSizeCategory,
);
#[cfg(feature = "UIInterface")]
#[unsafe(method(displayGamut))]
#[unsafe(method_family = none)]
fn displayGamut(&self) -> UIDisplayGamut;
#[cfg(feature = "UIInterface")]
#[unsafe(method(setDisplayGamut:))]
#[unsafe(method_family = none)]
fn setDisplayGamut(&self, display_gamut: UIDisplayGamut);
#[cfg(feature = "UIInterface")]
#[unsafe(method(accessibilityContrast))]
#[unsafe(method_family = none)]
fn accessibilityContrast(&self) -> UIAccessibilityContrast;
#[cfg(feature = "UIInterface")]
#[unsafe(method(setAccessibilityContrast:))]
#[unsafe(method_family = none)]
fn setAccessibilityContrast(&self, accessibility_contrast: UIAccessibilityContrast);
#[cfg(feature = "UIInterface")]
#[unsafe(method(userInterfaceLevel))]
#[unsafe(method_family = none)]
fn userInterfaceLevel(&self) -> UIUserInterfaceLevel;
#[cfg(feature = "UIInterface")]
#[unsafe(method(setUserInterfaceLevel:))]
#[unsafe(method_family = none)]
fn setUserInterfaceLevel(&self, user_interface_level: UIUserInterfaceLevel);
#[cfg(feature = "UIInterface")]
#[unsafe(method(legibilityWeight))]
#[unsafe(method_family = none)]
fn legibilityWeight(&self) -> UILegibilityWeight;
#[cfg(feature = "UIInterface")]
#[unsafe(method(setLegibilityWeight:))]
#[unsafe(method_family = none)]
fn setLegibilityWeight(&self, legibility_weight: UILegibilityWeight);
#[cfg(feature = "UIInterface")]
#[unsafe(method(activeAppearance))]
#[unsafe(method_family = none)]
fn activeAppearance(&self) -> UIUserInterfaceActiveAppearance;
#[cfg(feature = "UIInterface")]
#[unsafe(method(setActiveAppearance:))]
#[unsafe(method_family = none)]
fn setActiveAppearance(&self, active_appearance: UIUserInterfaceActiveAppearance);
#[cfg(feature = "UIInterface")]
#[unsafe(method(toolbarItemPresentationSize))]
#[unsafe(method_family = none)]
fn toolbarItemPresentationSize(&self) -> UINSToolbarItemPresentationSize;
#[cfg(feature = "UIInterface")]
#[unsafe(method(setToolbarItemPresentationSize:))]
#[unsafe(method_family = none)]
fn setToolbarItemPresentationSize(
&self,
toolbar_item_presentation_size: UINSToolbarItemPresentationSize,
);
#[cfg(feature = "UIInterface")]
#[unsafe(method(imageDynamicRange))]
#[unsafe(method_family = none)]
fn imageDynamicRange(&self) -> UIImageDynamicRange;
#[cfg(feature = "UIInterface")]
#[unsafe(method(setImageDynamicRange:))]
#[unsafe(method_family = none)]
fn setImageDynamicRange(&self, image_dynamic_range: UIImageDynamicRange);
#[cfg(feature = "UISceneDefinitions")]
#[unsafe(method(sceneCaptureState))]
#[unsafe(method_family = none)]
fn sceneCaptureState(&self) -> UISceneCaptureState;
#[cfg(feature = "UISceneDefinitions")]
#[unsafe(method(setSceneCaptureState:))]
#[unsafe(method_family = none)]
fn setSceneCaptureState(&self, scene_capture_state: UISceneCaptureState);
#[unsafe(method(typesettingLanguage))]
#[unsafe(method_family = none)]
fn typesettingLanguage(&self) -> Retained<NSString>;
#[unsafe(method(setTypesettingLanguage:))]
#[unsafe(method_family = none)]
fn setTypesettingLanguage(&self, typesetting_language: &NSString);
#[cfg(feature = "UITraitListEnvironment")]
#[unsafe(method(listEnvironment))]
#[unsafe(method_family = none)]
fn listEnvironment(&self) -> UIListEnvironment;
#[cfg(feature = "UITraitListEnvironment")]
#[unsafe(method(setListEnvironment:))]
#[unsafe(method_family = none)]
fn setListEnvironment(&self, list_environment: UIListEnvironment);
#[cfg(feature = "UITabAccessory")]
#[unsafe(method(tabAccessoryEnvironment))]
#[unsafe(method_family = none)]
fn tabAccessoryEnvironment(&self) -> UITabAccessoryEnvironment;
#[cfg(feature = "UITabAccessory")]
#[unsafe(method(setTabAccessoryEnvironment:))]
#[unsafe(method_family = none)]
fn setTabAccessoryEnvironment(&self, tab_accessory_environment: UITabAccessoryEnvironment);
#[cfg(feature = "UISplitViewControllerLayoutEnvironment")]
#[unsafe(method(splitViewControllerLayoutEnvironment))]
#[unsafe(method_family = none)]
fn splitViewControllerLayoutEnvironment(&self) -> UISplitViewControllerLayoutEnvironment;
#[cfg(feature = "UISplitViewControllerLayoutEnvironment")]
#[unsafe(method(setSplitViewControllerLayoutEnvironment:))]
#[unsafe(method_family = none)]
fn setSplitViewControllerLayoutEnvironment(
&self,
split_view_controller_layout_environment: UISplitViewControllerLayoutEnvironment,
);
#[unsafe(method(resolvesNaturalAlignmentWithBaseWritingDirection))]
#[unsafe(method_family = none)]
fn resolvesNaturalAlignmentWithBaseWritingDirection(&self) -> bool;
#[unsafe(method(setResolvesNaturalAlignmentWithBaseWritingDirection:))]
#[unsafe(method_family = none)]
fn setResolvesNaturalAlignmentWithBaseWritingDirection(
&self,
resolves_natural_alignment_with_base_writing_direction: bool,
);
}
);
#[cfg(feature = "block2")]
pub type UITraitMutations =
*mut block2::DynBlock<dyn Fn(NonNull<ProtocolObject<dyn UIMutableTraits>>)>;
impl UITraitCollection {
extern_methods!(
#[cfg(feature = "block2")]
#[unsafe(method(traitCollectionWithTraits:))]
#[unsafe(method_family = none)]
pub unsafe fn traitCollectionWithTraits(
mutations: UITraitMutations,
) -> Retained<UITraitCollection>;
#[cfg(feature = "block2")]
#[unsafe(method(traitCollectionByModifyingTraits:))]
#[unsafe(method_family = none)]
pub unsafe fn traitCollectionByModifyingTraits(
&self,
mutations: UITraitMutations,
) -> Retained<UITraitCollection>;
#[cfg(all(feature = "UITrait", feature = "objc2-core-foundation"))]
#[unsafe(method(traitCollectionWithCGFloatValue:forTrait:))]
#[unsafe(method_family = none)]
pub unsafe fn traitCollectionWithCGFloatValue_forTrait(
value: CGFloat,
r#trait: &UICGFloatTrait,
) -> Retained<UITraitCollection>;
#[cfg(all(feature = "UITrait", feature = "objc2-core-foundation"))]
#[unsafe(method(traitCollectionByReplacingCGFloatValue:forTrait:))]
#[unsafe(method_family = none)]
pub unsafe fn traitCollectionByReplacingCGFloatValue_forTrait(
&self,
value: CGFloat,
r#trait: &UICGFloatTrait,
) -> Retained<UITraitCollection>;
#[cfg(all(feature = "UITrait", feature = "objc2-core-foundation"))]
#[unsafe(method(valueForCGFloatTrait:))]
#[unsafe(method_family = none)]
pub unsafe fn valueForCGFloatTrait(&self, r#trait: &UICGFloatTrait) -> CGFloat;
#[cfg(feature = "UITrait")]
#[unsafe(method(traitCollectionWithNSIntegerValue:forTrait:))]
#[unsafe(method_family = none)]
pub unsafe fn traitCollectionWithNSIntegerValue_forTrait(
value: NSInteger,
r#trait: &UINSIntegerTrait,
) -> Retained<UITraitCollection>;
#[cfg(feature = "UITrait")]
#[unsafe(method(traitCollectionByReplacingNSIntegerValue:forTrait:))]
#[unsafe(method_family = none)]
pub unsafe fn traitCollectionByReplacingNSIntegerValue_forTrait(
&self,
value: NSInteger,
r#trait: &UINSIntegerTrait,
) -> Retained<UITraitCollection>;
#[cfg(feature = "UITrait")]
#[unsafe(method(valueForNSIntegerTrait:))]
#[unsafe(method_family = none)]
pub unsafe fn valueForNSIntegerTrait(&self, r#trait: &UINSIntegerTrait) -> NSInteger;
#[cfg(feature = "UITrait")]
#[unsafe(method(traitCollectionWithObject:forTrait:))]
#[unsafe(method_family = none)]
pub unsafe fn traitCollectionWithObject_forTrait(
object: Option<&ProtocolObject<dyn NSObjectProtocol>>,
r#trait: &UIObjectTrait,
) -> Retained<UITraitCollection>;
#[cfg(feature = "UITrait")]
#[unsafe(method(traitCollectionByReplacingObject:forTrait:))]
#[unsafe(method_family = none)]
pub unsafe fn traitCollectionByReplacingObject_forTrait(
&self,
object: Option<&ProtocolObject<dyn NSObjectProtocol>>,
r#trait: &UIObjectTrait,
) -> Retained<UITraitCollection>;
#[cfg(feature = "UITrait")]
#[unsafe(method(objectForTrait:))]
#[unsafe(method_family = none)]
pub unsafe fn objectForTrait(
&self,
r#trait: &UIObjectTrait,
) -> Option<Retained<ProtocolObject<dyn NSObjectProtocol>>>;
);
}
extern_protocol!(
pub unsafe trait UITraitEnvironment: NSObjectProtocol + MainThreadOnly {
#[unsafe(method(traitCollection))]
#[unsafe(method_family = none)]
fn traitCollection(&self) -> Retained<UITraitCollection>;
#[deprecated = "Use the trait change registration APIs declared in the UITraitChangeObservable protocol"]
#[unsafe(method(traitCollectionDidChange:))]
#[unsafe(method_family = none)]
fn traitCollectionDidChange(&self, previous_trait_collection: Option<&UITraitCollection>);
}
);
extern_protocol!(
pub unsafe trait UITraitChangeRegistration:
NSObjectProtocol + NSCopying + MainThreadOnly
{
}
);
#[cfg(feature = "block2")]
pub type UITraitChangeHandler = *mut block2::DynBlock<
dyn Fn(NonNull<ProtocolObject<dyn UITraitEnvironment>>, NonNull<UITraitCollection>),
>;
extern_protocol!(
pub unsafe trait UITraitOverrides: UIMutableTraits + MainThreadOnly {
#[cfg(feature = "UITrait")]
#[unsafe(method(containsTrait:))]
#[unsafe(method_family = none)]
unsafe fn containsTrait(&self, r#trait: &UITrait) -> bool;
#[cfg(feature = "UITrait")]
#[unsafe(method(removeTrait:))]
#[unsafe(method_family = none)]
unsafe fn removeTrait(&self, r#trait: &UITrait);
}
);
extern_protocol!(
pub unsafe trait UITraitChangeObservable: MainThreadOnly {
#[unsafe(method(unregisterForTraitChanges:))]
#[unsafe(method_family = none)]
fn unregisterForTraitChanges(
&self,
registration: &ProtocolObject<dyn UITraitChangeRegistration>,
);
}
);
impl UITraitCollection {
extern_methods!(
#[unsafe(method(currentTraitCollection))]
#[unsafe(method_family = none)]
pub unsafe fn currentTraitCollection() -> Retained<UITraitCollection>;
#[unsafe(method(setCurrentTraitCollection:))]
#[unsafe(method_family = none)]
pub unsafe fn setCurrentTraitCollection(current_trait_collection: &UITraitCollection);
#[cfg(feature = "block2")]
#[unsafe(method(performAsCurrentTraitCollection:))]
#[unsafe(method_family = none)]
pub fn performAsCurrentTraitCollection(&self, actions: &block2::DynBlock<dyn Fn() + '_>);
);
}
impl UITraitCollection {
extern_methods!(
#[unsafe(method(hasDifferentColorAppearanceComparedToTraitCollection:))]
#[unsafe(method_family = none)]
pub fn hasDifferentColorAppearanceComparedToTraitCollection(
&self,
trait_collection: Option<&UITraitCollection>,
) -> bool;
);
}
impl UITraitCollection {
extern_methods!(
#[cfg(feature = "UIImageConfiguration")]
#[unsafe(method(imageConfiguration))]
#[unsafe(method_family = none)]
pub unsafe fn imageConfiguration(&self) -> Retained<UIImageConfiguration>;
);
}