Skip to content

Commit

Permalink
Improve docstring for Frame with another example
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Jan 25, 2024
1 parent acb5208 commit 69e93ab
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion crates/egui/src/containers/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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 {
Expand Down

0 comments on commit 69e93ab

Please sign in to comment.