1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
// Take a look at the license at the top of the repository in the LICENSE file.
use crate::CellEditable;
use glib::translate::*;
use glib::IsA;
pub trait CellEditableExtManual {
/// Begins editing on a `self`.
///
/// The [`CellRenderer`][crate::CellRenderer] for the cell creates and returns a [`CellEditable`][crate::CellEditable] from
/// [`CellRendererExtManual::start_editing()`][crate::prelude::CellRendererExtManual::start_editing()], configured for the [`CellRenderer`][crate::CellRenderer] type.
///
/// [`CellEditableExtManual::start_editing()`][crate::prelude::CellEditableExtManual::start_editing()] can then set up `self` suitably for
/// editing a cell, e.g. making the Esc key emit `GtkCellEditable::editing-done`.
///
/// Note that the `self` is created on-demand for the current edit; its
/// lifetime is temporary and does not persist across other edits and/or cells.
/// ## `event`
/// The [`gdk::Event`][crate::gdk::Event] that began the editing process, or
/// [`None`] if editing was initiated programmatically
#[doc(alias = "gtk_cell_editable_start_editing")]
fn start_editing<P: AsRef<gdk::Event>>(&self, event: Option<&P>);
}
impl<O: IsA<CellEditable>> CellEditableExtManual for O {
fn start_editing<P: AsRef<gdk::Event>>(&self, event: Option<&P>) {
unsafe {
ffi::gtk_cell_editable_start_editing(
self.as_ref().to_glib_none().0,
event.map(|e| e.as_ref()).to_glib_none().0,
);
}
}
}