private void ContainerForm_DockedChanged(object sender, EventArgs e)
 {
     if (this.ContainerForm.Panels.Count > 1)
     {
         this.btnDock.Visible = false;
     }
     else if (this.ContainerForm.Panels.Count == 1)
     {
         this.btnDock.Visible = true;
         this.ContainerPanel = this.ContainerForm.Panels[0];
     }
     this.Refresh();
 }
Exemple #2
0
 public void AddTab(DockPanel panel)
 {
     TabButton button = new TabButton(this.Orientation, panel);
     button.Left = this.Panels.Count * button.Width;
     this.Panels.Add(panel);
     button.MouseDown += new MouseEventHandler(this.TabClick);
     foreach (TabButton button2 in this.gpgPanelTabs.Controls)
     {
         button2.Unselect();
     }
     this.gpgPanelContainer.Controls.Add(panel);
     this.gpgPanelTabs.Controls.Add(button);
     this.EnsureTabsFit();
     this.SwapPanels(panel);
 }
Exemple #3
0
 public TabButton(TabOrientations orientation, DockPanel panel)
 {
     base.SetStyle(ControlStyles.SupportsTransparentBackColor | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);
     this.BackColor = Color.Transparent;
     this.ForeColor = Color.LightGray;
     this.mOrientation = orientation;
     this.mPanel = panel;
     this.mManager = SkinManager.Docking;
     this.LoadImages();
     this.TextSize = DrawUtil.MeasureString(base.CreateGraphics(), this.Panel.Title, this.Font);
     base.Width = (this.LeftImage.Width + this.RightImage.Width) + ((int) this.TextSize.Width);
     if (this.Panel.Icon != null)
     {
         base.Width += this.Panel.Icon.Width;
     }
     base.Height = this.MidImage.Height;
 }
Exemple #4
0
 public DockTitleBar(DockPanel containerPanel)
 {
     DockStyleEventHandler handler = null;
     this.mDockedHeight = 0x19;
     this.mFloatingHeight = 50;
     this.mUndockMovementThreshhold = 8;
     this.mContainerPanel = containerPanel;
     this.InitializeComponent();
     this.Dock = System.Windows.Forms.DockStyle.Top;
     if (handler == null)
     {
         handler = delegate (object s, DockStyles style) {
             this.OnDockedChanged();
         };
     }
     this.ContainerPanel.DockStyleChanged += handler;
     this.OnDockedChanged();
     base.SetStyle(ControlStyles.ResizeRedraw, true);
 }
 public DockContainerForm(DockController controller, DockPanel initialPanel)
 {
     EventHandler handler = null;
     this.mTextPadding = new Padding(6, 8, 0, 0);
     this.mFormBorderCurve = 15;
     this.mPanels = new List<DockPanel>();
     this.mOutterDockThreshhold = 30;
     this.mPreviewStyle = DockStyles.None;
     this.mPreviewColor = Color.SkyBlue;
     this.mPreviewOpacity = 100;
     this.DragPaused = true;
     this.mResizeThreshold = 8;
     this.mDockStyle = DockStyles.Fill;
     this.InitializeComponent();
     this.mController = controller;
     this.Controller.Containers.Add(this);
     this.RootContainer = this.RootPanel;
     initialPanel.ContainerControl = this.RootContainer;
     initialPanel.ContainerForm = this;
     initialPanel.DockStyle = DockStyles.Floating;
     initialPanel.OnDocked();
     this.mTitleBar = new DockContainerTitleBar(this);
     this.TitleBarPanel.Height = this.TitleBar.Height;
     if (handler == null)
     {
         handler = delegate (object s, EventArgs e) {
             this.TitleBarPanel.Height = this.TitleBar.Height;
         };
     }
     this.TitleBar.SizeChanged += handler;
     this.TitleBarPanel.Controls.Add(this.TitleBar);
     this.LoadBorder();
     this.OnDocked(initialPanel);
     this.RootContainer.Controls.Add(initialPanel);
     this._Mouse_Moved = new MouseEventHandler(this.Mouse_Moved);
     GlobalHook.Mouse.Moved += this._Mouse_Moved;
     this._Mouse_ButtonDown = new MouseEventHandler(this.Mouse_ButtonDown);
     GlobalHook.Mouse.ButtonDown += this._Mouse_ButtonDown;
     this._Mouse_ButtonUp = new MouseEventHandler(this.Mouse_ButtonUp);
     GlobalHook.Mouse.ButtonUp += this._Mouse_ButtonUp;
 }
 internal void OnUndocked(DockPanel panel)
 {
     this.Panels.Remove(panel);
     if (this.Undocked != null)
     {
         this.Undocked(this, EventArgs.Empty);
     }
 }
 internal void OnDocked(DockPanel panel)
 {
     this.Panels.Add(panel);
     if (this.Docked != null)
     {
         this.Docked(this, EventArgs.Empty);
     }
 }
Exemple #8
0
 private void SwapPanels(DockPanel panel)
 {
     foreach (DockPanel panel2 in this.Panels)
     {
         if (!panel2.Equals(panel))
         {
             panel2.Hide();
         }
     }
     panel.Show();
     panel.BringToFront();
     this.mActivePanel = panel;
 }
Exemple #9
0
 public void RemoveTab(DockPanel panel)
 {
     if (this.Panels.Count > 1)
     {
         int index = 0;
         while (index < this.Panels.Count)
         {
             if (this.Panels[index].Equals(panel))
             {
                 break;
             }
             index++;
         }
         if (index >= 0)
         {
             if ((this.ActivePanel != null) && this.ActivePanel.Equals(panel))
             {
                 if (index == 0)
                 {
                     this.mActivePanel = this.Panels[1];
                 }
                 else
                 {
                     this.mActivePanel = this.Panels[index - 1];
                 }
             }
             this.SwapPanels(this.ActivePanel);
             this.Panels.RemoveAt(index);
             TabButton button = null;
             foreach (TabButton button2 in this.gpgPanelTabs.Controls)
             {
                 if (button2.Panel.Equals(panel))
                 {
                     button = button2;
                 }
                 else if (button2.Panel.Equals(this.ActivePanel))
                 {
                     button2.Select();
                 }
                 if (button != null)
                 {
                     button2.Left -= button.Width;
                 }
             }
             if (button != null)
             {
                 this.gpgPanelTabs.Controls.Remove(button);
             }
         }
     }
 }
Exemple #10
0
 protected override void OnParentChanged(EventArgs e)
 {
     base.OnParentChanged(e);
     this.mContainerPanel = base.Parent as DockPanel;
     this.PositionAnchor();
     base.Parent.SizeChanged += delegate (object s, EventArgs ea) {
         this.PositionAnchor();
     };
     this._Mouse_Moved = new MouseEventHandler(this.Mouse_Moved);
     this._Mouse_ButtonUp = new MouseEventHandler(this.Mouse_ButtonUp);
     this.Controller.BeginDockDrag += delegate (object s, EventArgs ea) {
         GlobalHook.Mouse.Moved += this._Mouse_Moved;
         GlobalHook.Mouse.ButtonUp += this._Mouse_ButtonUp;
     };
     this.Controller.EndDockDrag += delegate (object s, EventArgs ea) {
         GlobalHook.Mouse.Moved -= this._Mouse_Moved;
         GlobalHook.Mouse.ButtonUp -= this._Mouse_ButtonUp;
     };
 }