Resolve deferred size comparisons before allocating span slots
This commit is contained in:
1 parent
de1eb7e406
commit
8780b40bb7
23 files changed
+1471
-130
No files matched your search
@@ -4,6 +4,7 @@ use std::any::Any;
|
||||
mod data;
|
||||
mod handle;
|
||||
mod like;
|
||||
mod request;
|
||||
mod size_rule;
|
||||
mod tag;
|
||||
mod view;
|
||||
@@ -12,6 +13,7 @@ mod widgets;
|
||||
pub use data::*;
|
||||
pub use handle::*;
|
||||
pub use like::*;
|
||||
pub use request::*;
|
||||
pub use size_rule::*;
|
||||
pub use tag::*;
|
||||
pub use view::*;
|
||||
@@ -21,6 +23,12 @@ pub trait Widget: Any {
|
||||
/// Draws the widget, and returns what it used of the box it was given.
|
||||
fn draw(&mut self, painter: &mut Painter) -> Size;
|
||||
|
||||
/// Describes an axis before painting. Return `None` when discovering it
|
||||
/// needs a concrete box or work performed by `draw`.
|
||||
fn size_request(&self, requests: &mut SizeRequests, axis: Axis) -> Option<RequestedLen> {
|
||||
self.size_hint(axis).map(|len| requests.length(len))
|
||||
}
|
||||
|
||||
/// An exact length the widget can give without a painter or its children.
|
||||
/// Optional, and saves a draw rather than changing one: a hint that
|
||||
/// disagrees with the eventual draw fails a debug assertion.
|
||||
|
||||
Reference in new issue
Block a user