예제 #1
0
        /// <summary>
        /// When items are added to the tabs collection, we need to ensure that the <see cref="_parentWindow" />'s minimum width is set so that we can display at
        /// least each tab and its close buttons.
        /// </summary>
        /// <param name="sender">List of tabs in the <see cref="_parentWindow" />.</param>
        /// <param name="e">Arguments associated with the event.</param>
        private void Tabs_CollectionModified(object sender, ListModificationEventArgs e)
        {
            ListWithEvents <TitleBarTab> tabs = (ListWithEvents <TitleBarTab>)sender;

            if (tabs.Count == 0)
            {
                return;
            }

            int minimumWidth = tabs.Sum(
                tab => GetTabLeftImage(tab).Width + GetTabRightImage(tab).Width + (tab.ShowCloseButton
                                                   ? tab.CloseButtonArea.Width + CloseButtonMarginLeft
                                                   : 0));

            minimumWidth += OverlapWidth;

            minimumWidth += (_parentWindow.ControlBox
                                                                ? SystemInformation.CaptionButtonSize.Width
                                                                : 0) -
                            (_parentWindow.MinimizeBox
                                                                ? SystemInformation.CaptionButtonSize.Width
                                                                : 0) -
                            (_parentWindow.MaximizeBox
                                                                ? SystemInformation.CaptionButtonSize.Width
                                                                : 0) + (ShowAddButton
                                                                ? _addButtonImage.Width + AddButtonMarginLeft +
                                                                        AddButtonMarginRight
                                                                : 0);

            _parentWindow.MinimumSize = new Size(minimumWidth, 0);
        }
예제 #2
0
        /// <summary>
        /// Gets the image to use for the right side of the tab.  For Chrome, we pick a specific image for inactive tabs that aren't at
        /// the end of the list to allow for the separation between inactive tabs to be more clearly defined.
        /// </summary>
        /// <param name="tab">Tab that we are retrieving the image for.</param>
        /// <returns>Right-side image for <paramref name="tab"/>.</returns>
        protected override Image GetTabRightImage(TitleBarTab tab)
        {
            ListWithEvents <TitleBarTab> allTabs = tab.Parent.Tabs;

            if (tab.Active || allTabs.IndexOf(tab) == allTabs.Count - 1)
            {
                return(base.GetTabRightImage(tab));
            }

            return(_inactiveRightSideShadowImage);
        }