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 unsafe fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
91
92        #[unsafe(method(initWithCoder:))]
93        #[unsafe(method_family = init)]
94        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
95
96        #[cfg(feature = "NSImage")]
97        #[unsafe(method(initImageCell:))]
98        #[unsafe(method_family = init)]
99        pub unsafe fn initImageCell(
100            this: Allocated<Self>,
101            image: Option<&NSImage>,
102        ) -> Retained<Self>;
103
104        #[cfg(feature = "NSColor")]
105        #[unsafe(method(backgroundColor))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn backgroundColor(&self) -> Option<Retained<NSColor>>;
108
109        #[cfg(feature = "NSColor")]
110        /// Setter for [`backgroundColor`][Self::backgroundColor].
111        #[unsafe(method(setBackgroundColor:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn setBackgroundColor(&self, background_color: Option<&NSColor>);
114
115        #[unsafe(method(drawsBackground))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn drawsBackground(&self) -> bool;
118
119        /// Setter for [`drawsBackground`][Self::drawsBackground].
120        #[unsafe(method(setDrawsBackground:))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn setDrawsBackground(&self, draws_background: bool);
123
124        #[cfg(feature = "NSColor")]
125        #[unsafe(method(textColor))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn textColor(&self) -> Option<Retained<NSColor>>;
128
129        #[cfg(feature = "NSColor")]
130        /// Setter for [`textColor`][Self::textColor].
131        #[unsafe(method(setTextColor:))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn setTextColor(&self, text_color: Option<&NSColor>);
134
135        #[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
136        #[unsafe(method(setUpFieldEditorAttributes:))]
137        #[unsafe(method_family = none)]
138        pub unsafe fn setUpFieldEditorAttributes(&self, text_obj: &NSText) -> Retained<NSText>;
139
140        #[unsafe(method(bezelStyle))]
141        #[unsafe(method_family = none)]
142        pub unsafe fn bezelStyle(&self) -> NSTextFieldBezelStyle;
143
144        /// Setter for [`bezelStyle`][Self::bezelStyle].
145        #[unsafe(method(setBezelStyle:))]
146        #[unsafe(method_family = none)]
147        pub unsafe fn setBezelStyle(&self, bezel_style: NSTextFieldBezelStyle);
148
149        #[unsafe(method(placeholderString))]
150        #[unsafe(method_family = none)]
151        pub unsafe fn placeholderString(&self) -> Option<Retained<NSString>>;
152
153        /// Setter for [`placeholderString`][Self::placeholderString].
154        #[unsafe(method(setPlaceholderString:))]
155        #[unsafe(method_family = none)]
156        pub unsafe fn setPlaceholderString(&self, placeholder_string: Option<&NSString>);
157
158        #[unsafe(method(placeholderAttributedString))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn placeholderAttributedString(&self) -> Option<Retained<NSAttributedString>>;
161
162        /// Setter for [`placeholderAttributedString`][Self::placeholderAttributedString].
163        #[unsafe(method(setPlaceholderAttributedString:))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn setPlaceholderAttributedString(
166            &self,
167            placeholder_attributed_string: Option<&NSAttributedString>,
168        );
169
170        #[unsafe(method(setWantsNotificationForMarkedText:))]
171        #[unsafe(method_family = none)]
172        pub unsafe fn setWantsNotificationForMarkedText(&self, flag: bool);
173
174        #[unsafe(method(allowedInputSourceLocales))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn allowedInputSourceLocales(&self) -> Option<Retained<NSArray<NSString>>>;
177
178        /// Setter for [`allowedInputSourceLocales`][Self::allowedInputSourceLocales].
179        #[unsafe(method(setAllowedInputSourceLocales:))]
180        #[unsafe(method_family = none)]
181        pub unsafe fn setAllowedInputSourceLocales(
182            &self,
183            allowed_input_source_locales: Option<&NSArray<NSString>>,
184        );
185    );
186}
187
188/// Methods declared on superclass `NSCell`.
189#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
190impl NSTextFieldCell {
191    extern_methods!(
192        #[unsafe(method(init))]
193        #[unsafe(method_family = init)]
194        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
195    );
196}
197
198/// Methods declared on superclass `NSObject`.
199#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
200impl NSTextFieldCell {
201    extern_methods!(
202        #[unsafe(method(new))]
203        #[unsafe(method_family = new)]
204        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
205    );
206}