@@ -161,8 +161,10 @@ pub struct State<'a, 'b> {
161161
162162/// Convenience trait for code generic over contexts.
163163///
164- /// Methods to do with commands and timers.
165- /// Available to all contexts but PaintCtx.
164+ /// Methods that deal with commands and timers.
165+ /// Available to all contexts but [`PaintCtx`].
166+ ///
167+ /// [`PaintCtx`](PaintCtx)
166168pub trait ChangeCtx < ' b > {
167169 /// Submit a [`Command`] to be run after this event is handled. See [`submit_command`].
168170 ///
@@ -446,7 +448,7 @@ impl_context_method!(
446448 /// Returns `true` if either this specific widget or any one of its descendants is focused.
447449 /// To check if only this specific widget is focused use [`is_focused`],
448450 ///
449- /// [`is_focused`]: #method. is_focused
451+ /// [`is_focused`]: crate::EventCtx:: is_focused
450452 pub fn has_focus( & self ) -> bool {
451453 self . widget_state. has_focus
452454 }
@@ -463,7 +465,7 @@ impl_context_method!(
463465 /// For an example the decrease button of a counter of type `usize` should be disabled if the
464466 /// value is `0`.
465467 ///
466- /// [`set_disabled`]: EventCtx::set_disabled
468+ /// [`set_disabled`]: crate:: EventCtx::set_disabled
467469 pub fn is_disabled( & self ) -> bool {
468470 self . widget_state. is_disabled( )
469471 }
@@ -478,10 +480,10 @@ impl_context_method!(EventCtx<'_, '_>, UpdateCtx<'_, '_>, {
478480 /// cursor, the child widget's cursor will take precedence. (If that isn't what you want, use
479481 /// [`override_cursor`] instead.)
480482 ///
481- /// [`clear_cursor`]: EventCtx::clear_cursor
482- /// [`override_cursor`]: EventCtx::override_cursor
483- /// [`hot`]: EventCtx::is_hot
484- /// [`active`]: EventCtx::is_active
483+ /// [`clear_cursor`]: crate:: EventCtx::clear_cursor
484+ /// [`override_cursor`]: crate:: EventCtx::override_cursor
485+ /// [`hot`]: crate:: EventCtx::is_hot
486+ /// [`active`]: crate:: EventCtx::is_active
485487 pub fn set_cursor( & mut self , cursor: & Cursor ) {
486488 trace!( "set_cursor {:?}" , cursor) ;
487489 self . widget_state. cursor_change = CursorChange :: Set ( cursor. clone( ) ) ;
@@ -493,10 +495,10 @@ impl_context_method!(EventCtx<'_, '_>, UpdateCtx<'_, '_>, {
493495 /// effect when this widget is either [`hot`] or [`active`]. This will override the cursor
494496 /// preferences of a child widget. (If that isn't what you want, use [`set_cursor`] instead.)
495497 ///
496- /// [`clear_cursor`]: EventCtx::clear_cursor
497- /// [`set_cursor`]: EventCtx::override_cursor
498- /// [`hot`]: EventCtx::is_hot
499- /// [`active`]: EventCtx::is_active
498+ /// [`clear_cursor`]: crate:: EventCtx::clear_cursor
499+ /// [`set_cursor`]: crate:: EventCtx::set_cursor
500+ /// [`hot`]: crate:: EventCtx::is_hot
501+ /// [`active`]: crate:: EventCtx::is_active
500502 pub fn override_cursor( & mut self , cursor: & Cursor ) {
501503 trace!( "override_cursor {:?}" , cursor) ;
502504 self . widget_state. cursor_change = CursorChange :: Override ( cursor. clone( ) ) ;
@@ -506,20 +508,26 @@ impl_context_method!(EventCtx<'_, '_>, UpdateCtx<'_, '_>, {
506508 ///
507509 /// This undoes the effect of [`set_cursor`] and [`override_cursor`].
508510 ///
509- /// [`override_cursor`]: EventCtx::override_cursor
510- /// [`set_cursor`]: EventCtx::set_cursor
511+ /// [`override_cursor`]: crate:: EventCtx::override_cursor
512+ /// [`set_cursor`]: crate:: EventCtx::set_cursor
511513 pub fn clear_cursor( & mut self ) {
512514 trace!( "clear_cursor" ) ;
513515 self . widget_state. cursor_change = CursorChange :: Default ;
514516 }
515517} ) ;
516518
517- //methods on event, update and layout.
519+ // methods on event, update and layout.
518520impl_context_method ! ( EventCtx <' _, ' _>, UpdateCtx <' _, ' _>, LayoutCtx <' _, ' _>, {
519- /// Indicate that your view_context has changed.
521+ /// Indicate that your [`ViewContext`] has changed.
522+ ///
523+ /// This event is sent after layout is done and before paint is called. Note that you can still
524+ /// receive this event even if there was no prior call to layout.
525+ ///
526+ /// Widgets must call this method after changing the clip region of their children.
527+ /// Changes to the other parts of [`ViewContext`] (cursor position and global origin) are tracked
528+ /// internally.
520529 ///
521- /// Widgets must call this method after changing the clip region of thier children.
522- /// The other parts of view_context (cursor_position and global origin) are tracked internally.
530+ /// [`ViewContext`]: crate::ViewContext
523531 pub fn view_context_changed( & mut self ) {
524532 self . widget_state. view_context_changed = true ;
525533 }
0 commit comments