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))]
43extern_conformance!(
44    unsafe impl NSAccessibility for NSTextFieldCell {}
45);
46
47#[cfg(all(
48    feature = "NSAccessibilityProtocols",
49    feature = "NSActionCell",
50    feature = "NSCell"
51))]
52extern_conformance!(
53    unsafe impl NSAccessibilityElementProtocol for NSTextFieldCell {}
54);
55
56#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
57extern_conformance!(
58    unsafe impl NSCoding for NSTextFieldCell {}
59);
60
61#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
62extern_conformance!(
63    unsafe impl NSCopying for NSTextFieldCell {}
64);
65
66#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
67unsafe impl CopyingHelper for NSTextFieldCell {
68    type Result = Self;
69}
70
71#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
72extern_conformance!(
73    unsafe impl NSObjectProtocol for NSTextFieldCell {}
74);
75
76#[cfg(all(
77    feature = "NSActionCell",
78    feature = "NSCell",
79    feature = "NSUserInterfaceItemIdentification"
80))]
81extern_conformance!(
82    unsafe impl NSUserInterfaceItemIdentification for NSTextFieldCell {}
83);
84
85#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
86impl NSTextFieldCell {
87    extern_methods!(
88        #[unsafe(method(initTextCell:))]
89        #[unsafe(method_family = init)]
90        pub fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
91
92        /// # Safety
93        ///
94        /// `coder` possibly has further requirements.
95        #[unsafe(method(initWithCoder:))]
96        #[unsafe(method_family = init)]
97        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
98
99        #[cfg(feature = "NSImage")]
100        #[unsafe(method(initImageCell:))]
101        #[unsafe(method_family = init)]
102        pub unsafe fn initImageCell(
103            this: Allocated<Self>,
104            image: Option<&NSImage>,
105        ) -> Retained<Self>;
106
107        #[cfg(feature = "NSColor")]
108        #[unsafe(method(backgroundColor))]
109        #[unsafe(method_family = none)]
110        pub fn backgroundColor(&self) -> Option<Retained<NSColor>>;
111
112        #[cfg(feature = "NSColor")]
113        /// Setter for [`backgroundColor`][Self::backgroundColor].
114        ///
115        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
116        #[unsafe(method(setBackgroundColor:))]
117        #[unsafe(method_family = none)]
118        pub fn setBackgroundColor(&self, background_color: Option<&NSColor>);
119
120        #[unsafe(method(drawsBackground))]
121        #[unsafe(method_family = none)]
122        pub fn drawsBackground(&self) -> bool;
123
124        /// Setter for [`drawsBackground`][Self::drawsBackground].
125        #[unsafe(method(setDrawsBackground:))]
126        #[unsafe(method_family = none)]
127        pub fn setDrawsBackground(&self, draws_background: bool);
128
129        #[cfg(feature = "NSColor")]
130        #[unsafe(method(textColor))]
131        #[unsafe(method_family = none)]
132        pub fn textColor(&self) -> Option<Retained<NSColor>>;
133
134        #[cfg(feature = "NSColor")]
135        /// Setter for [`textColor`][Self::textColor].
136        ///
137        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
138        #[unsafe(method(setTextColor:))]
139        #[unsafe(method_family = none)]
140        pub fn setTextColor(&self, text_color: Option<&NSColor>);
141
142        #[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
143        #[unsafe(method(setUpFieldEditorAttributes:))]
144        #[unsafe(method_family = none)]
145        pub fn setUpFieldEditorAttributes(&self, text_obj: &NSText) -> Retained<NSText>;
146
147        #[unsafe(method(bezelStyle))]
148        #[unsafe(method_family = none)]
149        pub fn bezelStyle(&self) -> NSTextFieldBezelStyle;
150
151        /// Setter for [`bezelStyle`][Self::bezelStyle].
152        #[unsafe(method(setBezelStyle:))]
153        #[unsafe(method_family = none)]
154        pub fn setBezelStyle(&self, bezel_style: NSTextFieldBezelStyle);
155
156        #[unsafe(method(placeholderString))]
157        #[unsafe(method_family = none)]
158        pub fn placeholderString(&self) -> Option<Retained<NSString>>;
159
160        /// Setter for [`placeholderString`][Self::placeholderString].
161        ///
162        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
163        #[unsafe(method(setPlaceholderString:))]
164        #[unsafe(method_family = none)]
165        pub fn setPlaceholderString(&self, placeholder_string: Option<&NSString>);
166
167        #[unsafe(method(placeholderAttributedString))]
168        #[unsafe(method_family = none)]
169        pub fn placeholderAttributedString(&self) -> Option<Retained<NSAttributedString>>;
170
171        /// Setter for [`placeholderAttributedString`][Self::placeholderAttributedString].
172        ///
173        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
174        #[unsafe(method(setPlaceholderAttributedString:))]
175        #[unsafe(method_family = none)]
176        pub fn setPlaceholderAttributedString(
177            &self,
178            placeholder_attributed_string: Option<&NSAttributedString>,
179        );
180
181        #[unsafe(method(setWantsNotificationForMarkedText:))]
182        #[unsafe(method_family = none)]
183        pub fn setWantsNotificationForMarkedText(&self, flag: bool);
184
185        #[unsafe(method(allowedInputSourceLocales))]
186        #[unsafe(method_family = none)]
187        pub fn allowedInputSourceLocales(&self) -> Option<Retained<NSArray<NSString>>>;
188
189        /// Setter for [`allowedInputSourceLocales`][Self::allowedInputSourceLocales].
190        ///
191        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
192        #[unsafe(method(setAllowedInputSourceLocales:))]
193        #[unsafe(method_family = none)]
194        pub fn setAllowedInputSourceLocales(
195            &self,
196            allowed_input_source_locales: Option<&NSArray<NSString>>,
197        );
198    );
199}
200
201/// Methods declared on superclass `NSCell`.
202#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
203impl NSTextFieldCell {
204    extern_methods!(
205        #[unsafe(method(init))]
206        #[unsafe(method_family = init)]
207        pub fn init(this: Allocated<Self>) -> Retained<Self>;
208    );
209}
210
211/// Methods declared on superclass `NSObject`.
212#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
213impl NSTextFieldCell {
214    extern_methods!(
215        #[unsafe(method(new))]
216        #[unsafe(method_family = new)]
217        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
218    );
219}