pub struct ResizableGridWidget { /* private fields */ }Expand description
A widget that wraps ResizableGrid with mouse interaction support.
This widget manages hover state, drag state, and handles mouse events to resize dividers. It also provides styling options for visual feedback during interactions.
See the module-level docs for a minimal resizable split example.
§Example
use ratatui_toolkit::primitives::resizable_grid::{ResizableGridWidget, ResizableGrid};
let layout = ResizableGrid::new(0);
let state = ResizableGridWidgetState::default();
let widget = ResizableGridWidget::new(layout)
.with_divider_width(1)
.with_hit_threshold(2);Implementations§
Source§impl ResizableGridWidget
impl ResizableGridWidget
Sourcepub fn new(layout: ResizableGrid) -> ResizableGridWidget
Available on crate feature resizable-grid only.
pub fn new(layout: ResizableGrid) -> ResizableGridWidget
resizable-grid only.Create a new ResizableGridWidget owning the given ResizableGrid.
Sourcepub fn with_state(self, state: ResizableGridWidgetState) -> ResizableGridWidget
Available on crate feature resizable-grid only.
pub fn with_state(self, state: ResizableGridWidgetState) -> ResizableGridWidget
resizable-grid only.Set the widget state (for preserving hover/drag across frames).
Sourcepub fn state(&self) -> ResizableGridWidgetState
Available on crate feature resizable-grid only.
pub fn state(&self) -> ResizableGridWidgetState
resizable-grid only.Get the current widget state (for saving after frame).
Sourcepub fn optimal_poll_duration(&self) -> Duration
Available on crate feature resizable-grid only.
pub fn optimal_poll_duration(&self) -> Duration
resizable-grid only.Sourcepub fn layout(&self) -> &ResizableGrid
Available on crate feature resizable-grid only.
pub fn layout(&self) -> &ResizableGrid
resizable-grid only.Get a reference to the underlying layout.
Sourcepub fn layout_mut(&mut self) -> &mut ResizableGrid
Available on crate feature resizable-grid only.
pub fn layout_mut(&mut self) -> &mut ResizableGrid
resizable-grid only.Get a mutable reference to the underlying layout.
Sourcepub fn with_divider_width(self, width: u16) -> ResizableGridWidget
Available on crate feature resizable-grid only.
pub fn with_divider_width(self, width: u16) -> ResizableGridWidget
resizable-grid only.Set the width of divider lines.
Sourcepub fn with_hit_threshold(self, threshold: u16) -> ResizableGridWidget
Available on crate feature resizable-grid only.
pub fn with_hit_threshold(self, threshold: u16) -> ResizableGridWidget
resizable-grid only.Set the hit detection threshold for dividers.
Sourcepub fn with_hover_style(self, style: Style) -> ResizableGridWidget
Available on crate feature resizable-grid only.
pub fn with_hover_style(self, style: Style) -> ResizableGridWidget
resizable-grid only.Set the style for hovered dividers.
Sourcepub fn with_drag_style(self, style: Style) -> ResizableGridWidget
Available on crate feature resizable-grid only.
pub fn with_drag_style(self, style: Style) -> ResizableGridWidget
resizable-grid only.Set the style for dragging dividers.
Sourcepub fn with_divider_style(self, style: Style) -> ResizableGridWidget
Available on crate feature resizable-grid only.
pub fn with_divider_style(self, style: Style) -> ResizableGridWidget
resizable-grid only.Set the style for normal dividers.
Sourcepub fn with_block(self, block: Block<'static>) -> ResizableGridWidget
Available on crate feature resizable-grid only.
pub fn with_block(self, block: Block<'static>) -> ResizableGridWidget
resizable-grid only.Set the block to render around the widget.
Sourcepub fn with_pane_borders(self, show: bool) -> ResizableGridWidget
Available on crate feature resizable-grid only.
pub fn with_pane_borders(self, show: bool) -> ResizableGridWidget
resizable-grid only.Enable or disable pane borders.
Sourcepub fn is_hovering(&self) -> bool
Available on crate feature resizable-grid only.
pub fn is_hovering(&self) -> bool
resizable-grid only.Check if currently hovering over any divider.
Sourcepub fn is_dragging(&self) -> bool
Available on crate feature resizable-grid only.
pub fn is_dragging(&self) -> bool
resizable-grid only.Check if currently dragging any divider.
Sourcepub fn needs_fast_refresh(&self) -> bool
Available on crate feature resizable-grid only.
pub fn needs_fast_refresh(&self) -> bool
resizable-grid only.Check if the widget needs fast refresh (during drag operations).
Sourcepub fn hovered_divider(&self) -> Option<usize>
Available on crate feature resizable-grid only.
pub fn hovered_divider(&self) -> Option<usize>
resizable-grid only.Get the currently hovered divider index, if any.
Sourcepub fn dragging_divider(&self) -> Option<usize>
Available on crate feature resizable-grid only.
pub fn dragging_divider(&self) -> Option<usize>
resizable-grid only.Get the currently dragging divider index, if any.
Sourcepub fn handle_mouse(&mut self, mouse: MouseEvent, area: Rect)
Available on crate feature resizable-grid only.
pub fn handle_mouse(&mut self, mouse: MouseEvent, area: Rect)
resizable-grid only.Handle a mouse event.
This method processes mouse events and updates the widget’s state:
- Mouse move: Update hover state
- Mouse down: Start dragging if on a divider
- Mouse drag: Resize the divider
- Mouse up: Stop dragging
§Arguments
mouse- The mouse event to handlearea- The area the widget is rendered in
Sourcepub fn pane_layouts(&self, area: Rect) -> Vec<PaneLayout>
Available on crate feature resizable-grid only.
pub fn pane_layouts(&self, area: Rect) -> Vec<PaneLayout>
resizable-grid only.Get the layout rectangles for all panes.
This allows callers to render pane contents after the widget has drawn borders and overlays.
Trait Implementations§
Source§impl Clone for ResizableGridWidget
impl Clone for ResizableGridWidget
Source§fn clone(&self) -> ResizableGridWidget
fn clone(&self) -> ResizableGridWidget
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ResizableGridWidget
impl Debug for ResizableGridWidget
Auto Trait Implementations§
impl Freeze for ResizableGridWidget
impl RefUnwindSafe for ResizableGridWidget
impl Send for ResizableGridWidget
impl Sync for ResizableGridWidget
impl Unpin for ResizableGridWidget
impl UnsafeUnpin for ResizableGridWidget
impl UnwindSafe for ResizableGridWidget
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more