Skip to main content

GridState

Struct GridState 

Source
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: bool

When 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§context_menu: Option<ContextMenu>§filter_panel: Option<FilterPanel>§pending_action: Option<(MenuAction, usize)>§scrollbar_drag: Option<ScrollbarAxis>§scrollbar_drag_start_offset: f32§scrollbar_drag_start_pos: f32

Implementations§

Source§

impl GridState

Source

pub fn new( data: GridData, config: GridConfig, focus_handle: FocusHandle, ) -> Self

Source

pub fn set_config(&mut self, config: GridConfig)

Source

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.

Source

pub fn recompute(&mut self)

Source

pub fn toggle_sort(&mut self, col: usize)

Source

pub fn handle_mouse_down(&mut self, pos: Point<Pixels>, shift: bool)

Source

pub fn execute_action(&mut self, action: MenuAction, col: usize, cx: &mut App)

Source

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.

Source

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).

Source

pub fn maybe_auto_apply(&mut self)

Apply immediately — the panel always auto-applies.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn toggle_filter_op_menu(&mut self)

Toggle the operator dropdown’s expanded state.

Source

pub fn set_filter_focus(&mut self, focus: FilterInput)

Point keyboard focus at one of the panel’s text fields.

Source

pub fn toggle_filter_auto_apply(&mut self)

Toggle the panel’s auto-apply flag; kept for API completeness.

Source

pub fn drag_screen_rect(&self) -> Option<(Point<Pixels>, Point<Pixels>)>

Source

pub fn handle_mouse_move( &mut self, pos: Point<Pixels>, pressed_button: Option<MouseButton>, )

Source

pub fn handle_scroll_drag(&mut self)

Source

pub fn handle_mouse_up(&mut self)

Source

pub fn apply_edge_scroll(&mut self) -> bool

Source

pub fn select_all(&mut self)

Source

pub fn copy_selection(&self, with_headers: bool, cx: &mut App)

Source

pub fn page_up(&mut self)

Source

pub fn page_down(&mut self)

Source

pub fn handle_key(&mut self, keystroke: &Keystroke)

Source

pub fn wants_edge_scroll_tick(&self) -> bool

Trait Implementations§

Source§

impl Debug for GridState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more