1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8#[cfg(feature = "objc2-core-graphics")]
9#[cfg(target_vendor = "apple")]
10use objc2_core_graphics::*;
11use objc2_foundation::*;
12
13use crate::*;
14
15pub type NSImageName = NSString;
17
18extern "C" {
19 #[cfg(feature = "NSImageRep")]
21 pub static NSImageHintCTM: &'static NSImageHintKey;
22}
23
24extern "C" {
25 #[cfg(feature = "NSImageRep")]
27 pub static NSImageHintInterpolation: &'static NSImageHintKey;
28}
29
30extern "C" {
31 #[cfg(feature = "NSImageRep")]
33 pub static NSImageHintUserInterfaceLayoutDirection: &'static NSImageHintKey;
34}
35
36#[repr(transparent)]
39#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
40pub struct NSImageLoadStatus(pub NSUInteger);
41impl NSImageLoadStatus {
42 #[doc(alias = "NSImageLoadStatusCompleted")]
43 pub const Completed: Self = Self(0);
44 #[doc(alias = "NSImageLoadStatusCancelled")]
45 pub const Cancelled: Self = Self(1);
46 #[doc(alias = "NSImageLoadStatusInvalidData")]
47 pub const InvalidData: Self = Self(2);
48 #[doc(alias = "NSImageLoadStatusUnexpectedEOF")]
49 pub const UnexpectedEOF: Self = Self(3);
50 #[doc(alias = "NSImageLoadStatusReadError")]
51 pub const ReadError: Self = Self(4);
52}
53
54unsafe impl Encode for NSImageLoadStatus {
55 const ENCODING: Encoding = NSUInteger::ENCODING;
56}
57
58unsafe impl RefEncode for NSImageLoadStatus {
59 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
60}
61
62#[repr(transparent)]
65#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
66pub struct NSImageCacheMode(pub NSUInteger);
67impl NSImageCacheMode {
68 #[doc(alias = "NSImageCacheDefault")]
69 pub const Default: Self = Self(0);
70 #[doc(alias = "NSImageCacheAlways")]
71 pub const Always: Self = Self(1);
72 #[doc(alias = "NSImageCacheBySize")]
73 pub const BySize: Self = Self(2);
74 #[doc(alias = "NSImageCacheNever")]
75 pub const Never: Self = Self(3);
76}
77
78unsafe impl Encode for NSImageCacheMode {
79 const ENCODING: Encoding = NSUInteger::ENCODING;
80}
81
82unsafe impl RefEncode for NSImageCacheMode {
83 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
84}
85
86#[repr(transparent)]
89#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
90pub struct NSImageResizingMode(pub NSInteger);
91impl NSImageResizingMode {}
92
93unsafe impl Encode for NSImageResizingMode {
94 const ENCODING: Encoding = NSInteger::ENCODING;
95}
96
97unsafe impl RefEncode for NSImageResizingMode {
98 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
99}
100
101extern_class!(
102 #[unsafe(super(NSObject))]
104 #[derive(Debug, PartialEq, Eq, Hash)]
105 pub struct NSImage;
106);
107
108extern_conformance!(
109 unsafe impl NSObjectProtocol for NSImage {}
110);
111
112impl NSImage {
113 extern_methods!(
114 #[unsafe(method(imageNamed:))]
115 #[unsafe(method_family = none)]
116 pub fn imageNamed(name: &NSImageName) -> Option<Retained<NSImage>>;
117
118 #[unsafe(method(imageWithSystemSymbolName:accessibilityDescription:))]
124 #[unsafe(method_family = none)]
125 pub fn imageWithSystemSymbolName_accessibilityDescription(
126 name: &NSString,
127 description: Option<&NSString>,
128 ) -> Option<Retained<Self>>;
129
130 #[unsafe(method(imageWithSystemSymbolName:variableValue:accessibilityDescription:))]
141 #[unsafe(method_family = none)]
142 pub fn imageWithSystemSymbolName_variableValue_accessibilityDescription(
143 name: &NSString,
144 value: c_double,
145 description: Option<&NSString>,
146 ) -> Option<Retained<Self>>;
147
148 #[unsafe(method(imageWithSymbolName:variableValue:))]
157 #[unsafe(method_family = none)]
158 pub fn imageWithSymbolName_variableValue(
159 name: &NSString,
160 value: c_double,
161 ) -> Option<Retained<Self>>;
162
163 #[unsafe(method(imageWithSymbolName:bundle:variableValue:))]
174 #[unsafe(method_family = none)]
175 pub fn imageWithSymbolName_bundle_variableValue(
176 name: &NSString,
177 bundle: Option<&NSBundle>,
178 value: c_double,
179 ) -> Option<Retained<Self>>;
180
181 #[unsafe(method(initWithSize:))]
182 #[unsafe(method_family = init)]
183 pub fn initWithSize(this: Allocated<Self>, size: NSSize) -> Retained<Self>;
184
185 #[unsafe(method(initWithCoder:))]
189 #[unsafe(method_family = init)]
190 pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
191
192 #[unsafe(method(initWithData:))]
193 #[unsafe(method_family = init)]
194 pub fn initWithData(this: Allocated<Self>, data: &NSData) -> Option<Retained<Self>>;
195
196 #[unsafe(method(initWithContentsOfFile:))]
197 #[unsafe(method_family = init)]
198 pub fn initWithContentsOfFile(
199 this: Allocated<Self>,
200 file_name: &NSString,
201 ) -> Option<Retained<Self>>;
202
203 #[unsafe(method(initWithContentsOfURL:))]
204 #[unsafe(method_family = init)]
205 pub fn initWithContentsOfURL(this: Allocated<Self>, url: &NSURL) -> Option<Retained<Self>>;
206
207 #[unsafe(method(initByReferencingFile:))]
208 #[unsafe(method_family = init)]
209 pub fn initByReferencingFile(
210 this: Allocated<Self>,
211 file_name: &NSString,
212 ) -> Option<Retained<Self>>;
213
214 #[unsafe(method(initByReferencingURL:))]
215 #[unsafe(method_family = init)]
216 pub fn initByReferencingURL(this: Allocated<Self>, url: &NSURL) -> Retained<Self>;
217
218 #[cfg(feature = "NSPasteboard")]
219 #[unsafe(method(initWithPasteboard:))]
220 #[unsafe(method_family = init)]
221 pub fn initWithPasteboard(
222 this: Allocated<Self>,
223 pasteboard: &NSPasteboard,
224 ) -> Option<Retained<Self>>;
225
226 #[unsafe(method(initWithDataIgnoringOrientation:))]
227 #[unsafe(method_family = init)]
228 pub fn initWithDataIgnoringOrientation(
229 this: Allocated<Self>,
230 data: &NSData,
231 ) -> Option<Retained<Self>>;
232
233 #[cfg(feature = "block2")]
234 #[unsafe(method(imageWithSize:flipped:drawingHandler:))]
235 #[unsafe(method_family = none)]
236 pub fn imageWithSize_flipped_drawingHandler(
237 size: NSSize,
238 drawing_handler_should_be_called_with_flipped_context: bool,
239 drawing_handler: &block2::DynBlock<dyn Fn(NSRect) -> Bool>,
240 ) -> Retained<Self>;
241
242 #[unsafe(method(size))]
243 #[unsafe(method_family = none)]
244 pub fn size(&self) -> NSSize;
245
246 #[unsafe(method(setSize:))]
248 #[unsafe(method_family = none)]
249 pub fn setSize(&self, size: NSSize);
250
251 #[unsafe(method(setName:))]
252 #[unsafe(method_family = none)]
253 pub fn setName(&self, string: Option<&NSImageName>) -> bool;
254
255 #[unsafe(method(name))]
256 #[unsafe(method_family = none)]
257 pub fn name(&self) -> Option<Retained<NSImageName>>;
258
259 #[cfg(feature = "NSColor")]
260 #[unsafe(method(backgroundColor))]
261 #[unsafe(method_family = none)]
262 pub fn backgroundColor(&self) -> Retained<NSColor>;
263
264 #[cfg(feature = "NSColor")]
265 #[unsafe(method(setBackgroundColor:))]
269 #[unsafe(method_family = none)]
270 pub fn setBackgroundColor(&self, background_color: &NSColor);
271
272 #[unsafe(method(usesEPSOnResolutionMismatch))]
273 #[unsafe(method_family = none)]
274 pub fn usesEPSOnResolutionMismatch(&self) -> bool;
275
276 #[unsafe(method(setUsesEPSOnResolutionMismatch:))]
278 #[unsafe(method_family = none)]
279 pub fn setUsesEPSOnResolutionMismatch(&self, uses_eps_on_resolution_mismatch: bool);
280
281 #[unsafe(method(prefersColorMatch))]
282 #[unsafe(method_family = none)]
283 pub fn prefersColorMatch(&self) -> bool;
284
285 #[unsafe(method(setPrefersColorMatch:))]
287 #[unsafe(method_family = none)]
288 pub fn setPrefersColorMatch(&self, prefers_color_match: bool);
289
290 #[unsafe(method(matchesOnMultipleResolution))]
291 #[unsafe(method_family = none)]
292 pub fn matchesOnMultipleResolution(&self) -> bool;
293
294 #[unsafe(method(setMatchesOnMultipleResolution:))]
296 #[unsafe(method_family = none)]
297 pub fn setMatchesOnMultipleResolution(&self, matches_on_multiple_resolution: bool);
298
299 #[unsafe(method(matchesOnlyOnBestFittingAxis))]
300 #[unsafe(method_family = none)]
301 pub fn matchesOnlyOnBestFittingAxis(&self) -> bool;
302
303 #[unsafe(method(setMatchesOnlyOnBestFittingAxis:))]
305 #[unsafe(method_family = none)]
306 pub fn setMatchesOnlyOnBestFittingAxis(&self, matches_only_on_best_fitting_axis: bool);
307
308 #[cfg(all(feature = "NSGraphics", feature = "objc2-core-foundation"))]
309 #[unsafe(method(drawAtPoint:fromRect:operation:fraction:))]
310 #[unsafe(method_family = none)]
311 pub fn drawAtPoint_fromRect_operation_fraction(
312 &self,
313 point: NSPoint,
314 from_rect: NSRect,
315 op: NSCompositingOperation,
316 delta: CGFloat,
317 );
318
319 #[cfg(all(feature = "NSGraphics", feature = "objc2-core-foundation"))]
320 #[unsafe(method(drawInRect:fromRect:operation:fraction:))]
321 #[unsafe(method_family = none)]
322 pub fn drawInRect_fromRect_operation_fraction(
323 &self,
324 rect: NSRect,
325 from_rect: NSRect,
326 op: NSCompositingOperation,
327 delta: CGFloat,
328 );
329
330 #[cfg(all(
331 feature = "NSGraphics",
332 feature = "NSImageRep",
333 feature = "objc2-core-foundation"
334 ))]
335 #[unsafe(method(drawInRect:fromRect:operation:fraction:respectFlipped:hints:))]
339 #[unsafe(method_family = none)]
340 pub unsafe fn drawInRect_fromRect_operation_fraction_respectFlipped_hints(
341 &self,
342 dst_space_portion_rect: NSRect,
343 src_space_portion_rect: NSRect,
344 op: NSCompositingOperation,
345 requested_alpha: CGFloat,
346 respect_context_is_flipped: bool,
347 hints: Option<&NSDictionary<NSImageHintKey, AnyObject>>,
348 );
349
350 #[cfg(feature = "NSImageRep")]
351 #[unsafe(method(drawRepresentation:inRect:))]
352 #[unsafe(method_family = none)]
353 pub fn drawRepresentation_inRect(&self, image_rep: &NSImageRep, rect: NSRect) -> bool;
354
355 #[unsafe(method(drawInRect:))]
356 #[unsafe(method_family = none)]
357 pub fn drawInRect(&self, rect: NSRect);
358
359 #[unsafe(method(recache))]
360 #[unsafe(method_family = none)]
361 pub fn recache(&self);
362
363 #[unsafe(method(TIFFRepresentation))]
364 #[unsafe(method_family = none)]
365 pub fn TIFFRepresentation(&self) -> Option<Retained<NSData>>;
366
367 #[cfg(feature = "NSBitmapImageRep")]
368 #[unsafe(method(TIFFRepresentationUsingCompression:factor:))]
369 #[unsafe(method_family = none)]
370 pub fn TIFFRepresentationUsingCompression_factor(
371 &self,
372 comp: NSTIFFCompression,
373 factor: c_float,
374 ) -> Option<Retained<NSData>>;
375
376 #[cfg(feature = "NSImageRep")]
377 #[unsafe(method(representations))]
378 #[unsafe(method_family = none)]
379 pub fn representations(&self) -> Retained<NSArray<NSImageRep>>;
380
381 #[cfg(feature = "NSImageRep")]
382 #[unsafe(method(addRepresentations:))]
383 #[unsafe(method_family = none)]
384 pub fn addRepresentations(&self, image_reps: &NSArray<NSImageRep>);
385
386 #[cfg(feature = "NSImageRep")]
387 #[unsafe(method(addRepresentation:))]
388 #[unsafe(method_family = none)]
389 pub fn addRepresentation(&self, image_rep: &NSImageRep);
390
391 #[cfg(feature = "NSImageRep")]
392 #[unsafe(method(removeRepresentation:))]
393 #[unsafe(method_family = none)]
394 pub fn removeRepresentation(&self, image_rep: &NSImageRep);
395
396 #[unsafe(method(isValid))]
397 #[unsafe(method_family = none)]
398 pub fn isValid(&self) -> bool;
399
400 #[unsafe(method(delegate))]
401 #[unsafe(method_family = none)]
402 pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSImageDelegate>>>;
403
404 #[unsafe(method(setDelegate:))]
408 #[unsafe(method_family = none)]
409 pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSImageDelegate>>);
410
411 #[unsafe(method(imageTypes))]
412 #[unsafe(method_family = none)]
413 pub fn imageTypes() -> Retained<NSArray<NSString>>;
414
415 #[unsafe(method(imageUnfilteredTypes))]
416 #[unsafe(method_family = none)]
417 pub fn imageUnfilteredTypes() -> Retained<NSArray<NSString>>;
418
419 #[cfg(feature = "NSPasteboard")]
420 #[unsafe(method(canInitWithPasteboard:))]
421 #[unsafe(method_family = none)]
422 pub fn canInitWithPasteboard(pasteboard: &NSPasteboard) -> bool;
423
424 #[unsafe(method(cacheMode))]
425 #[unsafe(method_family = none)]
426 pub fn cacheMode(&self) -> NSImageCacheMode;
427
428 #[unsafe(method(setCacheMode:))]
430 #[unsafe(method_family = none)]
431 pub fn setCacheMode(&self, cache_mode: NSImageCacheMode);
432
433 #[unsafe(method(alignmentRect))]
434 #[unsafe(method_family = none)]
435 pub fn alignmentRect(&self) -> NSRect;
436
437 #[unsafe(method(setAlignmentRect:))]
439 #[unsafe(method_family = none)]
440 pub fn setAlignmentRect(&self, alignment_rect: NSRect);
441
442 #[unsafe(method(isTemplate))]
443 #[unsafe(method_family = none)]
444 pub fn isTemplate(&self) -> bool;
445
446 #[unsafe(method(setTemplate:))]
448 #[unsafe(method_family = none)]
449 pub fn setTemplate(&self, template: bool);
450
451 #[unsafe(method(accessibilityDescription))]
452 #[unsafe(method_family = none)]
453 pub fn accessibilityDescription(&self) -> Option<Retained<NSString>>;
454
455 #[unsafe(method(setAccessibilityDescription:))]
459 #[unsafe(method_family = none)]
460 pub fn setAccessibilityDescription(&self, accessibility_description: Option<&NSString>);
461
462 #[cfg(feature = "objc2-core-graphics")]
463 #[cfg(target_vendor = "apple")]
464 #[unsafe(method(initWithCGImage:size:))]
465 #[unsafe(method_family = init)]
466 pub fn initWithCGImage_size(
467 this: Allocated<Self>,
468 cg_image: &CGImage,
469 size: NSSize,
470 ) -> Retained<Self>;
471
472 #[cfg(all(
473 feature = "NSGraphicsContext",
474 feature = "NSImageRep",
475 feature = "objc2-core-graphics"
476 ))]
477 #[cfg(target_vendor = "apple")]
478 #[unsafe(method(CGImageForProposedRect:context:hints:))]
483 #[unsafe(method_family = none)]
484 pub unsafe fn CGImageForProposedRect_context_hints(
485 &self,
486 proposed_dest_rect: *mut NSRect,
487 reference_context: Option<&NSGraphicsContext>,
488 hints: Option<&NSDictionary<NSImageHintKey, AnyObject>>,
489 ) -> Option<Retained<CGImage>>;
490
491 #[cfg(all(feature = "NSGraphicsContext", feature = "NSImageRep"))]
492 #[unsafe(method(bestRepresentationForRect:context:hints:))]
496 #[unsafe(method_family = none)]
497 pub unsafe fn bestRepresentationForRect_context_hints(
498 &self,
499 rect: NSRect,
500 reference_context: Option<&NSGraphicsContext>,
501 hints: Option<&NSDictionary<NSImageHintKey, AnyObject>>,
502 ) -> Option<Retained<NSImageRep>>;
503
504 #[cfg(all(feature = "NSGraphicsContext", feature = "NSImageRep"))]
505 #[unsafe(method(hitTestRect:withImageDestinationRect:context:hints:flipped:))]
509 #[unsafe(method_family = none)]
510 pub unsafe fn hitTestRect_withImageDestinationRect_context_hints_flipped(
511 &self,
512 test_rect_dest_space: NSRect,
513 image_rect_dest_space: NSRect,
514 context: Option<&NSGraphicsContext>,
515 hints: Option<&NSDictionary<NSImageHintKey, AnyObject>>,
516 flipped: bool,
517 ) -> bool;
518
519 #[cfg(feature = "objc2-core-foundation")]
520 #[unsafe(method(recommendedLayerContentsScale:))]
521 #[unsafe(method_family = none)]
522 pub fn recommendedLayerContentsScale(&self, preferred_contents_scale: CGFloat) -> CGFloat;
523
524 #[cfg(feature = "objc2-core-foundation")]
525 #[unsafe(method(layerContentsForContentsScale:))]
526 #[unsafe(method_family = none)]
527 pub fn layerContentsForContentsScale(
528 &self,
529 layer_contents_scale: CGFloat,
530 ) -> Retained<AnyObject>;
531
532 #[unsafe(method(capInsets))]
533 #[unsafe(method_family = none)]
534 pub fn capInsets(&self) -> NSEdgeInsets;
535
536 #[unsafe(method(setCapInsets:))]
538 #[unsafe(method_family = none)]
539 pub fn setCapInsets(&self, cap_insets: NSEdgeInsets);
540
541 #[unsafe(method(resizingMode))]
542 #[unsafe(method_family = none)]
543 pub fn resizingMode(&self) -> NSImageResizingMode;
544
545 #[unsafe(method(setResizingMode:))]
547 #[unsafe(method_family = none)]
548 pub fn setResizingMode(&self, resizing_mode: NSImageResizingMode);
549
550 #[unsafe(method(imageWithSymbolConfiguration:))]
551 #[unsafe(method_family = none)]
552 pub fn imageWithSymbolConfiguration(
553 &self,
554 configuration: &NSImageSymbolConfiguration,
555 ) -> Option<Retained<NSImage>>;
556
557 #[unsafe(method(symbolConfiguration))]
558 #[unsafe(method_family = none)]
559 pub fn symbolConfiguration(&self) -> Retained<NSImageSymbolConfiguration>;
560
561 #[unsafe(method(imageWithLocale:))]
563 #[unsafe(method_family = none)]
564 pub fn imageWithLocale(&self, locale: Option<&NSLocale>) -> Retained<NSImage>;
565
566 #[unsafe(method(locale))]
568 #[unsafe(method_family = none)]
569 pub fn locale(&self) -> Option<Retained<NSLocale>>;
570 );
571}
572
573impl NSImage {
575 extern_methods!(
576 #[unsafe(method(init))]
577 #[unsafe(method_family = init)]
578 pub fn init(this: Allocated<Self>) -> Retained<Self>;
579
580 #[unsafe(method(new))]
581 #[unsafe(method_family = new)]
582 pub fn new() -> Retained<Self>;
583 );
584}
585
586impl DefaultRetained for NSImage {
587 #[inline]
588 fn default_retained() -> Retained<Self> {
589 Self::new()
590 }
591}
592
593impl NSImage {
594 extern_methods!();
595}
596
597extern_conformance!(
598 unsafe impl NSCopying for NSImage {}
599);
600
601unsafe impl CopyingHelper for NSImage {
602 type Result = Self;
603}
604
605#[cfg(feature = "NSPasteboard")]
606extern_conformance!(
607 unsafe impl NSPasteboardReading for NSImage {}
608);
609
610#[cfg(feature = "NSPasteboard")]
611extern_conformance!(
612 unsafe impl NSPasteboardWriting for NSImage {}
613);
614
615extern_conformance!(
616 unsafe impl NSSecureCoding for NSImage {}
617);
618
619impl NSImage {
620 extern_methods!();
621}
622
623extern_conformance!(
624 unsafe impl NSItemProviderReading for NSImage {}
625);
626
627extern_conformance!(
628 unsafe impl NSItemProviderWriting for NSImage {}
629);
630
631extern_protocol!(
632 pub unsafe trait NSImageDelegate: NSObjectProtocol {
634 #[optional]
635 #[unsafe(method(imageDidNotDraw:inRect:))]
636 #[unsafe(method_family = none)]
637 fn imageDidNotDraw_inRect(
638 &self,
639 sender: &NSImage,
640 rect: NSRect,
641 ) -> Option<Retained<NSImage>>;
642
643 #[cfg(feature = "NSImageRep")]
644 #[deprecated = "This method is no longer called on 10.4 or later."]
645 #[optional]
646 #[unsafe(method(image:willLoadRepresentation:))]
647 #[unsafe(method_family = none)]
648 fn image_willLoadRepresentation(&self, image: &NSImage, rep: &NSImageRep);
649
650 #[cfg(feature = "NSImageRep")]
651 #[deprecated = "This method is no longer called on 10.4 or later."]
652 #[optional]
653 #[unsafe(method(image:didLoadRepresentationHeader:))]
654 #[unsafe(method_family = none)]
655 fn image_didLoadRepresentationHeader(&self, image: &NSImage, rep: &NSImageRep);
656
657 #[cfg(feature = "NSImageRep")]
658 #[deprecated = "This method is no longer called on 10.4 or later."]
659 #[optional]
660 #[unsafe(method(image:didLoadPartOfRepresentation:withValidRows:))]
661 #[unsafe(method_family = none)]
662 fn image_didLoadPartOfRepresentation_withValidRows(
663 &self,
664 image: &NSImage,
665 rep: &NSImageRep,
666 rows: NSInteger,
667 );
668
669 #[cfg(feature = "NSImageRep")]
670 #[deprecated = "This method is no longer called on 10.4 or later."]
671 #[optional]
672 #[unsafe(method(image:didLoadRepresentation:withStatus:))]
673 #[unsafe(method_family = none)]
674 fn image_didLoadRepresentation_withStatus(
675 &self,
676 image: &NSImage,
677 rep: &NSImageRep,
678 status: NSImageLoadStatus,
679 );
680 }
681);
682
683mod private_NSBundleImageExtension {
684 pub trait Sealed {}
685}
686
687pub unsafe trait NSBundleImageExtension:
689 ClassType + Sized + private_NSBundleImageExtension::Sealed
690{
691 extern_methods!(
692 #[unsafe(method(imageForResource:))]
693 #[unsafe(method_family = none)]
694 fn imageForResource(&self, name: &NSImageName) -> Option<Retained<NSImage>>;
695
696 #[unsafe(method(pathForImageResource:))]
697 #[unsafe(method_family = none)]
698 fn pathForImageResource(&self, name: &NSImageName) -> Option<Retained<NSString>>;
699
700 #[unsafe(method(URLForImageResource:))]
701 #[unsafe(method_family = none)]
702 fn URLForImageResource(&self, name: &NSImageName) -> Option<Retained<NSURL>>;
703 );
704}
705
706impl private_NSBundleImageExtension::Sealed for NSBundle {}
707unsafe impl NSBundleImageExtension for NSBundle {}
708
709impl NSImage {
711 extern_methods!(
712 #[deprecated = "Use +imageUnfilteredTypes instead"]
713 #[unsafe(method(imageUnfilteredFileTypes))]
714 #[unsafe(method_family = none)]
715 pub fn imageUnfilteredFileTypes() -> Retained<NSArray<NSString>>;
716
717 #[cfg(feature = "NSPasteboard")]
718 #[deprecated = "Use +imageUnfilteredTypes instead"]
719 #[unsafe(method(imageUnfilteredPasteboardTypes))]
720 #[unsafe(method_family = none)]
721 pub fn imageUnfilteredPasteboardTypes() -> Retained<NSArray<NSPasteboardType>>;
722
723 #[deprecated = "Use +imageTypes instead"]
724 #[unsafe(method(imageFileTypes))]
725 #[unsafe(method_family = none)]
726 pub fn imageFileTypes() -> Retained<NSArray<NSString>>;
727
728 #[cfg(feature = "NSPasteboard")]
729 #[deprecated = "Use +imageTypes instead"]
730 #[unsafe(method(imagePasteboardTypes))]
731 #[unsafe(method_family = none)]
732 pub fn imagePasteboardTypes() -> Retained<NSArray<NSPasteboardType>>;
733
734 #[cfg(feature = "NSImageRep")]
735 #[deprecated = "Use -[NSImage bestRepresentationForRect:context:hints:] instead. Any deviceDescription dictionary is also a valid hints dictionary."]
740 #[unsafe(method(bestRepresentationForDevice:))]
741 #[unsafe(method_family = none)]
742 pub unsafe fn bestRepresentationForDevice(
743 &self,
744 device_description: Option<&NSDictionary>,
745 ) -> Option<Retained<NSImageRep>>;
746
747 #[deprecated = "This method is incompatible with resolution-independent drawing and should not be used. Instead, use +[NSImage imageWithSize:flipped:drawingHandler:] to create a block-based image describing the desired image drawing, or use +[NSGraphicsContext graphicsContextWithBitmapImageRep:] to manipulate specific bitmap image representations."]
748 #[unsafe(method(lockFocus))]
749 #[unsafe(method_family = none)]
750 pub fn lockFocus(&self);
751
752 #[deprecated = "This method is incompatible with resolution-independent drawing and should not be used. Instead, use +[NSImage imageWithSize:flipped:drawingHandler:] to create a block-based image describing the desired image drawing, or use +[NSGraphicsContext graphicsContextWithBitmapImageRep:] to manipulate specific bitmap image representations."]
753 #[unsafe(method(lockFocusFlipped:))]
754 #[unsafe(method_family = none)]
755 pub fn lockFocusFlipped(&self, flipped: bool);
756
757 #[deprecated = "This method is incompatible with resolution-independent drawing and should not be used. Instead, use +[NSImage imageWithSize:flipped:drawingHandler:] to create a block-based image describing the desired image drawing, or use +[NSGraphicsContext graphicsContextWithBitmapImageRep:] to manipulate specific bitmap image representations."]
758 #[unsafe(method(unlockFocus))]
759 #[unsafe(method_family = none)]
760 pub fn unlockFocus(&self);
761
762 #[deprecated = "The concept of flippedness for NSImage is deprecated. Please see the AppKit 10.6 release notes for a discussion of why and for how to replace existing usage."]
763 #[unsafe(method(setFlipped:))]
764 #[unsafe(method_family = none)]
765 pub fn setFlipped(&self, flag: bool);
766
767 #[deprecated = "The concept of flippedness for NSImage is deprecated. Please see the AppKit 10.6 release notes for a discussion of why and for how to replace existing usage."]
768 #[unsafe(method(isFlipped))]
769 #[unsafe(method_family = none)]
770 pub fn isFlipped(&self) -> bool;
771
772 #[deprecated = "You should be able to remove use of this method without any replacement. See 10.6 AppKit release notes for details."]
773 #[unsafe(method(setScalesWhenResized:))]
774 #[unsafe(method_family = none)]
775 pub fn setScalesWhenResized(&self, flag: bool);
776
777 #[deprecated = "You should be able to remove use of this method without any replacement. See 10.6 AppKit release notes for details."]
778 #[unsafe(method(scalesWhenResized))]
779 #[unsafe(method_family = none)]
780 pub fn scalesWhenResized(&self) -> bool;
781
782 #[deprecated = "You should be able to remove use of this method without any replacement. See 10.6 AppKit release notes for details."]
783 #[unsafe(method(setDataRetained:))]
784 #[unsafe(method_family = none)]
785 pub fn setDataRetained(&self, flag: bool);
786
787 #[deprecated = "You should be able to remove use of this method without any replacement. See 10.6 AppKit release notes for details."]
788 #[unsafe(method(isDataRetained))]
789 #[unsafe(method_family = none)]
790 pub fn isDataRetained(&self) -> bool;
791
792 #[deprecated = "You should be able to remove use of this method without any replacement. See 10.6 AppKit release notes for details."]
793 #[unsafe(method(setCachedSeparately:))]
794 #[unsafe(method_family = none)]
795 pub fn setCachedSeparately(&self, flag: bool);
796
797 #[deprecated = "You should be able to remove use of this method without any replacement. See 10.6 AppKit release notes for details."]
798 #[unsafe(method(isCachedSeparately))]
799 #[unsafe(method_family = none)]
800 pub fn isCachedSeparately(&self) -> bool;
801
802 #[deprecated = "You should be able to remove use of this method without any replacement. See 10.6 AppKit release notes for details."]
803 #[unsafe(method(setCacheDepthMatchesImageDepth:))]
804 #[unsafe(method_family = none)]
805 pub fn setCacheDepthMatchesImageDepth(&self, flag: bool);
806
807 #[deprecated = "You should be able to remove use of this method without any replacement. See 10.6 AppKit release notes for details."]
808 #[unsafe(method(cacheDepthMatchesImageDepth))]
809 #[unsafe(method_family = none)]
810 pub fn cacheDepthMatchesImageDepth(&self) -> bool;
811
812 #[cfg(feature = "objc2-core-foundation")]
813 #[deprecated = "Use -drawAtPoint:... or -drawInRect:... methods instead"]
814 #[unsafe(method(dissolveToPoint:fraction:))]
815 #[unsafe(method_family = none)]
816 pub fn dissolveToPoint_fraction(&self, point: NSPoint, fraction: CGFloat);
817
818 #[cfg(feature = "objc2-core-foundation")]
819 #[deprecated = "Use -drawAtPoint:... or -drawInRect:... methods instead"]
820 #[unsafe(method(dissolveToPoint:fromRect:fraction:))]
821 #[unsafe(method_family = none)]
822 pub fn dissolveToPoint_fromRect_fraction(
823 &self,
824 point: NSPoint,
825 rect: NSRect,
826 fraction: CGFloat,
827 );
828
829 #[cfg(feature = "NSGraphics")]
830 #[deprecated = "Use -drawAtPoint:... or -drawInRect:... methods instead"]
831 #[unsafe(method(compositeToPoint:operation:))]
832 #[unsafe(method_family = none)]
833 pub fn compositeToPoint_operation(&self, point: NSPoint, operation: NSCompositingOperation);
834
835 #[cfg(feature = "NSGraphics")]
836 #[deprecated = "Use -drawAtPoint:... or -drawInRect:... methods instead"]
837 #[unsafe(method(compositeToPoint:fromRect:operation:))]
838 #[unsafe(method_family = none)]
839 pub fn compositeToPoint_fromRect_operation(
840 &self,
841 point: NSPoint,
842 rect: NSRect,
843 operation: NSCompositingOperation,
844 );
845
846 #[cfg(all(feature = "NSGraphics", feature = "objc2-core-foundation"))]
847 #[deprecated = "Use -drawAtPoint:... or -drawInRect:... methods instead"]
848 #[unsafe(method(compositeToPoint:operation:fraction:))]
849 #[unsafe(method_family = none)]
850 pub fn compositeToPoint_operation_fraction(
851 &self,
852 point: NSPoint,
853 operation: NSCompositingOperation,
854 fraction: CGFloat,
855 );
856
857 #[cfg(all(feature = "NSGraphics", feature = "objc2-core-foundation"))]
858 #[deprecated = "Use -drawAtPoint:... or -drawInRect:... methods instead"]
859 #[unsafe(method(compositeToPoint:fromRect:operation:fraction:))]
860 #[unsafe(method_family = none)]
861 pub fn compositeToPoint_fromRect_operation_fraction(
862 &self,
863 point: NSPoint,
864 rect: NSRect,
865 operation: NSCompositingOperation,
866 fraction: CGFloat,
867 );
868
869 #[cfg(feature = "NSImageRep")]
870 #[deprecated = "Create an image using +[NSImage imageWithSize:flipped:drawingHandler:], and begin your custom drawing with -[NSImageRep drawInRect:] instead."]
874 #[unsafe(method(lockFocusOnRepresentation:))]
875 #[unsafe(method_family = none)]
876 pub unsafe fn lockFocusOnRepresentation(&self, image_representation: Option<&NSImageRep>);
877
878 #[deprecated = "This method does not perform any operation on 10.4 or later."]
879 #[unsafe(method(cancelIncrementalLoad))]
880 #[unsafe(method_family = none)]
881 pub fn cancelIncrementalLoad(&self);
882 );
883}
884
885extern "C" {
886 pub static NSImageNameAddTemplate: &'static NSImageName;
888}
889
890extern "C" {
891 pub static NSImageNameBluetoothTemplate: &'static NSImageName;
893}
894
895extern "C" {
896 pub static NSImageNameBonjour: &'static NSImageName;
898}
899
900extern "C" {
901 pub static NSImageNameBookmarksTemplate: &'static NSImageName;
903}
904
905extern "C" {
906 pub static NSImageNameCaution: &'static NSImageName;
908}
909
910extern "C" {
911 pub static NSImageNameComputer: &'static NSImageName;
913}
914
915extern "C" {
916 pub static NSImageNameEnterFullScreenTemplate: &'static NSImageName;
918}
919
920extern "C" {
921 pub static NSImageNameExitFullScreenTemplate: &'static NSImageName;
923}
924
925extern "C" {
926 pub static NSImageNameFolder: &'static NSImageName;
928}
929
930extern "C" {
931 pub static NSImageNameFolderBurnable: &'static NSImageName;
933}
934
935extern "C" {
936 pub static NSImageNameFolderSmart: &'static NSImageName;
938}
939
940extern "C" {
941 pub static NSImageNameFollowLinkFreestandingTemplate: &'static NSImageName;
943}
944
945extern "C" {
946 pub static NSImageNameHomeTemplate: &'static NSImageName;
948}
949
950extern "C" {
951 pub static NSImageNameIChatTheaterTemplate: &'static NSImageName;
953}
954
955extern "C" {
956 pub static NSImageNameLockLockedTemplate: &'static NSImageName;
958}
959
960extern "C" {
961 pub static NSImageNameLockUnlockedTemplate: &'static NSImageName;
963}
964
965extern "C" {
966 pub static NSImageNameNetwork: &'static NSImageName;
968}
969
970extern "C" {
971 pub static NSImageNamePathTemplate: &'static NSImageName;
973}
974
975extern "C" {
976 pub static NSImageNameQuickLookTemplate: &'static NSImageName;
978}
979
980extern "C" {
981 pub static NSImageNameRefreshFreestandingTemplate: &'static NSImageName;
983}
984
985extern "C" {
986 pub static NSImageNameRefreshTemplate: &'static NSImageName;
988}
989
990extern "C" {
991 pub static NSImageNameRemoveTemplate: &'static NSImageName;
993}
994
995extern "C" {
996 pub static NSImageNameRevealFreestandingTemplate: &'static NSImageName;
998}
999
1000extern "C" {
1001 pub static NSImageNameShareTemplate: &'static NSImageName;
1003}
1004
1005extern "C" {
1006 pub static NSImageNameSlideshowTemplate: &'static NSImageName;
1008}
1009
1010extern "C" {
1011 pub static NSImageNameStatusAvailable: &'static NSImageName;
1013}
1014
1015extern "C" {
1016 pub static NSImageNameStatusNone: &'static NSImageName;
1018}
1019
1020extern "C" {
1021 pub static NSImageNameStatusPartiallyAvailable: &'static NSImageName;
1023}
1024
1025extern "C" {
1026 pub static NSImageNameStatusUnavailable: &'static NSImageName;
1028}
1029
1030extern "C" {
1031 pub static NSImageNameStopProgressFreestandingTemplate: &'static NSImageName;
1033}
1034
1035extern "C" {
1036 pub static NSImageNameStopProgressTemplate: &'static NSImageName;
1038}
1039
1040extern "C" {
1041 pub static NSImageNameTrashEmpty: &'static NSImageName;
1043}
1044
1045extern "C" {
1046 pub static NSImageNameTrashFull: &'static NSImageName;
1048}
1049
1050extern "C" {
1051 pub static NSImageNameActionTemplate: &'static NSImageName;
1053}
1054
1055extern "C" {
1056 pub static NSImageNameSmartBadgeTemplate: &'static NSImageName;
1058}
1059
1060extern "C" {
1061 pub static NSImageNameIconViewTemplate: &'static NSImageName;
1063}
1064
1065extern "C" {
1066 pub static NSImageNameListViewTemplate: &'static NSImageName;
1068}
1069
1070extern "C" {
1071 pub static NSImageNameColumnViewTemplate: &'static NSImageName;
1073}
1074
1075extern "C" {
1076 pub static NSImageNameFlowViewTemplate: &'static NSImageName;
1078}
1079
1080extern "C" {
1081 pub static NSImageNameInvalidDataFreestandingTemplate: &'static NSImageName;
1083}
1084
1085extern "C" {
1086 pub static NSImageNameGoForwardTemplate: &'static NSImageName;
1088}
1089
1090extern "C" {
1091 pub static NSImageNameGoBackTemplate: &'static NSImageName;
1093}
1094
1095extern "C" {
1096 pub static NSImageNameGoRightTemplate: &'static NSImageName;
1098}
1099
1100extern "C" {
1101 pub static NSImageNameGoLeftTemplate: &'static NSImageName;
1103}
1104
1105extern "C" {
1106 pub static NSImageNameRightFacingTriangleTemplate: &'static NSImageName;
1108}
1109
1110extern "C" {
1111 pub static NSImageNameLeftFacingTriangleTemplate: &'static NSImageName;
1113}
1114
1115extern "C" {
1116 #[deprecated]
1118 pub static NSImageNameDotMac: &'static NSImageName;
1119}
1120
1121extern "C" {
1122 pub static NSImageNameMobileMe: &'static NSImageName;
1124}
1125
1126extern "C" {
1127 pub static NSImageNameMultipleDocuments: &'static NSImageName;
1129}
1130
1131extern "C" {
1132 pub static NSImageNameUserAccounts: &'static NSImageName;
1134}
1135
1136extern "C" {
1137 pub static NSImageNamePreferencesGeneral: &'static NSImageName;
1139}
1140
1141extern "C" {
1142 pub static NSImageNameAdvanced: &'static NSImageName;
1144}
1145
1146extern "C" {
1147 pub static NSImageNameInfo: &'static NSImageName;
1149}
1150
1151extern "C" {
1152 pub static NSImageNameFontPanel: &'static NSImageName;
1154}
1155
1156extern "C" {
1157 pub static NSImageNameColorPanel: &'static NSImageName;
1159}
1160
1161extern "C" {
1162 pub static NSImageNameUser: &'static NSImageName;
1164}
1165
1166extern "C" {
1167 pub static NSImageNameUserGroup: &'static NSImageName;
1169}
1170
1171extern "C" {
1172 pub static NSImageNameEveryone: &'static NSImageName;
1174}
1175
1176extern "C" {
1177 pub static NSImageNameUserGuest: &'static NSImageName;
1179}
1180
1181extern "C" {
1182 pub static NSImageNameMenuOnStateTemplate: &'static NSImageName;
1184}
1185
1186extern "C" {
1187 pub static NSImageNameMenuMixedStateTemplate: &'static NSImageName;
1189}
1190
1191extern "C" {
1192 pub static NSImageNameApplicationIcon: &'static NSImageName;
1194}
1195
1196extern "C" {
1197 pub static NSImageNameTouchBarAddDetailTemplate: &'static NSImageName;
1199}
1200
1201extern "C" {
1202 pub static NSImageNameTouchBarAddTemplate: &'static NSImageName;
1204}
1205
1206extern "C" {
1207 pub static NSImageNameTouchBarAlarmTemplate: &'static NSImageName;
1209}
1210
1211extern "C" {
1212 pub static NSImageNameTouchBarAudioInputMuteTemplate: &'static NSImageName;
1214}
1215
1216extern "C" {
1217 pub static NSImageNameTouchBarAudioInputTemplate: &'static NSImageName;
1219}
1220
1221extern "C" {
1222 pub static NSImageNameTouchBarAudioOutputMuteTemplate: &'static NSImageName;
1224}
1225
1226extern "C" {
1227 pub static NSImageNameTouchBarAudioOutputVolumeHighTemplate: &'static NSImageName;
1229}
1230
1231extern "C" {
1232 pub static NSImageNameTouchBarAudioOutputVolumeLowTemplate: &'static NSImageName;
1234}
1235
1236extern "C" {
1237 pub static NSImageNameTouchBarAudioOutputVolumeMediumTemplate: &'static NSImageName;
1239}
1240
1241extern "C" {
1242 pub static NSImageNameTouchBarAudioOutputVolumeOffTemplate: &'static NSImageName;
1244}
1245
1246extern "C" {
1247 pub static NSImageNameTouchBarBookmarksTemplate: &'static NSImageName;
1249}
1250
1251extern "C" {
1252 pub static NSImageNameTouchBarColorPickerFill: &'static NSImageName;
1254}
1255
1256extern "C" {
1257 pub static NSImageNameTouchBarColorPickerFont: &'static NSImageName;
1259}
1260
1261extern "C" {
1262 pub static NSImageNameTouchBarColorPickerStroke: &'static NSImageName;
1264}
1265
1266extern "C" {
1267 pub static NSImageNameTouchBarCommunicationAudioTemplate: &'static NSImageName;
1269}
1270
1271extern "C" {
1272 pub static NSImageNameTouchBarCommunicationVideoTemplate: &'static NSImageName;
1274}
1275
1276extern "C" {
1277 pub static NSImageNameTouchBarComposeTemplate: &'static NSImageName;
1279}
1280
1281extern "C" {
1282 pub static NSImageNameTouchBarDeleteTemplate: &'static NSImageName;
1284}
1285
1286extern "C" {
1287 pub static NSImageNameTouchBarDownloadTemplate: &'static NSImageName;
1289}
1290
1291extern "C" {
1292 pub static NSImageNameTouchBarEnterFullScreenTemplate: &'static NSImageName;
1294}
1295
1296extern "C" {
1297 pub static NSImageNameTouchBarExitFullScreenTemplate: &'static NSImageName;
1299}
1300
1301extern "C" {
1302 pub static NSImageNameTouchBarFastForwardTemplate: &'static NSImageName;
1304}
1305
1306extern "C" {
1307 pub static NSImageNameTouchBarFolderCopyToTemplate: &'static NSImageName;
1309}
1310
1311extern "C" {
1312 pub static NSImageNameTouchBarFolderMoveToTemplate: &'static NSImageName;
1314}
1315
1316extern "C" {
1317 pub static NSImageNameTouchBarFolderTemplate: &'static NSImageName;
1319}
1320
1321extern "C" {
1322 pub static NSImageNameTouchBarGetInfoTemplate: &'static NSImageName;
1324}
1325
1326extern "C" {
1327 pub static NSImageNameTouchBarGoBackTemplate: &'static NSImageName;
1329}
1330
1331extern "C" {
1332 pub static NSImageNameTouchBarGoDownTemplate: &'static NSImageName;
1334}
1335
1336extern "C" {
1337 pub static NSImageNameTouchBarGoForwardTemplate: &'static NSImageName;
1339}
1340
1341extern "C" {
1342 pub static NSImageNameTouchBarGoUpTemplate: &'static NSImageName;
1344}
1345
1346extern "C" {
1347 pub static NSImageNameTouchBarHistoryTemplate: &'static NSImageName;
1349}
1350
1351extern "C" {
1352 pub static NSImageNameTouchBarIconViewTemplate: &'static NSImageName;
1354}
1355
1356extern "C" {
1357 pub static NSImageNameTouchBarListViewTemplate: &'static NSImageName;
1359}
1360
1361extern "C" {
1362 pub static NSImageNameTouchBarMailTemplate: &'static NSImageName;
1364}
1365
1366extern "C" {
1367 pub static NSImageNameTouchBarNewFolderTemplate: &'static NSImageName;
1369}
1370
1371extern "C" {
1372 pub static NSImageNameTouchBarNewMessageTemplate: &'static NSImageName;
1374}
1375
1376extern "C" {
1377 pub static NSImageNameTouchBarOpenInBrowserTemplate: &'static NSImageName;
1379}
1380
1381extern "C" {
1382 pub static NSImageNameTouchBarPauseTemplate: &'static NSImageName;
1384}
1385
1386extern "C" {
1387 pub static NSImageNameTouchBarPlayPauseTemplate: &'static NSImageName;
1389}
1390
1391extern "C" {
1392 pub static NSImageNameTouchBarPlayTemplate: &'static NSImageName;
1394}
1395
1396extern "C" {
1397 pub static NSImageNameTouchBarQuickLookTemplate: &'static NSImageName;
1399}
1400
1401extern "C" {
1402 pub static NSImageNameTouchBarRecordStartTemplate: &'static NSImageName;
1404}
1405
1406extern "C" {
1407 pub static NSImageNameTouchBarRecordStopTemplate: &'static NSImageName;
1409}
1410
1411extern "C" {
1412 pub static NSImageNameTouchBarRefreshTemplate: &'static NSImageName;
1414}
1415
1416extern "C" {
1417 pub static NSImageNameTouchBarRemoveTemplate: &'static NSImageName;
1419}
1420
1421extern "C" {
1422 pub static NSImageNameTouchBarRewindTemplate: &'static NSImageName;
1424}
1425
1426extern "C" {
1427 pub static NSImageNameTouchBarRotateLeftTemplate: &'static NSImageName;
1429}
1430
1431extern "C" {
1432 pub static NSImageNameTouchBarRotateRightTemplate: &'static NSImageName;
1434}
1435
1436extern "C" {
1437 pub static NSImageNameTouchBarSearchTemplate: &'static NSImageName;
1439}
1440
1441extern "C" {
1442 pub static NSImageNameTouchBarShareTemplate: &'static NSImageName;
1444}
1445
1446extern "C" {
1447 pub static NSImageNameTouchBarSidebarTemplate: &'static NSImageName;
1449}
1450
1451extern "C" {
1452 pub static NSImageNameTouchBarSkipAhead15SecondsTemplate: &'static NSImageName;
1454}
1455
1456extern "C" {
1457 pub static NSImageNameTouchBarSkipAhead30SecondsTemplate: &'static NSImageName;
1459}
1460
1461extern "C" {
1462 pub static NSImageNameTouchBarSkipAheadTemplate: &'static NSImageName;
1464}
1465
1466extern "C" {
1467 pub static NSImageNameTouchBarSkipBack15SecondsTemplate: &'static NSImageName;
1469}
1470
1471extern "C" {
1472 pub static NSImageNameTouchBarSkipBack30SecondsTemplate: &'static NSImageName;
1474}
1475
1476extern "C" {
1477 pub static NSImageNameTouchBarSkipBackTemplate: &'static NSImageName;
1479}
1480
1481extern "C" {
1482 pub static NSImageNameTouchBarSkipToEndTemplate: &'static NSImageName;
1484}
1485
1486extern "C" {
1487 pub static NSImageNameTouchBarSkipToStartTemplate: &'static NSImageName;
1489}
1490
1491extern "C" {
1492 pub static NSImageNameTouchBarSlideshowTemplate: &'static NSImageName;
1494}
1495
1496extern "C" {
1497 pub static NSImageNameTouchBarTagIconTemplate: &'static NSImageName;
1499}
1500
1501extern "C" {
1502 pub static NSImageNameTouchBarTextBoldTemplate: &'static NSImageName;
1504}
1505
1506extern "C" {
1507 pub static NSImageNameTouchBarTextBoxTemplate: &'static NSImageName;
1509}
1510
1511extern "C" {
1512 pub static NSImageNameTouchBarTextCenterAlignTemplate: &'static NSImageName;
1514}
1515
1516extern "C" {
1517 pub static NSImageNameTouchBarTextItalicTemplate: &'static NSImageName;
1519}
1520
1521extern "C" {
1522 pub static NSImageNameTouchBarTextJustifiedAlignTemplate: &'static NSImageName;
1524}
1525
1526extern "C" {
1527 pub static NSImageNameTouchBarTextLeftAlignTemplate: &'static NSImageName;
1529}
1530
1531extern "C" {
1532 pub static NSImageNameTouchBarTextListTemplate: &'static NSImageName;
1534}
1535
1536extern "C" {
1537 pub static NSImageNameTouchBarTextRightAlignTemplate: &'static NSImageName;
1539}
1540
1541extern "C" {
1542 pub static NSImageNameTouchBarTextStrikethroughTemplate: &'static NSImageName;
1544}
1545
1546extern "C" {
1547 pub static NSImageNameTouchBarTextUnderlineTemplate: &'static NSImageName;
1549}
1550
1551extern "C" {
1552 pub static NSImageNameTouchBarUserAddTemplate: &'static NSImageName;
1554}
1555
1556extern "C" {
1557 pub static NSImageNameTouchBarUserGroupTemplate: &'static NSImageName;
1559}
1560
1561extern "C" {
1562 pub static NSImageNameTouchBarUserTemplate: &'static NSImageName;
1564}
1565
1566extern "C" {
1567 pub static NSImageNameTouchBarVolumeDownTemplate: &'static NSImageName;
1569}
1570
1571extern "C" {
1572 pub static NSImageNameTouchBarVolumeUpTemplate: &'static NSImageName;
1574}
1575
1576extern "C" {
1577 pub static NSImageNameTouchBarPlayheadTemplate: &'static NSImageName;
1579}
1580
1581#[repr(transparent)]
1584#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1585pub struct NSImageSymbolScale(pub NSInteger);
1586impl NSImageSymbolScale {
1587 #[doc(alias = "NSImageSymbolScaleSmall")]
1588 pub const Small: Self = Self(1);
1589 #[doc(alias = "NSImageSymbolScaleMedium")]
1590 pub const Medium: Self = Self(2);
1591 #[doc(alias = "NSImageSymbolScaleLarge")]
1592 pub const Large: Self = Self(3);
1593}
1594
1595unsafe impl Encode for NSImageSymbolScale {
1596 const ENCODING: Encoding = NSInteger::ENCODING;
1597}
1598
1599unsafe impl RefEncode for NSImageSymbolScale {
1600 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1601}
1602
1603#[repr(transparent)]
1606#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1607pub struct NSImageSymbolVariableValueMode(pub NSInteger);
1608impl NSImageSymbolVariableValueMode {
1609 #[doc(alias = "NSImageSymbolVariableValueModeAutomatic")]
1611 pub const Automatic: Self = Self(0);
1612 #[doc(alias = "NSImageSymbolVariableValueModeColor")]
1615 pub const Color: Self = Self(1);
1616 #[doc(alias = "NSImageSymbolVariableValueModeDraw")]
1619 pub const Draw: Self = Self(2);
1620}
1621
1622unsafe impl Encode for NSImageSymbolVariableValueMode {
1623 const ENCODING: Encoding = NSInteger::ENCODING;
1624}
1625
1626unsafe impl RefEncode for NSImageSymbolVariableValueMode {
1627 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1628}
1629
1630unsafe impl Send for NSImageSymbolVariableValueMode {}
1631
1632unsafe impl Sync for NSImageSymbolVariableValueMode {}
1633
1634#[repr(transparent)]
1637#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1638pub struct NSImageSymbolColorRenderingMode(pub NSInteger);
1639impl NSImageSymbolColorRenderingMode {
1640 #[doc(alias = "NSImageSymbolColorRenderingModeAutomatic")]
1642 pub const Automatic: Self = Self(0);
1643 #[doc(alias = "NSImageSymbolColorRenderingModeFlat")]
1645 pub const Flat: Self = Self(1);
1646 #[doc(alias = "NSImageSymbolColorRenderingModeGradient")]
1648 pub const Gradient: Self = Self(2);
1649}
1650
1651unsafe impl Encode for NSImageSymbolColorRenderingMode {
1652 const ENCODING: Encoding = NSInteger::ENCODING;
1653}
1654
1655unsafe impl RefEncode for NSImageSymbolColorRenderingMode {
1656 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1657}
1658
1659unsafe impl Send for NSImageSymbolColorRenderingMode {}
1660
1661unsafe impl Sync for NSImageSymbolColorRenderingMode {}
1662
1663extern_class!(
1664 #[unsafe(super(NSObject))]
1666 #[derive(Debug, PartialEq, Eq, Hash)]
1667 pub struct NSImageSymbolConfiguration;
1668);
1669
1670extern_conformance!(
1671 unsafe impl NSCoding for NSImageSymbolConfiguration {}
1672);
1673
1674extern_conformance!(
1675 unsafe impl NSCopying for NSImageSymbolConfiguration {}
1676);
1677
1678unsafe impl CopyingHelper for NSImageSymbolConfiguration {
1679 type Result = Self;
1680}
1681
1682extern_conformance!(
1683 unsafe impl NSObjectProtocol for NSImageSymbolConfiguration {}
1684);
1685
1686extern_conformance!(
1687 unsafe impl NSSecureCoding for NSImageSymbolConfiguration {}
1688);
1689
1690impl NSImageSymbolConfiguration {
1691 extern_methods!(
1692 #[cfg(all(feature = "NSFontDescriptor", feature = "objc2-core-foundation"))]
1693 #[unsafe(method(configurationWithPointSize:weight:scale:))]
1694 #[unsafe(method_family = none)]
1695 pub fn configurationWithPointSize_weight_scale(
1696 point_size: CGFloat,
1697 weight: NSFontWeight,
1698 scale: NSImageSymbolScale,
1699 ) -> Retained<Self>;
1700
1701 #[cfg(all(feature = "NSFontDescriptor", feature = "objc2-core-foundation"))]
1702 #[unsafe(method(configurationWithPointSize:weight:))]
1703 #[unsafe(method_family = none)]
1704 pub fn configurationWithPointSize_weight(
1705 point_size: CGFloat,
1706 weight: NSFontWeight,
1707 ) -> Retained<Self>;
1708
1709 #[cfg(feature = "NSFontDescriptor")]
1710 #[unsafe(method(configurationWithTextStyle:scale:))]
1711 #[unsafe(method_family = none)]
1712 pub fn configurationWithTextStyle_scale(
1713 style: &NSFontTextStyle,
1714 scale: NSImageSymbolScale,
1715 ) -> Retained<Self>;
1716
1717 #[cfg(feature = "NSFontDescriptor")]
1718 #[unsafe(method(configurationWithTextStyle:))]
1719 #[unsafe(method_family = none)]
1720 pub fn configurationWithTextStyle(style: &NSFontTextStyle) -> Retained<Self>;
1721
1722 #[unsafe(method(configurationWithScale:))]
1723 #[unsafe(method_family = none)]
1724 pub fn configurationWithScale(scale: NSImageSymbolScale) -> Retained<Self>;
1725
1726 #[unsafe(method(configurationPreferringMonochrome))]
1728 #[unsafe(method_family = none)]
1729 pub fn configurationPreferringMonochrome() -> Retained<Self>;
1730
1731 #[unsafe(method(configurationPreferringHierarchical))]
1735 #[unsafe(method_family = none)]
1736 pub fn configurationPreferringHierarchical() -> Retained<Self>;
1737
1738 #[cfg(feature = "NSColor")]
1739 #[unsafe(method(configurationWithHierarchicalColor:))]
1747 #[unsafe(method_family = none)]
1748 pub fn configurationWithHierarchicalColor(hierarchical_color: &NSColor) -> Retained<Self>;
1749
1750 #[cfg(feature = "NSColor")]
1751 #[unsafe(method(configurationWithPaletteColors:))]
1757 #[unsafe(method_family = none)]
1758 pub fn configurationWithPaletteColors(palette_colors: &NSArray<NSColor>) -> Retained<Self>;
1759
1760 #[unsafe(method(configurationPreferringMulticolor))]
1766 #[unsafe(method_family = none)]
1767 pub fn configurationPreferringMulticolor() -> Retained<Self>;
1768
1769 #[unsafe(method(configurationWithVariableValueMode:))]
1771 #[unsafe(method_family = none)]
1772 pub fn configurationWithVariableValueMode(
1773 variable_value_mode: NSImageSymbolVariableValueMode,
1774 ) -> Retained<Self>;
1775
1776 #[unsafe(method(configurationWithColorRenderingMode:))]
1778 #[unsafe(method_family = none)]
1779 pub fn configurationWithColorRenderingMode(
1780 mode: NSImageSymbolColorRenderingMode,
1781 ) -> Retained<Self>;
1782
1783 #[unsafe(method(configurationByApplyingConfiguration:))]
1787 #[unsafe(method_family = none)]
1788 pub fn configurationByApplyingConfiguration(
1789 &self,
1790 configuration: &NSImageSymbolConfiguration,
1791 ) -> Retained<Self>;
1792 );
1793}
1794
1795impl NSImageSymbolConfiguration {
1797 extern_methods!(
1798 #[unsafe(method(init))]
1799 #[unsafe(method_family = init)]
1800 pub fn init(this: Allocated<Self>) -> Retained<Self>;
1801
1802 #[unsafe(method(new))]
1803 #[unsafe(method_family = new)]
1804 pub fn new() -> Retained<Self>;
1805 );
1806}
1807
1808impl DefaultRetained for NSImageSymbolConfiguration {
1809 #[inline]
1810 fn default_retained() -> Retained<Self> {
1811 Self::new()
1812 }
1813}