/// <summary> /// Initializes a new instance of the in-place editor for a text cell. /// </summary> /// <param name="owner">The visual owning the element being edited.</param> /// <param name="column">The column in the Gtk.TreeView being edited.</param> /// <param name="cell">The text cell renderer to use.</param> /// <param name="maxLength">The maximum length of the string to allow.</param> public TextCellInPlaceEditor(Gtk.TreeView owner, Gtk.TreeViewColumn column, Gtk.CellRendererText cell, int maxLength) : this(owner, maxLength, null) { cell.Editable = true; cell.EditingStarted += CellEditingStarted; EditingObject = new TextCellInPlaceEditorObjectData(null, column); Renderer = cell; }
private void CellEditingStarted(object o, Gtk.EditingStartedArgs args) { DebugOutput("!$!$!$!$ CellEditingStarted"); Renderer.Edited += CellEdited; Renderer.EditingCanceled += CellEditingCanceled; EditedElement = args.Editable as Gtk.Entry; Editor.MaxLength = MaxLength; Editor.TextInserted += HandleTextInserted; if (EditingObject != null) { EditingObject = new TextCellInPlaceEditorObjectData(new Gtk.TreePath(args.Path), EditingObject.Column, Editor.Text); } }
private void CellEditingEnded(string newValue, Gtk.TreePath path, bool commit) { if (commit) { EditingObject = new TextCellInPlaceEditorObjectData(path, EditingObject.Column, newValue); CommitEditCore(); } else { CancelEditCore(); } Renderer.EditingCanceled -= CellEditingCanceled; Renderer.Edited -= CellEdited; Editor.TextInserted -= HandleTextInserted; EditedElement = null; EditingObject = new TextCellInPlaceEditorObjectData(EditingObject.Path, EditingObject.Column); }