use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
pub type NSAppearanceName = NSString;
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSAppearance;
);
extern_conformance!(
unsafe impl NSCoding for NSAppearance {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for NSAppearance {}
);
extern_conformance!(
unsafe impl NSSecureCoding for NSAppearance {}
);
impl NSAppearance {
extern_methods!(
#[unsafe(method(name))]
#[unsafe(method_family = none)]
pub fn name(&self) -> Retained<NSAppearanceName>;
#[deprecated = "Use -performAsCurrentDrawingAppearance: to temporarily set the drawing appearance, or +currentDrawingAppearance to access the currently drawing appearance."]
#[unsafe(method(currentAppearance))]
#[unsafe(method_family = none)]
pub fn currentAppearance() -> Option<Retained<NSAppearance>>;
#[deprecated = "Use -performAsCurrentDrawingAppearance: to temporarily set the drawing appearance, or +currentDrawingAppearance to access the currently drawing appearance."]
#[unsafe(method(setCurrentAppearance:))]
#[unsafe(method_family = none)]
pub unsafe fn setCurrentAppearance(current_appearance: Option<&NSAppearance>);
#[unsafe(method(currentDrawingAppearance))]
#[unsafe(method_family = none)]
pub fn currentDrawingAppearance() -> Retained<NSAppearance>;
#[cfg(feature = "block2")]
#[unsafe(method(performAsCurrentDrawingAppearance:))]
#[unsafe(method_family = none)]
pub fn performAsCurrentDrawingAppearance(&self, block: &block2::DynBlock<dyn Fn() + '_>);
#[unsafe(method(appearanceNamed:))]
#[unsafe(method_family = none)]
pub fn appearanceNamed(name: &NSAppearanceName) -> Option<Retained<NSAppearance>>;
#[unsafe(method(initWithAppearanceNamed:bundle:))]
#[unsafe(method_family = init)]
pub fn initWithAppearanceNamed_bundle(
this: Allocated<Self>,
name: &NSAppearanceName,
bundle: Option<&NSBundle>,
) -> Option<Retained<Self>>;
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[unsafe(method(allowsVibrancy))]
#[unsafe(method_family = none)]
pub fn allowsVibrancy(&self) -> bool;
#[unsafe(method(bestMatchFromAppearancesWithNames:))]
#[unsafe(method_family = none)]
pub fn bestMatchFromAppearancesWithNames(
&self,
appearances: &NSArray<NSAppearanceName>,
) -> Option<Retained<NSAppearanceName>>;
);
}
impl NSAppearance {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for NSAppearance {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern "C" {
pub static NSAppearanceNameAqua: &'static NSAppearanceName;
}
extern "C" {
pub static NSAppearanceNameDarkAqua: &'static NSAppearanceName;
}
extern "C" {
#[deprecated = "Light content should use the default Aqua apppearance."]
pub static NSAppearanceNameLightContent: &'static NSAppearanceName;
}
extern "C" {
pub static NSAppearanceNameVibrantDark: &'static NSAppearanceName;
}
extern "C" {
pub static NSAppearanceNameVibrantLight: &'static NSAppearanceName;
}
extern "C" {
pub static NSAppearanceNameAccessibilityHighContrastAqua: &'static NSAppearanceName;
}
extern "C" {
pub static NSAppearanceNameAccessibilityHighContrastDarkAqua: &'static NSAppearanceName;
}
extern "C" {
pub static NSAppearanceNameAccessibilityHighContrastVibrantLight: &'static NSAppearanceName;
}
extern "C" {
pub static NSAppearanceNameAccessibilityHighContrastVibrantDark: &'static NSAppearanceName;
}
extern_protocol!(
pub unsafe trait NSAppearanceCustomization: NSObjectProtocol {
#[unsafe(method(appearance))]
#[unsafe(method_family = none)]
fn appearance(&self) -> Option<Retained<NSAppearance>>;
#[unsafe(method(setAppearance:))]
#[unsafe(method_family = none)]
fn setAppearance(&self, appearance: Option<&NSAppearance>);
#[unsafe(method(effectiveAppearance))]
#[unsafe(method_family = none)]
fn effectiveAppearance(&self) -> Retained<NSAppearance>;
}
);