pub struct CellElementContext<'a, R: GridRow> { /* private fields */ }Expand description
What LiveGridDelegate::render_cell knows about a visible cell of an
Element or Control column.
Implementations§
Source§impl<'a, R: GridRow> CellElementContext<'a, R>
impl<'a, R: GridRow> CellElementContext<'a, R>
The row, shared: for an element’s handlers, which run after the frame and outlive it.
Sourcepub fn value(&self) -> CellValue<'a>
pub fn value(&self) -> CellValue<'a>
The cell’s value: the store’s, or the value a commit of the cell still waits with.
Sourcepub fn change(&self) -> Option<CellChange>
pub fn change(&self) -> Option<CellChange>
The cell’s highlighted change, if it is hot: for an element that
shows the change itself. On a removed row that fades out it is
RowChange::Removed at the fade’s
intensity: the element is drawn until the fade ends, and takes no
press, Space or edit.
Sourcepub fn size(&self) -> ComponentSize
pub fn size(&self) -> ComponentSize
The grid’s size: gpui-kit elements take it through Sizable and fit
the row.
Sourcepub fn cell_size(&self) -> Size<Pixels>
pub fn cell_size(&self) -> Size<Pixels>
The room for the element: the cell without its padding.
Sourcepub fn is_selected(&self) -> bool
pub fn is_selected(&self) -> bool
Returns true if the cell is selected.
Sourcepub fn is_focused(&self) -> bool
pub fn is_focused(&self) -> bool
Returns true if the cell has the grid’s focus.
Sourcepub fn edit_state(&self) -> Option<&'a EditState>
pub fn edit_state(&self) -> Option<&'a EditState>
The cell’s edits: a commit that waits for an answer (Pending) or
for the store (Accepted) — Self::value is its value then — or a
refused one (Failed). None for a cell with no edits.
Sourcepub fn edit(&self) -> Option<CellEditHandle>
pub fn edit(&self) -> Option<CellEditHandle>
A handle that commits values of this cell as edits, for the
element’s handlers, such as a checkbox’s on_click and
on_activate: EditCommit, then the value shown until the commit
settles. None if the column has no editor, or on a pinned row.
Whether the delegate’s is_editable takes the cell is asked at the
commit, outside the frame.
Sourcepub fn on_activate(&self, handler: impl Fn(&mut Window, &mut App) + 'static)
pub fn on_activate(&self, handler: impl Fn(&mut Window, &mut App) + 'static)
Sets what Space does on the focused cell of a Control column
(ActivateCell): what a press on the element does, such as
toggling a checkbox. Kept for the focused cell only, until the next
frame; on any other cell it is dropped without being stored. It runs
after the key is handled, outside the grid’s update, so it may
update the grid.
Auto Trait Implementations§
impl<'a, R> Freeze for CellElementContext<'a, R>
impl<'a, R> !RefUnwindSafe for CellElementContext<'a, R>
impl<'a, R> !Send for CellElementContext<'a, R>
impl<'a, R> !Sync for CellElementContext<'a, R>
impl<'a, R> Unpin for CellElementContext<'a, R>
impl<'a, R> UnsafeUnpin for CellElementContext<'a, R>
impl<'a, R> !UnwindSafe for CellElementContext<'a, R>
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<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> 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