示例#1
0
        /// <summary>Callback that is invoked whenever anything is added or removed from <see cref="Tabs" /> so that we can trigger a redraw of the tabs.</summary>
        /// <param name="sender">Object for which this event was raised.</param>
        /// <param name="e">Arguments associated with the event.</param>
        private void _tabs_CollectionModified(object sender, ListModificationEventArgs e)
        {
            SetFrameSize();

            if (e.Modification == ListModification.ItemAdded || e.Modification == ListModification.RangeAdded)
            {
                for (int i = 0; i < e.Count; i++)
                {
                    TitleBarTab currentTab = Tabs[i + e.StartIndex];

                    currentTab.Content.TextChanged += Content_TextChanged;
                    currentTab.Closing             += TitleBarTabs_Closing;

                    if (AeroPeekEnabled)
                    {
                        TaskbarManager.Instance.TabbedThumbnail.SetActiveTab(CreateThumbnailPreview(currentTab));
                    }
                }
            }

            if (_overlay != null)
            {
                _overlay.Render(true);
            }
        }
示例#2
0
        /// <summary>Raises <see cref="CollectionModified" /> events.</summary>
        /// <param name="e">An <see cref="ListModificationEventArgs" /> that contains the event data.</param>
        protected virtual void OnCollectionModified(ListModificationEventArgs e)
        {
            if (_suppressEvents)
            {
                return;
            }

            if (CollectionModified != null)
            {
                CollectionModified(this, e);
            }
        }
示例#3
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 => (tab.Active
                                        ? _activeLeftSideImage.Width
                                        : _inactiveLeftSideImage.Width) + (tab.Active
                                                ? _activeRightSideImage.Width
                                                : _inactiveRightSideImage.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);
        }