#[repr(C)]pub struct IKImageBrowserCell { /* private fields */ }IKImageBrowserCell and ImageKit only.Expand description
Implementations§
Source§impl IKImageBrowserCell
impl IKImageBrowserCell
Sourcepub unsafe fn imageBrowserView(
&self,
mtm: MainThreadMarker,
) -> Option<Retained<IKImageBrowserView>>
Available on crate feature IKImageBrowserView only.
pub unsafe fn imageBrowserView( &self, mtm: MainThreadMarker, ) -> Option<Retained<IKImageBrowserView>>
IKImageBrowserView only.Returns the view the receiver uses to display its represented object.
Subclasses should not override this method.
Sourcepub unsafe fn representedItem(&self) -> Option<Retained<AnyObject>>
pub unsafe fn representedItem(&self) -> Option<Retained<AnyObject>>
Returns the receiver�s represented object.
Subclasses should not override this method.
Sourcepub unsafe fn indexOfRepresentedItem(&self) -> NSUInteger
pub unsafe fn indexOfRepresentedItem(&self) -> NSUInteger
Returns the index of the receiver�s represented object in the datasource.
Subclasses should not override this method.
Sourcepub unsafe fn frame(&self) -> NSRect
pub unsafe fn frame(&self) -> NSRect
Returns the receiver�s frame rectangle, which defines its position in its IKImageBrowserView.
The coordinates of this frame are in view’s coordinate space. Subclasses should not override this method.
Sourcepub unsafe fn imageContainerFrame(&self) -> NSRect
pub unsafe fn imageContainerFrame(&self) -> NSRect
Returns the receiver�s image container frame rectangle, which defines the position of the container of the thumbnail in its IKImageBrowserView.
The coordinates of this frame are in view’s coordinate space. Subclasses can override this method to customize the position of the thumbnail container. The image frame is computed automatically from the image container frame by taking in account the image alignment and the image aspect ratio.
Sourcepub unsafe fn imageFrame(&self) -> NSRect
pub unsafe fn imageFrame(&self) -> NSRect
Returns the receiver�s image frame rectangle, which defines the position of the thumbnail in its IKImageBrowserView.
The coordinates of this frame are in view’s coordinate space. Subclasses can override this method to customize the position of the thumbnail.
Sourcepub unsafe fn selectionFrame(&self) -> NSRect
pub unsafe fn selectionFrame(&self) -> NSRect
Returns the receiver�s selection frame rectangle, which defines the position of the selection rectangle in its IKImageBrowserView.
The coordinates of this frame are in view’s coordinate space. Subclasses can override this method to customize the position of the selection frame.
Sourcepub unsafe fn titleFrame(&self) -> NSRect
pub unsafe fn titleFrame(&self) -> NSRect
Returns the receiver�s title frame rectangle, which defines the position of the title in its IKImageBrowserView.
The coordinates of this frame are in view’s coordinate space. Subclasses can override this method to customize the position of the title.
Sourcepub unsafe fn subtitleFrame(&self) -> NSRect
pub unsafe fn subtitleFrame(&self) -> NSRect
Returns the receiver�s subtitle frame rectangle, which defines the position of the subtitle in its IKImageBrowserView.
The coordinates of this frame are in view’s coordinate space. Subclasses can override this method to customize the position of the subtitle.
Sourcepub unsafe fn imageAlignment(&self) -> NSImageAlignment
pub unsafe fn imageAlignment(&self) -> NSImageAlignment
Returns the position of the cell�s image in the frame. The default is NSImageAlignCenter.
Subclasses can override this method to customize the image alignment. For the list of possible alignments, see [NSImageView setImageAlignment:]. The image frame will be computed automatically from the image container frame by taking in account the image alignment and the image aspect ratio.
Sourcepub unsafe fn isSelected(&self) -> bool
pub unsafe fn isSelected(&self) -> bool
Returns the selection state of the receiver.
Returns YES if the receiver is selected, otherwise NO. Subclasses should not override this method.
Sourcepub unsafe fn cellState(&self) -> IKImageBrowserCellState
pub unsafe fn cellState(&self) -> IKImageBrowserCellState
Returns the current cell state of the receiver.
Returns IKImageStateReady if the receiver�s represented object has been set and the cell is ready to display. The IKImageBrowserView creates thumbnails asynchronously; This method returns IKImageStateNoImage until a thumbnail has been created from the represented object.
Sourcepub unsafe fn opacity(&self) -> CGFloat
Available on crate feature objc2-core-foundation only.
pub unsafe fn opacity(&self) -> CGFloat
objc2-core-foundation only.Determines the opacity of the receiver.
Possible values are between 0.0 (transparent) and 1.0 (opaque). Subclasses can override this method to customize the opacity of the cell.
Sourcepub unsafe fn layerForType(
&self,
type: Option<&NSString>,
) -> Option<Retained<CALayer>>
Available on crate feature objc2-quartz-core only.
pub unsafe fn layerForType( &self, type: Option<&NSString>, ) -> Option<Retained<CALayer>>
objc2-quartz-core only.Provides the receiver�s layer for the given type. The default is nil.
Subclasses can override this method to add a layer in the background, foreground… of the cell (see possible types above).
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
pub fn class(&self) -> &'static AnyClass
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.
pub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
Ivar::load instead.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,
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
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 AsRef<AnyObject> for IKImageBrowserCell
impl AsRef<AnyObject> for IKImageBrowserCell
Source§impl AsRef<IKImageBrowserCell> for IKImageBrowserCell
impl AsRef<IKImageBrowserCell> for IKImageBrowserCell
Source§impl AsRef<NSObject> for IKImageBrowserCell
impl AsRef<NSObject> for IKImageBrowserCell
Source§impl Borrow<AnyObject> for IKImageBrowserCell
impl Borrow<AnyObject> for IKImageBrowserCell
Source§impl Borrow<NSObject> for IKImageBrowserCell
impl Borrow<NSObject> for IKImageBrowserCell
Source§impl ClassType for IKImageBrowserCell
impl ClassType for IKImageBrowserCell
Source§const NAME: &'static str = "IKImageBrowserCell"
const NAME: &'static str = "IKImageBrowserCell"
Source§type ThreadKind = <<IKImageBrowserCell as ClassType>::Super as ClassType>::ThreadKind
type ThreadKind = <<IKImageBrowserCell as ClassType>::Super as ClassType>::ThreadKind
Source§impl Debug for IKImageBrowserCell
impl Debug for IKImageBrowserCell
Source§impl Deref for IKImageBrowserCell
impl Deref for IKImageBrowserCell
Source§impl Hash for IKImageBrowserCell
impl Hash for IKImageBrowserCell
Source§impl Message for IKImageBrowserCell
impl Message for IKImageBrowserCell
Source§impl NSObjectProtocol for IKImageBrowserCell
impl NSObjectProtocol for IKImageBrowserCell
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