objc2_app_kit/generated/
NSTableViewRowAction.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstableviewrowactionstyle?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSTableViewRowActionStyle(pub NSInteger);
15impl NSTableViewRowActionStyle {
16    #[doc(alias = "NSTableViewRowActionStyleRegular")]
17    pub const Regular: Self = Self(0);
18    #[doc(alias = "NSTableViewRowActionStyleDestructive")]
19    pub const Destructive: Self = Self(1);
20}
21
22unsafe impl Encode for NSTableViewRowActionStyle {
23    const ENCODING: Encoding = NSInteger::ENCODING;
24}
25
26unsafe impl RefEncode for NSTableViewRowActionStyle {
27    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
28}
29
30extern_class!(
31    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstableviewrowaction?language=objc)
32    #[unsafe(super(NSObject))]
33    #[derive(Debug, PartialEq, Eq, Hash)]
34    pub struct NSTableViewRowAction;
35);
36
37extern_conformance!(
38    unsafe impl NSCopying for NSTableViewRowAction {}
39);
40
41unsafe impl CopyingHelper for NSTableViewRowAction {
42    type Result = Self;
43}
44
45extern_conformance!(
46    unsafe impl NSObjectProtocol for NSTableViewRowAction {}
47);
48
49impl NSTableViewRowAction {
50    extern_methods!(
51        #[cfg(feature = "block2")]
52        #[unsafe(method(rowActionWithStyle:title:handler:))]
53        #[unsafe(method_family = none)]
54        pub fn rowActionWithStyle_title_handler(
55            style: NSTableViewRowActionStyle,
56            title: &NSString,
57            handler: &block2::DynBlock<dyn Fn(NonNull<NSTableViewRowAction>, NSInteger)>,
58        ) -> Retained<Self>;
59
60        #[unsafe(method(style))]
61        #[unsafe(method_family = none)]
62        pub fn style(&self) -> NSTableViewRowActionStyle;
63
64        #[unsafe(method(title))]
65        #[unsafe(method_family = none)]
66        pub fn title(&self) -> Retained<NSString>;
67
68        /// Setter for [`title`][Self::title].
69        ///
70        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
71        #[unsafe(method(setTitle:))]
72        #[unsafe(method_family = none)]
73        pub fn setTitle(&self, title: &NSString);
74
75        #[cfg(feature = "NSColor")]
76        #[unsafe(method(backgroundColor))]
77        #[unsafe(method_family = none)]
78        pub fn backgroundColor(&self) -> Retained<NSColor>;
79
80        #[cfg(feature = "NSColor")]
81        /// Setter for [`backgroundColor`][Self::backgroundColor].
82        ///
83        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
84        #[unsafe(method(setBackgroundColor:))]
85        #[unsafe(method_family = none)]
86        pub fn setBackgroundColor(&self, background_color: Option<&NSColor>);
87
88        #[cfg(feature = "NSImage")]
89        #[unsafe(method(image))]
90        #[unsafe(method_family = none)]
91        pub fn image(&self) -> Option<Retained<NSImage>>;
92
93        #[cfg(feature = "NSImage")]
94        /// Setter for [`image`][Self::image].
95        #[unsafe(method(setImage:))]
96        #[unsafe(method_family = none)]
97        pub fn setImage(&self, image: Option<&NSImage>);
98    );
99}
100
101/// Methods declared on superclass `NSObject`.
102impl NSTableViewRowAction {
103    extern_methods!(
104        #[unsafe(method(init))]
105        #[unsafe(method_family = init)]
106        pub fn init(this: Allocated<Self>) -> Retained<Self>;
107
108        #[unsafe(method(new))]
109        #[unsafe(method_family = new)]
110        pub fn new() -> Retained<Self>;
111    );
112}
113
114impl DefaultRetained for NSTableViewRowAction {
115    #[inline]
116    fn default_retained() -> Retained<Self> {
117        Self::new()
118    }
119}