mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-03 07:04:34 +00:00
Move datastructures::LayoutInfo into layout
This commit is contained in:
parent
1b270f42d0
commit
b05a11945e
6 changed files with 29 additions and 29 deletions
|
@ -82,6 +82,7 @@ pub mod re_exports {
|
|||
pub use sixtyfps_corelib::graphics::{Point, Rect, Size};
|
||||
pub use sixtyfps_corelib::item_tree::visit_item_tree;
|
||||
pub use sixtyfps_corelib::items::*;
|
||||
pub use sixtyfps_corelib::layout::LayoutInfo;
|
||||
pub use sixtyfps_corelib::layout::{
|
||||
grid_layout_info, solve_grid_layout, solve_path_layout, GridLayoutCellData, GridLayoutData,
|
||||
PathLayoutData, PathLayoutItemData,
|
||||
|
|
|
@ -6,6 +6,7 @@ use std::cell::Cell;
|
|||
use vtable::*;
|
||||
|
||||
use crate::graphics::{HighLevelRenderingPrimitive, Point, Rect, Size};
|
||||
use crate::layout::LayoutInfo;
|
||||
#[cfg(feature = "rtti")]
|
||||
use crate::rtti::{BuiltinItem, FieldInfo, FieldOffset, PropertyInfo, ValueType};
|
||||
use const_field_offset::FieldOffsets;
|
||||
|
@ -112,26 +113,6 @@ pub struct ItemVTable {
|
|||
/// the associated vtable
|
||||
pub type ItemRef<'a> = vtable::VRef<'a, ItemVTable>;
|
||||
|
||||
/// The constraint that applies to an item
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct LayoutInfo {
|
||||
/// The minimum width for the item.
|
||||
pub min_width: f32,
|
||||
/// The maximum width for the item.
|
||||
pub max_width: f32,
|
||||
/// The minimum height for the item.
|
||||
pub min_height: f32,
|
||||
/// The maximum height for the item.
|
||||
pub max_height: f32,
|
||||
}
|
||||
|
||||
impl Default for LayoutInfo {
|
||||
fn default() -> Self {
|
||||
LayoutInfo { min_width: 0., max_width: f32::MAX, min_height: 0., max_height: f32::MAX }
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(FieldOffsets, Default, BuiltinItem, Clone, Debug, PartialEq)]
|
||||
#[pin]
|
||||
|
|
|
@ -16,10 +16,9 @@ When adding an item or a property, it needs to be kept in sync with different pl
|
|||
#![allow(non_upper_case_globals)]
|
||||
#![allow(missing_docs)] // because documenting each property of items is redundent
|
||||
|
||||
use super::abi::datastructures::{
|
||||
CachedRenderingData, Item, ItemConsts, LayoutInfo, MouseEvent, PathData,
|
||||
};
|
||||
use super::abi::datastructures::{CachedRenderingData, Item, ItemConsts, MouseEvent, PathData};
|
||||
use super::graphics::{Color, HighLevelRenderingPrimitive, Rect, Resource};
|
||||
use super::layout::LayoutInfo;
|
||||
#[cfg(feature = "rtti")]
|
||||
use crate::rtti::*;
|
||||
use crate::{Property, SharedString, Signal};
|
||||
|
|
|
@ -2,13 +2,30 @@
|
|||
//!
|
||||
//! Currently this is a very basic implementation
|
||||
|
||||
use crate::{
|
||||
abi::{datastructures::LayoutInfo, slice::Slice},
|
||||
Property,
|
||||
};
|
||||
use crate::{abi::slice::Slice, Property};
|
||||
|
||||
type Coord = f32;
|
||||
|
||||
/// The constraint that applies to an item
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct LayoutInfo {
|
||||
/// The minimum width for the item.
|
||||
pub min_width: f32,
|
||||
/// The maximum width for the item.
|
||||
pub max_width: f32,
|
||||
/// The minimum height for the item.
|
||||
pub min_height: f32,
|
||||
/// The maximum height for the item.
|
||||
pub max_height: f32,
|
||||
}
|
||||
|
||||
impl Default for LayoutInfo {
|
||||
fn default() -> Self {
|
||||
LayoutInfo { min_width: 0., max_width: f32::MAX, min_height: 0., max_height: f32::MAX }
|
||||
}
|
||||
}
|
||||
|
||||
mod internal {
|
||||
use super::*;
|
||||
|
||||
|
|
|
@ -8,11 +8,12 @@ use sixtyfps_compilerlib::layout::{GridLayout, Layout, LayoutItem, PathLayout};
|
|||
use sixtyfps_compilerlib::typeregister::Type;
|
||||
use sixtyfps_compilerlib::*;
|
||||
use sixtyfps_corelib::abi::datastructures::{
|
||||
ComponentVTable, ItemTreeNode, ItemVTable, ItemVisitorRefMut, LayoutInfo, WindowProperties,
|
||||
ComponentVTable, ItemTreeNode, ItemVTable, ItemVisitorRefMut, WindowProperties,
|
||||
};
|
||||
use sixtyfps_corelib::abi::{properties::PropertyListenerScope, slice::Slice};
|
||||
use sixtyfps_corelib::graphics::Resource;
|
||||
use sixtyfps_corelib::items::{Flickable, PropertyAnimation, Rectangle};
|
||||
use sixtyfps_corelib::layout::LayoutInfo;
|
||||
use sixtyfps_corelib::rtti::PropertyInfo;
|
||||
use sixtyfps_corelib::ComponentRefPin;
|
||||
use sixtyfps_corelib::{rtti, Color, Property, SharedString, Signal};
|
||||
|
|
|
@ -5,9 +5,10 @@ use core::pin::Pin;
|
|||
#[cfg(have_qt)]
|
||||
use cpp::cpp;
|
||||
use sixtyfps_corelib::abi::datastructures::{
|
||||
CachedRenderingData, Item, ItemConsts, ItemVTable, LayoutInfo, MouseEvent, MouseEventType,
|
||||
CachedRenderingData, Item, ItemConsts, ItemVTable, MouseEvent, MouseEventType,
|
||||
};
|
||||
use sixtyfps_corelib::graphics::{HighLevelRenderingPrimitive, Rect, Resource};
|
||||
use sixtyfps_corelib::layout::LayoutInfo;
|
||||
#[cfg(feature = "rtti")]
|
||||
use sixtyfps_corelib::rtti::*;
|
||||
use sixtyfps_corelib::{ItemVTable_static, Property, SharedString, Signal};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue