mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-29 21:34:50 +00:00
Replace a few qualified abi::primitives paths with uses
That'll make it easier to do the next rename :-)
This commit is contained in:
parent
44109130f0
commit
c29791fbaa
3 changed files with 21 additions and 27 deletions
|
@ -593,13 +593,13 @@ impl<T: Clone + InterpolatedPropertyValue + 'static> Property<T> {
|
|||
struct PropertyValueAnimationData<T> {
|
||||
from_value: T,
|
||||
to_value: T,
|
||||
details: crate::abi::primitives::PropertyAnimation,
|
||||
details: PropertyAnimation,
|
||||
start_time: instant::Instant,
|
||||
loop_iteration: i32,
|
||||
}
|
||||
|
||||
impl<T: InterpolatedPropertyValue> PropertyValueAnimationData<T> {
|
||||
fn new(from_value: T, to_value: T, details: crate::abi::primitives::PropertyAnimation) -> Self {
|
||||
fn new(from_value: T, to_value: T, details: PropertyAnimation) -> Self {
|
||||
let start_time =
|
||||
crate::animations::CURRENT_ANIMATION_DRIVER.with(|driver| driver.current_tick());
|
||||
|
||||
|
@ -691,8 +691,8 @@ impl<T: InterpolatedPropertyValue> BindingCallable for AnimatedBindingCallable<T
|
|||
|
||||
#[test]
|
||||
fn properties_simple_test() {
|
||||
use std::rc::Rc;
|
||||
use pin_weak::rc::PinWeak;
|
||||
use std::rc::Rc;
|
||||
fn g(prop: &Property<i32>) -> i32 {
|
||||
unsafe { Pin::new_unchecked(prop).get() }
|
||||
}
|
||||
|
@ -845,7 +845,7 @@ fn c_set_animated_value<T: InterpolatedPropertyValue>(
|
|||
handle: &PropertyHandleOpaque,
|
||||
from: T,
|
||||
to: T,
|
||||
animation_data: &crate::abi::primitives::PropertyAnimation,
|
||||
animation_data: &PropertyAnimation,
|
||||
) {
|
||||
let d = RefCell::new(PropertyValueAnimationData::new(from, to, animation_data.clone()));
|
||||
handle.0.set_binding(move |val: *mut ()| {
|
||||
|
@ -869,7 +869,7 @@ pub unsafe extern "C" fn sixtyfps_property_set_animated_value_int(
|
|||
handle: &PropertyHandleOpaque,
|
||||
from: i32,
|
||||
to: i32,
|
||||
animation_data: &crate::abi::primitives::PropertyAnimation,
|
||||
animation_data: &PropertyAnimation,
|
||||
) {
|
||||
c_set_animated_value(handle, from, to, animation_data)
|
||||
}
|
||||
|
@ -880,7 +880,7 @@ pub unsafe extern "C" fn sixtyfps_property_set_animated_value_float(
|
|||
handle: &PropertyHandleOpaque,
|
||||
from: f32,
|
||||
to: f32,
|
||||
animation_data: &crate::abi::primitives::PropertyAnimation,
|
||||
animation_data: &PropertyAnimation,
|
||||
) {
|
||||
c_set_animated_value(handle, from, to, animation_data)
|
||||
}
|
||||
|
@ -891,7 +891,7 @@ pub unsafe extern "C" fn sixtyfps_property_set_animated_value_color(
|
|||
handle: &PropertyHandleOpaque,
|
||||
from: Color,
|
||||
to: Color,
|
||||
animation_data: &crate::abi::primitives::PropertyAnimation,
|
||||
animation_data: &PropertyAnimation,
|
||||
) {
|
||||
c_set_animated_value(handle, from, to, animation_data);
|
||||
}
|
||||
|
@ -901,7 +901,7 @@ unsafe fn c_set_animated_binding<T: InterpolatedPropertyValue>(
|
|||
binding: extern "C" fn(*mut c_void, *mut T),
|
||||
user_data: *mut c_void,
|
||||
drop_user_data: Option<extern "C" fn(*mut c_void)>,
|
||||
animation_data: &crate::abi::primitives::PropertyAnimation,
|
||||
animation_data: &PropertyAnimation,
|
||||
) {
|
||||
let binding = core::mem::transmute::<
|
||||
extern "C" fn(*mut c_void, *mut T),
|
||||
|
@ -932,7 +932,7 @@ pub unsafe extern "C" fn sixtyfps_property_set_animated_binding_int(
|
|||
binding: extern "C" fn(*mut c_void, *mut i32),
|
||||
user_data: *mut c_void,
|
||||
drop_user_data: Option<extern "C" fn(*mut c_void)>,
|
||||
animation_data: &crate::abi::primitives::PropertyAnimation,
|
||||
animation_data: &PropertyAnimation,
|
||||
) {
|
||||
c_set_animated_binding(handle, binding, user_data, drop_user_data, animation_data);
|
||||
}
|
||||
|
@ -944,7 +944,7 @@ pub unsafe extern "C" fn sixtyfps_property_set_animated_binding_float(
|
|||
binding: extern "C" fn(*mut c_void, *mut f32),
|
||||
user_data: *mut c_void,
|
||||
drop_user_data: Option<extern "C" fn(*mut c_void)>,
|
||||
animation_data: &crate::abi::primitives::PropertyAnimation,
|
||||
animation_data: &PropertyAnimation,
|
||||
) {
|
||||
c_set_animated_binding(handle, binding, user_data, drop_user_data, animation_data);
|
||||
}
|
||||
|
@ -956,7 +956,7 @@ pub unsafe extern "C" fn sixtyfps_property_set_animated_binding_color(
|
|||
binding: extern "C" fn(*mut c_void, *mut Color),
|
||||
user_data: *mut c_void,
|
||||
drop_user_data: Option<extern "C" fn(*mut c_void)>,
|
||||
animation_data: &crate::abi::primitives::PropertyAnimation,
|
||||
animation_data: &PropertyAnimation,
|
||||
) {
|
||||
c_set_animated_binding(handle, binding, user_data, drop_user_data, animation_data);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*/
|
||||
|
||||
pub type FieldOffset<T, U> = const_field_offset::FieldOffset<T, U, const_field_offset::PinnedFlag>;
|
||||
use crate::abi::primitives::PropertyAnimation;
|
||||
use core::convert::{TryFrom, TryInto};
|
||||
use core::pin::Pin;
|
||||
|
||||
|
@ -33,13 +34,13 @@ pub trait PropertyInfo<Item, Value> {
|
|||
&self,
|
||||
item: Pin<&Item>,
|
||||
value: Value,
|
||||
animation: Option<crate::abi::primitives::PropertyAnimation>,
|
||||
animation: Option<PropertyAnimation>,
|
||||
) -> Result<(), ()>;
|
||||
fn set_binding(
|
||||
&self,
|
||||
item: Pin<&Item>,
|
||||
binding: Box<dyn Fn() -> Value>,
|
||||
animation: Option<crate::abi::primitives::PropertyAnimation>,
|
||||
animation: Option<PropertyAnimation>,
|
||||
) -> Result<(), ()>;
|
||||
|
||||
/// The offset of the property in the item.
|
||||
|
@ -69,7 +70,7 @@ where
|
|||
&self,
|
||||
item: Pin<&Item>,
|
||||
value: Value,
|
||||
animation: Option<crate::abi::primitives::PropertyAnimation>,
|
||||
animation: Option<PropertyAnimation>,
|
||||
) -> Result<(), ()> {
|
||||
if animation.is_some() {
|
||||
Err(())
|
||||
|
@ -82,7 +83,7 @@ where
|
|||
&self,
|
||||
item: Pin<&Item>,
|
||||
binding: Box<dyn Fn() -> Value>,
|
||||
animation: Option<crate::abi::primitives::PropertyAnimation>,
|
||||
animation: Option<PropertyAnimation>,
|
||||
) -> Result<(), ()> {
|
||||
if animation.is_some() {
|
||||
Err(())
|
||||
|
@ -117,7 +118,7 @@ where
|
|||
&self,
|
||||
item: Pin<&Item>,
|
||||
value: Value,
|
||||
animation: Option<crate::abi::primitives::PropertyAnimation>,
|
||||
animation: Option<PropertyAnimation>,
|
||||
) -> Result<(), ()> {
|
||||
if let Some(animation) = &animation {
|
||||
self.apply_pin(item).set_animated_value(value.try_into().map_err(|_| ())?, animation);
|
||||
|
@ -130,7 +131,7 @@ where
|
|||
&self,
|
||||
item: Pin<&Item>,
|
||||
binding: Box<dyn Fn() -> Value>,
|
||||
animation: Option<crate::abi::primitives::PropertyAnimation>,
|
||||
animation: Option<PropertyAnimation>,
|
||||
) -> Result<(), ()> {
|
||||
if let Some(animation) = &animation {
|
||||
self.apply_pin(item).set_animated_binding(
|
||||
|
|
|
@ -11,7 +11,7 @@ use sixtyfps_corelib::abi::datastructures::{
|
|||
ComponentVTable, ItemTreeNode, ItemVTable, ItemVisitorRefMut, LayoutInfo, Resource,
|
||||
WindowProperties,
|
||||
};
|
||||
use sixtyfps_corelib::abi::primitives::PropertyAnimation;
|
||||
use sixtyfps_corelib::abi::primitives::{Flickable, PropertyAnimation, Rectangle};
|
||||
use sixtyfps_corelib::abi::{properties::PropertyListenerScope, slice::Slice};
|
||||
use sixtyfps_corelib::rtti::PropertyInfo;
|
||||
use sixtyfps_corelib::ComponentRefPin;
|
||||
|
@ -279,16 +279,9 @@ fn generate_component(root_component: &Rc<object_tree::Component>) -> Rc<Compone
|
|||
if is_flickable_rect {
|
||||
use vtable::HasStaticVTable;
|
||||
let offset = items_types[&item.id].offset
|
||||
+ sixtyfps_corelib::abi::primitives::Flickable::field_offsets()
|
||||
.viewport
|
||||
.get_byte_offset();
|
||||
+ Flickable::field_offsets().viewport.get_byte_offset();
|
||||
tree_array.push(ItemTreeNode::Item {
|
||||
item: unsafe {
|
||||
vtable::VOffset::from_raw(
|
||||
sixtyfps_corelib::abi::primitives::Rectangle::static_vtable(),
|
||||
offset,
|
||||
)
|
||||
},
|
||||
item: unsafe { vtable::VOffset::from_raw(Rectangle::static_vtable(), offset) },
|
||||
children_index: tree_array.len() as u32 + 1,
|
||||
chilren_count: item.children.len() as _,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue