internal void EndEditing() { if (editSession != null) { Remove(currentEditor); currentEditor.Destroy(); currentEditor = null; editSession.Dispose(); editSession = null; currentEditorRow = null; parentGrid.Populate(saveEditSession: false); QueueDraw(); } }
void StartEditing(TableRow row) { EndEditing(); currentEditorRow = row; var cell = GetCell(row); editSession = cell.StartEditing(row.EditorBounds, State); if (editSession == null) { return; } currentEditor = (Gtk.Widget)editSession.Editor; Add(currentEditor); SetAllocation(currentEditor, row.EditorBounds); currentEditor.Show(); currentEditor.CanFocus = true; currentEditor.GrabFocus(); ConnectTabEvent(currentEditor); var refreshAtt = row.Property.Attributes.OfType <RefreshPropertiesAttribute> ().FirstOrDefault(); var refresh = refreshAtt == null ? RefreshProperties.None : refreshAtt.RefreshProperties; editSession.Changed += delegate { if (refresh == RefreshProperties.Repaint) { parentGrid.Refresh(); } else if (refresh == RefreshProperties.All) { parentGrid.Populate(); } if (Changed != null) { Changed(this, EventArgs.Empty); } }; var vs = ((Gtk.Viewport)Parent).Vadjustment; if (row.EditorBounds.Top < vs.Value) { vs.Value = row.EditorBounds.Top; } else if (row.EditorBounds.Bottom > vs.Value + vs.PageSize) { vs.Value = row.EditorBounds.Bottom - vs.PageSize; } QueueDraw(); }