objc2_app_kit/generated/
NSTextFieldCell.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/nstextfieldbezelstyle?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSTextFieldBezelStyle(pub NSUInteger);
15impl NSTextFieldBezelStyle {
16    #[doc(alias = "NSTextFieldSquareBezel")]
17    pub const SquareBezel: Self = Self(0);
18    #[doc(alias = "NSTextFieldRoundedBezel")]
19    pub const RoundedBezel: Self = Self(1);
20}
21
22unsafe impl Encode for NSTextFieldBezelStyle {
23    const ENCODING: Encoding = NSUInteger::ENCODING;
24}
25
26unsafe impl RefEncode for NSTextFieldBezelStyle {
27    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
28}
29
30extern_class!(
31    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextfieldcell?language=objc)
32    #[unsafe(super(NSActionCell, NSCell, NSObject))]
33    #[derive(Debug, PartialEq, Eq, Hash)]
34    #[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
35    pub struct NSTextFieldCell;
36);
37
38#[cfg(all(
39    feature = "NSAccessibilityProtocols",
40    feature = "NSActionCell",
41    feature = "NSCell"
42))]
43unsafe impl NSAccessibility for NSTextFieldCell {}
44
45#[cfg(all(
46    feature = "NSAccessibilityProtocols",
47    feature = "NSActionCell",
48    feature = "NSCell"
49))]
50unsafe impl NSAccessibilityElementProtocol for NSTextFieldCell {}
51
52#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
53unsafe impl NSCoding for NSTextFieldCell {}
54
55#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
56unsafe impl NSCopying for NSTextFieldCell {}
57
58#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
59unsafe impl CopyingHelper for NSTextFieldCell {
60    type Result = Self;
61}
62
63#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
64unsafe impl NSObjectProtocol for NSTextFieldCell {}
65
66#[cfg(all(
67    feature = "NSActionCell",
68    feature = "NSCell",
69    feature = "NSUserInterfaceItemIdentification"
70))]
71unsafe impl NSUserInterfaceItemIdentification for NSTextFieldCell {}
72
73#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
74impl NSTextFieldCell {
75    extern_methods!(
76        #[unsafe(method(initTextCell:))]
77        #[unsafe(method_family = init)]
78        pub unsafe fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
79
80        #[unsafe(method(initWithCoder:))]
81        #[unsafe(method_family = init)]
82        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
83
84        #[cfg(feature = "NSImage")]
85        #[unsafe(method(initImageCell:))]
86        #[unsafe(method_family = init)]
87        pub unsafe fn initImageCell(
88            this: Allocated<Self>,
89            image: Option<&NSImage>,
90        ) -> Retained<Self>;
91
92        #[cfg(feature = "NSColor")]
93        #[unsafe(method(backgroundColor))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn backgroundColor(&self) -> Option<Retained<NSColor>>;
96
97        #[cfg(feature = "NSColor")]
98        /// Setter for [`backgroundColor`][Self::backgroundColor].
99        #[unsafe(method(setBackgroundColor:))]
100        #[unsafe(method_family = none)]
101        pub unsafe fn setBackgroundColor(&self, background_color: Option<&NSColor>);
102
103        #[unsafe(method(drawsBackground))]
104        #[unsafe(method_family = none)]
105        pub unsafe fn drawsBackground(&self) -> bool;
106
107        /// Setter for [`drawsBackground`][Self::drawsBackground].
108        #[unsafe(method(setDrawsBackground:))]
109        #[unsafe(method_family = none)]
110        pub unsafe fn setDrawsBackground(&self, draws_background: bool);
111
112        #[cfg(feature = "NSColor")]
113        #[unsafe(method(textColor))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn textColor(&self) -> Option<Retained<NSColor>>;
116
117        #[cfg(feature = "NSColor")]
118        /// Setter for [`textColor`][Self::textColor].
119        #[unsafe(method(setTextColor:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn setTextColor(&self, text_color: Option<&NSColor>);
122
123        #[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
124        #[unsafe(method(setUpFieldEditorAttributes:))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn setUpFieldEditorAttributes(&self, text_obj: &NSText) -> Retained<NSText>;
127
128        #[unsafe(method(bezelStyle))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn bezelStyle(&self) -> NSTextFieldBezelStyle;
131
132        /// Setter for [`bezelStyle`][Self::bezelStyle].
133        #[unsafe(method(setBezelStyle:))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn setBezelStyle(&self, bezel_style: NSTextFieldBezelStyle);
136
137        #[unsafe(method(placeholderString))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn placeholderString(&self) -> Option<Retained<NSString>>;
140
141        /// Setter for [`placeholderString`][Self::placeholderString].
142        #[unsafe(method(setPlaceholderString:))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn setPlaceholderString(&self, placeholder_string: Option<&NSString>);
145
146        #[unsafe(method(placeholderAttributedString))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn placeholderAttributedString(&self) -> Option<Retained<NSAttributedString>>;
149
150        /// Setter for [`placeholderAttributedString`][Self::placeholderAttributedString].
151        #[unsafe(method(setPlaceholderAttributedString:))]
152        #[unsafe(method_family = none)]
153        pub unsafe fn setPlaceholderAttributedString(
154            &self,
155            placeholder_attributed_string: Option<&NSAttributedString>,
156        );
157
158        #[unsafe(method(setWantsNotificationForMarkedText:))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn setWantsNotificationForMarkedText(&self, flag: bool);
161
162        #[unsafe(method(allowedInputSourceLocales))]
163        #[unsafe(method_family = none)]
164        pub unsafe fn allowedInputSourceLocales(&self) -> Option<Retained<NSArray<NSString>>>;
165
166        /// Setter for [`allowedInputSourceLocales`][Self::allowedInputSourceLocales].
167        #[unsafe(method(setAllowedInputSourceLocales:))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn setAllowedInputSourceLocales(
170            &self,
171            allowed_input_source_locales: Option<&NSArray<NSString>>,
172        );
173    );
174}
175
176/// Methods declared on superclass `NSCell`.
177#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
178impl NSTextFieldCell {
179    extern_methods!(
180        #[unsafe(method(init))]
181        #[unsafe(method_family = init)]
182        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
183    );
184}
185
186/// Methods declared on superclass `NSObject`.
187#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
188impl NSTextFieldCell {
189    extern_methods!(
190        #[unsafe(method(new))]
191        #[unsafe(method_family = new)]
192        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
193    );
194}