Some documentation improvements

This commit is contained in:
Emil Ernerfeldt 2021-05-08 09:25:52 +02:00
parent cb797a489a
commit 5e46bd404c
3 changed files with 10 additions and 2 deletions

View file

@ -60,6 +60,10 @@ impl Ui {
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Creation: // Creation:
/// Create a new `Ui`.
///
/// Normally you would not use this directly, but instead use
/// [`SidePanel`], [`TopPanel`], [`CentralPanel`], [`Window`] or [`Area`].
pub fn new(ctx: CtxRef, layer_id: LayerId, id: Id, max_rect: Rect, clip_rect: Rect) -> Self { pub fn new(ctx: CtxRef, layer_id: LayerId, id: Id, max_rect: Rect, clip_rect: Rect) -> Self {
let style = ctx.style(); let style = ctx.style();
Ui { Ui {
@ -72,6 +76,7 @@ impl Ui {
} }
} }
/// Create a new `Ui` at a specific region.
pub fn child_ui(&mut self, max_rect: Rect, layout: Layout) -> Self { pub fn child_ui(&mut self, max_rect: Rect, layout: Layout) -> Self {
debug_assert!(!max_rect.any_nan()); debug_assert!(!max_rect.any_nan());
let next_auto_id_source = Id::new(self.next_auto_id_source).with("child").value(); let next_auto_id_source = Id::new(self.next_auto_id_source).with("child").value();

View file

@ -145,9 +145,9 @@ impl Label {
self self
} }
/// Make the label response to clicks and/or drags. /// Make the label respond to clicks and/or drags.
/// ///
/// By default, a label is inert and does not response to click or drags. /// By default, a label is inert and does not respond to click or drags.
/// By calling this you can turn the label into a button of sorts. /// By calling this you can turn the label into a button of sorts.
/// This will also give the label the hover-effect of a button, but without the frame. /// This will also give the label the hover-effect of a button, but without the frame.
/// ///

View file

@ -215,6 +215,9 @@ impl Curve {
} }
/// Name of this curve. /// Name of this curve.
///
/// If a curve is given a name it will show up in the plot legend
/// (if legends are turned on).
#[allow(clippy::needless_pass_by_value)] #[allow(clippy::needless_pass_by_value)]
pub fn name(mut self, name: impl ToString) -> Self { pub fn name(mut self, name: impl ToString) -> Self {
self.name = name.to_string(); self.name = name.to_string();