#[repr(C)]pub struct NSView {
pub ptr: Id<Object>,
}
Expand description
The infrastructure for drawing, printing, and handling events in an app.
Fields§
§ptr: Id<Object>
The raw pointer to the Objective-C object.
Implementations§
Source§impl NSView
impl NSView
Sourcepub fn init_with_frame(frame: NSRect) -> Self
pub fn init_with_frame(frame: NSRect) -> Self
Initializes and returns a newly allocated NSView object with a specified frame rectangle.
Sourcepub fn init_with_coder(coder: NSCoder) -> Self
pub fn init_with_coder(coder: NSCoder) -> Self
Initializes a view using from data in the specified coder object.
Sourcepub fn prepare_for_reuse(&self)
pub fn prepare_for_reuse(&self)
Restores the view to an initial state so that it can be reused.
Sourcepub fn subviews<V>(&self) -> NSArray<V>where
V: INSView,
pub fn subviews<V>(&self) -> NSArray<V>where
V: INSView,
The array of views embedded in the current view.
Sourcepub fn opaque_ancestor(&self) -> Self
pub fn opaque_ancestor(&self) -> Self
The view’s closest opaque ancestor, which might be the view itself.
Sourcepub fn is_descendant_of(&self, view: NSView) -> bool
pub fn is_descendant_of(&self, view: NSView) -> bool
Returns a Boolean value that indicates whether the view is a subview of the specified view.
Returns the closest ancestor shared by the view and another specified view.
The menu item containing the view or any of its superviews in the view hierarchy.
Sourcepub fn add_subview<V>(&self, view: V)where
V: INSView,
pub fn add_subview<V>(&self, view: V)where
V: INSView,
Adds a view to the view’s subviews so it’s displayed above its siblings.
Sourcepub fn bounds(&self) -> NSRect
pub fn bounds(&self) -> NSRect
The view’s bounds rectangle, which expresses its location and size in its own coordinate system.
Sourcepub fn set_bounds(&self, bounds: NSRect)
pub fn set_bounds(&self, bounds: NSRect)
Sets the view’s bounds rectangle, which expresses its location and size in its own coordinate system.
§Arguments
bounds
- The new bounds rectangle.
Sourcepub fn requires_constraint_based_layout() -> bool
pub fn requires_constraint_based_layout() -> bool
Returns a Boolean value indicating whether the view depends on the constraint-based layout system.
Sourcepub fn translates_autoresizing_mask_to_constraints(&self) -> bool
pub fn translates_autoresizing_mask_to_constraints(&self) -> bool
A Boolean value indicating whether the view’s autoresizing mask is translated into constraints for the constraint-based layout system.
Sourcepub fn set_translates_autoresizing_mask_to_constraints(&self, flag: bool)
pub fn set_translates_autoresizing_mask_to_constraints(&self, flag: bool)
Sets a Boolean value indicating whether the view’s autoresizing mask is translated into constraints for the constraint-based layout system.
§Arguments
flag
- The new value.
Sourcepub fn bottom_anchor(&self) -> NSLayoutYAxisAnchor
pub fn bottom_anchor(&self) -> NSLayoutYAxisAnchor
A layout anchor representing the bottom edge of the view’s frame.
Sourcepub fn center_x_anchor(&self) -> NSLayoutXAxisAnchor
pub fn center_x_anchor(&self) -> NSLayoutXAxisAnchor
A layout anchor representing the horizontal center of the view’s frame.
Sourcepub fn center_y_anchor(&self) -> NSLayoutYAxisAnchor
pub fn center_y_anchor(&self) -> NSLayoutYAxisAnchor
A layout anchor representing the vertical center of the view’s frame.
Methods from Deref<Target = Object>§
Sourcepub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
pub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
Returns a reference to the ivar of self with the given name.
Panics if self has no ivar with the given name.
Unsafe because the caller must ensure that the ivar is actually
of type T
.
Sourcepub unsafe fn get_mut_ivar<T>(&mut self, name: &str) -> &mut Twhere
T: Encode,
pub unsafe fn get_mut_ivar<T>(&mut self, name: &str) -> &mut Twhere
T: Encode,
Returns a mutable reference to the ivar of self with the given name.
Panics if self has no ivar with the given name.
Unsafe because the caller must ensure that the ivar is actually
of type T
.