diff options
author | 2023-06-30 19:10:41 +0200 | |
---|---|---|
committer | 2023-06-30 19:10:41 +0200 | |
commit | a057f8811bfc47afc4271f05b92263a19122d888 (patch) | |
tree | 3adab32cf4901ad985cc6844f970019df75f20a2 /core | |
parent | 949eca3eb814bce04f0c658ea0c9da9ecbbdfe12 (diff) | |
parent | d666e739cdcc2084c14593888867d40066c232fe (diff) | |
download | iced-a057f8811bfc47afc4271f05b92263a19122d888.tar.gz iced-a057f8811bfc47afc4271f05b92263a19122d888.tar.bz2 iced-a057f8811bfc47afc4271f05b92263a19122d888.zip |
Merge pull request #1938 from iced-rs/text-cache-modes
Text cache modes
Diffstat (limited to '')
-rw-r--r-- | core/src/renderer.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/core/src/renderer.rs b/core/src/renderer.rs index 1b327e56..7c73d2e4 100644 --- a/core/src/renderer.rs +++ b/core/src/renderer.rs @@ -5,13 +5,26 @@ mod null; #[cfg(debug_assertions)] pub use null::Null; -use crate::{Background, BorderRadius, Color, Rectangle, Vector}; +use crate::layout; +use crate::{Background, BorderRadius, Color, Element, Rectangle, Vector}; /// A component that can be used by widgets to draw themselves on a screen. pub trait Renderer: Sized { /// The supported theme of the [`Renderer`]. type Theme; + /// Lays out the elements of a user interface. + /// + /// You should override this if you need to perform any operations before or + /// after layouting. For instance, trimming the measurements cache. + fn layout<Message>( + &mut self, + element: &Element<'_, Message, Self>, + limits: &layout::Limits, + ) -> layout::Node { + element.as_widget().layout(self, limits) + } + /// Draws the primitives recorded in the given closure in a new layer. /// /// The layer will clip its contents to the provided `bounds`. |