objc2_app_kit/generated/
NSCursor.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10#[repr(usize)] #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub enum NSCursorFrameResizePosition {
17 #[doc(alias = "NSCursorFrameResizePositionTop")]
19 Top = 1 << 0,
20 #[doc(alias = "NSCursorFrameResizePositionLeft")]
22 Left = 1 << 1,
23 #[doc(alias = "NSCursorFrameResizePositionBottom")]
25 Bottom = 1 << 2,
26 #[doc(alias = "NSCursorFrameResizePositionRight")]
28 Right = 1 << 3,
29 #[doc(alias = "NSCursorFrameResizePositionTopLeft")]
31 TopLeft = NSCursorFrameResizePosition::Top as NSUInteger
32 | NSCursorFrameResizePosition::Left as NSUInteger,
33 #[doc(alias = "NSCursorFrameResizePositionTopRight")]
35 TopRight = NSCursorFrameResizePosition::Top as NSUInteger
36 | NSCursorFrameResizePosition::Right as NSUInteger,
37 #[doc(alias = "NSCursorFrameResizePositionBottomLeft")]
39 BottomLeft = NSCursorFrameResizePosition::Bottom as NSUInteger
40 | NSCursorFrameResizePosition::Left as NSUInteger,
41 #[doc(alias = "NSCursorFrameResizePositionBottomRight")]
43 BottomRight = NSCursorFrameResizePosition::Bottom as NSUInteger
44 | NSCursorFrameResizePosition::Right as NSUInteger,
45}
46
47unsafe impl Encode for NSCursorFrameResizePosition {
48 const ENCODING: Encoding = NSUInteger::ENCODING;
49}
50
51unsafe impl RefEncode for NSCursorFrameResizePosition {
52 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
53}
54
55#[repr(transparent)]
60#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
61pub struct NSCursorFrameResizeDirections(pub NSUInteger);
62bitflags::bitflags! {
63 impl NSCursorFrameResizeDirections: NSUInteger {
64#[doc(alias = "NSCursorFrameResizeDirectionsInward")]
66 const Inward = 1<<0;
67#[doc(alias = "NSCursorFrameResizeDirectionsOutward")]
69 const Outward = 1<<1;
70#[doc(alias = "NSCursorFrameResizeDirectionsAll")]
72 const All = NSCursorFrameResizeDirections::Inward.0|NSCursorFrameResizeDirections::Outward.0;
73 }
74}
75
76unsafe impl Encode for NSCursorFrameResizeDirections {
77 const ENCODING: Encoding = NSUInteger::ENCODING;
78}
79
80unsafe impl RefEncode for NSCursorFrameResizeDirections {
81 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
82}
83
84extern_class!(
85 #[unsafe(super(NSObject))]
87 #[derive(Debug, PartialEq, Eq, Hash)]
88 pub struct NSCursor;
89);
90
91extern_conformance!(
92 unsafe impl NSCoding for NSCursor {}
93);
94
95extern_conformance!(
96 unsafe impl NSObjectProtocol for NSCursor {}
97);
98
99extern_conformance!(
100 unsafe impl NSSecureCoding for NSCursor {}
101);
102
103impl NSCursor {
104 extern_methods!(
105 #[cfg(feature = "NSImage")]
106 #[unsafe(method(initWithImage:hotSpot:))]
107 #[unsafe(method_family = init)]
108 pub fn initWithImage_hotSpot(
109 this: Allocated<Self>,
110 new_image: &NSImage,
111 point: NSPoint,
112 ) -> Retained<Self>;
113
114 #[unsafe(method(initWithCoder:))]
115 #[unsafe(method_family = init)]
116 pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
117
118 #[cfg(feature = "NSImage")]
119 #[unsafe(method(image))]
120 #[unsafe(method_family = none)]
121 pub unsafe fn image(&self) -> Retained<NSImage>;
122
123 #[unsafe(method(hotSpot))]
124 #[unsafe(method_family = none)]
125 pub unsafe fn hotSpot(&self) -> NSPoint;
126
127 #[unsafe(method(hide))]
128 #[unsafe(method_family = none)]
129 pub unsafe fn hide();
130
131 #[unsafe(method(unhide))]
132 #[unsafe(method_family = none)]
133 pub unsafe fn unhide();
134
135 #[unsafe(method(setHiddenUntilMouseMoves:))]
136 #[unsafe(method_family = none)]
137 pub unsafe fn setHiddenUntilMouseMoves(flag: bool);
138
139 #[unsafe(method(pop))]
140 #[unsafe(method_family = none)]
141 pub unsafe fn pop_class();
142
143 #[unsafe(method(pop))]
144 #[unsafe(method_family = none)]
145 pub unsafe fn pop(&self);
146
147 #[unsafe(method(push))]
148 #[unsafe(method_family = none)]
149 pub unsafe fn push(&self);
150
151 #[unsafe(method(set))]
152 #[unsafe(method_family = none)]
153 pub unsafe fn set(&self);
154
155 #[unsafe(method(currentCursor))]
158 #[unsafe(method_family = none)]
159 pub unsafe fn currentCursor() -> Retained<NSCursor>;
160
161 #[unsafe(method(arrowCursor))]
164 #[unsafe(method_family = none)]
165 pub fn arrowCursor() -> Retained<NSCursor>;
166
167 #[unsafe(method(crosshairCursor))]
168 #[unsafe(method_family = none)]
169 pub fn crosshairCursor() -> Retained<NSCursor>;
170
171 #[unsafe(method(disappearingItemCursor))]
172 #[unsafe(method_family = none)]
173 pub fn disappearingItemCursor() -> Retained<NSCursor>;
174
175 #[unsafe(method(operationNotAllowedCursor))]
176 #[unsafe(method_family = none)]
177 pub fn operationNotAllowedCursor() -> Retained<NSCursor>;
178
179 #[unsafe(method(dragLinkCursor))]
180 #[unsafe(method_family = none)]
181 pub fn dragLinkCursor() -> Retained<NSCursor>;
182
183 #[unsafe(method(dragCopyCursor))]
184 #[unsafe(method_family = none)]
185 pub fn dragCopyCursor() -> Retained<NSCursor>;
186
187 #[unsafe(method(contextualMenuCursor))]
188 #[unsafe(method_family = none)]
189 pub fn contextualMenuCursor() -> Retained<NSCursor>;
190
191 #[unsafe(method(pointingHandCursor))]
192 #[unsafe(method_family = none)]
193 pub fn pointingHandCursor() -> Retained<NSCursor>;
194
195 #[unsafe(method(closedHandCursor))]
196 #[unsafe(method_family = none)]
197 pub fn closedHandCursor() -> Retained<NSCursor>;
198
199 #[unsafe(method(openHandCursor))]
200 #[unsafe(method_family = none)]
201 pub fn openHandCursor() -> Retained<NSCursor>;
202
203 #[unsafe(method(IBeamCursor))]
204 #[unsafe(method_family = none)]
205 pub fn IBeamCursor() -> Retained<NSCursor>;
206
207 #[unsafe(method(IBeamCursorForVerticalLayout))]
208 #[unsafe(method_family = none)]
209 pub fn IBeamCursorForVerticalLayout() -> Retained<NSCursor>;
210
211 #[unsafe(method(zoomInCursor))]
214 #[unsafe(method_family = none)]
215 pub unsafe fn zoomInCursor() -> Retained<NSCursor>;
216
217 #[unsafe(method(zoomOutCursor))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn zoomOutCursor() -> Retained<NSCursor>;
222
223 #[unsafe(method(columnResizeCursor))]
225 #[unsafe(method_family = none)]
226 pub unsafe fn columnResizeCursor() -> Retained<NSCursor>;
227
228 #[cfg(feature = "NSDirection")]
229 #[unsafe(method(columnResizeCursorInDirections:))]
232 #[unsafe(method_family = none)]
233 pub unsafe fn columnResizeCursorInDirections(
234 directions: NSHorizontalDirections,
235 ) -> Retained<NSCursor>;
236
237 #[unsafe(method(rowResizeCursor))]
239 #[unsafe(method_family = none)]
240 pub unsafe fn rowResizeCursor() -> Retained<NSCursor>;
241
242 #[cfg(feature = "NSDirection")]
243 #[unsafe(method(rowResizeCursorInDirections:))]
246 #[unsafe(method_family = none)]
247 pub unsafe fn rowResizeCursorInDirections(
248 directions: NSVerticalDirections,
249 ) -> Retained<NSCursor>;
250
251 #[unsafe(method(frameResizeCursorFromPosition:inDirections:))]
256 #[unsafe(method_family = none)]
257 pub unsafe fn frameResizeCursorFromPosition_inDirections(
258 position: NSCursorFrameResizePosition,
259 directions: NSCursorFrameResizeDirections,
260 ) -> Retained<NSCursor>;
261 );
262}
263
264impl NSCursor {
266 extern_methods!(
267 #[unsafe(method(init))]
268 #[unsafe(method_family = init)]
269 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
270
271 #[unsafe(method(new))]
272 #[unsafe(method_family = new)]
273 pub unsafe fn new() -> Retained<Self>;
274 );
275}
276
277#[cfg(feature = "NSApplication")]
279pub static NSAppKitVersionNumberWithCursorSizeSupport: NSAppKitVersion = 682.0 as _;
280
281impl NSCursor {
283 extern_methods!(
284 #[deprecated = "No longer recommended. Use ScreenCaptureKit to capture the screen. Use the `showsCursor` property on `SCStreamConfiguration` to control whether or not to include the cursor in the capture. Or, use `NSCursor.currentCursor` if needing to just get the current cursor for this application."]
286 #[unsafe(method(currentSystemCursor))]
287 #[unsafe(method_family = none)]
288 pub unsafe fn currentSystemCursor() -> Option<Retained<NSCursor>>;
289
290 #[deprecated = "Use either `+[NSCursor columnResizeCursorInDirections:]` or `+[NSCursor frameResizeCursorFromPosition:inDirections:]` instead, depending on whether a divider is being re-positioned or a rectangular frame is being resized."]
291 #[unsafe(method(resizeLeftCursor))]
292 #[unsafe(method_family = none)]
293 pub fn resizeLeftCursor() -> Retained<NSCursor>;
294
295 #[deprecated = "Use either `+[NSCursor columnResizeCursorInDirections:]` or `+[NSCursor frameResizeCursorFromPosition:inDirections:]` instead, depending on whether a divider is being re-positioned or a rectangular frame is being resized."]
296 #[unsafe(method(resizeRightCursor))]
297 #[unsafe(method_family = none)]
298 pub fn resizeRightCursor() -> Retained<NSCursor>;
299
300 #[deprecated = "Use either `+[NSCursor columnResizeCursorInDirections:]` or `+[NSCursor frameResizeCursorFromPosition:inDirections:]` instead, depending on whether a divider is being re-positioned or a rectangular frame is being resized."]
301 #[unsafe(method(resizeLeftRightCursor))]
302 #[unsafe(method_family = none)]
303 pub fn resizeLeftRightCursor() -> Retained<NSCursor>;
304
305 #[deprecated = "Use either `+[NSCursor rowResizeCursorInDirections:]` or `+[NSCursor frameResizeCursorFromPosition:inDirections:]` instead, depending on whether a divider is being re-positioned or a rectangular frame is being resized."]
306 #[unsafe(method(resizeUpCursor))]
307 #[unsafe(method_family = none)]
308 pub fn resizeUpCursor() -> Retained<NSCursor>;
309
310 #[deprecated = "Use either `+[NSCursor rowResizeCursorInDirections:]` or `+[NSCursor frameResizeCursorFromPosition:inDirections:]` instead, depending on whether a divider is being re-positioned or a rectangular frame is being resized."]
311 #[unsafe(method(resizeDownCursor))]
312 #[unsafe(method_family = none)]
313 pub fn resizeDownCursor() -> Retained<NSCursor>;
314
315 #[deprecated = "Use either `+[NSCursor rowResizeCursorInDirections:]` or `+[NSCursor frameResizeCursorFromPosition:inDirections:]` instead, depending on whether a divider is being re-positioned or a rectangular frame is being resized."]
316 #[unsafe(method(resizeUpDownCursor))]
317 #[unsafe(method_family = none)]
318 pub fn resizeUpDownCursor() -> Retained<NSCursor>;
319 );
320}
321
322impl NSCursor {
324 extern_methods!(
325 #[cfg(all(feature = "NSColor", feature = "NSImage"))]
326 #[deprecated = "Color hints are ignored. Use -initWithImage:hotSpot: instead"]
327 #[unsafe(method(initWithImage:foregroundColorHint:backgroundColorHint:hotSpot:))]
328 #[unsafe(method_family = init)]
329 pub unsafe fn initWithImage_foregroundColorHint_backgroundColorHint_hotSpot(
330 this: Allocated<Self>,
331 new_image: &NSImage,
332 fg: Option<&NSColor>,
333 bg: Option<&NSColor>,
334 hot_spot: NSPoint,
335 ) -> Retained<Self>;
336
337 #[deprecated = "setOnMouseExited is unused and should not be called"]
338 #[unsafe(method(setOnMouseExited:))]
339 #[unsafe(method_family = none)]
340 pub unsafe fn setOnMouseExited(&self, flag: bool);
341
342 #[deprecated = "setOnMouseEntered is unused and should not be called"]
343 #[unsafe(method(setOnMouseEntered:))]
344 #[unsafe(method_family = none)]
345 pub unsafe fn setOnMouseEntered(&self, flag: bool);
346
347 #[deprecated = "isSetOnMouseExited is unused"]
348 #[unsafe(method(isSetOnMouseExited))]
349 #[unsafe(method_family = none)]
350 pub unsafe fn isSetOnMouseExited(&self) -> bool;
351
352 #[deprecated = "isSetOnMouseEntered is unused"]
353 #[unsafe(method(isSetOnMouseEntered))]
354 #[unsafe(method_family = none)]
355 pub unsafe fn isSetOnMouseEntered(&self) -> bool;
356
357 #[cfg(feature = "NSEvent")]
358 #[deprecated = "mouseEntered: is unused and should not be called"]
359 #[unsafe(method(mouseEntered:))]
360 #[unsafe(method_family = none)]
361 pub unsafe fn mouseEntered(&self, event: &NSEvent);
362
363 #[cfg(feature = "NSEvent")]
364 #[deprecated = "mouseExited: is unused and should not be called"]
365 #[unsafe(method(mouseExited:))]
366 #[unsafe(method_family = none)]
367 pub unsafe fn mouseExited(&self, event: &NSEvent);
368 );
369}