Exemple #1
0
 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);
     }
 }
Exemple #2
0
        private void CloseWindowEvent(object sender, DocumentWindowEventArgs e)
        {
            DocumentWindow documentWindow = (DocumentWindow)sender;

            if (documentWindow.ViewContent == null)
            {
                return;
            }
            this.CloseContent(documentWindow.ViewContent);
        }
Exemple #3
0
 public void SelectWindow()
 {
     this.tabControl.CurrentTabIndex = this.tab.Index;
     if (this.tabControl.FocusChild != null)
     {
         this.tabControl.FocusChild.GrabFocus();
     }
     else
     {
         DocumentWindow.DeepGrabFocus(this.content.Control);
     }
 }
Exemple #4
0
        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);
        }
Exemple #5
0
        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();
        }
Exemple #6
0
        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();
        }
Exemple #7
0
        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);
                }
            }
        }