Example #1
0
        public DockNotebookTab InsertTab(int index)
        {
            var tab = new DockNotebookTab(this, tabStrip);

            if (index == -1)
            {
                pages.Add(tab);
                tab.Index = pages.Count - 1;
            }
            else
            {
                pages.Insert(index, tab);
                tab.Index = index;
                UpdateIndexes(index + 1);
            }

            pagesHistory.Add(tab);

            if (pages.Count == 1)
            {
                CurrentTab = tab;
            }

            tabStrip.StartOpenAnimation((DockNotebookTab)tab);
            tabStrip.Update();
            tabStrip.DropDownButton.Sensitive = pages.Count > 0;

            if (PageAdded != null)
            {
                PageAdded(this, EventArgs.Empty);
            }

            return(tab);
        }
Example #2
0
        public DockNotebookTab InsertTab(int index)
        {
            var tab = new DockNotebookTab(this, tabStrip);

            if (index == -1)
            {
                pages.Add(tab);
                tab.Index = pages.Count - 1;
            }
            else
            {
                pages.Insert(index, tab);
                tab.Index = index;
                UpdateIndexes(index + 1);
            }

            pagesHistory.Add(tab);

            if (pages.Count == 1)
            {
                CurrentTab = tab;
            }

            tabStrip.StartOpenAnimation((DockNotebookTab)tab);
            tabStrip.Update();
            tabStrip.DropDownButton.Sensitive = pages.Count > 0;

            PageAdded?.Invoke(this, new TabEventArgs {
                Tab = tab,
            });

            tab.OnChangingPinned = OnTabPinned;

            NotebookChanged?.Invoke(this, EventArgs.Empty);

            return(tab);
        }