pub trait ContextMenuProvider: 'static {
// Required method
fn menu_items(&self, request: &ContextMenuRequest) -> Vec<ContextMenuItem>;
// Provided method
fn on_action(
&self,
action_id: &str,
request: &ContextMenuRequest,
state: &mut GridState,
cx: &mut App,
) { ... }
}Expand description
Trait implemented by consumers to supply custom right-click menu items and handle clicks on those items.
The provider is registered on
crate::grid::SqllyDataTableBuilder::context_menu_provider. When
registered, the provider fully controls the right-click menu for all
targets (cells, row headers, column headers). When no provider is
registered, the built-in column-header menu is used unchanged.
menu_items is called only on right-click, so normal render/scroll
performance is unaffected. on_action is called when the user clicks a
custom menu item, with &mut GridState and &mut gpui::App available
for clipboard, selection, or application-level side effects.
Required Methods§
Build the menu items for the given right-click context.
Provided Methods§
Sourcefn on_action(
&self,
action_id: &str,
request: &ContextMenuRequest,
state: &mut GridState,
cx: &mut App,
)
fn on_action( &self, action_id: &str, request: &ContextMenuRequest, state: &mut GridState, cx: &mut App, )
Handle a click on a custom action item. action_id matches the id
supplied in ContextMenuItem::Action. Built-in items
(ContextMenuItem::BuiltIn) are handled by the grid and do not
reach this method.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".