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:))]
118 #[unsafe(method_family = init)]
119 pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
120
121 #[cfg(feature = "NSImage")]
122 #[unsafe(method(image))]
123 #[unsafe(method_family = none)]
124 pub fn image(&self) -> Retained<NSImage>;
125
126 #[unsafe(method(hotSpot))]
127 #[unsafe(method_family = none)]
128 pub fn hotSpot(&self) -> NSPoint;
129
130 #[unsafe(method(hide))]
131 #[unsafe(method_family = none)]
132 pub fn hide();
133
134 #[unsafe(method(unhide))]
135 #[unsafe(method_family = none)]
136 pub fn unhide();
137
138 #[unsafe(method(setHiddenUntilMouseMoves:))]
139 #[unsafe(method_family = none)]
140 pub fn setHiddenUntilMouseMoves(flag: bool);
141
142 #[unsafe(method(pop))]
143 #[unsafe(method_family = none)]
144 pub fn pop_class();
145
146 #[unsafe(method(pop))]
147 #[unsafe(method_family = none)]
148 pub fn pop(&self);
149
150 #[unsafe(method(push))]
151 #[unsafe(method_family = none)]
152 pub fn push(&self);
153
154 #[unsafe(method(set))]
155 #[unsafe(method_family = none)]
156 pub fn set(&self);
157
158 #[unsafe(method(currentCursor))]
161 #[unsafe(method_family = none)]
162 pub fn currentCursor() -> Retained<NSCursor>;
163
164 #[unsafe(method(arrowCursor))]
167 #[unsafe(method_family = none)]
168 pub fn arrowCursor() -> Retained<NSCursor>;
169
170 #[unsafe(method(crosshairCursor))]
171 #[unsafe(method_family = none)]
172 pub fn crosshairCursor() -> Retained<NSCursor>;
173
174 #[unsafe(method(disappearingItemCursor))]
175 #[unsafe(method_family = none)]
176 pub fn disappearingItemCursor() -> Retained<NSCursor>;
177
178 #[unsafe(method(operationNotAllowedCursor))]
179 #[unsafe(method_family = none)]
180 pub fn operationNotAllowedCursor() -> Retained<NSCursor>;
181
182 #[unsafe(method(dragLinkCursor))]
183 #[unsafe(method_family = none)]
184 pub fn dragLinkCursor() -> Retained<NSCursor>;
185
186 #[unsafe(method(dragCopyCursor))]
187 #[unsafe(method_family = none)]
188 pub fn dragCopyCursor() -> Retained<NSCursor>;
189
190 #[unsafe(method(contextualMenuCursor))]
191 #[unsafe(method_family = none)]
192 pub fn contextualMenuCursor() -> Retained<NSCursor>;
193
194 #[unsafe(method(pointingHandCursor))]
195 #[unsafe(method_family = none)]
196 pub fn pointingHandCursor() -> Retained<NSCursor>;
197
198 #[unsafe(method(closedHandCursor))]
199 #[unsafe(method_family = none)]
200 pub fn closedHandCursor() -> Retained<NSCursor>;
201
202 #[unsafe(method(openHandCursor))]
203 #[unsafe(method_family = none)]
204 pub fn openHandCursor() -> Retained<NSCursor>;
205
206 #[unsafe(method(IBeamCursor))]
207 #[unsafe(method_family = none)]
208 pub fn IBeamCursor() -> Retained<NSCursor>;
209
210 #[unsafe(method(IBeamCursorForVerticalLayout))]
211 #[unsafe(method_family = none)]
212 pub fn IBeamCursorForVerticalLayout() -> Retained<NSCursor>;
213
214 #[unsafe(method(zoomInCursor))]
217 #[unsafe(method_family = none)]
218 pub fn zoomInCursor() -> Retained<NSCursor>;
219
220 #[unsafe(method(zoomOutCursor))]
223 #[unsafe(method_family = none)]
224 pub fn zoomOutCursor() -> Retained<NSCursor>;
225
226 #[unsafe(method(columnResizeCursor))]
228 #[unsafe(method_family = none)]
229 pub fn columnResizeCursor() -> Retained<NSCursor>;
230
231 #[cfg(feature = "NSDirection")]
232 #[unsafe(method(columnResizeCursorInDirections:))]
235 #[unsafe(method_family = none)]
236 pub fn columnResizeCursorInDirections(
237 directions: NSHorizontalDirections,
238 ) -> Retained<NSCursor>;
239
240 #[unsafe(method(rowResizeCursor))]
242 #[unsafe(method_family = none)]
243 pub fn rowResizeCursor() -> Retained<NSCursor>;
244
245 #[cfg(feature = "NSDirection")]
246 #[unsafe(method(rowResizeCursorInDirections:))]
249 #[unsafe(method_family = none)]
250 pub fn rowResizeCursorInDirections(directions: NSVerticalDirections) -> Retained<NSCursor>;
251
252 #[unsafe(method(frameResizeCursorFromPosition:inDirections:))]
257 #[unsafe(method_family = none)]
258 pub fn frameResizeCursorFromPosition_inDirections(
259 position: NSCursorFrameResizePosition,
260 directions: NSCursorFrameResizeDirections,
261 ) -> Retained<NSCursor>;
262 );
263}
264
265impl NSCursor {
267 extern_methods!(
268 #[unsafe(method(init))]
269 #[unsafe(method_family = init)]
270 pub fn init(this: Allocated<Self>) -> Retained<Self>;
271
272 #[unsafe(method(new))]
273 #[unsafe(method_family = new)]
274 pub fn new() -> Retained<Self>;
275 );
276}
277
278impl DefaultRetained for NSCursor {
279 #[inline]
280 fn default_retained() -> Retained<Self> {
281 Self::new()
282 }
283}
284
285#[cfg(feature = "NSApplication")]
287pub static NSAppKitVersionNumberWithCursorSizeSupport: NSAppKitVersion = 682.0 as _;
288
289impl NSCursor {
291 extern_methods!(
292 #[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."]
294 #[unsafe(method(currentSystemCursor))]
295 #[unsafe(method_family = none)]
296 pub fn currentSystemCursor() -> Option<Retained<NSCursor>>;
297
298 #[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."]
299 #[unsafe(method(resizeLeftCursor))]
300 #[unsafe(method_family = none)]
301 pub fn resizeLeftCursor() -> Retained<NSCursor>;
302
303 #[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."]
304 #[unsafe(method(resizeRightCursor))]
305 #[unsafe(method_family = none)]
306 pub fn resizeRightCursor() -> Retained<NSCursor>;
307
308 #[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."]
309 #[unsafe(method(resizeLeftRightCursor))]
310 #[unsafe(method_family = none)]
311 pub fn resizeLeftRightCursor() -> Retained<NSCursor>;
312
313 #[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."]
314 #[unsafe(method(resizeUpCursor))]
315 #[unsafe(method_family = none)]
316 pub fn resizeUpCursor() -> Retained<NSCursor>;
317
318 #[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."]
319 #[unsafe(method(resizeDownCursor))]
320 #[unsafe(method_family = none)]
321 pub fn resizeDownCursor() -> Retained<NSCursor>;
322
323 #[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."]
324 #[unsafe(method(resizeUpDownCursor))]
325 #[unsafe(method_family = none)]
326 pub fn resizeUpDownCursor() -> Retained<NSCursor>;
327 );
328}
329
330impl NSCursor {
332 extern_methods!(
333 #[cfg(all(feature = "NSColor", feature = "NSImage"))]
334 #[deprecated = "Color hints are ignored. Use -initWithImage:hotSpot: instead"]
335 #[unsafe(method(initWithImage:foregroundColorHint:backgroundColorHint:hotSpot:))]
336 #[unsafe(method_family = init)]
337 pub fn initWithImage_foregroundColorHint_backgroundColorHint_hotSpot(
338 this: Allocated<Self>,
339 new_image: &NSImage,
340 fg: Option<&NSColor>,
341 bg: Option<&NSColor>,
342 hot_spot: NSPoint,
343 ) -> Retained<Self>;
344
345 #[deprecated = "setOnMouseExited is unused and should not be called"]
346 #[unsafe(method(setOnMouseExited:))]
347 #[unsafe(method_family = none)]
348 pub fn setOnMouseExited(&self, flag: bool);
349
350 #[deprecated = "setOnMouseEntered is unused and should not be called"]
351 #[unsafe(method(setOnMouseEntered:))]
352 #[unsafe(method_family = none)]
353 pub fn setOnMouseEntered(&self, flag: bool);
354
355 #[deprecated = "isSetOnMouseExited is unused"]
356 #[unsafe(method(isSetOnMouseExited))]
357 #[unsafe(method_family = none)]
358 pub fn isSetOnMouseExited(&self) -> bool;
359
360 #[deprecated = "isSetOnMouseEntered is unused"]
361 #[unsafe(method(isSetOnMouseEntered))]
362 #[unsafe(method_family = none)]
363 pub fn isSetOnMouseEntered(&self) -> bool;
364
365 #[cfg(feature = "NSEvent")]
366 #[deprecated = "mouseEntered: is unused and should not be called"]
367 #[unsafe(method(mouseEntered:))]
368 #[unsafe(method_family = none)]
369 pub fn mouseEntered(&self, event: &NSEvent);
370
371 #[cfg(feature = "NSEvent")]
372 #[deprecated = "mouseExited: is unused and should not be called"]
373 #[unsafe(method(mouseExited:))]
374 #[unsafe(method_family = none)]
375 pub fn mouseExited(&self, event: &NSEvent);
376 );
377}