mirror of
https://github.com/colhountech/DarkUI.Net5.git
synced 2025-07-25 20:51:32 +03:00
DockPanel now tracks active content
This commit is contained in:
parent
46ac401542
commit
c39af6c190
@ -1,4 +1,5 @@
|
|||||||
using DarkUI.Config;
|
using DarkUI.Config;
|
||||||
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
@ -59,10 +60,6 @@ namespace DarkUI.Docking
|
|||||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||||
public DarkDockGroup DockGroup { get; internal set; }
|
public DarkDockGroup DockGroup { get; internal set; }
|
||||||
|
|
||||||
[Browsable(false)]
|
|
||||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
|
||||||
public bool IsActive { get; internal set; }
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructor Region
|
#region Constructor Region
|
||||||
@ -81,5 +78,19 @@ namespace DarkUI.Docking
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Event Handler Region
|
||||||
|
|
||||||
|
protected override void OnEnter(EventArgs e)
|
||||||
|
{
|
||||||
|
base.OnEnter(e);
|
||||||
|
|
||||||
|
if (DockPanel == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
DockPanel.ActiveContent = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,35 @@ namespace DarkUI.Docking
|
|||||||
private List<DarkDockContent> _contents;
|
private List<DarkDockContent> _contents;
|
||||||
private Dictionary<DarkDockArea, DarkDockRegion> _regions;
|
private Dictionary<DarkDockArea, DarkDockRegion> _regions;
|
||||||
|
|
||||||
|
private DarkDockContent _activeContent;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Property Region
|
#region Property Region
|
||||||
|
|
||||||
|
public DarkDockContent ActiveContent
|
||||||
|
{
|
||||||
|
get { return _activeContent; }
|
||||||
|
internal set
|
||||||
|
{
|
||||||
|
_activeContent = value;
|
||||||
|
|
||||||
|
ActiveGroup = _activeContent.DockGroup;
|
||||||
|
ActiveRegion = ActiveGroup.DockRegion;
|
||||||
|
|
||||||
|
foreach (var content in _contents)
|
||||||
|
content.Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Browsable(false)]
|
||||||
|
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||||
|
public DarkDockRegion ActiveRegion { get; internal set; }
|
||||||
|
|
||||||
|
[Browsable(false)]
|
||||||
|
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||||
|
public DarkDockGroup ActiveGroup { get; internal set; }
|
||||||
|
|
||||||
[Browsable(false)]
|
[Browsable(false)]
|
||||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
|
||||||
public IMessageFilter MessageFilter { get; private set; }
|
public IMessageFilter MessageFilter { get; private set; }
|
||||||
|
@ -33,6 +33,18 @@ namespace DarkUI.Docking
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Method Region
|
||||||
|
|
||||||
|
private bool IsActive()
|
||||||
|
{
|
||||||
|
if (DockPanel == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return DockPanel.ActiveContent == this;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Paint Region
|
#region Paint Region
|
||||||
|
|
||||||
protected override void OnPaint(PaintEventArgs e)
|
protected override void OnPaint(PaintEventArgs e)
|
||||||
@ -45,10 +57,12 @@ namespace DarkUI.Docking
|
|||||||
g.FillRectangle(b, ClientRectangle);
|
g.FillRectangle(b, ClientRectangle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isActive = IsActive();
|
||||||
|
|
||||||
// Draw header
|
// Draw header
|
||||||
var bgColor = IsActive ? Colors.BlueBackground : Colors.HeaderBackground;
|
var bgColor = isActive ? Colors.BlueBackground : Colors.HeaderBackground;
|
||||||
var darkColor = IsActive ? Colors.DarkBlueBorder : Colors.DarkBorder;
|
var darkColor = isActive ? Colors.DarkBlueBorder : Colors.DarkBorder;
|
||||||
var lightColor = IsActive ? Colors.LightBlueBorder : Colors.LightBorder;
|
var lightColor = isActive ? Colors.LightBlueBorder : Colors.LightBorder;
|
||||||
|
|
||||||
using (var b = new SolidBrush(bgColor))
|
using (var b = new SolidBrush(bgColor))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user