Exemplo n.º 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);
     }
 }
Exemplo n.º 2
0
        private void CloseWindowEvent(object sender, DocumentWindowEventArgs e)
        {
            DocumentWindow documentWindow = (DocumentWindow)sender;

            if (documentWindow.ViewContent == null)
            {
                return;
            }
            this.CloseContent(documentWindow.ViewContent);
        }
Exemplo n.º 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);
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 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();
        }
Exemplo n.º 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();
        }
Exemplo n.º 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);
                }
            }
        }