protected override bool OnKeyPressEvent(Gdk.EventKey evnt) { if (evnt.Key == Gdk.Key.Delete) { blackboard.DeleteSelection(); } return(base.OnKeyPressEvent(evnt)); }
public void DeleteSelection_1ElementSelected_ElementDeletedFromCanvasAndModel() { var drawing = new FrameDrawing(); var cross = new Cross(); var line = new Line(); drawing.Drawables.Add(cross); drawing.Drawables.Add(line); blackboard.Drawing = drawing; blackboard.UpdateSelection(new Selection(blackboard.Objects [0] as IMovableObject, SelectionPosition.All)); blackboard.DeleteSelection(); Assert.AreEqual(1, blackboard.Objects.Count); Assert.AreEqual(1, drawing.Drawables.Count); }
void HandleShowMenuEvent(IBlackboardObject drawable) { Menu m = new Menu(); MenuItem item = new MenuItem(Catalog.GetString("Move to Front")); item.Activated += (sender, e) => blackboard.MoveToFront(); m.Add(item); item = new MenuItem(Catalog.GetString("Move to Back")); item.Activated += (sender, e) => blackboard.MoveToBack(); m.Add(item); item = new MenuItem(Catalog.GetString("Delete")); item.Activated += (sender, e) => blackboard.DeleteSelection(); m.Add(item); if (drawable is Text) { MenuItem edit = new MenuItem(Catalog.GetString("Edit")); edit.Activated += (sender, e) => EditText(drawable as Text); m.Add(edit); } m.ShowAll(); m.Popup(); }