From 69e93ab544e84c281dd91199707981c75d694af0 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Thu, 25 Jan 2024 19:52:59 +0100 Subject: [PATCH] Improve docstring for Frame with another example --- crates/egui/src/containers/frame.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/crates/egui/src/containers/frame.rs b/crates/egui/src/containers/frame.rs index 11269d11d71..bd7f8eb7029 100644 --- a/crates/egui/src/containers/frame.rs +++ b/crates/egui/src/containers/frame.rs @@ -21,7 +21,22 @@ use epaint::*; /// /// ``` /// # egui::__run_test_ui(|ui| { -/// let frame = egui::Frame::default().inner_margin(4.0).begin(ui); +/// let mut frame = egui::Frame::default().inner_margin(4.0).begin(ui); +/// { +/// let response = frame.content_ui.label("Inside the frame"); +/// if response.hovered() { +/// frame.frame.fill = egui::Color32::RED; +/// } +/// } +/// frame.end(ui); // Will "close" the frame. +/// # }); +/// ``` +/// +/// You can also respond to the hovering of the frame itself: +/// +/// ``` +/// # egui::__run_test_ui(|ui| { +/// let mut frame = egui::Frame::default().inner_margin(4.0).begin(ui); /// { /// frame.content_ui.label("Inside the frame"); /// frame.content_ui.label("This too"); @@ -35,6 +50,7 @@ use epaint::*; /// ``` /// /// Note that you cannot change the margins after calling `begin`. +#[doc(alias = "border")] #[derive(Clone, Copy, Debug, Default, PartialEq)] #[must_use = "You should call .show()"] pub struct Frame {