Block off AppKit animator proxy to fix iOS compiling
This commit is contained in:
parent
e8f954080b
commit
8b43d43caf
|
@ -10,6 +10,7 @@ use objc_id::ShareId;
|
||||||
|
|
||||||
use crate::foundation::{id, NO, YES};
|
use crate::foundation::{id, NO, YES};
|
||||||
|
|
||||||
|
#[cfg(all(feature = "appkit", target_os = "macos"))]
|
||||||
use super::LayoutConstraintAnimatorProxy;
|
use super::LayoutConstraintAnimatorProxy;
|
||||||
|
|
||||||
/// A wrapper for `NSLayoutConstraint`. This both acts as a central path through which to activate
|
/// A wrapper for `NSLayoutConstraint`. This both acts as a central path through which to activate
|
||||||
|
@ -31,18 +32,22 @@ pub struct LayoutConstraint {
|
||||||
pub priority: f64,
|
pub priority: f64,
|
||||||
|
|
||||||
/// An animator proxy that can be used inside animation contexts.
|
/// An animator proxy that can be used inside animation contexts.
|
||||||
pub animator: LayoutConstraintAnimatorProxy
|
/// This is currently only supported on macOS with the `appkit` feature.
|
||||||
|
#[cfg(all(feature = "appkit", target_os = "macos"))]
|
||||||
|
pub animator: LayoutConstraintAnimatorProxy,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl LayoutConstraint {
|
impl LayoutConstraint {
|
||||||
/// An internal method for wrapping existing constraints.
|
/// An internal method for wrapping existing constraints.
|
||||||
pub(crate) fn new(object: id) -> Self {
|
pub(crate) fn new(object: id) -> Self {
|
||||||
LayoutConstraint {
|
LayoutConstraint {
|
||||||
|
#[cfg(all(feature = "appkit", target_os = "macos"))]
|
||||||
animator: LayoutConstraintAnimatorProxy::new(object),
|
animator: LayoutConstraintAnimatorProxy::new(object),
|
||||||
|
|
||||||
constraint: unsafe { ShareId::from_ptr(object) },
|
constraint: unsafe { ShareId::from_ptr(object) },
|
||||||
offset: 0.0,
|
offset: 0.0,
|
||||||
multiplier: 0.0,
|
multiplier: 0.0,
|
||||||
priority: 0.0
|
priority: 0.0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,11 +60,13 @@ impl LayoutConstraint {
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutConstraint {
|
LayoutConstraint {
|
||||||
|
#[cfg(all(feature = "appkit", target_os = "macos"))]
|
||||||
animator: self.animator,
|
animator: self.animator,
|
||||||
|
|
||||||
constraint: self.constraint,
|
constraint: self.constraint,
|
||||||
offset: offset,
|
offset: offset,
|
||||||
multiplier: self.multiplier,
|
multiplier: self.multiplier,
|
||||||
priority: self.priority
|
priority: self.priority,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,10 @@
|
||||||
mod traits;
|
mod traits;
|
||||||
pub use traits::Layout;
|
pub use traits::Layout;
|
||||||
|
|
||||||
|
#[cfg(all(feature = "appkit", target_os = "macos"))]
|
||||||
mod animator;
|
mod animator;
|
||||||
|
|
||||||
|
#[cfg(all(feature = "appkit", target_os = "macos"))]
|
||||||
pub use animator::LayoutConstraintAnimatorProxy;
|
pub use animator::LayoutConstraintAnimatorProxy;
|
||||||
|
|
||||||
#[cfg(feature = "autolayout")]
|
#[cfg(feature = "autolayout")]
|
||||||
|
|
|
@ -58,7 +58,10 @@ use crate::layout::{LayoutAnchorDimension, LayoutAnchorX, LayoutAnchorY, SafeAre
|
||||||
#[cfg(feature = "appkit")]
|
#[cfg(feature = "appkit")]
|
||||||
use crate::pasteboard::PasteboardType;
|
use crate::pasteboard::PasteboardType;
|
||||||
|
|
||||||
|
#[cfg(all(feature = "appkit", target_os = "macos"))]
|
||||||
mod animator;
|
mod animator;
|
||||||
|
|
||||||
|
#[cfg(all(feature = "appkit", target_os = "macos"))]
|
||||||
pub use animator::ViewAnimatorProxy;
|
pub use animator::ViewAnimatorProxy;
|
||||||
|
|
||||||
#[cfg_attr(feature = "appkit", path = "appkit.rs")]
|
#[cfg_attr(feature = "appkit", path = "appkit.rs")]
|
||||||
|
@ -94,6 +97,9 @@ pub struct View<T = ()> {
|
||||||
pub objc: ObjcProperty,
|
pub objc: ObjcProperty,
|
||||||
|
|
||||||
/// An object that supports limited animations. Can be cloned into animation closures.
|
/// An object that supports limited animations. Can be cloned into animation closures.
|
||||||
|
///
|
||||||
|
/// This is currently only supported on macOS with the `appkit` feature.
|
||||||
|
#[cfg(all(feature = "appkit", target_os = "macos"))]
|
||||||
pub animator: ViewAnimatorProxy,
|
pub animator: ViewAnimatorProxy,
|
||||||
|
|
||||||
/// References the underlying layer. This is consistent across AppKit & UIKit - in AppKit
|
/// References the underlying layer. This is consistent across AppKit & UIKit - in AppKit
|
||||||
|
@ -145,7 +151,7 @@ pub struct View<T = ()> {
|
||||||
|
|
||||||
/// A pointer to the Objective-C runtime center Y layout constraint.
|
/// A pointer to the Objective-C runtime center Y layout constraint.
|
||||||
#[cfg(feature = "autolayout")]
|
#[cfg(feature = "autolayout")]
|
||||||
pub center_y: LayoutAnchorY
|
pub center_y: LayoutAnchorY,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for View {
|
impl Default for View {
|
||||||
|
@ -209,8 +215,9 @@ impl View {
|
||||||
|
|
||||||
layer: Layer::wrap(unsafe { msg_send![view, layer] }),
|
layer: Layer::wrap(unsafe { msg_send![view, layer] }),
|
||||||
|
|
||||||
|
#[cfg(all(feature = "appkit", target_os = "macos"))]
|
||||||
animator: ViewAnimatorProxy::new(view),
|
animator: ViewAnimatorProxy::new(view),
|
||||||
objc: ObjcProperty::retain(view)
|
objc: ObjcProperty::retain(view),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +229,7 @@ impl View {
|
||||||
|
|
||||||
impl<T> View<T>
|
impl<T> View<T>
|
||||||
where
|
where
|
||||||
T: ViewDelegate + 'static
|
T: ViewDelegate + 'static,
|
||||||
{
|
{
|
||||||
/// Initializes a new View with a given `ViewDelegate`. This enables you to respond to events
|
/// Initializes a new View with a given `ViewDelegate`. This enables you to respond to events
|
||||||
/// and customize the view as a module, similar to class-based systems.
|
/// and customize the view as a module, similar to class-based systems.
|
||||||
|
@ -256,6 +263,8 @@ impl<T> View<T> {
|
||||||
is_handle: true,
|
is_handle: true,
|
||||||
layer: self.layer.clone(),
|
layer: self.layer.clone(),
|
||||||
objc: self.objc.clone(),
|
objc: self.objc.clone(),
|
||||||
|
|
||||||
|
#[cfg(all(feature = "appkit", target_os = "macos"))]
|
||||||
animator: self.animator.clone(),
|
animator: self.animator.clone(),
|
||||||
|
|
||||||
#[cfg(feature = "autolayout")]
|
#[cfg(feature = "autolayout")]
|
||||||
|
@ -289,7 +298,7 @@ impl<T> View<T> {
|
||||||
center_x: self.center_x.clone(),
|
center_x: self.center_x.clone(),
|
||||||
|
|
||||||
#[cfg(feature = "autolayout")]
|
#[cfg(feature = "autolayout")]
|
||||||
center_y: self.center_y.clone()
|
center_y: self.center_y.clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue