masonry: Update more docs to use non-HTML links. (#327)

This commit is contained in:
Bruce Mitchener 2024-06-03 18:29:51 +07:00 committed by GitHub
parent 94d8f50947
commit 8c06d3a9bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 34 deletions

View File

@ -59,7 +59,7 @@ pub struct EventCtx<'a> {
/// A context provided to the [`lifecycle`] method on widgets.
///
/// [`lifecycle`]: trait.Widget.html#tymethod.lifecycle
/// [`lifecycle`]: Widget::lifecycle
pub struct LifeCycleCtx<'a> {
pub(crate) global_state: &'a mut RenderRootState,
pub(crate) widget_state: &'a mut WidgetState,
@ -145,7 +145,7 @@ impl_context_method!(
/// Generally it will be the same as the size returned by the child widget's
/// [`layout`] method.
///
/// [`layout`]: trait.Widget.html#tymethod.layout
/// [`layout`]: Widget::layout
pub fn size(&self) -> Size {
self.widget_state.size()
}
@ -203,15 +203,15 @@ impl_context_method!(
/// A widget can request focus using the [`request_focus`] method.
/// It's also possible to register for automatic focus via [`register_for_focus`].
///
/// If a widget gains or loses focus it will get a [`LifeCycle::FocusChanged`] event.
/// If a widget gains or loses focus it will get a [`StatusChange::FocusChanged`] event.
///
/// Only one widget at a time is focused. However due to the way events are routed,
/// all ancestors of that widget will also receive keyboard events.
///
/// [`request_focus`]: struct.EventCtx.html#method.request_focus
/// [`register_for_focus`]: struct.LifeCycleCtx.html#method.register_for_focus
/// [`LifeCycle::FocusChanged`]: enum.LifeCycle.html#variant.FocusChanged
/// [`has_focus`]: #method.has_focus
/// [`request_focus`]: EventCtx::request_focus
/// [`register_for_focus`]: LifeCycleCtx::register_for_focus
/// [`StatusChange::FocusChanged`]: crate::StatusChange::FocusChanged
/// [`has_focus`]: Self::has_focus
pub fn is_focused(&self) -> bool {
self.global_state.focused_widget == Some(self.widget_id())
}
@ -404,7 +404,7 @@ impl_context_method!(WidgetCtx<'_>, EventCtx<'_>, LifeCycleCtx<'_>, {
///
/// Calling this method during [`LifeCycle::DisabledChanged`] has no effect.
///
/// [`LifeCycle::DisabledChanged`]: struct.LifeCycle.html#variant.DisabledChanged
/// [`LifeCycle::DisabledChanged`]: crate::LifeCycle::DisabledChanged
/// [`is_disabled`]: EventCtx::is_disabled
pub fn set_disabled(&mut self, disabled: bool) {
// widget_state.children_disabled_changed is not set because we want to be able to delete
@ -578,7 +578,7 @@ impl LifeCycleCtx<'_> {
///
/// See [`EventCtx::is_focused`](Self::is_focused) for more information about focus.
///
/// [`LifeCycle::BuildFocusChain`]: enum.Lifecycle.html#variant.BuildFocusChain
/// [`LifeCycle::BuildFocusChain`]: crate::LifeCycle::BuildFocusChain
pub fn register_for_focus(&mut self) {
trace!("register_for_focus");
self.widget_state.focus_chain.push(self.widget_id());
@ -611,8 +611,7 @@ impl LayoutCtx<'_> {
///
/// For more information, see [`WidgetPod::paint_insets`].
///
/// [`Insets`]: struct.Insets.html
/// [`WidgetPod::paint_insets`]: struct.WidgetPod.html#method.paint_insets
/// [`WidgetPod::paint_insets`]: crate::widget::WidgetPod::paint_insets
pub fn set_paint_insets(&mut self, insets: impl Into<Insets>) {
let insets = insets.into();
trace!("set_paint_insets {:?}", insets);

View File

@ -122,16 +122,12 @@ impl Flex {
}
/// Builder-style method for specifying the childrens' [`CrossAxisAlignment`].
///
/// [`CrossAxisAlignment`]: enum.CrossAxisAlignment.html
pub fn cross_axis_alignment(mut self, alignment: CrossAxisAlignment) -> Self {
self.cross_alignment = alignment;
self
}
/// Builder-style method for specifying the childrens' [`MainAxisAlignment`].
///
/// [`MainAxisAlignment`]: enum.MainAxisAlignment.html
pub fn main_axis_alignment(mut self, alignment: MainAxisAlignment) -> Self {
self.main_alignment = alignment;
self
@ -243,24 +239,18 @@ impl Flex {
// --- MARK: WIDGETMUT---
impl<'a> WidgetMut<'a, Flex> {
/// Set the flex direction (see [`Axis`]).
///
/// [`Axis`]: enum.Axis.html
pub fn set_direction(&mut self, direction: Axis) {
self.widget.direction = direction;
self.ctx.request_layout();
}
/// Set the childrens' [`CrossAxisAlignment`].
///
/// [`CrossAxisAlignment`]: enum.CrossAxisAlignment.html
pub fn set_cross_axis_alignment(&mut self, alignment: CrossAxisAlignment) {
self.widget.cross_alignment = alignment;
self.ctx.request_layout();
}
/// Set the childrens' [`MainAxisAlignment`].
///
/// [`MainAxisAlignment`]: enum.MainAxisAlignment.html
pub fn set_main_axis_alignment(&mut self, alignment: MainAxisAlignment) {
self.widget.main_alignment = alignment;
self.ctx.request_layout();

View File

@ -117,8 +117,8 @@ impl SizedBox {
/// space. If you only care about expanding in one of width or height, use
/// [`expand_width`] or [`expand_height`] instead.
///
/// [`expand_height`]: #method.expand_height
/// [`expand_width`]: #method.expand_width
/// [`expand_height`]: Self::expand_height
/// [`expand_width`]: Self::expand_width
pub fn expand(mut self) -> Self {
self.width = Some(f64::INFINITY);
self.height = Some(f64::INFINITY);

View File

@ -79,8 +79,6 @@ impl<W: Widget> WidgetPod<W> {
}
/// Return `true` if the widget has received [`LifeCycle::WidgetAdded`].
///
/// [`LifeCycle::WidgetAdded`]: ./enum.LifeCycle.html#variant.WidgetAdded
pub fn is_initialized(&self) -> bool {
!self.state.is_new
}
@ -122,7 +120,7 @@ impl<W: Widget> WidgetPod<W> {
/// This rect will also be used to detect whether any given pointer event (eg clicks)
/// intersects with the rectangle.
///
/// [`layout`]: trait.Widget.html#tymethod.layout
/// [`layout`]: Widget::layout
/// [`place_child`]: LayoutCtx::place_child
pub fn layout_rect(&self) -> Rect {
self.state.layout_rect()
@ -151,9 +149,8 @@ impl<W: Widget> WidgetPod<W> {
/// A widget can set its insets by calling [`set_paint_insets`] during its
/// [`layout`] method.
///
/// [`Insets`]: struct.Insets.html
/// [`set_paint_insets`]: struct.LayoutCtx.html#method.set_paint_insets
/// [`layout`]: trait.Widget.html#tymethod.layout
/// [`set_paint_insets`]: LayoutCtx::set_paint_insets
/// [`layout`]: Widget::layout
pub fn paint_insets(&self) -> Insets {
self.state.paint_insets
}
@ -166,8 +163,7 @@ impl<W: Widget> WidgetPod<W> {
/// propagate a child's desired paint rect, if it extends beyond the bounds
/// of the parent's layout rect.
///
/// [`layout`]: trait.Widget.html#tymethod.layout
/// [`Insets`]: struct.Insets.html
/// [`layout`]: Widget::layout
pub fn compute_parent_paint_insets(&self, parent_size: Size) -> Insets {
let parent_bounds = Rect::ZERO.with_size(parent_size);
let union_pant_rect = self.paint_rect().union(parent_bounds);
@ -555,8 +551,6 @@ impl<W: Widget> WidgetPod<W> {
// - A widget only receives BuildFocusChain if none of its parents are hidden.
/// Propagate a [`LifeCycle`] event.
///
/// [`LifeCycle`]: enum.LifeCycle.html
pub fn lifecycle(&mut self, parent_ctx: &mut LifeCycleCtx, event: &LifeCycle) {
let _span = self.inner.make_trace_span().entered();
@ -817,7 +811,7 @@ impl<W: Widget> WidgetPod<W> {
/// Generally called by container widgets as part of their [`layout`]
/// method.
///
/// [`layout`]: trait.Widget.html#tymethod.layout
/// [`layout`]: Widget::layout
pub fn layout(&mut self, parent_ctx: &mut LayoutCtx, bc: &BoxConstraints) -> Size {
let _span = self.inner.make_trace_span().entered();