Esempio n. 1
0
        public void RemoveTab(int page, bool animate)
        {
            var tab = pages [page];

            if (animate)
            {
                tabStrip.StartCloseAnimation((DockNotebookTab)tab);
            }
            pagesHistory.Remove(tab);
            if (pages.Count == 1)
            {
                CurrentTab = null;
            }
            else if (page == CurrentTabIndex)
            {
                SelectLastActiveTab(page);
            }
            pages.RemoveAt(page);
            UpdateIndexes(page);
            tabStrip.Update();
            tabStrip.DropDownButton.Sensitive = pages.Count > 0;

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

            NotebookChanged?.Invoke(this, EventArgs.Empty);
        }
Esempio n. 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,
            });

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

            return(tab);
        }
Esempio n. 3
0
        internal void SetDockNotebook(DockNotebook tabControl, DockNotebookTab tabLabel)
        {
            var oldNotebook = tabControl;

            this.tabControl = tabControl;
            this.tab        = tabLabel;
            SetTitleEvent();
            SetDockNotebookTabTitle();

            if (oldNotebook != tabControl)
            {
                NotebookChanged?.Invoke(this, new NotebookChangeEventArgs {
                    OldNotebook = oldNotebook, NewNotebook = tabControl
                });
            }
        }