mirror of
https://github.com/slint-ui/slint.git
synced 2025-09-29 21:34:50 +00:00
Rename corelib::abi::primitives to corelib::items
This commit is contained in:
parent
72d2a430ee
commit
69beab5957
10 changed files with 35 additions and 34 deletions
|
@ -74,12 +74,13 @@ pub mod re_exports {
|
|||
pub use crate::repeater::*;
|
||||
pub use const_field_offset::{self, FieldOffsets};
|
||||
pub use once_cell::unsync::OnceCell;
|
||||
pub use pin_weak::rc::*;
|
||||
pub use sixtyfps_corelib::abi::datastructures::*;
|
||||
pub use sixtyfps_corelib::abi::primitives::*;
|
||||
pub use sixtyfps_corelib::abi::properties::{Property, PropertyListenerScope};
|
||||
pub use sixtyfps_corelib::abi::signals::Signal;
|
||||
pub use sixtyfps_corelib::abi::slice::Slice;
|
||||
pub use sixtyfps_corelib::item_tree::visit_item_tree;
|
||||
pub use sixtyfps_corelib::items::*;
|
||||
pub use sixtyfps_corelib::layout::{
|
||||
grid_layout_info, solve_grid_layout, solve_path_layout, GridLayoutCellData, GridLayoutData,
|
||||
PathLayoutData, PathLayoutItemData,
|
||||
|
@ -90,7 +91,6 @@ pub mod re_exports {
|
|||
pub use sixtyfps_corelib::SharedArray;
|
||||
pub use sixtyfps_corelib::SharedString;
|
||||
pub use vtable::{self, *};
|
||||
pub use pin_weak::rc::*;
|
||||
}
|
||||
|
||||
/// Creates a new window to render components in.
|
||||
|
|
|
@ -797,36 +797,36 @@ pub unsafe extern "C" fn sixtyfps_visit_item_tree(
|
|||
ItemVTable_static! {
|
||||
/// The VTable for `Image`
|
||||
#[no_mangle]
|
||||
pub static ImageVTable for crate::abi::primitives::Image
|
||||
pub static ImageVTable for crate::items::Image
|
||||
}
|
||||
ItemVTable_static! {
|
||||
/// The VTable for `Rectangle`
|
||||
#[no_mangle]
|
||||
pub static RectangleVTable for crate::abi::primitives::Rectangle
|
||||
pub static RectangleVTable for crate::items::Rectangle
|
||||
}
|
||||
ItemVTable_static! {
|
||||
/// The VTable for `BorderRectangle`
|
||||
#[no_mangle]
|
||||
pub static BorderRectangleVTable for crate::abi::primitives::BorderRectangle
|
||||
pub static BorderRectangleVTable for crate::items::BorderRectangle
|
||||
}
|
||||
ItemVTable_static! {
|
||||
/// The VTable for `Text`
|
||||
#[no_mangle]
|
||||
pub static TextVTable for crate::abi::primitives::Text
|
||||
pub static TextVTable for crate::items::Text
|
||||
}
|
||||
ItemVTable_static! {
|
||||
/// The VTable for `TouchArea`
|
||||
#[no_mangle]
|
||||
pub static TouchAreaVTable for crate::abi::primitives::TouchArea
|
||||
pub static TouchAreaVTable for crate::items::TouchArea
|
||||
}
|
||||
ItemVTable_static! {
|
||||
/// The VTable for `Path`
|
||||
#[no_mangle]
|
||||
pub static PathVTable for crate::abi::primitives::Path
|
||||
pub static PathVTable for crate::items::Path
|
||||
}
|
||||
|
||||
ItemVTable_static! {
|
||||
/// The VTable for `Flickable`
|
||||
#[no_mangle]
|
||||
pub static FlickableVTable for crate::abi::primitives::Flickable
|
||||
pub static FlickableVTable for crate::items::Flickable
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ use core::cell::{Cell, RefCell, UnsafeCell};
|
|||
use core::{marker::PhantomPinned, pin::Pin};
|
||||
|
||||
use crate::abi::datastructures::Color;
|
||||
use crate::abi::primitives::PropertyAnimation;
|
||||
use crate::items::PropertyAnimation;
|
||||
|
||||
/// The return value of a binding
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
|
@ -964,7 +964,7 @@ pub unsafe extern "C" fn sixtyfps_property_set_animated_binding_color(
|
|||
#[cfg(test)]
|
||||
mod animation_tests {
|
||||
use super::*;
|
||||
use crate::abi::primitives::PropertyAnimation;
|
||||
use crate::items::PropertyAnimation;
|
||||
use std::rc::Rc;
|
||||
|
||||
#[derive(Default)]
|
||||
|
|
|
@ -157,7 +157,7 @@ fn main() {
|
|||
cbindgen::Builder::new()
|
||||
.with_config(config)
|
||||
.with_src(crate_dir.join("abi/datastructures.rs"))
|
||||
.with_src(crate_dir.join("abi/primitives.rs"))
|
||||
.with_src(crate_dir.join("items.rs"))
|
||||
.with_src(crate_dir.join("abi/model.rs"))
|
||||
.with_src(crate_dir.join("abi/tests.rs"))
|
||||
.with_src(crate_dir.join("layout.rs")) // FIXME: move in ABI?
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//! The implementation details behind the Flickable
|
||||
|
||||
use crate::abi::datastructures::{EasingCurve, MouseEvent, MouseEventType, Point};
|
||||
use crate::abi::primitives::{Flickable, PropertyAnimation, Rectangle};
|
||||
use crate::items::{Flickable, PropertyAnimation, Rectangle};
|
||||
use core::cell::RefCell;
|
||||
use core::pin::Pin;
|
||||
use instant::Instant;
|
||||
|
|
|
@ -12,12 +12,13 @@ When adding an item or a property, it needs to be kept in sync with different pl
|
|||
|
||||
*/
|
||||
|
||||
#![allow(unsafe_code)]
|
||||
#![allow(non_upper_case_globals)]
|
||||
#![allow(missing_docs)] // because documenting each property of items is redundent
|
||||
|
||||
use super::datastructures::{
|
||||
CachedRenderingData, Color, Item, ItemConsts, LayoutInfo, PathData, Rect, RenderingPrimitive,
|
||||
Resource,
|
||||
use super::abi::datastructures::{
|
||||
CachedRenderingData, Color, Item, ItemConsts, LayoutInfo, MouseEvent, PathData, Rect,
|
||||
RenderingPrimitive, Resource,
|
||||
};
|
||||
#[cfg(feature = "rtti")]
|
||||
use crate::rtti::*;
|
||||
|
@ -68,7 +69,7 @@ impl Item for Rectangle {
|
|||
Default::default()
|
||||
}
|
||||
|
||||
fn input_event(self: Pin<&Self>, _: super::datastructures::MouseEvent) {}
|
||||
fn input_event(self: Pin<&Self>, _: MouseEvent) {}
|
||||
}
|
||||
|
||||
impl ItemConsts for Rectangle {
|
||||
|
@ -128,7 +129,7 @@ impl Item for BorderRectangle {
|
|||
Default::default()
|
||||
}
|
||||
|
||||
fn input_event(self: Pin<&Self>, _: super::datastructures::MouseEvent) {}
|
||||
fn input_event(self: Pin<&Self>, _: MouseEvent) {}
|
||||
}
|
||||
|
||||
impl ItemConsts for BorderRectangle {
|
||||
|
@ -175,7 +176,7 @@ impl Item for Image {
|
|||
Default::default()
|
||||
}
|
||||
|
||||
fn input_event(self: Pin<&Self>, _: super::datastructures::MouseEvent) {}
|
||||
fn input_event(self: Pin<&Self>, _: MouseEvent) {}
|
||||
}
|
||||
|
||||
impl ItemConsts for Image {
|
||||
|
@ -240,7 +241,7 @@ impl Item for Text {
|
|||
})
|
||||
}
|
||||
|
||||
fn input_event(self: Pin<&Self>, _: super::datastructures::MouseEvent) {}
|
||||
fn input_event(self: Pin<&Self>, _: MouseEvent) {}
|
||||
}
|
||||
|
||||
impl ItemConsts for Text {
|
||||
|
@ -283,14 +284,14 @@ impl Item for TouchArea {
|
|||
LayoutInfo::default()
|
||||
}
|
||||
|
||||
fn input_event(self: Pin<&Self>, event: super::datastructures::MouseEvent) {
|
||||
fn input_event(self: Pin<&Self>, event: MouseEvent) {
|
||||
println!("Touch Area Event {:?}", event);
|
||||
Self::field_offsets().pressed.apply_pin(self).set(match event.what {
|
||||
super::datastructures::MouseEventType::MousePressed => true,
|
||||
super::datastructures::MouseEventType::MouseReleased => false,
|
||||
super::datastructures::MouseEventType::MouseMoved => return,
|
||||
super::abi::datastructures::MouseEventType::MousePressed => true,
|
||||
super::abi::datastructures::MouseEventType::MouseReleased => false,
|
||||
super::abi::datastructures::MouseEventType::MouseMoved => return,
|
||||
});
|
||||
if matches!(event.what, super::datastructures::MouseEventType::MouseReleased) {
|
||||
if matches!(event.what, super::abi::datastructures::MouseEventType::MouseReleased) {
|
||||
Self::field_offsets().clicked.apply_pin(self).emit(())
|
||||
}
|
||||
}
|
||||
|
@ -346,7 +347,7 @@ impl Item for Path {
|
|||
LayoutInfo::default()
|
||||
}
|
||||
|
||||
fn input_event(self: Pin<&Self>, _: super::datastructures::MouseEvent) {}
|
||||
fn input_event(self: Pin<&Self>, _: MouseEvent) {}
|
||||
}
|
||||
|
||||
impl ItemConsts for Path {
|
||||
|
@ -389,7 +390,7 @@ impl Item for Flickable {
|
|||
LayoutInfo::default()
|
||||
}
|
||||
|
||||
fn input_event(self: Pin<&Self>, event: super::datastructures::MouseEvent) {
|
||||
fn input_event(self: Pin<&Self>, event: MouseEvent) {
|
||||
self.data.handle_mouse(self, event);
|
||||
}
|
||||
}
|
|
@ -28,7 +28,6 @@ pub mod abi {
|
|||
#![allow(unsafe_code)]
|
||||
pub mod datastructures;
|
||||
pub mod model;
|
||||
pub mod primitives;
|
||||
pub mod properties;
|
||||
pub mod sharedarray;
|
||||
pub mod signals;
|
||||
|
@ -37,6 +36,8 @@ pub mod abi {
|
|||
pub mod tests;
|
||||
}
|
||||
|
||||
pub mod items;
|
||||
|
||||
#[doc(inline)]
|
||||
pub use abi::string::SharedString;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*/
|
||||
|
||||
pub type FieldOffset<T, U> = const_field_offset::FieldOffset<T, U, const_field_offset::PinnedFlag>;
|
||||
use crate::abi::primitives::PropertyAnimation;
|
||||
use crate::items::PropertyAnimation;
|
||||
use core::convert::{TryFrom, TryInto};
|
||||
use core::pin::Pin;
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ use sixtyfps_corelib::abi::datastructures::{
|
|||
ComponentVTable, ItemTreeNode, ItemVTable, ItemVisitorRefMut, LayoutInfo, Resource,
|
||||
WindowProperties,
|
||||
};
|
||||
use sixtyfps_corelib::abi::primitives::{Flickable, PropertyAnimation, Rectangle};
|
||||
use sixtyfps_corelib::abi::{properties::PropertyListenerScope, slice::Slice};
|
||||
use sixtyfps_corelib::items::{Flickable, PropertyAnimation, Rectangle};
|
||||
use sixtyfps_corelib::rtti::PropertyInfo;
|
||||
use sixtyfps_corelib::ComponentRefPin;
|
||||
use sixtyfps_corelib::{rtti, Color, Property, SharedString, Signal};
|
||||
|
@ -244,7 +244,7 @@ pub fn load(
|
|||
fn generate_component(root_component: &Rc<object_tree::Component>) -> Rc<ComponentDescription> {
|
||||
let mut rtti = HashMap::new();
|
||||
{
|
||||
use sixtyfps_corelib::abi::primitives::*;
|
||||
use sixtyfps_corelib::items::*;
|
||||
rtti.extend(
|
||||
[
|
||||
rtti_for::<Image>(),
|
||||
|
|
|
@ -7,9 +7,8 @@ use sixtyfps_compilerlib::expression_tree::{
|
|||
use sixtyfps_compilerlib::{object_tree::ElementRc, typeregister::Type};
|
||||
use sixtyfps_corelib as corelib;
|
||||
use sixtyfps_corelib::{
|
||||
abi::datastructures::ItemRef, abi::datastructures::PathElement,
|
||||
abi::primitives::PropertyAnimation, Color, ComponentRefPin, PathData, Resource, SharedArray,
|
||||
SharedString,
|
||||
abi::datastructures::ItemRef, abi::datastructures::PathElement, items::PropertyAnimation,
|
||||
Color, ComponentRefPin, PathData, Resource, SharedArray, SharedString,
|
||||
};
|
||||
use std::{collections::HashMap, rc::Rc};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue