protected override void OnButtonPressed(ButtonEventArgs args) { var node = GetValue(BuildOutputNodeField); var status = GetViewStatus(node); if (args.Button == PointerButton.Left && args.MultiplePress == 0) { if (status.TaskLinkRenderRectangle.Contains(args.Position)) { GoToTask?.Invoke(this, node); return; } if (status.ErrorsRectangle.Contains(args.Position)) { ExpandErrors?.Invoke(this, node); return; } if (status.WarningsRectangle.Contains(args.Position)) { ExpandWarnings?.Invoke(this, node); return; } } status.CalculateLayout(status.LastRenderBounds); if (status.LastRenderExpanderBounds != Rectangle.Zero && status.LastRenderExpanderBounds.Contains(args.Position)) { if (DateTime.Now.Subtract(lastExpanderClick).TotalMilliseconds < DefaultExpandClickDelay) { return; } status.Expanded = !status.Expanded; lastExpanderClick = DateTime.Now; QueueResize(); return; } if (args.Button == PointerButton.Left && status.LastRenderLayoutBounds.Contains(args.Position)) { var pos = status.layout.GetIndexFromCoordinates(args.Position.X - status.LastRenderLayoutBounds.X, args.Position.Y - status.LastRenderLayoutBounds.Y); if (pos != -1) { if (TextSelection == null) { TextSelection = new TextSelection <BuildOutputNode> (); } TextSelection.Start(args.Position, pos, node); } else { TextSelection = null; } QueueDraw(); } //HACK: to avoid automatic scroll behaviour in Gtk (we handle the behaviour) //we only want break the normal click behaviour of treeview, in cases when label size is bigger than tree height var treeView = ((TreeView)ParentWidget); if (status.Expanded && status.LastRenderBounds.Height > treeView.Size.Height) { args.Handled = true; treeView.SelectRow(node); } base.OnButtonPressed(args); }
public void ClearSelection() { TextSelection = null; QueueDraw(); }