diff --git a/egui/src/ui.rs b/egui/src/ui.rs index 3914df3e..7ed0f294 100644 --- a/egui/src/ui.rs +++ b/egui/src/ui.rs @@ -1222,6 +1222,7 @@ impl Ui { /// In particular, the space between widgets is the same width as the space character. /// /// You can still add any widgets to the layout (not only Labels). + #[deprecated = "Use horizontal instead and set the desired spacing manually with `ui.spacing_mut().item_spacing`"] pub fn horizontal_for_text( &mut self, text_style: TextStyle, @@ -1266,6 +1267,7 @@ impl Ui { /// and the line spacing is the same as that for text. /// /// You can still add any widgets to the layout (not only Labels). + #[deprecated = "Use horizontal_wrapped instead and set the desired spacing manually with `ui.spacing_mut().item_spacing`"] pub fn horizontal_wrapped_for_text( &mut self, text_style: TextStyle, diff --git a/egui_demo_lib/src/apps/demo/widget_gallery.rs b/egui_demo_lib/src/apps/demo/widget_gallery.rs index 18a0e527..997a4004 100644 --- a/egui_demo_lib/src/apps/demo/widget_gallery.rs +++ b/egui_demo_lib/src/apps/demo/widget_gallery.rs @@ -176,7 +176,7 @@ impl WidgetGallery { ui.add(doc_link_label("CollapsingHeader", "collapsing")); ui.collapsing("Click to see what is hidden!", |ui| { - ui.horizontal_wrapped_for_text(egui::TextStyle::Body, |ui| { + ui.horizontal_wrapped(|ui| { ui.label( "Not much, as it turns out - but here is a gold star for you for checking:", ); diff --git a/egui_demo_lib/src/apps/demo/widgets.rs b/egui_demo_lib/src/apps/demo/widgets.rs index 573727fc..53b40c4a 100644 --- a/egui_demo_lib/src/apps/demo/widgets.rs +++ b/egui_demo_lib/src/apps/demo/widgets.rs @@ -46,7 +46,10 @@ impl Widgets { ui.add(crate::__egui_github_link_file_line!()); }); - ui.horizontal_wrapped_for_text(TextStyle::Body, |ui| { + ui.horizontal_wrapped(|ui| { + // Trick so we don't have to add spaces in the text below: + ui.spacing_mut().item_spacing.x = ui.fonts()[TextStyle::Body].glyph_width(' '); + ui.add(Label::new("Text can have").text_color(Color32::from_rgb(110, 255, 110))); ui.colored_label(Color32::from_rgb(128, 140, 255), "color"); // Shortcut version ui.label("and tooltips.").on_hover_text( @@ -104,7 +107,7 @@ impl Widgets { ui.separator(); - ui.horizontal_for_text(TextStyle::Body, |ui| { + ui.horizontal(|ui| { ui.label("An angle:"); ui.drag_angle(&mut self.angle); ui.label(format!("≈ {:.3}τ", self.angle / std::f32::consts::TAU)) diff --git a/egui_demo_lib/src/wrap_app.rs b/egui_demo_lib/src/wrap_app.rs index 1edd5bac..e3d09af1 100644 --- a/egui_demo_lib/src/wrap_app.rs +++ b/egui_demo_lib/src/wrap_app.rs @@ -285,7 +285,7 @@ impl BackendPanel { "Everything you see is rendered as textured triangles. There is no DOM. There are no HTML elements. \ This is not JavaScript. This is Rust, running at 60 FPS. This is the web page, reinvented with game tech."); ui.label("This is also work in progress, and not ready for production... yet :)"); - ui.horizontal_wrapped_for_text(egui::TextStyle::Body, |ui| { + ui.horizontal_wrapped(|ui| { ui.label("Project home page:"); ui.hyperlink("https://github.com/emilk/egui"); });