Add Panel to replace SidePanel and TopBottomPanel#5659
Add Panel to replace SidePanel and TopBottomPanel#5659emilk merged 30 commits intoemilk:mainfrom sharky98:common-panels
Panel to replace SidePanel and TopBottomPanel#5659Conversation
Merged the sides. Merged the panel options. Started panel shows
…move TopBottomSide NOTE: Non-working commit
…ethods NOTE: Non-working commit
NOTE: Non-working commit
following those steps:
1. Rename `egui::SidePanel` with `egui::Panel`.
2. Rename `width` with `size` in all chained methods.
- `default_width()` to `default_size()`
- `min_width()` to `min_size()`
- `max_width()` to `max_size()`
- `width_range()` to `size_range()`
- `exact_width()` to `exact_size()`
if using `Panel::new()`, replace
- `Side::Left` with `Side::Vertical(VerticalSide::Left)`
- `Side::Right` with `Side::Vertical(VerticalSide::Right)`
NOTE: Non-working commit
…pBottomPanel when both SidePanel and TopBottomPanel were mentioned.
following those steps:
1. Rename `egui::TopBottomPanel` with `egui::Panel`.
2. Rename `height` with `size` in all chained methods.
- `default_height()` to `default_size()`
- `min_height()` to `min_size()`
- `max_height()` to `max_size()`
- `height_range()` to `size_range()`
- `exact_height()` to `exact_size()`
if using `Panel::new()`, replace
- `TopBottomSide::Top` with `Side::Horizontal(HorizontalSide::Top)`
- `TopBottomSide::Bottom` with `Side::Horizontal(HorizontalSide::Bottom)`
NOTE: Non-working commit
- replace switch fn with closures in some places. - integrate the switch fn inside the main switch. - make sure lifetime are defined for PanelSizer. - remove some `mut`, `&`, and `*` where they superfluous. - wrongly called `ctx()` when it was a variable 🤦. - cannot use `impl Trait` in a variable declaration type.
|
Locally, all the tests passed (except those regarding |
lucasmerlin
left a comment
There was a problem hiding this comment.
Nice, I think this makes sense. Also, having one struct is definitely the better approch (instead of introducing a trait, as you suggested in your issue)
|
Preview available at https://egui-pr-preview.github.io/pr/5659-common-panels View snapshot changes at kitdiff |
emilk
left a comment
There was a problem hiding this comment.
Thanks for the PR! Let's remove the .unwrap()s, add #[deprecated aliases for backwards compatibility/migration, and then test thoroughly :)
Panel to replace SidePanel and TopBottomPanel
This combines `SidePanel` and `TopBottomPanel` into a single `Panel`. The old types are still there as type aliases, but are deprecated. `.min_width(…)` etc are now called `.min_size(…)` etc. Again, the old names are still there, but deprecated. (edited by @emilk) --------- Co-authored-by: Emil Ernerfeldt <[email protected]>
This combines
SidePanelandTopBottomPanelinto a singlePanel.The old types are still there as type aliases, but are deprecated.
.min_width(…)etc are now called.min_size(…)etc.Again, the old names are still there, but deprecated.
(edited by @emilk)