protected override bool OnButtonPressEvent(EventButton evnt) { var t = FindTab((int)evnt.X, (int)evnt.Y); if (t != null) { if (evnt.IsContextMenuButton()) { DockNotebook.ActiveNotebook = notebook; notebook.CurrentTab = t; if (notebook.DoPopupMenu != null) { notebook.DoPopupMenu(notebook, t.Index, evnt); } return(true); } // Don't select the tab if we are clicking the close button if (IsOverCloseButton(t, (int)evnt.X, (int)evnt.Y)) { overCloseOnPress = true; return(true); } overCloseOnPress = false; if (evnt.Type == EventType.TwoButtonPress) { if (allowDoubleClick) { notebook.OnActivateTab(t); buttonPressedOnTab = false; } return(true); } if (evnt.Button == 2) { notebook.OnCloseTab(t); return(true); } DockNotebook.ActiveNotebook = notebook; buttonPressedOnTab = true; notebook.CurrentTab = t; return(true); } buttonPressedOnTab = true; QueueDraw(); return(base.OnButtonPressEvent(evnt)); }
protected override bool OnDeleteEvent(Event evnt) { foreach (var notebook in Container.GetNotebooks().ToList()) { foreach (var tab in notebook.Tabs.ToList()) { if (!notebook.OnCloseTab(tab)) { return(true); } } } return(base.OnDeleteEvent(evnt)); }