linebender/druid

It should be possible for a window to get its size from its contents

Open

#1246 opened on Sep 19, 2020

View on GitHub
 (7 comments) (0 reactions) (0 assignees)Rust (9,091 stars) (567 forks)batch import
D-Hardenhancementhelp wanted

Description

Currently, it seems that a window determines its size based on the value passed to it by the user and then forces its contents to be laid out within that size.

However, it's often more useful and convenient to do it the other way around: The window should use the usual box layout methods on its content to determine the best size for itself within the usual constraints (which should be user-settable on the window). Whether to do this, of course, should be an option settable on the window.

Furthermore, there should be separate options to control whether this size can grow and/or shrink in response to future layouts. This way, it's possible to have a completely dynamically sized window, where showing/hiding UI (for example) inside the window will automatically grow/shrink the window as well.

(I know druid is WIP, but I like it and I didn't see a way to do this nor an existing issue on it, so I've though to open one)

Contributor guide