RE ADD CONTEXT
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
pub struct MaxSize {
|
||||
pub inner: WidgetHandle,
|
||||
pub struct MaxSize<State> {
|
||||
pub inner: WidgetHandle<State>,
|
||||
pub x: Option<Len>,
|
||||
pub y: Option<Len>,
|
||||
}
|
||||
|
||||
impl MaxSize {
|
||||
fn apply_to_outer(&self, ctx: &mut SizeCtx) {
|
||||
impl<State: 'static> MaxSize<State> {
|
||||
fn apply_to_outer(&self, ctx: &mut SizeCtx<State>) {
|
||||
if let Some(x) = self.x {
|
||||
ctx.outer.x.select_len(x.apply_rest());
|
||||
}
|
||||
@@ -17,12 +17,12 @@ impl MaxSize {
|
||||
}
|
||||
}
|
||||
|
||||
impl Widget for MaxSize {
|
||||
fn draw(&mut self, painter: &mut Painter) {
|
||||
impl<State: 'static> Widget<State> for MaxSize<State> {
|
||||
fn draw(&mut self, painter: &mut Painter<State>) {
|
||||
painter.widget(&self.inner);
|
||||
}
|
||||
|
||||
fn desired_width(&mut self, ctx: &mut SizeCtx) -> Len {
|
||||
fn desired_width(&mut self, ctx: &mut SizeCtx<State>) -> Len {
|
||||
self.apply_to_outer(ctx);
|
||||
let width = ctx.width(&self.inner);
|
||||
if let Some(x) = self.x {
|
||||
@@ -34,7 +34,7 @@ impl Widget for MaxSize {
|
||||
}
|
||||
}
|
||||
|
||||
fn desired_height(&mut self, ctx: &mut SizeCtx) -> Len {
|
||||
fn desired_height(&mut self, ctx: &mut SizeCtx<State>) -> Len {
|
||||
self.apply_to_outer(ctx);
|
||||
let height = ctx.height(&self.inner);
|
||||
if let Some(y) = self.y {
|
||||
|
||||
Reference in New Issue
Block a user