pub trait EditorField: 'static {
// Required methods
fn render(
&self,
cell: &EditorCell<'_>,
window: &mut Window,
cx: &mut App,
) -> AnyElement;
fn focus(&self, window: &mut Window, cx: &mut App);
fn value(&self, cx: &App) -> Result<OwnedValue, EditError>;
fn set_value(&self, value: &OwnedValue, window: &mut Window, cx: &mut App);
fn is_dirty(&self, cx: &App) -> bool;
}Expand description
One open editor: its element in the cell, its draft and its focus.
Required Methods§
Sourcefn render(
&self,
cell: &EditorCell<'_>,
window: &mut Window,
cx: &mut App,
) -> AnyElement
fn render( &self, cell: &EditorCell<'_>, window: &mut Window, cx: &mut App, ) -> AnyElement
The element in the cell, built in prepaint every frame while the editor is open. Must not read, update or notify the grid entity.
Sourcefn focus(&self, window: &mut Window, cx: &mut App)
fn focus(&self, window: &mut Window, cx: &mut App)
Moves the keyboard focus into the editor; once, when it opens.
Sourcefn value(&self, cx: &App) -> Result<OwnedValue, EditError>
fn value(&self, cx: &App) -> Result<OwnedValue, EditError>
The draft as a value of the column; Err if it is not one: the
editor stays open and shows the message.
Sourcefn set_value(&self, value: &OwnedValue, window: &mut Window, cx: &mut App)
fn set_value(&self, value: &OwnedValue, window: &mut Window, cx: &mut App)
Replaces the draft (DraftAction::Replace).