Ejemplo n.º 1
0
        // This removes a docker
        public bool Remove(Docker d)
        {
            foreach (TabPage page in tabs.TabPages)
            {
                if ((page.Tag as Docker) == d)
                {
                    // Go for all controls to remove events
                    Queue <Control> todo = new Queue <Control>();
                    todo.Enqueue(d.Control);
                    while (todo.Count > 0)
                    {
                        Control c = todo.Dequeue();
                        c.MouseEnter -= RaiseMouseContainerEnter;
                        c.MouseLeave -= RaiseMouseContainerLeave;
                        foreach (Control cc in c.Controls)
                        {
                            todo.Enqueue(cc);
                        }
                    }

                    // Take down that page
                    if (page == tabs.SelectedTab)
                    {
                        SelectPrevious();
                    }
                    page.Controls.Clear();
                    tabs.TabPages.Remove(page);
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 2
0
        // This selects a docker
        public bool SelectDocker(Docker d)
        {
            int index = 0;

            foreach (TabPage page in tabs.TabPages)
            {
                if ((page.Tag as Docker) == d)
                {
                    if (iscollapsed)
                    {
                        previousselected = currentselected;
                        expandedtab      = index;
                    }
                    else
                    {
                        tabs.SelectedTab = page;
                    }

                    return(true);
                }

                index++;
            }

            return(false);
        }
Ejemplo n.º 3
0
        // This adds a docker
        public void Add(Docker d)
        {
            // Set up page
            TabPage page = new TabPage(d.Title);

            page.SuspendLayout();
            page.Font = this.Font;
            page.Tag  = d;
            page.UseVisualStyleBackColor = false;
            page.Controls.Add(d.Control);
            d.Control.Dock = DockStyle.Fill;
            tabs.TabPages.Add(page);
            page.ResumeLayout(true);
            if (iscollapsed)
            {
                tabs.SelectedIndex = -1;
            }

            // Go for all controls to add events
            Queue <Control> todo = new Queue <Control>();

            todo.Enqueue(d.Control);
            while (todo.Count > 0)
            {
                Control c = todo.Dequeue();
                c.MouseEnter += RaiseMouseContainerEnter;
                c.MouseLeave += RaiseMouseContainerLeave;
                foreach (Control cc in c.Controls)
                {
                    todo.Enqueue(cc);
                }
            }
        }
Ejemplo n.º 4
0
        // Tab selected
        private void tabs_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!controlledselection)
            {
                // Keep track of previous selected tab
                previousselected = currentselected;
                if (tabs.SelectedTab != null)
                {
                    Docker d = (tabs.SelectedTab.Tag as Docker);
                    currentselected = d.FullName;
                }
                else
                {
                    currentselected = null;
                }
            }

            General.MainWindow.FocusDisplay();
        }