Permalink
Browse files

Generated a key to sign DockPanel Suite. Added .gitignore. Merged Mon…

…o lite mode patch from #SNMP.
  • Loading branch information...
lextm committed May 18, 2012
1 parent c10c301 commit 5e27774b05a7d0325da5041816e7018e00d0468f
View
@@ -0,0 +1,26 @@
+build/
+*.suo
+*.user
+_ReSharper*
+*.csproj.user
+*.resharper.user
+*.userprefs
+*.suo
+*.cache
+*.trx
+*.pidb
+Thumbs.db
+[Bb]in
+[Dd]ebug
+[Oo]bj
+[Rr]elease
+[Tt]est[Rr]esult*
+_UpgradeReport_Files
+*[Pp]ublish.xml
+*.project
+*.metadata
+logs
+*.generated.cs
+T4MVC.cs
+/SharpSnmpLib/sharpsnmplib.snk
+/packages
@@ -258,6 +258,7 @@ public DockPanel DockPanel
Form.FormBorderStyle = FormBorderStyle.None;
Form.ShowInTaskbar = false;
Form.WindowState = FormWindowState.Normal;
+ if (!Win32Helper.IsRunningOnMono())
NativeMethods.SetWindowPos(Form.Handle, IntPtr.Zero, 0, 0, 0, 0,
Win32.FlagsSetWindowPos.SWP_NOACTIVATE |
Win32.FlagsSetWindowPos.SWP_NOMOVE |
@@ -513,6 +514,7 @@ internal void SetDockState(bool isHidden, DockState visibleState, DockPane oldPa
if (Form.ContainsFocus)
if (DockState == DockState.Hidden || DockState == DockState.Unknown)
+ if (!Win32Helper.IsRunningOnMono())
DockPanel.ContentFocusManager.GiveUpFocus(Content);
SetPaneAndVisible(Pane);
@@ -533,8 +535,10 @@ internal void SetDockState(bool isHidden, DockState visibleState, DockPane oldPa
{
if (DockState == DockState.Hidden || DockState == DockState.Unknown ||
DockHelper.IsDockStateAutoHide(DockState))
+ if (!Win32Helper.IsRunningOnMono())
DockPanel.ContentFocusManager.RemoveFromList(Content);
else
+ if (!Win32Helper.IsRunningOnMono())
DockPanel.ContentFocusManager.AddToList(Content);
OnDockStateChanged(EventArgs.Empty);
@@ -641,12 +645,14 @@ public void Activate()
DockPanel.ActiveAutoHideContent = Content;
if (!Form.ContainsFocus)
+ if (!Win32Helper.IsRunningOnMono())
DockPanel.ContentFocusManager.Activate(Content);
}
}
public void GiveUpFocus()
{
+ if (!Win32Helper.IsRunningOnMono())
DockPanel.ContentFocusManager.GiveUpFocus(Content);
}
@@ -725,6 +731,7 @@ private void SetParent(Control value)
{
//Suggested as a fix for a memory leak by bugreports
if (value == null && !IsFloat)
+ if (!Win32Helper.IsRunningOnMono())
DockPanel.ContentFocusManager.GiveUpFocus(this.Content);
else
{
@@ -911,6 +911,7 @@ private void InternalSetDockState(DockState value)
FloatWindow = DockPanel.FloatWindowFactory.CreateFloatWindow(DockPanel, this);
if (contentFocused != null)
+ if (!Win32Helper.IsRunningOnMono())
DockPanel.ContentFocusManager.Activate(contentFocused);
ResumeRefreshStateChange(oldContainer, oldDockState);
@@ -102,6 +102,7 @@ public IDockContent ActiveContent
if (m_activeContent != null)
{
if (m_activeContent.DockHandler.Form.ContainsFocus)
+ if (!Win32Helper.IsRunningOnMono())
DockPanel.ContentFocusManager.GiveUpFocus(m_activeContent);
AnimateWindow(false);
}
@@ -45,6 +45,7 @@ protected bool BeginDrag()
StartMousePosition = Control.MousePosition;
+ if (!Win32Helper.IsRunningOnMono())
if (!NativeMethods.DragDetect(DragControl.Handle, StartMousePosition))
return false;
@@ -124,6 +124,10 @@ protected virtual void Dispose(bool disposing)
public FocusManagerImpl(DockPanel dockPanel)
{
m_dockPanel = dockPanel;
+
+ if (Win32Helper.IsRunningOnMono())
+ return;
+
m_localWindowsHook = new LocalWindowsHook(Win32.HookType.WH_CALLWNDPROCRET);
m_hookEventHandler = new LocalWindowsHook.HookEventHandler(HookEventHandler);
m_localWindowsHook.HookInvoked += m_hookEventHandler;
@@ -143,6 +147,7 @@ protected override void Dispose(bool disposing)
{
if (!m_disposed && disposing)
{
+ if (!Win32Helper.IsRunningOnMono())
m_localWindowsHook.Dispose();
m_disposed = true;
}
@@ -172,11 +177,13 @@ public void Activate(IDockContent content)
if (handler.Form.IsDisposed)
return; // Should not reach here, but better than throwing an exception
if (ContentContains(content, handler.ActiveWindowHandle))
+ if (!Win32Helper.IsRunningOnMono())
NativeMethods.SetFocus(handler.ActiveWindowHandle);
if (!handler.Form.ContainsFocus)
{
if (!handler.Form.SelectNextControl(handler.Form.ActiveControl, true, true, true, true))
// Since DockContent Form is not selectalbe, use Win32 SetFocus instead
+ if (!Win32Helper.IsRunningOnMono())
NativeMethods.SetFocus(handler.Form.Handle);
}
}
@@ -285,6 +292,7 @@ private static bool ContentContains(IDockContent content, IntPtr hWnd)
public void SuspendFocusTracking()
{
m_countSuspendFocusTracking++;
+ if (!Win32Helper.IsRunningOnMono())
m_localWindowsHook.HookInvoked -= m_hookEventHandler;
}
@@ -300,6 +308,7 @@ public void ResumeFocusTracking()
Activate(ContentActivating);
ContentActivating = null;
}
+ if (!Win32Helper.IsRunningOnMono())
m_localWindowsHook.HookInvoked += m_hookEventHandler;
if (!InRefreshActiveWindow)
RefreshActiveWindow();
@@ -390,7 +399,7 @@ public DockPane ActivePane
private void SetActivePane()
{
- DockPane value = GetPaneFromHandle(NativeMethods.GetFocus());
+ DockPane value = Win32Helper.IsRunningOnMono() ? null : GetPaneFromHandle(NativeMethods.GetFocus());
if (m_activePane == value)
return;
@@ -87,6 +87,8 @@ public BorderStyle BorderStyle
// "Adding designable borders to user controls".
// http://www.codeproject.com/cs/miscctrl/CsAddingBorders.asp
+ if (!Win32Helper.IsRunningOnMono())
+ {
// Get styles using Win32 calls
int style = NativeMethods.GetWindowLong(MdiClient.Handle, (int)Win32.GetWindowLongIndex.GWL_STYLE);
int exStyle = NativeMethods.GetWindowLong(MdiClient.Handle, (int)Win32.GetWindowLongIndex.GWL_EXSTYLE);
@@ -113,7 +115,7 @@ public BorderStyle BorderStyle
// Set the styles using Win32 calls
NativeMethods.SetWindowLong(MdiClient.Handle, (int)Win32.GetWindowLongIndex.GWL_STYLE, style);
NativeMethods.SetWindowLong(MdiClient.Handle, (int)Win32.GetWindowLongIndex.GWL_EXSTYLE, exStyle);
-
+ }
// Cause an update of the non-client area.
UpdateStyles();
}
@@ -232,6 +234,7 @@ protected override void WndProc(ref Message m)
// If AutoScroll is set to false, hide the scrollbars when the control
// calculates its non-client area.
if (!AutoScroll)
+ if (!Win32Helper.IsRunningOnMono())
NativeMethods.ShowScrollBar(m.HWnd, (int)Win32.ScrollBars.SB_BOTH, 0 /*false*/);
break;
}
@@ -320,6 +323,7 @@ private void UpdateStyles()
// To show style changes, the non-client area must be repainted. Using the
// control's Invalidate method does not affect the non-client area.
// Instead use a Win32 call to signal the style has changed.
+ if (!Win32Helper.IsRunningOnMono())
NativeMethods.SetWindowPos(MdiClient.Handle, IntPtr.Zero, 0, 0, 0, 0,
Win32.FlagsSetWindowPos.SWP_NOACTIVATE |
Win32.FlagsSetWindowPos.SWP_NOMOVE |
@@ -252,8 +252,11 @@ public static void SaveAsXml(DockPanel dockPanel, Stream stream, Encoding encodi
xmlOut.WriteAttributeString("DockRightPortion", dockPanel.DockRightPortion.ToString(CultureInfo.InvariantCulture));
xmlOut.WriteAttributeString("DockTopPortion", dockPanel.DockTopPortion.ToString(CultureInfo.InvariantCulture));
xmlOut.WriteAttributeString("DockBottomPortion", dockPanel.DockBottomPortion.ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteAttributeString("ActiveDocumentPane", dockPanel.Panes.IndexOf(dockPanel.ActiveDocumentPane).ToString(CultureInfo.InvariantCulture));
- xmlOut.WriteAttributeString("ActivePane", dockPanel.Panes.IndexOf(dockPanel.ActivePane).ToString(CultureInfo.InvariantCulture));
+ if (!Win32Helper.IsRunningOnMono())
+ {
+ xmlOut.WriteAttributeString("ActiveDocumentPane", dockPanel.Panes.IndexOf(dockPanel.ActiveDocumentPane).ToString(CultureInfo.InvariantCulture));
+ xmlOut.WriteAttributeString("ActivePane", dockPanel.Panes.IndexOf(dockPanel.ActivePane).ToString(CultureInfo.InvariantCulture));
+ }
// Contents
xmlOut.WriteStartElement("Contents");
@@ -170,24 +170,47 @@ public IDockContent ActiveAutoHideContent
set { AutoHideWindow.ActiveContent = value; }
}
- private bool m_allowEndUserDocking = true;
+ private bool m_allowEndUserDocking = !Win32Helper.IsRunningOnMono();
[LocalizedCategory("Category_Docking")]
[LocalizedDescription("DockPanel_AllowEndUserDocking_Description")]
[DefaultValue(true)]
public bool AllowEndUserDocking
{
- get { return m_allowEndUserDocking; }
- set { m_allowEndUserDocking = value; }
+ get
+ {
+ if (Win32Helper.IsRunningOnMono() && m_allowEndUserDocking)
+ m_allowEndUserDocking = false;
+
+ return m_allowEndUserDocking;
+ }
+ set
+ {
+ if (Win32Helper.IsRunningOnMono() && value)
+ throw new InvalidOperationException("AllowEndUserDocking can only be false if running on Mono");
+
+ m_allowEndUserDocking = value;
+ }
}
- private bool m_allowEndUserNestedDocking = true;
+ private bool m_allowEndUserNestedDocking = !Win32Helper.IsRunningOnMono();
[LocalizedCategory("Category_Docking")]
[LocalizedDescription("DockPanel_AllowEndUserNestedDocking_Description")]
[DefaultValue(true)]
public bool AllowEndUserNestedDocking
{
- get { return m_allowEndUserNestedDocking; }
- set { m_allowEndUserNestedDocking = value; }
+ get
+ {
+ if (Win32Helper.IsRunningOnMono() && m_allowEndUserDocking)
+ m_allowEndUserDocking = false;
+ return m_allowEndUserNestedDocking;
+ }
+ set
+ {
+ if (Win32Helper.IsRunningOnMono() && value)
+ throw new InvalidOperationException("AllowEndUserNestedDocking can only be false if running on Mono");
+
+ m_allowEndUserNestedDocking = value;
+ }
}
private DockContentCollection m_contents = new DockContentCollection();
@@ -1038,4 +1061,4 @@ protected virtual void OnContentRemoved(DockContentEventArgs e)
handler(this, e);
}
}
-}
+}
@@ -58,6 +58,7 @@ public virtual void Show(bool bActivate)
if (bActivate)
Show();
else
+ if (!Win32Helper.IsRunningOnMono())
NativeMethods.ShowWindow(Handle, (int)Win32.ShowWindowStyles.SW_SHOWNOACTIVATE);
}
}
@@ -176,7 +176,7 @@ protected override void WndProc(ref Message m)
if (IsDisposed)
return;
- uint result = NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
+ uint result = Win32Helper.IsRunningOnMono() ? 0 : NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
if (result == 2 && DockPanel.AllowEndUserDocking && this.AllowEndUserDocking) // HITTEST_CAPTION
{
Activate();
@@ -189,7 +189,7 @@ protected override void WndProc(ref Message m)
}
else if (m.Msg == (int)Win32.Msgs.WM_NCRBUTTONDOWN)
{
- uint result = NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
+ uint result = Win32Helper.IsRunningOnMono() ? 0 : NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
if (result == 2) // HITTEST_CAPTION
{
DockPane theOnlyPane = (VisibleNestedPanes.Count == 1) ? VisibleNestedPanes[0] : null;
@@ -234,7 +234,7 @@ protected override void WndProc(ref Message m)
}
else if (m.Msg == (int)Win32.Msgs.WM_NCLBUTTONDBLCLK)
{
- uint result = NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
+ uint result = Win32Helper.IsRunningOnMono() ? 0: NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
if (result != 2) // HITTEST_CAPTION
{
base.WndProc(ref m);
@@ -314,6 +314,7 @@ internal void TestDrop(IDockDragSource dragSource, DockOutlineBase dockOutline)
Point ptMouse = Control.MousePosition;
uint lParam = Win32Helper.MakeLong(ptMouse.X, ptMouse.Y);
+ if (!Win32Helper.IsRunningOnMono())
if (NativeMethods.SendMessage(Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, lParam) == (uint)Win32.HitTest.HTCAPTION)
dockOutline.Show(VisibleNestedPanes[0], -1);
}
@@ -74,6 +74,7 @@ public static DockState ToggleAutoHideState(DockState state)
public static DockPane PaneAtPoint(Point pt, DockPanel dockPanel)
{
+ if (!Win32Helper.IsRunningOnMono())
for (Control control = Win32Helper.ControlAtPoint(pt); control != null; control = control.Parent)
{
IDockContent content = control as IDockContent;
@@ -90,6 +91,7 @@ public static DockPane PaneAtPoint(Point pt, DockPanel dockPanel)
public static FloatWindow FloatWindowAtPoint(Point pt, DockPanel dockPanel)
{
+ if (!Win32Helper.IsRunningOnMono())
for (Control control = Win32Helper.ControlAtPoint(pt); control != null; control = control.Parent)
{
FloatWindow floatWindow = control as FloatWindow;
@@ -4,16 +4,21 @@
namespace WeifenLuo.WinFormsUI.Docking
{
- internal static class Win32Helper
+ public static class Win32Helper
{
- public static Control ControlAtPoint(Point pt)
- {
- return Control.FromChildHandle(NativeMethods.WindowFromPoint(pt));
+ internal static Control ControlAtPoint(Point pt)
+ {
+ return Control.FromChildHandle(NativeMethods.WindowFromPoint(pt));
}
- public static uint MakeLong(int low, int high)
+ internal static uint MakeLong(int low, int high)
{
return (uint)((high << 16) + low);
}
+
+ public static bool IsRunningOnMono()
+ {
+ return Type.GetType ("Mono.Runtime") != null;
+ }
}
}
@@ -56,6 +56,7 @@ private void CheckFloatWindowDispose()
{
FloatWindow floatWindow = (FloatWindow)Container;
if (!floatWindow.Disposing && !floatWindow.IsDisposed)
+ if (!Win32Helper.IsRunningOnMono())
NativeMethods.PostMessage(((FloatWindow)Container).Handle, FloatWindow.WM_CHECKDISPOSE, 0, 0);
}
}
@@ -125,13 +125,13 @@
<value>Resources\DockIndicator_PaneDiamond_Bottom.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="DockIndicator_PaneDiamond_Fill" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>Resources\DockIndicator_PaneDiamond_Fill.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <value>Resources\Dockindicator_PaneDiamond_Fill.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="DockIndicator_PaneDiamond_HotSpot" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>Resources\DockIndicator_PaneDiamond_HotSpot.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <value>Resources\DockIndicator_PaneDiamond_Hotspot.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="DockIndicator_PaneDiamond_HotSpotIndex" type="System.Resources.ResXFileRef, System.Windows.Forms">
- <value>Resources\DockIndicator_PaneDiamond_HotSpotIndex.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
+ <value>Resources\DockIndicator_PaneDiamond_HotspotIndex.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="DockIndicator_PaneDiamond_Left" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\DockIndicator_PaneDiamond_Left.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@@ -187,4 +187,4 @@
<data name="DockPane_OptionOverflow" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\DockPane_OptionOverflow.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
-</root>
+</root>
Oops, something went wrong.

0 comments on commit 5e27774

Please sign in to comment.