コード例 #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Moves the view's control from its form to the tab.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public void DockView()
        {
            if (_undockingInProgress || _viewDocked)
            {
                return;
            }

            App.MsgMediator.SendMessage("BeginViewDocking", View);
            Utils.SetWindowRedraw(OwningTabGroup, false, false);
            Visible = true;

            OwningTabGroup.ViewWasDocked(this);
            View.Size = OwningTabGroup.ClientSize;
            OwningTabGroup.Controls.Add(View);
            View.PerformLayout();
            View.BringToFront();

            _viewDocked         = true;
            _ignoreTabSelection = true;
            OwningTabGroup.SelectTab(this);
            _ignoreTabSelection = false;

            Utils.SetWindowRedraw(OwningTabGroup, true, true);
            View.Focus();
            OwningTabGroup.SetActiveView(View as ITabView, false);
            App.MsgMediator.SendMessage("ViewDocked", View);
        }
コード例 #2
0
 /// ------------------------------------------------------------------------------------
 private void MainForm_Activated(object sender, EventArgs e)
 {
     if (_viewDocked && View != null && View.Visible)
     {
         OwningTabGroup.SetActiveView(View as ITabView, false);
     }
 }
コード例 #3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Draws the tab's background.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void DrawBackground(Graphics g)
        {
            Rectangle rc = ClientRectangle;

            // First, fill the entire background with the control color.
            g.FillRectangle(SystemBrushes.Control, rc);

            Point[] pts = new[] { new Point(0, rc.Bottom), new Point(0, rc.Top + 3),
                                  new Point(3, 0), new Point(rc.Right - 4, 0), new Point(rc.Right - 1, rc.Top + 3),
                                  new Point(rc.Right - 1, rc.Bottom) };

            if (_selected)
            {
                using (SolidBrush br = new SolidBrush(Color.White))
                    g.FillPolygon(br, pts);

                g.DrawLines(SystemPens.ControlDark, pts);
            }
            else
            {
                // Draw the etched line on the right edge to act as a separator. But
                // only draw it when the tab to the right of this one is not selected.
                if (!OwningTabGroup.IsRightAdjacentTabSelected(this))
                {
                    g.DrawLine(SystemPens.ControlDark, rc.Width - 2, 1, rc.Width - 2, rc.Height - 5);
                    g.DrawLine(SystemPens.ControlLight, rc.Width - 1, 1, rc.Width - 1, rc.Height - 5);
                }

                // The tab is not selected tab, so draw a
                // line across the bottom of the tab.
                g.DrawLine(SystemPens.ControlDark, 0, rc.Bottom - 1, rc.Right, rc.Bottom - 1);
            }
        }
コード例 #4
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Make sure the current tab is selected when its grid get's focus.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 private void HandleResultViewEnter(object sender, EventArgs e)
 {
     if (!m_selected || !OwningTabGroup.IsCurrent)
     {
         OwningTabGroup.SelectTab(this, true);
     }
 }
コード例 #5
0
 /// ------------------------------------------------------------------------------------
 public void ShowCIESimilarOptions()
 {
     if (CIESimilarOptionsButton.Visible)
     {
         OwningTabGroup.ShowCIESimilarOptions(CIESimilarOptionsButton);
     }
 }
コード例 #6
0
        /// ------------------------------------------------------------------------------------
        void m_btnCIESimilarOptions_Click(object sender, EventArgs e)
        {
            if (!m_selected || !OwningTabGroup.IsCurrent)
            {
                OwningTabGroup.SelectTab(this, true);
            }

            ShowCIESimilarOptions();
        }
コード例 #7
0
 /// ------------------------------------------------------------------------------------
 internal void CIEViewSimilarRefresh()
 {
     if (m_resultView.Grid == null || !m_resultView.Grid.CIESimilarViewRefresh())
     {
         CIESimilarOptionsButton.Visible = false;
         AdjustWidth();
         OwningTabGroup.AdjustTabContainerWidth();
     }
 }
コード例 #8
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Moves the view's control from its form to the tab.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public void UnDockView()
        {
            if (s_undockingInProgress || !_viewDocked)
            {
                return;
            }

            App.MsgMediator.SendMessage("BeginViewUnDocking", View);
            _undockingInProgress  = true;
            s_undockingInProgress = true;

            if (OwningTabGroup.Controls.Contains(View))
            {
                OwningTabGroup.Controls.Remove(View);
            }

            // Prepare the undocked view's form to host the view and be displayed.
            _viewsForm              = new UndockedViewWnd(View);
            _viewsForm.FormClosing += m_viewsForm_FormClosing;
            _viewsForm.FormClosed  += m_viewsForm_FormClosed;
            _viewsForm.Activated   += m_viewsForm_Activated;

            if (TabImage != null)
            {
                _viewsForm.Icon = Icon.FromHandle(((Bitmap)TabImage).GetHicon());
            }

            // Strip out accelerator key prefixes but keep ampersands that should be kept.
            var prjName = ((ITabView)View).Project.Name;
            var caption = Utils.RemoveAcceleratorPrefix(Text);
            var fmt     = LocalizationManager.GetString("Views.UndockedViewCaptionFormat", "{0} ({1}) - {2}",
                                                        "Parameter one is the project name; parameter 2 is the view name; parameter 3 is the application name.");

            _viewsForm.Text = string.Format(fmt, prjName, caption, Application.ProductName);

            Visible = false;

            // Inform the tab group that one of it's views has been undocked.
            _ignoreTabSelection = true;
            OwningTabGroup.ViewWasUnDocked(this);
            _ignoreTabSelection   = false;
            s_undockingInProgress = false;
            _viewDocked           = false;
            _undockingInProgress  = false;

            _viewsForm.Show();
            _viewsForm.Activate();
            App.MsgMediator.SendMessage("ViewUndocked", View);
        }
コード例 #9
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Clears the search results on the tab and sets the tab to an empty tab.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public void Clear()
        {
            RemoveResultView();

            if (OwningTabGroup.RecordView != null)
            {
                OwningTabGroup.RecordView.Clear();
            }

            SearchQuery = new SearchQuery();
            CIEOptionsButton.Visible        = false;
            CIESimilarOptionsButton.Visible = false;
            Text = EmptyTabText;
            AdjustWidth();
            OwningTabGroup.AdjustTabContainerWidth();
        }
コード例 #10
0
        /// ------------------------------------------------------------------------------------
        public void ToggleCIESimilarView()
        {
            if (m_resultView != null && m_resultView.Grid != null && m_resultView.Grid.Cache != null)
            {
                if (m_resultView.Grid.Cache.IsSimilarEnvironment)
                {
                    m_resultView.Grid.CIESimilarViewOff();
                }
                else
                {
                    m_resultView.Grid.CIESimilarViewOn();
                }

                // Force users to restart Find when toggling the CIEView
                FindInfo.CanFindAgain = false;

                CIESimilarOptionsButton.Visible = m_resultView.Grid.Cache.IsSimilarEnvironment;
                AdjustWidth();
                OwningTabGroup.AdjustTabContainerWidth();
            }
        }
コード例 #11
0
        /// ------------------------------------------------------------------------------------
        protected override void OnMouseEnter(EventArgs e)
        {
            m_mouseOverTab = true;
            Invalidate();
            base.OnMouseEnter(e);

            if (m_btnClose.Parent == null)
            {
                // Add the button to the owning form because we want the bounds
                // of the button to extend beyond the bounds of this tab.
                FindForm().Controls.Add(m_btnClose);
                m_btnClose.BringToFront();
            }

            // If, at the point where the bottom, left of the close button would be
            // displayed is not visible (i.e. scrolled out of view), don't show it.
            if (OwningTabGroup.GetIsTabsRightEdgeVisible(this))
            {
                var pt = PointToScreen(new Point(Width - (m_btnClose.Width - 2), -2));
                m_btnClose.Location = FindForm().PointToClient(pt);
                m_btnClose.Visible  = true;
            }
        }
コード例 #12
0
        /// ------------------------------------------------------------------------------------
        private void SetupCloseButton()
        {
            m_btnClose                 = new XButton();
            m_btnClose.Visible         = false;
            m_btnClose.BackColor       = Color.Transparent;
            m_btnClose.Image           = Properties.Resources.CloseTabNormal;
            m_btnClose.Size            = m_btnClose.Image.Size;
            m_btnClose.DrawBackground += delegate { return(true); };
            m_btnClose.Click          += delegate { OwningTabGroup.RemoveTab(this, true); };

            m_btnClose.MouseEnter += delegate
            {
                m_btnClose.Image   = Properties.Resources.CloseTabHot;
                m_btnClose.Visible = true;
            };

            m_btnClose.MouseLeave += delegate
            {
                m_btnClose.Visible = false;
                m_btnClose.Image   = Properties.Resources.CloseTabNormal;
                Invalidate();
            };
        }
コード例 #13
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Reflects drag drop events to the tab's owning group.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 protected override void OnDragDrop(DragEventArgs e)
 {
     base.OnDragDrop(e);
     OwningTabGroup.InternalDragDrop(e);
 }
コード例 #14
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Reflects drag leave events to the tab's owning group.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 protected override void OnDragLeave(EventArgs e)
 {
     base.OnDragLeave(e);
     OwningTabGroup.InternalDragLeave(e);
 }
コード例 #15
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Treat dragging on a result view grid just like dragging on the tab.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 void HandleResultViewDragLeave(object sender, EventArgs e)
 {
     OwningTabGroup.InternalDragLeave(e);
 }
コード例 #16
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Make sure the global view and view type are set when an undocked view gets focus.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 public void m_viewsForm_Activated(object sender, EventArgs e)
 {
     OwningTabGroup.SetActiveView(View as ITabView, false);
 }
コード例 #17
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Treat dropping on a result view grid just like dropping on the tab.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 void HandleResultViewDragDrop(object sender, DragEventArgs e)
 {
     OwningTabGroup.InternalDragDrop(e);
 }