pub struct GridMenuContext<'a, R: GridRow> { /* private fields */ }Expand description
What LiveGridDelegate::context_menu and
LiveGridDelegate::primary_command know: the target, the command scope
and the rows of the snapshot shown when the menu opened.
Implementations§
Source§impl<'a, R: GridRow> GridMenuContext<'a, R>
impl<'a, R: GridRow> GridMenuContext<'a, R>
Sourcepub fn grouping_items(&self, menu: PopupMenu) -> PopupMenu
pub fn grouping_items(&self, menu: PopupMenu) -> PopupMenu
“Group by this column” (GroupByColumn), “Ungroup” (UngroupColumn)
for the target column, then “Ungroup all” (ClearGrouping). Items
that would do nothing are disabled: grouping by a column that is not
groupable or already a level, or in a tree view (a tree and a
grouping exclude each other, as in AG Grid and DevExpress);
ungrouping a column that is no level; ungrouping all without a
grouping. Without a target column, only “Ungroup all”.
Self::column_items ends with them.
Source§impl<'a, R: GridRow> GridMenuContext<'a, R>
impl<'a, R: GridRow> GridMenuContext<'a, R>
Sourcepub fn target(&self) -> &GridTarget<R::Key, R::Column>
pub fn target(&self) -> &GridTarget<R::Key, R::Column>
Where the menu was opened.
Sourcepub fn selection(&self) -> &ScopedSelection<R::Key>
pub fn selection(&self) -> &ScopedSelection<R::Key>
The command scope of the target when the menu opened, in display
order: a caption’s group rows, else scoped_selection(), as the
selection policy decides. For labels and enabled states only: a
command handler reads the scope again when it runs.
Sourcepub fn group(&self) -> Option<GroupInfo<'a>>
pub fn group(&self) -> Option<GroupInfo<'a>>
The group of a caption or footer target, in the projection shown when the menu opened.
Sourcepub fn row(&self, key: &R::Key) -> Option<&'a Arc<R>>
pub fn row(&self, key: &R::Key) -> Option<&'a Arc<R>>
A data row of the snapshot shown when the menu opened.
Sourcepub fn target_row(&self) -> Option<&'a Arc<R>>
pub fn target_row(&self) -> Option<&'a Arc<R>>
The row the target is in, as the snapshot shown when the menu opened
has it: the data row of a cell target, the pinned row of a pinned
target; None for a header, the empty area and the lines the grid
makes (captions, footers, totals).
Sourcepub fn standard_items(
&self,
menu: PopupMenu,
window: &mut Window,
cx: &mut Context<'_, PopupMenu>,
) -> PopupMenu
pub fn standard_items( &self, menu: PopupMenu, window: &mut Window, cx: &mut Context<'_, PopupMenu>, ) -> PopupMenu
The built-in items for the target, in the standard order:
- a cell: Copy, Copy all; the Sort and Column submenus for its column, so the keyboard reaches the header’s commands (Shift+F10 on the focused cell);
- a header: the sort items, the column items, Copy, Copy all;
- a group caption: the group items, Copy (the group’s rows), Copy all;
- a pinned row, a group footer, the totals row and elsewhere: Copy, Copy all (Copy copies the selection of data rows; Copy all takes the bands and the totals too).
The grid puts the primary command above them.
Sourcepub fn group_items(&self, menu: PopupMenu) -> PopupMenu
pub fn group_items(&self, menu: PopupMenu) -> PopupMenu
Expand or Collapse for a caption target (by its state), then Expand
all, Collapse all and Captions only (checked while the default depth
is ExpandDepth::Captions). They dispatch ExpandRow,
CollapseRow, ExpandAll, CollapseAll and ShowCaptionsOnly to
the grid, whose focus is on the caption a press opened the menu for.
Sourcepub fn copy_items(&self, menu: PopupMenu) -> PopupMenu
pub fn copy_items(&self, menu: PopupMenu) -> PopupMenu
Copy (Copy, disabled when the command scope is empty) and Copy all
(CopyAll).
Sourcepub fn sort_items(&self, menu: PopupMenu) -> PopupMenu
pub fn sort_items(&self, menu: PopupMenu) -> PopupMenu
Sort ascending, Sort descending and Clear sort for the target column,
then Clear all sorting (ClearAllSorting); nothing without a target
column. The first three are disabled for a column that is not
sortable; the current direction is checked; Clear sort is disabled
for a column outside the sort, Clear all sorting when nothing is
sorted.
Sourcepub fn column_items(&self, menu: PopupMenu) -> PopupMenu
pub fn column_items(&self, menu: PopupMenu) -> PopupMenu
Autofit, hide, show all, choose (ShowColumnChooser), freeze,
unfreeze and reset columns for the target column, then the grouping items (Self::grouping_items).
Without a target column, only the items for every column. “Hide
column” is disabled for the last visible column and for a column the
user may not hide (GridColumn::with_hideable).
Auto Trait Implementations§
impl<'a, R> Freeze for GridMenuContext<'a, R>
impl<'a, R> !RefUnwindSafe for GridMenuContext<'a, R>
impl<'a, R> Send for GridMenuContext<'a, R>
impl<'a, R> Sync for GridMenuContext<'a, R>
impl<'a, R> Unpin for GridMenuContext<'a, R>
impl<'a, R> UnsafeUnpin for GridMenuContext<'a, R>
impl<'a, R> !UnwindSafe for GridMenuContext<'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> DowncastSync for T
impl<T> DowncastSync for T
§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