Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split trait Layout into Tile, Layout; impl Layout for Text #469

Merged
merged 12 commits into from
Jan 21, 2025
Merged

Conversation

dhardy
Copy link
Collaborator

@dhardy dhardy commented Jan 21, 2025

pub trait Tile is now the dyn-safe (no assoc. type Data or Sized restriction) super of trait Widget.

trait Tile: Layout with:

pub trait Layout {
    fn size_rules(&mut self, sizer: SizeCx, axis: AxisInfo) -> SizeRules;

    fn set_rect(&mut self, cx: &mut ConfigCx, rect: Rect, hints: AlignHints);

    fn try_probe(&mut self, coord: Coord) -> Option<Id> {
        None
    }

    fn draw(&mut self, draw: DrawCx);

where Layout is now implementable by non-widgets.

fn probe is moved to trait Events since it doesn't need to appear in the dyn Widget vtable and is not applicable to non-widgets`.

Implement Layout for kas::theme::Text.

Allow usage of layout = self.text where text is a Text field.

@dhardy dhardy merged commit 90a4347 into master Jan 21, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant