4ecfbd0928
- Added basic animation support, via NSAnimationContext proxy objects. These can be used to animate layout constraints and alpha values, currently. - Fixed a bug in ListView where the underlying NSTableView would not redraw the full correct virtual height in some conditions. - Added safe layout guide support to some views. - Added a new trait to buffer ObjC object access for view and control types. This is the supertrait of the Layout and Control traits. - Added a Control trait, which implements various NSControl pieces. - Added a Select control, which is a Select-ish HTML dropdown lookalike. - Added NSURL support, which is one of the few types to expose here. - Filesystem and pasteboard types now work with NSURLs. Users who need pathbufs can use the provided conversion method on NSURL. - Fixed a bug where some Window and ViewController types could wind up in a double-init scenario.
27 lines
684 B
Rust
27 lines
684 B
Rust
use core_graphics::base::CGFloat;
|
|
|
|
use objc::{msg_send, sel, sel_impl};
|
|
use objc::runtime::{Class, Object};
|
|
use objc_id::ShareId;
|
|
|
|
use crate::foundation::id;
|
|
|
|
/// A wrapper for an animation proxy object in Cocoa that supports basic animations.
|
|
#[derive(Clone, Debug)]
|
|
pub struct ViewAnimatorProxy(pub ShareId<Object>);
|
|
|
|
impl ViewAnimatorProxy {
|
|
pub fn new(proxy: id) -> Self {
|
|
Self(unsafe {
|
|
ShareId::from_ptr(msg_send![proxy, animator])
|
|
})
|
|
}
|
|
|
|
/// Sets the alpha value for the view being animated.
|
|
pub fn set_alpha(&self, value: CGFloat) {
|
|
unsafe {
|
|
let _: () = msg_send![&*self.0, setAlphaValue:value];
|
|
}
|
|
}
|
|
}
|