objc2_app_kit/generated/
NSTextInsertionIndicator.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/nstextinsertionindicatordisplaymode?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSTextInsertionIndicatorDisplayMode(pub NSInteger);
15impl NSTextInsertionIndicatorDisplayMode {
16    #[doc(alias = "NSTextInsertionIndicatorDisplayModeAutomatic")]
17    pub const Automatic: Self = Self(0);
18    #[doc(alias = "NSTextInsertionIndicatorDisplayModeHidden")]
19    pub const Hidden: Self = Self(1);
20    #[doc(alias = "NSTextInsertionIndicatorDisplayModeVisible")]
21    pub const Visible: Self = Self(2);
22}
23
24unsafe impl Encode for NSTextInsertionIndicatorDisplayMode {
25    const ENCODING: Encoding = NSInteger::ENCODING;
26}
27
28unsafe impl RefEncode for NSTextInsertionIndicatorDisplayMode {
29    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
30}
31
32/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextinsertionindicatorautomaticmodeoptions?language=objc)
33// NS_OPTIONS
34#[repr(transparent)]
35#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
36pub struct NSTextInsertionIndicatorAutomaticModeOptions(pub NSInteger);
37bitflags::bitflags! {
38    impl NSTextInsertionIndicatorAutomaticModeOptions: NSInteger {
39        #[doc(alias = "NSTextInsertionIndicatorAutomaticModeOptionsShowEffectsView")]
40        const ShowEffectsView = 1<<0;
41        #[doc(alias = "NSTextInsertionIndicatorAutomaticModeOptionsShowWhileTracking")]
42        const ShowWhileTracking = 1<<1;
43    }
44}
45
46unsafe impl Encode for NSTextInsertionIndicatorAutomaticModeOptions {
47    const ENCODING: Encoding = NSInteger::ENCODING;
48}
49
50unsafe impl RefEncode for NSTextInsertionIndicatorAutomaticModeOptions {
51    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
52}
53
54extern_class!(
55    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextinsertionindicator?language=objc)
56    #[unsafe(super(NSView, NSResponder, NSObject))]
57    #[derive(Debug, PartialEq, Eq, Hash)]
58    #[cfg(all(feature = "NSResponder", feature = "NSView"))]
59    pub struct NSTextInsertionIndicator;
60);
61
62#[cfg(all(
63    feature = "NSAccessibilityProtocols",
64    feature = "NSResponder",
65    feature = "NSView"
66))]
67extern_conformance!(
68    unsafe impl NSAccessibility for NSTextInsertionIndicator {}
69);
70
71#[cfg(all(
72    feature = "NSAccessibilityProtocols",
73    feature = "NSResponder",
74    feature = "NSView"
75))]
76extern_conformance!(
77    unsafe impl NSAccessibilityElementProtocol for NSTextInsertionIndicator {}
78);
79
80#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
81extern_conformance!(
82    unsafe impl NSAnimatablePropertyContainer for NSTextInsertionIndicator {}
83);
84
85#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
86extern_conformance!(
87    unsafe impl NSAppearanceCustomization for NSTextInsertionIndicator {}
88);
89
90#[cfg(all(feature = "NSResponder", feature = "NSView"))]
91extern_conformance!(
92    unsafe impl NSCoding for NSTextInsertionIndicator {}
93);
94
95#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
96extern_conformance!(
97    unsafe impl NSDraggingDestination for NSTextInsertionIndicator {}
98);
99
100#[cfg(all(feature = "NSResponder", feature = "NSView"))]
101extern_conformance!(
102    unsafe impl NSObjectProtocol for NSTextInsertionIndicator {}
103);
104
105#[cfg(all(
106    feature = "NSResponder",
107    feature = "NSUserInterfaceItemIdentification",
108    feature = "NSView"
109))]
110extern_conformance!(
111    unsafe impl NSUserInterfaceItemIdentification for NSTextInsertionIndicator {}
112);
113
114#[cfg(all(feature = "NSResponder", feature = "NSView"))]
115impl NSTextInsertionIndicator {
116    extern_methods!(
117        /// Sets-returns the indicator's display mode.
118        #[unsafe(method(displayMode))]
119        #[unsafe(method_family = none)]
120        pub fn displayMode(&self) -> NSTextInsertionIndicatorDisplayMode;
121
122        /// Setter for [`displayMode`][Self::displayMode].
123        #[unsafe(method(setDisplayMode:))]
124        #[unsafe(method_family = none)]
125        pub fn setDisplayMode(&self, display_mode: NSTextInsertionIndicatorDisplayMode);
126
127        #[cfg(feature = "NSColor")]
128        /// The color of the indicator.
129        ///
130        /// Defaults to NSColor.textInsertionPointColor.
131        ///
132        /// Note: If set to
133        /// `nil,`uses NSColor.textInsertionPointColor.
134        #[unsafe(method(color))]
135        #[unsafe(method_family = none)]
136        pub fn color(&self) -> Retained<NSColor>;
137
138        #[cfg(feature = "NSColor")]
139        /// Setter for [`color`][Self::color].
140        ///
141        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
142        #[unsafe(method(setColor:))]
143        #[unsafe(method_family = none)]
144        pub fn setColor(&self, color: Option<&NSColor>);
145
146        /// Options for the NSTextInsertionIndicatorDisplayModeAutomatic display mode.
147        /// Defaults to NSTextInsertionIndicatorAutomaticModeOptionsShowEffectsView.
148        #[unsafe(method(automaticModeOptions))]
149        #[unsafe(method_family = none)]
150        pub fn automaticModeOptions(&self) -> NSTextInsertionIndicatorAutomaticModeOptions;
151
152        /// Setter for [`automaticModeOptions`][Self::automaticModeOptions].
153        #[unsafe(method(setAutomaticModeOptions:))]
154        #[unsafe(method_family = none)]
155        pub fn setAutomaticModeOptions(
156            &self,
157            automatic_mode_options: NSTextInsertionIndicatorAutomaticModeOptions,
158        );
159
160        #[cfg(feature = "block2")]
161        /// Sets-returns a block that inserts a view into the view hierarchy.
162        ///
163        /// During dictation the NSTextInsertionIndicator displays a glow effect by inserting a view below the text view. If an application needs to insert the view in a different way, the application can specify a block of code that will be called when the glow effect needs to be displayed.
164        ///
165        /// # Safety
166        ///
167        /// The returned block's argument must be a valid pointer.
168        #[unsafe(method(effectsViewInserter))]
169        #[unsafe(method_family = none)]
170        pub unsafe fn effectsViewInserter(&self) -> *mut block2::DynBlock<dyn Fn(NonNull<NSView>)>;
171
172        #[cfg(feature = "block2")]
173        /// Setter for [`effectsViewInserter`][Self::effectsViewInserter].
174        ///
175        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
176        #[unsafe(method(setEffectsViewInserter:))]
177        #[unsafe(method_family = none)]
178        pub fn setEffectsViewInserter(
179            &self,
180            effects_view_inserter: Option<&block2::DynBlock<dyn Fn(NonNull<NSView>)>>,
181        );
182    );
183}
184
185/// Methods declared on superclass `NSView`.
186#[cfg(all(feature = "NSResponder", feature = "NSView"))]
187impl NSTextInsertionIndicator {
188    extern_methods!(
189        #[unsafe(method(initWithFrame:))]
190        #[unsafe(method_family = init)]
191        pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
192
193        /// # Safety
194        ///
195        /// `coder` possibly has further requirements.
196        #[unsafe(method(initWithCoder:))]
197        #[unsafe(method_family = init)]
198        pub unsafe fn initWithCoder(
199            this: Allocated<Self>,
200            coder: &NSCoder,
201        ) -> Option<Retained<Self>>;
202    );
203}
204
205/// Methods declared on superclass `NSResponder`.
206#[cfg(all(feature = "NSResponder", feature = "NSView"))]
207impl NSTextInsertionIndicator {
208    extern_methods!(
209        #[unsafe(method(init))]
210        #[unsafe(method_family = init)]
211        pub fn init(this: Allocated<Self>) -> Retained<Self>;
212    );
213}
214
215/// Methods declared on superclass `NSObject`.
216#[cfg(all(feature = "NSResponder", feature = "NSView"))]
217impl NSTextInsertionIndicator {
218    extern_methods!(
219        #[unsafe(method(new))]
220        #[unsafe(method_family = new)]
221        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
222    );
223}