emilk / egui

egui: an easy-to-use immediate mode GUI in Rust that runs on both web and native
https://www.egui.rs/
Apache License 2.0
22.35k stars 1.61k forks source link

Add methods to collapse a window #358

Open emilk opened 3 years ago

emilk commented 3 years ago

We should add two methods to egui::Window

nside commented 3 years ago

i'll take it

nside commented 3 years ago

i've got this https://github.com/nside/egui/commit/9285214cc0495e741b0029cbdf8a36f40accb722 but it's overriding the state in the collapsing header. somehow the ctx is needed to retrieve the header state. how would you handle this?

nside commented 3 years ago

why not keep the collapsing header state in the window struct?

emilk commented 3 years ago

struct Window is a builder - it stores no state at all between frames. The position and size of a window is stored in area::State, the scroll offset in scroll_area::State, the collapsing state in collapsing_header::State.

nside commented 3 years ago

I meant adding an Option<collapsing_header::State> field to the struct Window - similar to how area and scroll are handled. Otherwise the collapsed bool would need to be handled similarly to the window open state?

leo848 commented 2 years ago

Any updates on this? Is there any way to have a window collapsed by default at this point?

lordbenedikt commented 1 year ago

I also would like this feature. I'm creating an editor app with lots of functionalities that shouldn't be visible right at startup.

konradmoesch commented 3 months ago

I'd also like this feature. Is someone working on this? I see #3517 marked as draft with no progress for four months. Are you still working on it, @Norlock? Or would you be open to me taking over the PR or making a whole new attempt at this feature?

Norlock commented 3 months ago

You can also continue, I have been busy with other projects so haven't really looked into it. But let me try if I can make an improvement (today/tomorrow). I will have to look at the code again.