#[repr(C)]pub struct NSColor { /* private fields */ }
NSColor
only.Expand description
Implementations§
impl NSColor
NSAccessibilityColorConformance.
Source§impl NSColor
impl NSColor
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>
pub unsafe fn initWithCoder( this: Allocated<Self>, coder: &NSCoder, ) -> Option<Retained<Self>>
pub unsafe fn colorWithColorSpace_components_count( space: &NSColorSpace, components: NonNull<CGFloat>, number_of_components: NSInteger, ) -> Retained<NSColor>
NSColorSpace
and objc2-core-foundation
only.pub unsafe fn colorWithSRGBRed_green_blue_alpha( red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat, ) -> Retained<NSColor>
objc2-core-foundation
only.pub unsafe fn colorWithGenericGamma22White_alpha( white: CGFloat, alpha: CGFloat, ) -> Retained<NSColor>
objc2-core-foundation
only.pub unsafe fn colorWithDisplayP3Red_green_blue_alpha( red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat, ) -> Retained<NSColor>
objc2-core-foundation
only.pub unsafe fn colorWithWhite_alpha( white: CGFloat, alpha: CGFloat, ) -> Retained<NSColor>
objc2-core-foundation
only.pub unsafe fn colorWithRed_green_blue_alpha( red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat, ) -> Retained<NSColor>
objc2-core-foundation
only.pub unsafe fn colorWithHue_saturation_brightness_alpha( hue: CGFloat, saturation: CGFloat, brightness: CGFloat, alpha: CGFloat, ) -> Retained<NSColor>
objc2-core-foundation
only.pub unsafe fn colorWithColorSpace_hue_saturation_brightness_alpha( space: &NSColorSpace, hue: CGFloat, saturation: CGFloat, brightness: CGFloat, alpha: CGFloat, ) -> Retained<NSColor>
NSColorSpace
and objc2-core-foundation
only.pub unsafe fn colorWithCatalogName_colorName( list_name: &NSColorListName, color_name: &NSColorName, ) -> Option<Retained<NSColor>>
NSColorList
only.pub unsafe fn colorNamed_bundle( name: &NSColorName, bundle: Option<&NSBundle>, ) -> Option<Retained<NSColor>>
NSColorList
only.pub unsafe fn colorNamed(name: &NSColorName) -> Option<Retained<NSColor>>
NSColorList
only.pub unsafe fn colorWithName_dynamicProvider( color_name: Option<&NSColorName>, dynamic_provider: &DynBlock<dyn Fn(NonNull<NSAppearance>) -> NonNull<NSColor>>, ) -> Retained<NSColor>
NSAppearance
and NSColorList
and block2
only.pub unsafe fn colorWithDeviceWhite_alpha( white: CGFloat, alpha: CGFloat, ) -> Retained<NSColor>
objc2-core-foundation
only.pub unsafe fn colorWithDeviceRed_green_blue_alpha( red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat, ) -> Retained<NSColor>
objc2-core-foundation
only.pub unsafe fn colorWithDeviceHue_saturation_brightness_alpha( hue: CGFloat, saturation: CGFloat, brightness: CGFloat, alpha: CGFloat, ) -> Retained<NSColor>
objc2-core-foundation
only.pub unsafe fn colorWithDeviceCyan_magenta_yellow_black_alpha( cyan: CGFloat, magenta: CGFloat, yellow: CGFloat, black: CGFloat, alpha: CGFloat, ) -> Retained<NSColor>
objc2-core-foundation
only.pub unsafe fn colorWithCalibratedWhite_alpha( white: CGFloat, alpha: CGFloat, ) -> Retained<NSColor>
objc2-core-foundation
only.pub unsafe fn colorWithCalibratedRed_green_blue_alpha( red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat, ) -> Retained<NSColor>
objc2-core-foundation
only.pub unsafe fn colorWithCalibratedHue_saturation_brightness_alpha( hue: CGFloat, saturation: CGFloat, brightness: CGFloat, alpha: CGFloat, ) -> Retained<NSColor>
objc2-core-foundation
only.pub unsafe fn colorWithPatternImage(image: &NSImage) -> Retained<NSColor>
NSImage
only.pub unsafe fn type(&self) -> NSColorType
pub unsafe fn colorUsingType( &self, type: NSColorType, ) -> Option<Retained<NSColor>>
pub unsafe fn colorUsingColorSpace( &self, space: &NSColorSpace, ) -> Option<Retained<NSColor>>
NSColorSpace
only.pub unsafe fn blackColor() -> Retained<NSColor>
pub unsafe fn darkGrayColor() -> Retained<NSColor>
pub unsafe fn lightGrayColor() -> Retained<NSColor>
pub unsafe fn whiteColor() -> Retained<NSColor>
pub unsafe fn grayColor() -> Retained<NSColor>
pub unsafe fn redColor() -> Retained<NSColor>
pub unsafe fn greenColor() -> Retained<NSColor>
pub unsafe fn blueColor() -> Retained<NSColor>
pub unsafe fn cyanColor() -> Retained<NSColor>
pub unsafe fn yellowColor() -> Retained<NSColor>
pub unsafe fn magentaColor() -> Retained<NSColor>
pub unsafe fn orangeColor() -> Retained<NSColor>
pub unsafe fn purpleColor() -> Retained<NSColor>
pub unsafe fn brownColor() -> Retained<NSColor>
pub unsafe fn clearColor() -> Retained<NSColor>
pub unsafe fn labelColor() -> Retained<NSColor>
pub unsafe fn secondaryLabelColor() -> Retained<NSColor>
pub unsafe fn tertiaryLabelColor() -> Retained<NSColor>
pub unsafe fn quaternaryLabelColor() -> Retained<NSColor>
pub unsafe fn quinaryLabelColor() -> Retained<NSColor>
Sourcepub unsafe fn linkColor() -> Retained<NSColor>
pub unsafe fn linkColor() -> Retained<NSColor>
Used for large scale images or subtle decorative elements; not for general foreground content.
pub unsafe fn placeholderTextColor() -> Retained<NSColor>
pub unsafe fn windowFrameTextColor() -> Retained<NSColor>
pub unsafe fn selectedMenuItemTextColor() -> Retained<NSColor>
pub unsafe fn alternateSelectedControlTextColor() -> Retained<NSColor>
pub unsafe fn headerTextColor() -> Retained<NSColor>
pub unsafe fn separatorColor() -> Retained<NSColor>
pub unsafe fn gridColor() -> Retained<NSColor>
pub unsafe fn windowBackgroundColor() -> Retained<NSColor>
pub unsafe fn underPageBackgroundColor() -> Retained<NSColor>
pub unsafe fn controlBackgroundColor() -> Retained<NSColor>
pub unsafe fn selectedContentBackgroundColor() -> Retained<NSColor>
pub unsafe fn unemphasizedSelectedContentBackgroundColor() -> Retained<NSColor>
pub unsafe fn alternatingContentBackgroundColors() -> Retained<NSArray<NSColor>>
pub unsafe fn findHighlightColor() -> Retained<NSColor>
pub unsafe fn textColor() -> Retained<NSColor>
pub unsafe fn textBackgroundColor() -> Retained<NSColor>
pub unsafe fn textInsertionPointColor() -> Retained<NSColor>
pub unsafe fn selectedTextColor() -> Retained<NSColor>
pub unsafe fn selectedTextBackgroundColor() -> Retained<NSColor>
pub unsafe fn unemphasizedSelectedTextBackgroundColor() -> Retained<NSColor>
pub unsafe fn unemphasizedSelectedTextColor() -> Retained<NSColor>
pub unsafe fn controlColor() -> Retained<NSColor>
pub unsafe fn controlTextColor() -> Retained<NSColor>
pub unsafe fn selectedControlColor() -> Retained<NSColor>
pub unsafe fn selectedControlTextColor() -> Retained<NSColor>
pub unsafe fn disabledControlTextColor() -> Retained<NSColor>
pub unsafe fn keyboardFocusIndicatorColor() -> Retained<NSColor>
pub unsafe fn scrubberTexturedBackgroundColor() -> Retained<NSColor>
pub unsafe fn systemRedColor() -> Retained<NSColor>
pub unsafe fn systemGreenColor() -> Retained<NSColor>
pub unsafe fn systemBlueColor() -> Retained<NSColor>
pub unsafe fn systemOrangeColor() -> Retained<NSColor>
pub unsafe fn systemYellowColor() -> Retained<NSColor>
pub unsafe fn systemBrownColor() -> Retained<NSColor>
pub unsafe fn systemPinkColor() -> Retained<NSColor>
pub unsafe fn systemPurpleColor() -> Retained<NSColor>
pub unsafe fn systemGrayColor() -> Retained<NSColor>
pub unsafe fn systemTealColor() -> Retained<NSColor>
pub unsafe fn systemIndigoColor() -> Retained<NSColor>
pub unsafe fn systemMintColor() -> Retained<NSColor>
pub unsafe fn systemCyanColor() -> Retained<NSColor>
Sourcepub unsafe fn systemFillColor() -> Retained<NSColor>
pub unsafe fn systemFillColor() -> Retained<NSColor>
Fill colors for UI elements. These are meant to be used over the background colors, since their alpha component is less than 1.
systemFillColor is appropriate for filling thin shapes, such as the track of a slider.
Sourcepub unsafe fn secondarySystemFillColor() -> Retained<NSColor>
pub unsafe fn secondarySystemFillColor() -> Retained<NSColor>
secondarySystemFillColor is appropriate for filling small-size shapes, such as the backing of a progress indicator.
Sourcepub unsafe fn tertiarySystemFillColor() -> Retained<NSColor>
pub unsafe fn tertiarySystemFillColor() -> Retained<NSColor>
tertiarySystemFillColor is appropriate for filling medium-size shapes, such as the backing of a switch.
Sourcepub unsafe fn quaternarySystemFillColor() -> Retained<NSColor>
pub unsafe fn quaternarySystemFillColor() -> Retained<NSColor>
quaternarySystemFillColor is appropriate for filling large areas, such as a group box or tab pane.
Sourcepub unsafe fn quinarySystemFillColor() -> Retained<NSColor>
pub unsafe fn quinarySystemFillColor() -> Retained<NSColor>
quinarySystemFillColor is appropriate for filling large areas that require subtle emphasis, such as content of a form..
Sourcepub unsafe fn controlAccentColor() -> Retained<NSColor>
pub unsafe fn controlAccentColor() -> Retained<NSColor>
A dynamic color that reflects the user’s current preferred accent color. This color automatically updates when the accent color preference changes. Do not make assumptions about the color space of this color, which may change across releases.
pub unsafe fn currentControlTint() -> NSControlTint
NSCell
only.pub unsafe fn colorForControlTint( control_tint: NSControlTint, ) -> Retained<NSColor>
NSCell
only.pub unsafe fn highlightColor() -> Retained<NSColor>
pub unsafe fn shadowColor() -> Retained<NSColor>
pub unsafe fn highlightWithLevel( &self, val: CGFloat, ) -> Option<Retained<NSColor>>
objc2-core-foundation
only.pub unsafe fn shadowWithLevel(&self, val: CGFloat) -> Option<Retained<NSColor>>
objc2-core-foundation
only.Sourcepub unsafe fn colorWithSystemEffect(
&self,
system_effect: NSColorSystemEffect,
) -> Retained<NSColor>
pub unsafe fn colorWithSystemEffect( &self, system_effect: NSColorSystemEffect, ) -> Retained<NSColor>
Returns a color representing the base color with a system defined effect applied to it. This color is safe to create before draw time, as the resolution of the final color only happens when being -set
, retrieving its CGColor
, resolving with -colorWithType:
, etc. The return color type is .named
.
pub unsafe fn set(&self)
pub unsafe fn setFill(&self)
pub unsafe fn setStroke(&self)
pub unsafe fn blendedColorWithFraction_ofColor( &self, fraction: CGFloat, color: &NSColor, ) -> Option<Retained<NSColor>>
objc2-core-foundation
only.pub unsafe fn colorWithAlphaComponent( &self, alpha: CGFloat, ) -> Retained<NSColor>
objc2-core-foundation
only.Sourcepub unsafe fn catalogNameComponent(&self) -> Retained<NSColorListName>
Available on crate feature NSColorList
only.
pub unsafe fn catalogNameComponent(&self) -> Retained<NSColorListName>
NSColorList
only.- Methods to get various components of colors. Not all of the methods apply to all colors; if called, they raise. **
pub unsafe fn colorNameComponent(&self) -> Retained<NSColorName>
NSColorList
only.pub unsafe fn localizedCatalogNameComponent(&self) -> Retained<NSString>
pub unsafe fn localizedColorNameComponent(&self) -> Retained<NSString>
pub unsafe fn redComponent(&self) -> CGFloat
objc2-core-foundation
only.pub unsafe fn greenComponent(&self) -> CGFloat
objc2-core-foundation
only.pub unsafe fn blueComponent(&self) -> CGFloat
objc2-core-foundation
only.pub unsafe fn getRed_green_blue_alpha( &self, red: *mut CGFloat, green: *mut CGFloat, blue: *mut CGFloat, alpha: *mut CGFloat, )
objc2-core-foundation
only.pub unsafe fn hueComponent(&self) -> CGFloat
objc2-core-foundation
only.pub unsafe fn saturationComponent(&self) -> CGFloat
objc2-core-foundation
only.pub unsafe fn brightnessComponent(&self) -> CGFloat
objc2-core-foundation
only.pub unsafe fn getHue_saturation_brightness_alpha( &self, hue: *mut CGFloat, saturation: *mut CGFloat, brightness: *mut CGFloat, alpha: *mut CGFloat, )
objc2-core-foundation
only.pub unsafe fn whiteComponent(&self) -> CGFloat
objc2-core-foundation
only.pub unsafe fn getWhite_alpha(&self, white: *mut CGFloat, alpha: *mut CGFloat)
objc2-core-foundation
only.pub unsafe fn cyanComponent(&self) -> CGFloat
objc2-core-foundation
only.pub unsafe fn magentaComponent(&self) -> CGFloat
objc2-core-foundation
only.pub unsafe fn yellowComponent(&self) -> CGFloat
objc2-core-foundation
only.pub unsafe fn blackComponent(&self) -> CGFloat
objc2-core-foundation
only.pub unsafe fn getCyan_magenta_yellow_black_alpha( &self, cyan: *mut CGFloat, magenta: *mut CGFloat, yellow: *mut CGFloat, black: *mut CGFloat, alpha: *mut CGFloat, )
objc2-core-foundation
only.pub unsafe fn colorSpace(&self) -> Retained<NSColorSpace>
NSColorSpace
only.pub unsafe fn numberOfComponents(&self) -> NSInteger
pub unsafe fn getComponents(&self, components: NonNull<CGFloat>)
objc2-core-foundation
only.pub unsafe fn patternImage(&self) -> Retained<NSImage>
NSImage
only.pub unsafe fn alphaComponent(&self) -> CGFloat
objc2-core-foundation
only.pub unsafe fn colorFromPasteboard( paste_board: &NSPasteboard, ) -> Option<Retained<NSColor>>
NSPasteboard
only.pub unsafe fn writeToPasteboard(&self, paste_board: &NSPasteboard)
NSPasteboard
only.pub unsafe fn drawSwatchInRect(&self, rect: NSRect)
pub unsafe fn colorWithCGColor(cg_color: &CGColor) -> Option<Retained<NSColor>>
objc2-core-graphics
and Apple only.pub unsafe fn CGColor(&self) -> Retained<CGColor>
objc2-core-graphics
and Apple only.pub unsafe fn ignoresAlpha(mtm: MainThreadMarker) -> bool
showsAlpha
in NSColorPanel
and supportsAlpha
in NSColorWell
to control alpha behavior for individual controls.Sourcepub unsafe fn setIgnoresAlpha(ignores_alpha: bool, mtm: MainThreadMarker)
👎Deprecated: Use showsAlpha
in NSColorPanel
and supportsAlpha
in NSColorWell
to control alpha behavior for individual controls.
pub unsafe fn setIgnoresAlpha(ignores_alpha: bool, mtm: MainThreadMarker)
showsAlpha
in NSColorPanel
and supportsAlpha
in NSColorWell
to control alpha behavior for individual controls.Setter for ignoresAlpha
.
Source§impl NSColor
NSDeprecated.
impl NSColor
NSDeprecated.
Sourcepub unsafe fn controlHighlightColor() -> Retained<NSColor>
👎Deprecated: Use a color that matches the semantics being used, such as separatorColor
pub unsafe fn controlHighlightColor() -> Retained<NSColor>
separatorColor
Historically used as the inner border highlight color for beveled buttons. No longer used.
Sourcepub unsafe fn controlLightHighlightColor() -> Retained<NSColor>
👎Deprecated: Use a color that matches the semantics being used, such as separatorColor
pub unsafe fn controlLightHighlightColor() -> Retained<NSColor>
separatorColor
Historically used as the outer border highlight color for beveled buttons. No longer used.
Sourcepub unsafe fn controlShadowColor() -> Retained<NSColor>
👎Deprecated: Use a color that matches the semantics being used, such as separatorColor
pub unsafe fn controlShadowColor() -> Retained<NSColor>
separatorColor
Historically used as the inner border shadow color for beveled buttons. No longer used.
Sourcepub unsafe fn controlDarkShadowColor() -> Retained<NSColor>
👎Deprecated: Use a color that matches the semantics being used, such as separatorColor
pub unsafe fn controlDarkShadowColor() -> Retained<NSColor>
separatorColor
Historically used as the outer border shadow color for beveled buttons. No longer used.
Sourcepub unsafe fn scrollBarColor() -> Retained<NSColor>
👎Deprecated: Use NSScroller instead
pub unsafe fn scrollBarColor() -> Retained<NSColor>
Historically used as the color of scroll bars. No longer used.
Sourcepub unsafe fn knobColor() -> Retained<NSColor>
👎Deprecated: Use NSScroller instead
pub unsafe fn knobColor() -> Retained<NSColor>
Historically used as the color of scroll bar knobs. No longer used.
Sourcepub unsafe fn selectedKnobColor() -> Retained<NSColor>
👎Deprecated: Use NSScroller instead
pub unsafe fn selectedKnobColor() -> Retained<NSColor>
Historically used as the color of scroll bar knobs being dragged. No longer used.
Sourcepub unsafe fn windowFrameColor() -> Retained<NSColor>
👎Deprecated: Use NSVisualEffectMaterialTitlebar
pub unsafe fn windowFrameColor() -> Retained<NSColor>
Historically used as the color of the window chrome, which is no longer able to be represented by a color. No longer used.
Sourcepub unsafe fn selectedMenuItemColor() -> Retained<NSColor>
👎Deprecated: Use NSVisualEffectMaterialSelection
pub unsafe fn selectedMenuItemColor() -> Retained<NSColor>
Historically used as the color of selected menu items, which is no longer a color but a tinted blur effect. No longer used.
Sourcepub unsafe fn headerColor() -> Retained<NSColor>
👎Deprecated: Use NSVisualEffectMaterialHeaderView
pub unsafe fn headerColor() -> Retained<NSColor>
Historically used as the color of table headers, which is no longer a color but a tinted blur effect.
Sourcepub unsafe fn secondarySelectedControlColor() -> Retained<NSColor>
👎Deprecated
pub unsafe fn secondarySelectedControlColor() -> Retained<NSColor>
The background color of selected content or text that is unemphasized. Older alias for +unemphasizedSelectedContentBackgroundColor and +unemphasizedSelectedTextBackgroundColor
Sourcepub unsafe fn alternateSelectedControlColor() -> Retained<NSColor>
👎Deprecated
pub unsafe fn alternateSelectedControlColor() -> Retained<NSColor>
The background color of selected and emphasized (focused) content: table views rows, collection views, etc. Older alias for +selectedContentBackgroundColor
Sourcepub unsafe fn controlAlternatingRowBackgroundColors() -> Retained<NSArray<NSColor>>
👎Deprecated
pub unsafe fn controlAlternatingRowBackgroundColors() -> Retained<NSArray<NSColor>>
The background colors for alternating content items: such as table view rows, collection view items. Older alias for +alternatingContentBackgroundColors
pub unsafe fn colorSpaceName(&self) -> Retained<NSColorSpaceName>
NSGraphics
only.pub unsafe fn colorUsingColorSpaceName_device( &self, name: Option<&NSColorSpaceName>, device_description: Option<&NSDictionary<NSDeviceDescriptionKey, AnyObject>>, ) -> Option<Retained<NSColor>>
NSGraphics
only.pub unsafe fn colorUsingColorSpaceName( &self, name: &NSColorSpaceName, ) -> Option<Retained<NSColor>>
NSGraphics
only.Methods from Deref<Target = NSObject>§
Sourcepub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
pub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
Handle messages the object doesn’t recognize.
See Apple’s documentation for details.
Methods from Deref<Target = AnyObject>§
Sourcepub fn class(&self) -> &'static AnyClass
Available on crate feature NSAccessibilityConstants
only.
pub fn class(&self) -> &'static AnyClass
NSAccessibilityConstants
only.Dynamically find the class of this object.
§Panics
May panic if the object is invalid (which may be the case for objects
returned from unavailable init
/new
methods).
§Example
Check that an instance of NSObject
has the precise class NSObject
.
use objc2::ClassType;
use objc2::runtime::NSObject;
let obj = NSObject::new();
assert_eq!(obj.class(), NSObject::class());
Sourcepub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
👎Deprecated: this is difficult to use correctly, use Ivar::load
instead.Available on crate feature NSAccessibilityConstants
only.
pub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
Ivar::load
instead.NSAccessibilityConstants
only.Use Ivar::load
instead.
§Safety
The object must have an instance variable with the given name, and it
must be of type T
.
See Ivar::load_ptr
for details surrounding this.
Sourcepub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
Available on crate feature NSAccessibilityConstants
only.
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
NSAccessibilityConstants
only.Attempt to downcast the object to a class of type T
.
This is the reference-variant. Use Retained::downcast
if you want
to convert a retained object to another type.
§Mutable classes
Some classes have immutable and mutable variants, such as NSString
and NSMutableString
.
When some Objective-C API signature says it gives you an immutable class, it generally expects you to not mutate that, even though it may technically be mutable “under the hood”.
So using this method to convert a NSString
to a NSMutableString
,
while not unsound, is generally frowned upon unless you created the
string yourself, or the API explicitly documents the string to be
mutable.
See Apple’s documentation on mutability and on
isKindOfClass:
for more details.
§Generic classes
Objective-C generics are called “lightweight generics”, and that’s because they aren’t exposed in the runtime. This makes it impossible to safely downcast to generic collections, so this is disallowed by this method.
You can, however, safely downcast to generic collections where all the
type-parameters are AnyObject
.
§Panics
This works internally by calling isKindOfClass:
. That means that the
object must have the instance method of that name, and an exception
will be thrown (if CoreFoundation is linked) or the process will abort
if that is not the case. In the vast majority of cases, you don’t need
to worry about this, since both root objects NSObject
and
NSProxy
implement this method.
§Examples
Cast an NSString
back and forth from NSObject
.
use objc2::rc::Retained;
use objc2_foundation::{NSObject, NSString};
let obj: Retained<NSObject> = NSString::new().into_super();
let string = obj.downcast_ref::<NSString>().unwrap();
// Or with `downcast`, if we do not need the object afterwards
let string = obj.downcast::<NSString>().unwrap();
Try (and fail) to cast an NSObject
to an NSString
.
use objc2_foundation::{NSObject, NSString};
let obj = NSObject::new();
assert!(obj.downcast_ref::<NSString>().is_none());
Try to cast to an array of strings.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
// This is invalid and doesn't type check.
let arr = arr.downcast_ref::<NSArray<NSString>>();
This fails to compile, since it would require enumerating over the array to ensure that each element is of the desired type, which is a performance pitfall.
Downcast when processing each element instead.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
for elem in arr {
if let Some(data) = elem.downcast_ref::<NSString>() {
// handle `data`
}
}
Trait Implementations§
Source§impl ClassType for NSColor
impl ClassType for NSColor
Source§const NAME: &'static str = "NSColor"
const NAME: &'static str = "NSColor"
Source§type ThreadKind = <<NSColor as ClassType>::Super as ClassType>::ThreadKind
type ThreadKind = <<NSColor as ClassType>::Super as ClassType>::ThreadKind
Source§impl CopyingHelper for NSColor
impl CopyingHelper for NSColor
Source§impl NSAccessibilityColor for NSColor
Available on crate feature NSAccessibilityColor
only.
impl NSAccessibilityColor for NSColor
NSAccessibilityColor
only.Source§impl NSCopying for NSColor
impl NSCopying for NSColor
Source§impl NSObjectProtocol for NSColor
impl NSObjectProtocol for NSColor
Source§fn isEqual(&self, other: Option<&AnyObject>) -> bool
fn isEqual(&self, other: Option<&AnyObject>) -> bool
Source§fn hash(&self) -> usize
fn hash(&self) -> usize
Source§fn isKindOfClass(&self, cls: &AnyClass) -> bool
fn isKindOfClass(&self, cls: &AnyClass) -> bool
Source§fn is_kind_of<T>(&self) -> bool
fn is_kind_of<T>(&self) -> bool
isKindOfClass
directly, or cast your objects with AnyObject::downcast_ref
Source§fn isMemberOfClass(&self, cls: &AnyClass) -> bool
fn isMemberOfClass(&self, cls: &AnyClass) -> bool
Source§fn respondsToSelector(&self, aSelector: Sel) -> bool
fn respondsToSelector(&self, aSelector: Sel) -> bool
Source§fn conformsToProtocol(&self, aProtocol: &AnyProtocol) -> bool
fn conformsToProtocol(&self, aProtocol: &AnyProtocol) -> bool
Source§fn debugDescription(&self) -> Retained<NSObject>
fn debugDescription(&self) -> Retained<NSObject>
Source§impl NSPasteboardReading for NSColor
impl NSPasteboardReading for NSColor
Source§unsafe fn readableTypesForPasteboard(
pasteboard: &NSPasteboard,
) -> Retained<NSArray<NSPasteboardType>>
unsafe fn readableTypesForPasteboard( pasteboard: &NSPasteboard, ) -> Retained<NSArray<NSPasteboardType>>
NSPasteboard
only.Source§unsafe fn readingOptionsForType_pasteboard(
type: &NSPasteboardType,
pasteboard: &NSPasteboard,
) -> NSPasteboardReadingOptions
unsafe fn readingOptionsForType_pasteboard( type: &NSPasteboardType, pasteboard: &NSPasteboard, ) -> NSPasteboardReadingOptions
NSPasteboard
only.Source§unsafe fn initWithPasteboardPropertyList_ofType(
this: Allocated<Self>,
property_list: &AnyObject,
type: &NSPasteboardType,
) -> Option<Retained<Self>>
unsafe fn initWithPasteboardPropertyList_ofType( this: Allocated<Self>, property_list: &AnyObject, type: &NSPasteboardType, ) -> Option<Retained<Self>>
NSPasteboard
only.Source§impl NSPasteboardWriting for NSColor
impl NSPasteboardWriting for NSColor
Source§unsafe fn writableTypesForPasteboard(
&self,
pasteboard: &NSPasteboard,
) -> Retained<NSArray<NSPasteboardType>>
unsafe fn writableTypesForPasteboard( &self, pasteboard: &NSPasteboard, ) -> Retained<NSArray<NSPasteboardType>>
NSPasteboard
only.Source§unsafe fn writingOptionsForType_pasteboard(
&self,
type: &NSPasteboardType,
pasteboard: &NSPasteboard,
) -> NSPasteboardWritingOptions
unsafe fn writingOptionsForType_pasteboard( &self, type: &NSPasteboardType, pasteboard: &NSPasteboard, ) -> NSPasteboardWritingOptions
NSPasteboard
only.Source§unsafe fn pasteboardPropertyListForType(
&self,
type: &NSPasteboardType,
) -> Option<Retained<AnyObject>>
unsafe fn pasteboardPropertyListForType( &self, type: &NSPasteboardType, ) -> Option<Retained<AnyObject>>
NSPasteboard
only.