pub struct LiveGrid<D: LiveGridDelegate> { /* private fields */ }Expand description
A live grid element over a LiveGridState.
LiveGrid::new(&grid)
.accessibility_label("Trades")
.xsmall()
.bordered(false)
.group_panel(true)Sizes follow gpui-kit tables: xsmall 26 px rows, small 30, medium
(default) 32, large 40, or an explicit Size::Size(px).
The cells take the font of the element the grid is placed in: its
family, size and OpenType features, and so do the ghosts its drags show
under the pointer (a header, a group level, rows), though GPUI draws them
outside that element. The grid adds tabular figures (tnum) so digits
line up, and keeps the rest, so a feature set on an ancestor reaches the
cells:
div()
.font_family("IBM Plex Mono")
// A slashed zero in every cell.
.font_features(FontFeatures(Arc::new(vec![("zero".into(), 1)])))
.child(LiveGrid::new(&grid))Give every grid an accessible name with Self::accessibility_label:
a screen reader announces the grid by it (Design Guides, “controls have
accessible names”).
Implementations§
Source§impl<D: LiveGridDelegate> LiveGrid<D>
impl<D: LiveGridDelegate> LiveGrid<D>
Sourcepub fn new(state: &Entity<LiveGridState<D>>) -> Self
pub fn new(state: &Entity<LiveGridState<D>>) -> Self
A grid element for state.
Sourcepub fn accessibility_label(self, label: impl Into<SharedString>) -> Self
pub fn accessibility_label(self, label: impl Into<SharedString>) -> Self
The accessible name of the grid, e.g. “Trades”: a screen reader names the table by it. No name by default.
Sourcepub fn bordered(self, bordered: bool) -> Self
pub fn bordered(self, bordered: bool) -> Self
Draws a border with the theme radius around the grid (default true).
Sourcepub fn group_panel(self, shown: bool) -> Self
pub fn group_panel(self, shown: bool) -> Self
Shows the group panel above the header (default false): the grouping levels as chips, and a drop zone for column headers. The user drags a header into it to group by the column, drags a chip to reorder the levels or out onto the grid to remove one, clicks a chip to reverse its groups, and removes it with its button. The panel is one header row tall; the rows get that much less room.
The application decides when it shows, as with Self::bordered:
always, only while the grid is grouped, or behind a toolbar toggle.
Trait Implementations§
Source§impl<D: LiveGridDelegate> IntoElement for LiveGrid<D>
impl<D: LiveGridDelegate> IntoElement for LiveGrid<D>
Source§type Element = ViewElement<LiveGrid<D>>
type Element = ViewElement<LiveGrid<D>>
Source§fn into_element(self) -> Self::Element
fn into_element(self) -> Self::Element
Element].Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement].Source§impl<D: LiveGridDelegate> RenderOnce for LiveGrid<D>
impl<D: LiveGridDelegate> RenderOnce for LiveGrid<D>
Auto Trait Implementations§
impl<D> Freeze for LiveGrid<D>
impl<D> !RefUnwindSafe for LiveGrid<D>
impl<D> Send for LiveGrid<D>
impl<D> Sync for LiveGrid<D>
impl<D> Unpin for LiveGrid<D>
impl<D> UnsafeUnpin for LiveGrid<D>
impl<D> !UnwindSafe for LiveGrid<D>
Blanket Implementations§
§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>where
Self: Sized,
T: SpringTarget,
<T as SpringTarget>::Output: 'static,
fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>where
Self: Sized,
T: SpringTarget,
<T as SpringTarget>::Output: 'static,
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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