diff options
Diffstat (limited to 'native/src/widget/pane_grid')
-rw-r--r-- | native/src/widget/pane_grid/configuration.rs | 12 | ||||
-rw-r--r-- | native/src/widget/pane_grid/content.rs | 16 | ||||
-rw-r--r-- | native/src/widget/pane_grid/node.rs | 22 | ||||
-rw-r--r-- | native/src/widget/pane_grid/pane.rs | 2 | ||||
-rw-r--r-- | native/src/widget/pane_grid/split.rs | 2 | ||||
-rw-r--r-- | native/src/widget/pane_grid/state.rs | 42 | ||||
-rw-r--r-- | native/src/widget/pane_grid/title_bar.rs | 23 |
7 files changed, 19 insertions, 100 deletions
diff --git a/native/src/widget/pane_grid/configuration.rs b/native/src/widget/pane_grid/configuration.rs index 1fed98b7..4c43826e 100644 --- a/native/src/widget/pane_grid/configuration.rs +++ b/native/src/widget/pane_grid/configuration.rs @@ -2,7 +2,7 @@ use crate::pane_grid::Axis; /// The arrangement of a [`PaneGrid`]. /// -/// [`PaneGrid`]: struct.PaneGrid.html +/// [`PaneGrid`]: crate::pane_grid::PaneGrid #[derive(Debug, Clone)] pub enum Configuration<T> { /// A split of the available space. @@ -13,18 +13,14 @@ pub enum Configuration<T> { /// The ratio of the split in [0.0, 1.0]. ratio: f32, - /// The left/top [`Content`] of the split. - /// - /// [`Configuration`]: enum.Node.html + /// The left/top [`Configuration`] of the split. a: Box<Configuration<T>>, - /// The right/bottom [`Content`] of the split. - /// - /// [`Configuration`]: enum.Node.html + /// The right/bottom [`Configuration`] of the split. b: Box<Configuration<T>>, }, /// A [`Pane`]. /// - /// [`Pane`]: struct.Pane.html + /// [`Pane`]: crate::pane_grid::Pane Pane(T), } diff --git a/native/src/widget/pane_grid/content.rs b/native/src/widget/pane_grid/content.rs index 2dac7060..c9981903 100644 --- a/native/src/widget/pane_grid/content.rs +++ b/native/src/widget/pane_grid/content.rs @@ -7,7 +7,7 @@ use crate::{Clipboard, Element, Hasher, Layout, Point, Size}; /// The content of a [`Pane`]. /// -/// [`Pane`]: struct.Pane.html +/// [`Pane`]: crate::widget::pane_grid::Pane #[allow(missing_debug_implementations)] pub struct Content<'a, Message, Renderer: pane_grid::Renderer> { title_bar: Option<TitleBar<'a, Message, Renderer>>, @@ -20,8 +20,6 @@ where Renderer: pane_grid::Renderer, { /// Creates a new [`Content`] with the provided body. - /// - /// [`Content`]: struct.Content.html pub fn new(body: impl Into<Element<'a, Message, Renderer>>) -> Self { Self { title_bar: None, @@ -31,9 +29,6 @@ where } /// Sets the [`TitleBar`] of this [`Content`]. - /// - /// [`TitleBar`]: struct.TitleBar.html - /// [`Content`]: struct.Content.html pub fn title_bar( mut self, title_bar: TitleBar<'a, Message, Renderer>, @@ -43,8 +38,6 @@ where } /// Sets the style of the [`Content`]. - /// - /// [`Content`]: struct.Content.html pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { self.style = style.into(); self @@ -57,9 +50,7 @@ where { /// Draws the [`Content`] with the provided [`Renderer`] and [`Layout`]. /// - /// [`Content`]: struct.Content.html - /// [`Renderer`]: trait.Renderer.html - /// [`Layout`]: ../layout/struct.Layout.html + /// [`Renderer`]: crate::widget::pane_grid::Renderer pub fn draw( &self, renderer: &mut Renderer, @@ -94,9 +85,6 @@ where /// Returns whether the [`Content`] with the given [`Layout`] can be picked /// at the provided cursor position. - /// - /// [`Content`]: struct.Content.html - /// [`Layout`]: ../layout/struct.Layout.html pub fn can_be_picked_at( &self, layout: Layout<'_>, diff --git a/native/src/widget/pane_grid/node.rs b/native/src/widget/pane_grid/node.rs index cbfd8a43..319936fc 100644 --- a/native/src/widget/pane_grid/node.rs +++ b/native/src/widget/pane_grid/node.rs @@ -7,17 +7,12 @@ use std::collections::HashMap; /// A layout node of a [`PaneGrid`]. /// -/// [`PaneGrid`]: struct.PaneGrid.html +/// [`PaneGrid`]: crate::widget::PaneGrid #[derive(Debug, Clone)] pub enum Node { /// The region of this [`Node`] is split into two. - /// - /// [`Node`]: enum.Node.html Split { /// The [`Split`] of this [`Node`]. - /// - /// [`Split`]: struct.Split.html - /// [`Node`]: enum.Node.html id: Split, /// The direction of the split. @@ -27,26 +22,17 @@ pub enum Node { ratio: f32, /// The left/top [`Node`] of the split. - /// - /// [`Node`]: enum.Node.html a: Box<Node>, /// The right/bottom [`Node`] of the split. - /// - /// [`Node`]: enum.Node.html b: Box<Node>, }, /// The region of this [`Node`] is taken by a [`Pane`]. - /// - /// [`Pane`]: struct.Pane.html Pane(Pane), } impl Node { /// Returns an iterator over each [`Split`] in this [`Node`]. - /// - /// [`Split`]: struct.Split.html - /// [`Node`]: enum.Node.html pub fn splits(&self) -> impl Iterator<Item = &Split> { let mut unvisited_nodes = vec![self]; @@ -69,9 +55,6 @@ impl Node { /// Returns the rectangular region for each [`Pane`] in the [`Node`] given /// the spacing between panes and the total available space. - /// - /// [`Pane`]: struct.Pane.html - /// [`Node`]: enum.Node.html pub fn pane_regions( &self, spacing: f32, @@ -96,9 +79,6 @@ impl Node { /// Returns the axis, rectangular region, and ratio for each [`Split`] in /// the [`Node`] given the spacing between panes and the total available /// space. - /// - /// [`Split`]: struct.Split.html - /// [`Node`]: enum.Node.html pub fn split_regions( &self, spacing: f32, diff --git a/native/src/widget/pane_grid/pane.rs b/native/src/widget/pane_grid/pane.rs index f9866407..39d9f3ef 100644 --- a/native/src/widget/pane_grid/pane.rs +++ b/native/src/widget/pane_grid/pane.rs @@ -1,5 +1,5 @@ /// A rectangular region in a [`PaneGrid`] used to display widgets. /// -/// [`PaneGrid`]: struct.PaneGrid.html +/// [`PaneGrid`]: crate::widget::PaneGrid #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct Pane(pub(super) usize); diff --git a/native/src/widget/pane_grid/split.rs b/native/src/widget/pane_grid/split.rs index d020c510..16975abc 100644 --- a/native/src/widget/pane_grid/split.rs +++ b/native/src/widget/pane_grid/split.rs @@ -1,5 +1,5 @@ /// A divider that splits a region in a [`PaneGrid`] into two different panes. /// -/// [`PaneGrid`]: struct.PaneGrid.html +/// [`PaneGrid`]: crate::widget::PaneGrid #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct Split(pub(super) usize); diff --git a/native/src/widget/pane_grid/state.rs b/native/src/widget/pane_grid/state.rs index 7a51781e..666e1ca0 100644 --- a/native/src/widget/pane_grid/state.rs +++ b/native/src/widget/pane_grid/state.rs @@ -15,11 +15,8 @@ use std::collections::HashMap; /// provided to the view function of [`PaneGrid::new`] for displaying each /// [`Pane`]. /// -/// [`PaneGrid`]: struct.PaneGrid.html -/// [`PaneGrid::new`]: struct.PaneGrid.html#method.new -/// [`Pane`]: struct.Pane.html -/// [`Split`]: struct.Split.html -/// [`State`]: struct.State.html +/// [`PaneGrid`]: crate::widget::PaneGrid +/// [`PaneGrid::new`]: crate::widget::PaneGrid::new #[derive(Debug, Clone)] pub struct State<T> { pub(super) panes: HashMap<Pane, T>, @@ -31,9 +28,6 @@ impl<T> State<T> { /// state. /// /// Alongside the [`State`], it returns the first [`Pane`] identifier. - /// - /// [`State`]: struct.State.html - /// [`Pane`]: struct.Pane.html pub fn new(first_pane_state: T) -> (Self, Pane) { ( Self::with_configuration(Configuration::Pane(first_pane_state)), @@ -42,9 +36,6 @@ impl<T> State<T> { } /// Creates a new [`State`] with the given [`Configuration`]. - /// - /// [`State`]: struct.State.html - /// [`Configuration`]: enum.Configuration.html pub fn with_configuration(config: impl Into<Configuration<T>>) -> Self { let mut panes = HashMap::new(); @@ -62,54 +53,40 @@ impl<T> State<T> { } /// Returns the total amount of panes in the [`State`]. - /// - /// [`State`]: struct.State.html pub fn len(&self) -> usize { self.panes.len() } /// Returns the internal state of the given [`Pane`], if it exists. - /// - /// [`Pane`]: struct.Pane.html pub fn get(&self, pane: &Pane) -> Option<&T> { self.panes.get(pane) } /// Returns the internal state of the given [`Pane`] with mutability, if it /// exists. - /// - /// [`Pane`]: struct.Pane.html pub fn get_mut(&mut self, pane: &Pane) -> Option<&mut T> { self.panes.get_mut(pane) } /// Returns an iterator over all the panes of the [`State`], alongside its /// internal state. - /// - /// [`State`]: struct.State.html pub fn iter(&self) -> impl Iterator<Item = (&Pane, &T)> { self.panes.iter() } /// Returns a mutable iterator over all the panes of the [`State`], /// alongside its internal state. - /// - /// [`State`]: struct.State.html pub fn iter_mut(&mut self) -> impl Iterator<Item = (&Pane, &mut T)> { self.panes.iter_mut() } /// Returns the layout of the [`State`]. - /// - /// [`State`]: struct.State.html pub fn layout(&self) -> &Node { &self.internal.layout } /// Returns the adjacent [`Pane`] of another [`Pane`] in the given /// direction, if there is one. - /// - /// [`Pane`]: struct.Pane.html pub fn adjacent(&self, pane: &Pane, direction: Direction) -> Option<Pane> { let regions = self .internal @@ -145,9 +122,6 @@ impl<T> State<T> { /// Splits the given [`Pane`] into two in the given [`Axis`] and /// initializing the new [`Pane`] with the provided internal state. - /// - /// [`Pane`]: struct.Pane.html - /// [`Axis`]: enum.Axis.html pub fn split( &mut self, axis: Axis, @@ -180,9 +154,8 @@ impl<T> State<T> { /// If you want to swap panes on drag and drop in your [`PaneGrid`], you /// will need to call this method when handling a [`DragEvent`]. /// - /// [`State`]: struct.State.html - /// [`PaneGrid`]: struct.PaneGrid.html - /// [`DragEvent`]: struct.DragEvent.html + /// [`PaneGrid`]: crate::widget::PaneGrid + /// [`DragEvent`]: crate::widget::pane_grid::DragEvent pub fn swap(&mut self, a: &Pane, b: &Pane) { self.internal.layout.update(&|node| match node { Node::Split { .. } => {} @@ -204,17 +177,14 @@ impl<T> State<T> { /// If you want to enable resize interactions in your [`PaneGrid`], you will /// need to call this method when handling a [`ResizeEvent`]. /// - /// [`Split`]: struct.Split.html - /// [`PaneGrid`]: struct.PaneGrid.html - /// [`ResizeEvent`]: struct.ResizeEvent.html + /// [`PaneGrid`]: crate::widget::PaneGrid + /// [`ResizeEvent`]: crate::widget::pane_grid::ResizeEvent pub fn resize(&mut self, split: &Split, ratio: f32) { let _ = self.internal.layout.resize(split, ratio); } /// Closes the given [`Pane`] and returns its internal state and its closest /// sibling, if it exists. - /// - /// [`Pane`]: struct.Pane.html pub fn close(&mut self, pane: &Pane) -> Option<(T, Pane)> { if let Some(sibling) = self.internal.layout.remove(pane) { self.panes.remove(pane).map(|state| (state, sibling)) diff --git a/native/src/widget/pane_grid/title_bar.rs b/native/src/widget/pane_grid/title_bar.rs index f8ff43eb..475cb9ae 100644 --- a/native/src/widget/pane_grid/title_bar.rs +++ b/native/src/widget/pane_grid/title_bar.rs @@ -5,7 +5,7 @@ use crate::{Clipboard, Element, Hasher, Layout, Point, Rectangle, Size}; /// The title bar of a [`Pane`]. /// -/// [`Pane`]: struct.Pane.html +/// [`Pane`]: crate::widget::pane_grid::Pane #[allow(missing_debug_implementations)] pub struct TitleBar<'a, Message, Renderer: pane_grid::Renderer> { title: String, @@ -21,8 +21,6 @@ where Renderer: pane_grid::Renderer, { /// Creates a new [`TitleBar`] with the given title. - /// - /// [`TitleBar`]: struct.TitleBar.html pub fn new(title: impl Into<String>) -> Self { Self { title: title.into(), @@ -35,16 +33,12 @@ where } /// Sets the size of the title of the [`TitleBar`]. - /// - /// [`TitleBar`]: struct.TitleBar.html pub fn title_size(mut self, size: u16) -> Self { self.title_size = Some(size); self } /// Sets the controls of the [`TitleBar`]. - /// - /// [`TitleBar`]: struct.TitleBar.html pub fn controls( mut self, controls: impl Into<Element<'a, Message, Renderer>>, @@ -54,16 +48,12 @@ where } /// Sets the padding of the [`TitleBar`]. - /// - /// [`TitleBar`]: struct.TitleBar.html pub fn padding(mut self, units: u16) -> Self { self.padding = units; self } /// Sets the style of the [`TitleBar`]. - /// - /// [`TitleBar`]: struct.TitleBar.html pub fn style(mut self, style: impl Into<Renderer::Style>) -> Self { self.style = style.into(); self @@ -75,9 +65,8 @@ where /// By default, the controls are only visible when the [`Pane`] of this /// [`TitleBar`] is hovered. /// - /// [`TitleBar`]: struct.TitleBar.html - /// [`controls`]: struct.TitleBar.html#method.controls - /// [`Pane`]: struct.Pane.html + /// [`controls`]: Self::controls + /// [`Pane`]: crate::widget::pane_grid::Pane pub fn always_show_controls(mut self) -> Self { self.always_show_controls = true; self @@ -90,9 +79,7 @@ where { /// Draws the [`TitleBar`] with the provided [`Renderer`] and [`Layout`]. /// - /// [`TitleBar`]: struct.TitleBar.html - /// [`Renderer`]: trait.Renderer.html - /// [`Layout`]: ../layout/struct.Layout.html + /// [`Renderer`]: crate::widget::pane_grid::Renderer pub fn draw( &self, renderer: &mut Renderer, @@ -152,8 +139,6 @@ where /// [`TitleBar`] or not. /// /// The whole [`TitleBar`] is a pick area, except its controls. - /// - /// [`TitleBar`]: struct.TitleBar.html pub fn is_over_pick_area( &self, layout: Layout<'_>, |