コード例 #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// This message is received when the current tab group changes. We catch it here
        /// for every group in order to invalidate the tabs contained in the group. They're
        /// invalidated to force painting consistent with their selected status.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected bool OnSearchResultTabGroupChanged(object args)
        {
            SearchResultTabGroup group = args as SearchResultTabGroup;

            if (group != null && group.m_rsltVwMngr == m_rsltVwMngr)
            {
                IsCurrent = (group == this);

                foreach (SearchResultTab tab in Tabs)
                {
                    tab.Invalidate();
                    if (tab.ResultView != null && tab.ResultView.Grid != null)
                    {
                        tab.ResultView.Grid.IsCurrentPlaybackGrid = false;
                    }
                }

                // Force the text in empty views to be redrawn. This is only necessary
                // when there is more than one tab group and the current tab in any one
                // of those groups is empty. (The text is drawn disabled looking when
                // the tab's owning tab group isn't current).
                if (CurrentTab != null && CurrentTab.ResultView == null)
                {
                    Invalidate();
                }
            }

            // There's a strange problem in which a tab group's wait cursor gets turned on
            // and I can't find where. It's not explicitly so it must be implicitly.
            UseWaitCursor = false;
            Cursor        = Cursors.Default;

            return(false);
        }
コード例 #2
0
        /// ------------------------------------------------------------------------------------
        void ContextMenuStrip_Opening(object sender, CancelEventArgs e)
        {
            var cms = sender as ContextMenuStrip;

            if (cms != null && cms.SourceControl != null)
            {
                m_contextMenuTabGroup = cms.SourceControl.Parent as SearchResultTabGroup;
            }
        }
コード例 #3
0
        /// ------------------------------------------------------------------------------------
        protected bool OnCloseTabGroup(object args)
        {
            if (ContextMenuTab != null || m_contextMenuTabGroup == this)
            {
                Close();
                ContextMenuTab        = null;
                m_contextMenuTabGroup = null;
                return(true);
            }

            return(false);
        }
コード例 #4
0
        /// ------------------------------------------------------------------------------------
        public SearchResultTab(SearchResultTabGroup owningTabControl)
        {
            base.DoubleBuffered = true;
            base.AutoSize       = false;
            base.AllowDrop      = true;
            base.Font           = App.PhoneticFont;
            OwningTabGroup      = owningTabControl;
            SearchQuery         = new SearchQuery();
            App.AddMediatorColleague(this);
            SetContextMenus();
            SetupCloseButton();

            // Prepare the tab's minimal pair options button.
            Image img = Properties.Resources.kimidMinimalPairsOptionsDropDown;

            CIEOptionsButton             = new XButton();
            CIEOptionsButton.Image       = img;
            CIEOptionsButton.Size        = new Size(img.Width + 4, img.Height + 4);
            CIEOptionsButton.BackColor   = Color.Transparent;
            CIEOptionsButton.Visible     = false;
            CIEOptionsButton.Left        = kleftImgMargin;
            CIEOptionsButton.Click      += m_btnCIEOptions_Click;
            CIEOptionsButton.MouseEnter += m_btnCIEOptions_MouseEnter;
            CIEOptionsButton.MouseLeave += m_btnCIEOptions_MouseLeave;
            Controls.Add(CIEOptionsButton);

            // Prepare the tab's minimal pair options button.
            img = Properties.Resources.SimilarEnvironment;
            CIESimilarOptionsButton             = new XButton();
            CIESimilarOptionsButton.Image       = img;
            CIESimilarOptionsButton.Size        = new Size(img.Width + 4, img.Height + 4);
            CIESimilarOptionsButton.BackColor   = Color.Transparent;
            CIESimilarOptionsButton.Visible     = false;
            CIESimilarOptionsButton.Left        = kleftImgMargin;
            CIESimilarOptionsButton.Click      += m_btnCIESimilarOptions_Click;
            CIESimilarOptionsButton.MouseEnter += m_btnCIESimilarOptions_MouseEnter;
            CIESimilarOptionsButton.MouseLeave += m_btnCIESimilarOptions_MouseLeave;
            Controls.Add(CIESimilarOptionsButton);

            GetTabColors();

            Text = EmptyTabText;
        }
コード例 #5
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 ///
 /// </summary>
 /// ------------------------------------------------------------------------------------
 public TabDropIndicator(SearchResultTabGroup tabGroup, int height)
     : base(tabGroup)
 {
     m_tabGroup = tabGroup;
     m_height   = height;
 }
コード例 #6
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Removes the specified tab from the group's collection of tabs.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public void RemoveTab(SearchResultTab tab, bool disposeOfTab)
        {
            // If the tab being removed is selected and owned by a tab group, then make
            // sure we select an adjacent tab before removing the tab because a tab group
            // always has to have a selected tab.
            if (tab.Selected && tab.OwningTabGroup != null)
            {
                SearchResultTabGroup tabGroup             = tab.OwningTabGroup;
                SearchResultTab      newTabInSendingGroup = null;
                int i = tabGroup.m_tabsPanel.Controls.IndexOf(tab);

                if (i - 1 >= 0)
                {
                    newTabInSendingGroup = tabGroup.m_tabsPanel.Controls[i - 1] as SearchResultTab;
                }
                else if (i + 1 < tabGroup.m_tabsPanel.Controls.Count)
                {
                    newTabInSendingGroup = tabGroup.m_tabsPanel.Controls[i + 1] as SearchResultTab;
                }

                if (newTabInSendingGroup != null)
                {
                    tabGroup.SelectTab(newTabInSendingGroup, true);
                }
            }

            if (m_tabsPanel.Controls.Contains(tab))
            {
                tab.Click     -= HandleTabClick;
                tab.MouseDown -= HandleMouseDown;

                if (tab.ResultView != null)
                {
                    tab.ResultView.Click     -= HandleClick;
                    tab.ResultView.MouseDown -= HandleMouseDown;
                }

                if (Controls.Contains(tab.ResultView))
                {
                    Controls.Remove(tab.ResultView);
                }

                m_tabsPanel.Controls.Remove(tab);
                Tabs.Remove(tab);

                if (disposeOfTab)
                {
                    tab.Dispose();
                }

                AdjustTabContainerWidth();
                RefreshScrollButtonPanel();

                // If removing the tab left a gap between the furthest right tab and the
                // button panel... and all or a portion of the furthest left tab are
                // scrolled out of view, then scroll right to close that gap.
                if (m_tabsPanel.Left < 0 && m_tabsPanel.Right < m_buttonPanel.Left)
                {
                    int dx = (m_buttonPanel.Left - m_tabsPanel.Right);
                    SlideTabs(m_tabsPanel.Left + dx);
                }
            }

            // If the last tab was removed from the group, then close the tab group by
            // removing ourselves from our parent's control collection.
            if (Tabs.Count == 0 && Parent != null)
            {
                Controls.Clear();
                Parent.Controls.Remove(this);
                Dispose();
            }
        }