From ea10add1cb81bad92b43a83e961e2319cd46e99d Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Sat, 19 Dec 2020 11:14:59 +0100 Subject: [PATCH] Deprecate left/centered/right column functions in Ui --- CHANGELOG.md | 3 ++- egui/src/demos/fractal_clock.rs | 8 ++++---- egui/src/ui.rs | 7 +++++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index de2303aa..5a11b845 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,7 +30,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). * `egui::App`: added `fn name(&self)` and `fn clear_color(&self)`. ### Deprecated -* Deprecated `RawInput::screen_size` - use `RawInput::screen_rect` instead. +* `RawInput::screen_size` - use `RawInput::screen_rect` instead. +* left/centered/right column functions on `Ui`. ## 0.5.0 - 2020-12-13 diff --git a/egui/src/demos/fractal_clock.rs b/egui/src/demos/fractal_clock.rs index 22035b71..5edb8b2c 100644 --- a/egui/src/demos/fractal_clock.rs +++ b/egui/src/demos/fractal_clock.rs @@ -58,17 +58,17 @@ impl FractalClock { ui.available_rect_before_wrap_finite(), ); self.paint(&painter); + // Make sure we allocate what we used (everything) + ui.expand_to_include_rect(painter.clip_rect()); Frame::popup(ui.style()) .fill(Rgba::luminance_alpha(0.02, 0.5).into()) .stroke(Stroke::none()) - .show(&mut ui.left_column(320.0), |ui| { + .show(ui, |ui| { + ui.set_max_width(270.0); CollapsingHeader::new("Settings") .show(ui, |ui| self.options_ui(ui, seconds_since_midnight)); }); - - // Make sure we allocate what we used (everything) - ui.allocate_space(painter.clip_rect().size()); } fn options_ui(&mut self, ui: &mut Ui, seconds_since_midnight: Option) { diff --git a/egui/src/ui.rs b/egui/src/ui.rs index d89ba56d..5f0db349 100644 --- a/egui/src/ui.rs +++ b/egui/src/ui.rs @@ -834,19 +834,26 @@ impl Ui { (ret, self.interact_hover(rect)) } + #[deprecated] pub fn left_column(&mut self, width: f32) -> Self { + #[allow(deprecated)] self.column(Align::Min, width) } + #[deprecated] pub fn centered_column(&mut self, width: f32) -> Self { + #[allow(deprecated)] self.column(Align::Center, width) } + #[deprecated] pub fn right_column(&mut self, width: f32) -> Self { + #[allow(deprecated)] self.column(Align::Max, width) } /// A column ui with a given width. + #[deprecated] pub fn column(&mut self, column_position: Align, width: f32) -> Self { let x = match column_position { Align::Min => 0.0,