pub struct GridState {Show 35 fields
pub data: GridData,
pub config: GridConfig,
pub resolved_formats: Vec<ResolvedColumnFormat>,
pub display_indices: Vec<usize>,
pub selection: Selection,
pub sort: Option<(usize, SortDirection)>,
pub filters: Vec<ColumnFilter>,
pub scroll_handle: ScrollHandle,
pub focus_handle: FocusHandle,
pub bounds: Bounds<Pixels>,
pub row_height: f32,
pub header_height: f32,
pub row_header_width: f32,
pub font_size: f32,
pub char_width: f32,
pub theme: GridTheme,
pub is_dragging: bool,
pub drag_start: Option<Point<Pixels>>,
pub drag_start_hit: Option<HitResult>,
pub scroll_at_click: Option<Point<Pixels>>,
pub last_mouse_pos: Option<Point<Pixels>>,
pub status_bar_height: f32,
pub debug_bar_enabled: bool,
pub click_pos: Option<Point<Pixels>>,
pub click_hit: Option<HitResult>,
pub hover_hit: Option<HitResult>,
pub resizing_col: Option<usize>,
pub resize_start_x: f32,
pub resize_start_width: f32,
pub context_menu: Option<ContextMenu>,
pub filter_panel: Option<FilterPanel>,
pub pending_action: Option<(MenuAction, usize)>,
pub scrollbar_drag: Option<ScrollbarAxis>,
pub scrollbar_drag_start_offset: f32,
pub scrollbar_drag_start_pos: f32,
/* private fields */
}Expand description
Complete grid state owned by a GPUI Entity<GridState>.
Fields§
§data: GridData§config: GridConfig§resolved_formats: Vec<ResolvedColumnFormat>Cached resolved-format list, kept in sync with data.columns and
config. Paint, copy, and filter read this directly instead of
recomputing per cell.
display_indices: Vec<usize>§selection: Selection§sort: Option<(usize, SortDirection)>§filters: Vec<ColumnFilter>§scroll_handle: ScrollHandle§focus_handle: FocusHandle§bounds: Bounds<Pixels>§row_height: f32§header_height: f32§row_header_width: f32§font_size: f32§char_width: f32§theme: GridTheme§is_dragging: bool§drag_start: Option<Point<Pixels>>§drag_start_hit: Option<HitResult>§scroll_at_click: Option<Point<Pixels>>§last_mouse_pos: Option<Point<Pixels>>§status_bar_height: f32§debug_bar_enabled: boolWhen true, the debug status bar is painted at the bottom of the grid
showing click position, scroll offset, and hovered cell. Off by
default; enable via [SqllyDataTableBuilder::debug_bar] or
GridState::set_debug_bar_enabled.
click_pos: Option<Point<Pixels>>§click_hit: Option<HitResult>§hover_hit: Option<HitResult>§resizing_col: Option<usize>§resize_start_x: f32§resize_start_width: f32§filter_panel: Option<FilterPanel>§pending_action: Option<(MenuAction, usize)>§scrollbar_drag: Option<ScrollbarAxis>§scrollbar_drag_start_offset: f32§scrollbar_drag_start_pos: f32Implementations§
Source§impl GridState
impl GridState
pub fn new( data: GridData, config: GridConfig, focus_handle: FocusHandle, ) -> Self
pub fn set_config(&mut self, config: GridConfig)
Sourcepub fn set_debug_bar_enabled(&mut self, enabled: bool)
pub fn set_debug_bar_enabled(&mut self, enabled: bool)
Enable or disable the debug status bar at runtime. When enabled, a bar is painted at the bottom of the grid showing click position, scroll offset, and hovered cell coordinates.
pub fn recompute(&mut self)
pub fn toggle_sort(&mut self, col: usize)
pub fn handle_mouse_down(&mut self, pos: Point<Pixels>, shift: bool)
pub fn execute_action(&mut self, action: MenuAction, col: usize, cx: &mut App)
Sourcepub fn open_filter_panel(&mut self, col: usize, anchor: Option<Point<Pixels>>)
pub fn open_filter_panel(&mut self, col: usize, anchor: Option<Point<Pixels>>)
Open the rich per-column filter popover for col, seeding its working
state from any filter already committed on that column. The overlay is
rendered by widget.rs as a deferred + anchored element so it can
paint and receive events outside the grid’s own layout bounds, exactly
like the right-click context menu.
anchor overrides the panel’s spawn position; pass the original
context-menu / header right-click position so the panel doesn’t jump to
the mouse’s current location (which by now has moved to the menu item).
Falls back to last_mouse_pos when None.
Sourcepub fn apply_filter_panel(&mut self)
pub fn apply_filter_panel(&mut self)
Commit the panel’s working state to Self::filters and re-filter.
Called automatically on every interaction (auto-apply).
Sourcepub fn maybe_auto_apply(&mut self)
pub fn maybe_auto_apply(&mut self)
Apply immediately — the panel always auto-applies.
Sourcepub fn clear_filter_panel(&mut self)
pub fn clear_filter_panel(&mut self)
Reset both the committed filter for the panel’s column and the panel’s working state (all values checked, no operator), then re-filter.
Sourcepub fn set_panel_sort(&mut self, direction: SortDirection)
pub fn set_panel_sort(&mut self, direction: SortDirection)
Set the sort direction on the panel’s column (the panel’s Sort buttons). Clicking the already-active direction turns the sort off.
Sourcepub fn toggle_filter_value(&mut self, index: usize)
pub fn toggle_filter_value(&mut self, index: usize)
Toggle the checked state of a single distinct value row (by index into
FilterPanel::distinct), then auto-apply if enabled.
Sourcepub fn toggle_filter_select_all(&mut self)
pub fn toggle_filter_select_all(&mut self)
Toggle every currently visible (search-filtered) value row at once, then auto-apply if enabled. Mirrors the “(Select All)” checkbox.
Sourcepub fn set_filter_operator(&mut self, op_index: usize)
pub fn set_filter_operator(&mut self, op_index: usize)
Select an operator by its index in FilterPanel::op_labels, close the
dropdown, and auto-apply if enabled.
Toggle the operator dropdown’s expanded state.
Sourcepub fn set_filter_focus(&mut self, focus: FilterInput)
pub fn set_filter_focus(&mut self, focus: FilterInput)
Point keyboard focus at one of the panel’s text fields.
Sourcepub fn toggle_filter_auto_apply(&mut self)
pub fn toggle_filter_auto_apply(&mut self)
Toggle the panel’s auto-apply flag; kept for API completeness.
pub fn drag_screen_rect(&self) -> Option<(Point<Pixels>, Point<Pixels>)>
pub fn handle_mouse_move( &mut self, pos: Point<Pixels>, pressed_button: Option<MouseButton>, )
pub fn handle_scroll_drag(&mut self)
pub fn handle_mouse_up(&mut self)
pub fn apply_edge_scroll(&mut self) -> bool
pub fn select_all(&mut self)
pub fn copy_selection(&self, with_headers: bool, cx: &mut App)
pub fn page_up(&mut self)
pub fn page_down(&mut self)
pub fn handle_key(&mut self, keystroke: &Keystroke)
pub fn wants_edge_scroll_tick(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for GridState
impl !Send for GridState
impl !Sync for GridState
impl !UnwindSafe for GridState
impl Freeze for GridState
impl Unpin for GridState
impl UnsafeUnpin for GridState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.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