public virtual void ShowView(IViewContentExtend content, bool bringToFront) { if (this.viewContentCollection.Contains(content)) { this.SelectView((IViewContent)content); } else { this.viewContentCollection.Add(content); Xwt.Drawing.Image image = (Xwt.Drawing.Image)null; DockNotebookTab tabLabel = this.tabControl.InsertTab(-1); DocumentWindow documentWindow = new DocumentWindow(this, content, this.tabControl, tabLabel); documentWindow.Closed += new EventHandler <DocumentWindowEventArgs>(this.CloseWindowEvent); documentWindow.Show(); tabLabel.Content = (Widget)documentWindow; if (image != null) { tabLabel.Icon = image; } if (bringToFront) { documentWindow.SelectWindow(); } documentWindow.ShowAll(); this.OnActiveWindowChanged((object)null, (EventArgs)null); } }
private void CloseWindowEvent(object sender, DocumentWindowEventArgs e) { DocumentWindow documentWindow = (DocumentWindow)sender; if (documentWindow.ViewContent == null) { return; } this.CloseContent(documentWindow.ViewContent); }
public void SelectWindow() { this.tabControl.CurrentTabIndex = this.tab.Index; if (this.tabControl.FocusChild != null) { this.tabControl.FocusChild.GrabFocus(); } else { DocumentWindow.DeepGrabFocus(this.content.Control); } }
private void CloseWindowEvent(object sender, WorkbenchWindowEventArgs e) { DocumentWindow documentWindow = (DocumentWindow)sender; this.lastActiveWindows.Remove((IDocumentWindow)documentWindow); if (documentWindow.ViewContent != null) { this.CloseContent(documentWindow.ViewContent); if (e.WasActive && !this.SelectLastActiveWindow((IDocumentWindow)documentWindow)) { this.OnActiveWindowChanged((object)this, (EventArgs)null); } } this.lastActiveWindows.Remove((IDocumentWindow)documentWindow); }
private void FocusActiveDocumentWindow() { if (!this.documentDockItem.ContentVisible || this.ActiveWorkbenchWindow == null) { return; } this.LockActiveWindowChangeEvent(); DockNotebookTab currentTab = this.tabControl.CurrentTab; this.tabControl.CurrentTab = (DockNotebookTab)null; this.tabControl.CurrentTab = currentTab; DocumentWindow activeWorkbenchWindow = this.ActiveWorkbenchWindow as DocumentWindow; if (activeWorkbenchWindow != null) { activeWorkbenchWindow.ViewContent.Activated(); } this.UnlockActiveWindowChangeEvent(); }
private static void DeepGrabFocus(Widget widget) { Widget widget1 = (Widget)null; foreach (Widget focussableWidget in DocumentWindow.GetFocussableWidgets(widget)) { if (focussableWidget.HasFocus) { return; } if (widget1 == null) { widget1 = focussableWidget; } } if (widget1 == null) { return; } widget1.GrabFocus(); }
private static IEnumerable <Widget> GetFocussableWidgets(Widget widget) { Container c = widget as Container; if (widget.CanFocus) { yield return(widget); } if (c != null) { foreach (Widget widget1 in ((IEnumerable <Widget>)c.FocusChain).SelectMany <Widget, Widget>((Func <Widget, IEnumerable <Widget> >)(x => DocumentWindow.GetFocussableWidgets(x))).Where <Widget>((Func <Widget, bool>)(y => y != null))) { yield return(widget1); } } }