Permalink
Browse files

Improve extensibility

  • Loading branch information...
yck1509 committed Jan 3, 2015
1 parent 8668fda commit 72645c566987fb43fee469770d842f5f49c1fb97
@@ -157,7 +157,7 @@ private SplitterDragHandler GetSplitterDragHandler()
return m_splitterDragHandler;
}
internal void BeginDrag(ISplitterDragSource dragSource, Rectangle rectSplitter)
public void BeginDrag(ISplitterDragSource dragSource, Rectangle rectSplitter)
{
GetSplitterDragHandler().BeginDrag(dragSource, rectSplitter);
}
@@ -799,20 +799,27 @@ public void SetPaneIndex(DockPane pane, int index)
Panes.AddAt(pane, index);
}
int suspendCount = 0;
public void SuspendLayout(bool allWindows)
{
FocusManager.SuspendFocusTracking();
SuspendLayout();
if (allWindows)
SuspendMdiClientLayout();
if (suspendCount++ == 0)
{
FocusManager.SuspendFocusTracking();
SuspendLayout();
if (allWindows)
SuspendMdiClientLayout();
}
}
public void ResumeLayout(bool performLayout, bool allWindows)
{
FocusManager.ResumeFocusTracking();
ResumeLayout(performLayout);
if (allWindows)
ResumeMdiClientLayout(performLayout);
if (--suspendCount == 0)
{
FocusManager.ResumeFocusTracking();
ResumeLayout(performLayout);
if (allWindows)
ResumeMdiClientLayout(performLayout);
}
}
internal Form ParentForm
@@ -15,7 +15,7 @@ public partial class DockWindow : Panel, INestedPanesContainer, ISplitterDragSou
private SplitterBase m_splitter;
private NestedPaneCollection m_nestedPanes;
internal DockWindow(DockPanel dockPanel, DockState dockState)
protected internal DockWindow(DockPanel dockPanel, DockState dockState)
{
m_nestedPanes = new NestedPaneCollection(this);
m_dockPanel = dockPanel;
@@ -4,7 +4,7 @@
namespace WeifenLuo.WinFormsUI.Docking
{
internal static class DockHelper
public static class DockHelper
{
public static bool IsDockStateAutoHide(DockState dockState)
{
@@ -6,7 +6,7 @@
namespace WeifenLuo.WinFormsUI.Docking
{
internal static class DrawHelper
public static class DrawHelper
{
public static Point RtlTransform(Control control, Point point)
{
@@ -7,7 +7,7 @@
namespace WeifenLuo.WinFormsUI.Docking
{
internal abstract class InertButtonBase : Control
public abstract class InertButtonBase : Control
{
protected InertButtonBase()
{
@@ -34,11 +34,45 @@ private set
}
}
private bool m_isMouseDown = false;
protected bool IsMouseDown
{
get { return m_isMouseDown; }
private set
{
if (m_isMouseDown == value)
return;
m_isMouseDown = value;
Invalidate();
}
}
protected override Size DefaultSize
{
get { return Resources.DockPane_Close.Size; }
}
protected virtual Color HoverBackColor
{
get { return Color.Transparent; }
}
protected virtual Color HoverBorderColor
{
get { return ForeColor; }
}
protected virtual Color HoverForeColor
{
get { return ForeColor; }
}
protected virtual Color PressedBackColor
{
get { return Color.Transparent; }
}
protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
@@ -61,27 +95,44 @@ protected override void OnMouseLeave(EventArgs e)
IsMouseOver = false;
}
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseLeave(e);
if (!IsMouseDown)
IsMouseDown = true;
}
protected override void OnMouseUp(MouseEventArgs e)
{
base.OnMouseLeave(e);
if (IsMouseDown)
IsMouseDown = false;
}
protected override void OnPaint(PaintEventArgs e)
{
if (IsMouseOver && Enabled)
{
using (Pen pen = new Pen(ForeColor))
using (Pen pen = new Pen(this.HoverBorderColor))
using (Brush brush = new SolidBrush(IsMouseDown ? PressedBackColor : HoverBackColor))

This comment has been minimized.

Show comment
Hide comment
@lextm

lextm Sep 6, 2016

It shows how to show pressed image, which is quite useful for VS2012/2013 themes.

@lextm

lextm Sep 6, 2016

It shows how to show pressed image, which is quite useful for VS2012/2013 themes.

{
e.Graphics.DrawRectangle(pen, Rectangle.Inflate(ClientRectangle, -1, -1));
Rectangle rect = ClientRectangle;
rect.Width--;
rect.Height--;
e.Graphics.FillRectangle(brush, rect);
e.Graphics.DrawRectangle(pen, rect);
}
}
using (ImageAttributes imageAttributes = new ImageAttributes())
{
ColorMap[] colorMap = new ColorMap[2];
colorMap[0] = new ColorMap();
colorMap[0].OldColor = Color.FromArgb(0, 0, 0);
colorMap[0].NewColor = ForeColor;
colorMap[1] = new ColorMap();
colorMap[1].OldColor = Image.GetPixel(0, 0);
colorMap[1].NewColor = Color.Transparent;
imageAttributes.SetRemapTable(colorMap);
Color color = IsMouseOver ? HoverForeColor : ForeColor;
ColorMatrix matrix = new ColorMatrix();
matrix.Matrix40 = color.R / 255f;
matrix.Matrix41 = color.G / 255f;
matrix.Matrix42 = color.B / 255f;
imageAttributes.SetColorMatrix(matrix);
e.Graphics.DrawImage(
Image,
@@ -20,12 +20,12 @@ public interface INestedPanesContainer
bool IsFloat { get; }
}
internal interface IDragSource
public interface IDragSource
{
Control DragControl { get; }
}
internal interface IDockDragSource : IDragSource
public interface IDockDragSource : IDragSource
{
Rectangle BeginDrag(Point ptMouse);
void EndDrag();
@@ -36,7 +36,7 @@ internal interface IDockDragSource : IDragSource
void DockTo(DockPanel panel, DockStyle dockStyle);
}
internal interface ISplitterDragSource : IDragSource
public interface ISplitterDragSource : IDragSource
{
void BeginDrag(Rectangle rectSplitter);
void EndDrag();
@@ -69,7 +69,7 @@ private void CheckFloatWindowDispose()
/// Switches a pane with its first child in the pane hierarchy. (The actual hiding happens elsewhere.)
/// </summary>
/// <param name="pane">Pane to switch</param>
internal void SwitchPaneWithFirstChild(DockPane pane)
public void SwitchPaneWithFirstChild(DockPane pane)
{
if (!Contains(pane))
return;
Oops, something went wrong.

1 comment on commit 72645c5

@lextm

This comment has been minimized.

Show comment
Hide comment
@lextm

lextm commented on 72645c5 Sep 6, 2016

Tracked under dockpanelsuite#397

Please sign in to comment.