public void OnKeyPress(object sender, KeyPressEventArgs e) { if (FocusedNode != null) { if (e.KeyChar != (char)13) { IFocusableNode node = GetLastFocusInHierarchy((ClassDiagramNode)FocusedNode); if (node is IKeyboardFocusableNode kn) { kn.OnKeyPress(this, e); } } else { FocusedNode?.OnUnfocused?.Invoke(this, new NodeEventArgs(FocusedNode)); } } Render(); }
private void HandleLeftClick(Vector mouse_position, MouseEventArgs e) { INode temp = null; if (OptionsMenu != null && CheckIfClicked(mouse_position, OptionsMenu)) { temp = OptionsMenu; } else if (RelationshipManager.Relationships.Count > 0 && RelationshipManager.Relationships.FirstOrDefault(x => CheckIfClicked(mouse_position, x)) != null) { temp = RelationshipManager.Relationships.FirstOrDefault(x => CheckIfClicked(mouse_position, x)); } else { temp = Children.FirstOrDefault(x => CheckIfClicked(mouse_position, x)); } if (RelationshipManager.IsCreating && temp != null && temp is ClassDiagramNode cn) { RelationshipManager.SelectedNode = cn; } else { IFocusableNode node = SearchForClicked(temp, mouse_position); if (node != null) { if (node is Relationship r) { } else { node.OnFocused?.Invoke(this, new NodeEventArgs(node)); if (node is IMouseFocusableNode mn) { mn.OnMouseClick?.Invoke(this, e); } } } } }
public void Add(IFocusableNode node) => NodeList.AddLast(node);