remove state generic from a lot of things

This commit is contained in:
2025-12-17 21:37:55 -05:00
parent 7e6369029f
commit 30bc55c78e
45 changed files with 740 additions and 856 deletions

View File

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