Author: jpobst
Date: 2007-01-01 17:39:12 -0500 (Mon, 01 Jan 2007)
New Revision: 70329
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusStrip.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripProfessionalRenderer.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripRenderer.cs
Log:
2007-01-01 Jonathan Pobst <[EMAIL PROTECTED]>
* StatusStrip.cs: Add implementation of the sizing grip.
* ToolStripRenderer.cs, ToolStripProfessionalRenderer.cs: Add
StatusStrip rendering.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-01-01 21:09:11 UTC (rev 70328)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-01-01 22:39:12 UTC (rev 70329)
@@ -1,3 +1,10 @@
+2007-01-01 Jonathan Pobst <[EMAIL PROTECTED]>
+
+ * StatusStrip.cs: Add implementation of the sizing grip.
+
+ * ToolStripRenderer.cs, ToolStripProfessionalRenderer.cs: Add
+ StatusStrip rendering.
+
2006-12-31 Chris Toshok <[EMAIL PROTECTED]>
* ToolBar.cs: don't assign to dock_style in the .ctor. it doesn't
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusStrip.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusStrip.cs
2007-01-01 21:09:11 UTC (rev 70328)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/StatusStrip.cs
2007-01-01 22:39:12 UTC (rev 70329)
@@ -45,21 +45,14 @@
{
this.GripStyle = ToolStripGripStyle.Hidden;
this.layout_style = ToolStripLayoutStyle.Table;
- this.sizing_grip = false;
+ this.sizing_grip = true;
base.Stretch = true;
}
#region Public Properties
- public override DockStyle Dock
- {
- get
- {
- return base.Dock;
- }
- set
- {
- base.Dock = value;
- }
+ public override DockStyle Dock {
+ get { return base.Dock; }
+ set { base.Dock = value; }
}
public new ToolStripGripStyle GripStyle {
@@ -83,7 +76,7 @@
}
public Rectangle SizeGripBounds {
- get { return Rectangle.Empty; }
+ get { return new Rectangle (this.Width - 12, this.Top,
12, this.Height); }
}
public bool SizingGrip {
@@ -137,10 +130,42 @@
protected override void OnPaintBackground (PaintEventArgs
pevent)
{
base.OnPaintBackground (pevent);
+
+ if (this.sizing_grip)
+ this.Renderer.DrawStatusStripSizingGrip (new
ToolStripRenderEventArgs (pevent.Graphics, this));
}
protected override void WndProc (ref Message m)
{
+ switch ((Msg)m.Msg) {
+ // If the mouse is over the size grip, change
the cursor
+ case Msg.WM_MOUSEMOVE: {
+ if (FromParamToMouseButtons ((int)
m.WParam.ToInt32()) == MouseButtons.None) {
+ Point p = new Point (LowOrder
((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()));
+
+ if (this.SizingGrip &&
this.SizeGripBounds.Contains (p)) {
+ this.Cursor =
Cursors.SizeNESW;
+ return;
+ } else
+ this.Cursor =
Cursors.Default;
+ }
+
+ break;
+ }
+ // If the left mouse button is pushed over the
size grip,
+ // send the WM a message to begin a window
resize operation
+ case Msg.WM_LBUTTONDOWN: {
+ Point p = new Point (LowOrder
((int)m.LParam.ToInt32 ()), HighOrder ((int)m.LParam.ToInt32 ()));
+
+ if (this.SizingGrip &&
this.SizeGripBounds.Contains (p)) {
+ XplatUI.SendMessage
(this.FindForm().Handle, Msg.WM_NCLBUTTONDOWN, (IntPtr) HitTest.HTBOTTOMRIGHT,
IntPtr.Zero);
+ return;
+ }
+
+ break;
+ }
+ }
+
base.WndProc (ref m);
}
#endregion
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripProfessionalRenderer.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripProfessionalRenderer.cs
2007-01-01 21:09:11 UTC (rev 70328)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripProfessionalRenderer.cs
2007-01-01 22:39:12 UTC (rev 70329)
@@ -342,16 +342,17 @@
e.Graphics.FillRectangle (b,
side_gradient);
return;
}
-
- if (e.ToolStrip is MenuStrip)
- {
+
+ if (e.ToolStrip is MenuStrip || e.ToolStrip is
StatusStrip) {
using (LinearGradientBrush b = new
LinearGradientBrush (e.AffectedBounds, this.ColorTable.MenuStripGradientBegin,
this.ColorTable.MenuStripGradientEnd, e.ToolStrip.Orientation ==
Orientation.Horizontal ? LinearGradientMode.Horizontal :
LinearGradientMode.Vertical))
e.Graphics.FillRectangle (b,
e.AffectedBounds);
-
}
else
using (LinearGradientBrush b = new
LinearGradientBrush (e.AffectedBounds, this.ColorTable.ToolStripGradientBegin,
this.ColorTable.ToolStripGradientEnd, e.ToolStrip.Orientation ==
Orientation.Vertical ? LinearGradientMode.Horizontal :
LinearGradientMode.Vertical))
e.Graphics.FillRectangle (b,
e.AffectedBounds);
+
+ if (e.ToolStrip is StatusStrip)
+ e.Graphics.DrawLine (Pens.White,
e.AffectedBounds.Left, e.AffectedBounds.Top, e.AffectedBounds.Right,
e.AffectedBounds.Top);
}
protected override void OnRenderToolStripBorder
(ToolStripRenderEventArgs e)
@@ -363,7 +364,7 @@
return;
}
- if (e.ToolStrip is MenuStrip)
+ if (e.ToolStrip is MenuStrip || e.ToolStrip is
StatusStrip)
return;
using (Pen p = new Pen
(this.ColorTable.ToolStripBorder)) {
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripRenderer.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripRenderer.cs
2007-01-01 21:09:11 UTC (rev 70328)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripRenderer.cs
2007-01-01 22:39:12 UTC (rev 70329)
@@ -244,6 +244,11 @@
protected virtual void OnRenderStatusStripSizingGrip
(ToolStripRenderEventArgs e)
{
+ StatusStrip ss = (StatusStrip)e.ToolStrip;
+
+ if (ss.SizingGrip == true)
+ DrawSizingGrip (e.Graphics, ss.SizeGripBounds);
+
ToolStripRenderEventHandler eh =
(ToolStripRenderEventHandler)Events [RenderStatusStripSizingGripEvent];
if (eh != null)
eh (this, e);
@@ -444,6 +449,22 @@
break;
}
}
+
+ private void DrawSizingGrip (Graphics g, Rectangle rect)
+ {
+ DrawGripBox (g, rect.Right - 5, rect.Bottom - 5);
+ DrawGripBox (g, rect.Right - 9, rect.Bottom - 5);
+ DrawGripBox (g, rect.Right - 5, rect.Bottom - 9);
+ DrawGripBox (g, rect.Right - 13, rect.Bottom - 5);
+ DrawGripBox (g, rect.Right - 5, rect.Bottom - 13);
+ DrawGripBox (g, rect.Right - 9, rect.Bottom - 9);
+ }
+
+ private void DrawGripBox (Graphics g, int x, int y)
+ {
+ g.DrawRectangle (ThemeEngine.Current.ResPool.GetPen
(Color.White), x + 1, y + 1, 1, 1);
+ g.DrawRectangle (ThemeEngine.Current.ResPool.GetPen
(Color.FromArgb (172, 168, 153)), x, y, 1, 1);
+ }
#endregion
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches