pub struct RebuildCx<'a, 'b> { /* private fields */ }
Expand description
A context for rebuilding the view tree.
Implementations§
Source§impl<'a, 'b> RebuildCx<'a, 'b>
impl<'a, 'b> RebuildCx<'a, 'b>
Sourcepub fn new(base: &'a mut BaseCx<'b>, view_state: &'a mut ViewState) -> Self
pub fn new(base: &'a mut BaseCx<'b>, view_state: &'a mut ViewState) -> Self
Create a new rebuild context.
Sourcepub fn as_build_cx(&mut self) -> BuildCx<'_, 'b>
pub fn as_build_cx(&mut self) -> BuildCx<'_, 'b>
Get a build context.
Sourcepub fn as_layout_cx(&mut self) -> LayoutCx<'_, 'b>
pub fn as_layout_cx(&mut self) -> LayoutCx<'_, 'b>
Get a layout context.
Source§impl RebuildCx<'_, '_>
impl RebuildCx<'_, '_>
Sourcepub fn window_mut(&mut self) -> &mut Window
pub fn window_mut(&mut self) -> &mut Window
Get the window mutably.
Sourcepub fn is_hovered(&self) -> bool
pub fn is_hovered(&self) -> bool
Get whether the view is hovered.
Sourcepub fn is_focused(&self) -> bool
pub fn is_focused(&self) -> bool
Get whether the view is focused.
Sourcepub fn is_focusable(&self) -> bool
pub fn is_focusable(&self) -> bool
Get whether the view is focusable.
Sourcepub fn has_hovered(&self) -> bool
pub fn has_hovered(&self) -> bool
Get whether a child view is hovered.
Sourcepub fn has_focused(&self) -> bool
pub fn has_focused(&self) -> bool
Get whether a child view is focused.
Sourcepub fn has_active(&self) -> bool
pub fn has_active(&self) -> bool
Get whether a child view is active.
Sourcepub fn contains_property<T: 'static>(&self) -> bool
pub fn contains_property<T: 'static>(&self) -> bool
Check if the view has the property T
.
Sourcepub fn insert_property<T: 'static>(&mut self, item: T)
pub fn insert_property<T: 'static>(&mut self, item: T)
Insert a property into the view.
Sourcepub fn remove_property<T: 'static>(&mut self) -> Option<T>
pub fn remove_property<T: 'static>(&mut self) -> Option<T>
Remove a property from the view.
Sourcepub fn get_property<T: 'static>(&self) -> Option<&T>
pub fn get_property<T: 'static>(&self) -> Option<&T>
Get the property T
of the view.
Sourcepub fn get_property_mut<T: 'static>(&mut self) -> Option<&mut T>
pub fn get_property_mut<T: 'static>(&mut self) -> Option<&mut T>
Get the property T
of the view mutably.
Sourcepub fn property_or_insert_with<T: 'static, F: FnOnce() -> T>(
&mut self,
f: F,
) -> &mut T
pub fn property_or_insert_with<T: 'static, F: FnOnce() -> T>( &mut self, f: F, ) -> &mut T
Get the property T
of the view or insert it with a value.
Sourcepub fn property_or<T: 'static>(&mut self, item: T) -> &mut T
pub fn property_or<T: 'static>(&mut self, item: T) -> &mut T
Get the property T
of the view or insert it with a value.
Sourcepub fn property_or_default<T: 'static + Default>(&mut self) -> &mut T
pub fn property_or_default<T: 'static + Default>(&mut self) -> &mut T
Get the property T
of the view or insert it with a default value.
Source§impl RebuildCx<'_, '_>
impl RebuildCx<'_, '_>
Sourcepub fn focus_next(&mut self)
pub fn focus_next(&mut self)
Request the next focusable view to be focused.
Sourcepub fn focus_prev(&mut self)
pub fn focus_prev(&mut self)
Request the previous focusable view to be focused.
Sourcepub fn set_cursor(&mut self, cursor: Option<Cursor>)
pub fn set_cursor(&mut self, cursor: Option<Cursor>)
Set the cursor of the view.
Sourcepub fn set_hovered(&mut self, hovered: bool) -> bool
pub fn set_hovered(&mut self, hovered: bool) -> bool
Set whether the view is hovered.
Returns true
if the hovered state changed.
Sourcepub fn set_focused(&mut self, focused: bool) -> bool
pub fn set_focused(&mut self, focused: bool) -> bool
Set whether the view is focused.
Returns true
if the focused state changed.
Sourcepub fn set_active(&mut self, active: bool) -> bool
pub fn set_active(&mut self, active: bool) -> bool
Set whether the view is active.
Returns true
if the active state changed.
Sourcepub fn set_focusable(&mut self, focusable: bool) -> bool
pub fn set_focusable(&mut self, focusable: bool) -> bool
Set whether the view is focusable.
Returns true
if the focusable state changed.
Methods from Deref<Target = BaseCx<'b>>§
Sourcepub fn measure_paragraph(&mut self, paragraph: &Paragraph, width: f32) -> Size
pub fn measure_paragraph(&mut self, paragraph: &Paragraph, width: f32) -> Size
Measure a paragraph.
Sourcepub fn layout_paragraph(
&mut self,
paragraph: &Paragraph,
width: f32,
) -> Vec<TextLayoutLine>
pub fn layout_paragraph( &mut self, paragraph: &Paragraph, width: f32, ) -> Vec<TextLayoutLine>
Layout a paragraph.
Sourcepub fn proxy(&self) -> CommandProxy
pub fn proxy(&self) -> CommandProxy
Get the CommandProxy
.
Sourcepub fn spawn_async(&mut self, future: impl Future<Output = ()> + Send + 'static)
pub fn spawn_async(&mut self, future: impl Future<Output = ()> + Send + 'static)
Spawn a future.
Sourcepub fn cmd_async<T: Any + Send>(
&self,
future: impl Future<Output = T> + Send + 'static,
)
pub fn cmd_async<T: Any + Send>( &self, future: impl Future<Output = T> + Send + 'static, )
Spawn a future sending a command when it completes.
Sourcepub fn contexts_mut(&mut self) -> &mut Contexts
pub fn contexts_mut(&mut self) -> &mut Contexts
Get a mutable reference to the Contexts
.
Sourcepub fn insert_context<T: Any>(&mut self, context: T) -> Option<T>
pub fn insert_context<T: Any>(&mut self, context: T) -> Option<T>
Insert a context.
Sourcepub fn contains_context<T: Any>(&self) -> bool
pub fn contains_context<T: Any>(&self) -> bool
Check if a context is contained.
Sourcepub fn remove_context<T: Any>(&mut self) -> Option<T>
pub fn remove_context<T: Any>(&mut self) -> Option<T>
Remove a context.
Sourcepub fn get_context<T: Any>(&self) -> Option<&T>
pub fn get_context<T: Any>(&self) -> Option<&T>
Get a context.
Sourcepub fn get_context_mut<T: Any>(&mut self) -> Option<&mut T>
pub fn get_context_mut<T: Any>(&mut self) -> Option<&mut T>
Get a mutable context.
Sourcepub fn context_mut<T: Any>(&mut self) -> &mut T
pub fn context_mut<T: Any>(&mut self) -> &mut T
Sourcepub fn context_or_default<T: Any + Default>(&mut self) -> &mut T
pub fn context_or_default<T: Any + Default>(&mut self) -> &mut T
Get a context or insert a default
.