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>
Source§fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement
Render::render() method
which takes a mutable reference.Auto Trait Implementations§
impl<D> !RefUnwindSafe for LiveGrid<D>
impl<D> !UnwindSafe for LiveGrid<D>
impl<D> Forget for LiveGrid<D>
impl<D> Freeze for LiveGrid<D>
impl<D> Move 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>
Blanket Implementations§
Source§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
Source§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,
Source§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,
Source§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>
fn with_spring<T>( self, id: impl Into<ElementId>, animation: SpringAnimation<T>, animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static, ) -> SpringAnimationElement<Self>
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> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
Source§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
Source§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,
Source§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,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<E> TestTextExt for Ewhere
E: IntoElement,
impl<E> TestTextExt for Ewhere
E: IntoElement,
Source§fn test_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_text(self, text: impl Into<SharedString>) -> Self::Element
test-support, records text each time the element paints.
Otherwise returns the element it builds.Source§fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
Self::test_text for an image’s alternative text, which
stands in for what the element draws.