Adanos020 / egui_dock

Docking support for egui – an immediate-mode GUI library for Rust
MIT License
458 stars 75 forks source link

[Feature Request] Modify `hello.rs` to not use Strings #246

Open dolezvo1 opened 4 months ago

dolezvo1 commented 4 months ago

Hello, I'm sorry, this is not a feature for the library per se, but rather for the hello.rs demo. I've been looking over it for few hours now, and I'm struggling to think of a way to use this crate when you have more more difficult tab type to work with.

For example I would naturally think to model the tab type as an enum, with tab data in the variant fields. What bothers me is that you necessarily wouldn't want to hash this additional data, as that might potentially be very resource intensive, meaning you probably wouldn't want to use a hashmap to store the tabs. Similarly the on_close function accepts a tab, so that seems to suggest you should give all the tab variants an uuid of some sort to identify them by?

What I'm trying to say, I would really appreciate if there were some hints as to how this could work for a more complicated setup. I am really struggling to see it in there, and I think it might be much clearer if the tabs weren't represented by the strings as they are now.

dolezvo1 commented 4 months ago

I just noticed the other demos, but I can't necessarily say I can see the answers to my questions in there.

dolezvo1 commented 4 months ago

I think I might have just been confused as to what the open_tabs field does in the hello.rs demo. Do I understand correctly that this field basically just serves for tracking of the "unique" tabs, and wouldn't be necessary if you were to track their state in separate fields?