Skip to main content

EditorField

Trait EditorField 

Source
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§

Source

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.

Source

fn focus(&self, window: &mut Window, cx: &mut App)

Moves the keyboard focus into the editor; once, when it opens.

Source

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.

Source

fn set_value(&self, value: &OwnedValue, window: &mut Window, cx: &mut App)

Replaces the draft (DraftAction::Replace).

Source

fn is_dirty(&self, cx: &App) -> bool

Returns true if the user changed the draft since the editor opened.

Implementors§