//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstableviewrowactionstyle?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTableViewRowActionStyle(pub NSInteger);
impl NSTableViewRowActionStyle {
    #[doc(alias = "NSTableViewRowActionStyleRegular")]
    pub const Regular: Self = Self(0);
    #[doc(alias = "NSTableViewRowActionStyleDestructive")]
    pub const Destructive: Self = Self(1);
}

unsafe impl Encode for NSTableViewRowActionStyle {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for NSTableViewRowActionStyle {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstableviewrowaction?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSTableViewRowAction;
);

extern_conformance!(
    unsafe impl NSCopying for NSTableViewRowAction {}
);

unsafe impl CopyingHelper for NSTableViewRowAction {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for NSTableViewRowAction {}
);

impl NSTableViewRowAction {
    extern_methods!(
        #[cfg(feature = "block2")]
        #[unsafe(method(rowActionWithStyle:title:handler:))]
        #[unsafe(method_family = none)]
        pub fn rowActionWithStyle_title_handler(
            style: NSTableViewRowActionStyle,
            title: &NSString,
            handler: &block2::DynBlock<dyn Fn(NonNull<NSTableViewRowAction>, NSInteger)>,
        ) -> Retained<Self>;

        #[unsafe(method(style))]
        #[unsafe(method_family = none)]
        pub fn style(&self) -> NSTableViewRowActionStyle;

        #[unsafe(method(title))]
        #[unsafe(method_family = none)]
        pub fn title(&self) -> Retained<NSString>;

        /// Setter for [`title`][Self::title].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setTitle:))]
        #[unsafe(method_family = none)]
        pub fn setTitle(&self, title: &NSString);

        #[cfg(feature = "NSColor")]
        #[unsafe(method(backgroundColor))]
        #[unsafe(method_family = none)]
        pub fn backgroundColor(&self) -> Retained<NSColor>;

        #[cfg(feature = "NSColor")]
        /// Setter for [`backgroundColor`][Self::backgroundColor].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setBackgroundColor:))]
        #[unsafe(method_family = none)]
        pub fn setBackgroundColor(&self, background_color: Option<&NSColor>);

        #[cfg(feature = "NSImage")]
        #[unsafe(method(image))]
        #[unsafe(method_family = none)]
        pub fn image(&self) -> Option<Retained<NSImage>>;

        #[cfg(feature = "NSImage")]
        /// Setter for [`image`][Self::image].
        #[unsafe(method(setImage:))]
        #[unsafe(method_family = none)]
        pub fn setImage(&self, image: Option<&NSImage>);
    );
}

/// Methods declared on superclass `NSObject`.
impl NSTableViewRowAction {
    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 NSTableViewRowAction {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}
