瀏覽代碼

Added the missing divider code and grip for ToolBar Control.

svn path=/trunk/mcs/; revision=32842
Ravindra 21 年之前
父節點
當前提交
0c8273bc84

+ 5 - 1
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Theme.cs

@@ -23,9 +23,12 @@
 //	Jordi Mas i Hernandez, [email protected]
 //
 //
-// $Revision: 1.4 $
+// $Revision: 1.5 $
 // $Modtime: $
 // $Log: Theme.cs,v $
+// Revision 1.5  2004/08/25 20:04:40  ravindra
+// Added the missing divider code and grip for ToolBar Control.
+//
 // Revision 1.4  2004/08/24 18:37:02  jordi
 // fixes formmating, methods signature, and adds missing events
 //
@@ -198,6 +201,7 @@ namespace System.Windows.Forms
 		/*
 		  	ToolBar Control properties
 		 */
+		public abstract int ToolBarGripWidth {get;}              // Grip width for the ToolBar
 		public abstract int ToolBarImageGripWidth {get;}         // Grip width for the Image on the ToolBarButton
 		public abstract int ToolBarSeparatorWidth {get;}         // width of the separator
 		public abstract int ToolBarDropDownWidth { get; }        // width of the dropdown arrow rect

+ 20 - 4
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs

@@ -25,9 +25,12 @@
 //
 //
 //
-// $Revision: 1.30 $
+// $Revision: 1.31 $
 // $Modtime: $
 // $Log: ThemeWin32Classic.cs,v $
+// Revision 1.31  2004/08/25 20:04:40  ravindra
+// Added the missing divider code and grip for ToolBar Control.
+//
 // Revision 1.30  2004/08/25 18:29:14  jordi
 // new methods, properties, and fixes for progressbar
 //
@@ -248,8 +251,15 @@ namespace System.Windows.Forms
 		/*
 		 * ToolBar Control properties
 		 */
+		// Grip width for the ToolBar
+		public override int ToolBarGripWidth
+		{
+			get { return 2;}
+		}
+
 		// Grip width for the Image on the ToolBarButton
-		public override int ToolBarImageGripWidth {
+		public override int ToolBarImageGripWidth
+		{
 			get { return 2;}
 		}
 
@@ -1679,10 +1689,16 @@ namespace System.Windows.Forms
 
 		public  override void DrawToolBar (Graphics dc, ToolBar control, StringFormat format)
 		{
-			Rectangle paint_area = new Rectangle (0, 0, control.Width, control.Height);// control.ClientRectangle;
+			// Exclude the area for divider
+			Rectangle paint_area = new Rectangle (0, ThemeEngine.Current.ToolBarGripWidth / 2, 
+							      control.Width, control.Height - ThemeEngine.Current.ToolBarGripWidth / 2);
+			bool flat = (control.Appearance == ToolBarAppearance.Flat);
+
 			dc.FillRectangle (SystemBrushes.Control, paint_area);
 			DrawBorderStyle (dc, paint_area, control.BorderStyle);
-			bool flat = (control.Appearance == ToolBarAppearance.Flat);
+
+			if (control.Divider)
+				dc.DrawLine (pen_buttonhilight, 0, 0, paint_area.Width, 0);
 
 			foreach (ToolBarButton button in control.Buttons) {
 

+ 12 - 8
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBar.cs

@@ -33,9 +33,12 @@
 // Copyright (C) Novell Inc., 2004
 //
 //
-// $Revision: 1.8 $
+// $Revision: 1.9 $
 // $Modtime: $
 // $Log: ToolBar.cs,v $
+// Revision 1.9  2004/08/25 20:04:40  ravindra
+// Added the missing divider code and grip for ToolBar Control.
+//
 // Revision 1.8  2004/08/25 00:43:13  ravindra
 // Fixed wrapping related issues in ToolBar control.
 //
@@ -589,12 +592,12 @@ namespace System.Windows.Forms
 		{
 			if (! this.Enabled || appearance != ToolBarAppearance.Flat) return;
 
-			if (currentButton != null) {
+			if (currentButton != null && currentButton.Hilight) {
 				currentButton.Hilight = false;
 				Redraw (false);
 				Invalidate (currentButton.Rectangle);
-				currentButton = null;
 			}
+			currentButton = null;
 		}
 
 		private void ToolBar_MouseMove (object sender, MouseEventArgs me)
@@ -703,7 +706,8 @@ namespace System.Windows.Forms
 		{
 			int wd = this.Width;             // the amount of space we have for rest of the buttons
 			int ht = this.ButtonSize.Height; // all buttons are displayed with the same height
-			Point loc = new Point (0, 0);    // the location to place the next button
+			Point loc;                       // the location to place the next button, leave the space for border
+			loc = new Point (ThemeEngine.Current.ToolBarGripWidth, ThemeEngine.Current.ToolBarGripWidth);
 
 			// clear all the wrappers if toolbar is not wrappable
 			if (! wrappable && ! autosize) {
@@ -742,7 +746,7 @@ namespace System.Windows.Forms
 							else {
 								button.Wrapper = true;
 								button.Location = loc;
-								loc.X = 0;
+								loc.X = ThemeEngine.Current.ToolBarGripWidth;
 								wd = this.Width;
 								// we need space to draw horizontal separator
 								loc.Y = loc.Y + ThemeEngine.Current.ToolBarSeparatorWidth + ht; 
@@ -764,7 +768,7 @@ namespace System.Windows.Forms
 								buttons [separatorIndex].Wrapper = true;
 								seenSeparator = false;
 								separatorIndex = -1;
-								loc.X = 0;
+								loc.X = ThemeEngine.Current.ToolBarGripWidth;
 								// we need space to draw horizontal separator
 								loc.Y = loc.Y + ht + ThemeEngine.Current.ToolBarSeparatorWidth; 
 								wd = this.Width;
@@ -785,8 +789,8 @@ namespace System.Windows.Forms
 				}
 				/* adjust the control height, if we are autosizeable */
 				if (autosize) // wrappable
-					if (this.Height != (loc.Y + ht))
-						this.Height = loc.Y + ht;
+					if (this.Height != (loc.Y + ht + ThemeEngine.Current.ToolBarGripWidth))
+						this.Height = loc.Y + ht + ThemeEngine.Current.ToolBarGripWidth;
 			}
 		}
 

+ 6 - 2
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolBarButton.cs

@@ -29,9 +29,12 @@
 //     - DropDownMenu
 //     - Adding a button to two toolbars
 //
-// $Revision: 1.4 $
+// $Revision: 1.5 $
 // $Modtime: $
 // $Log: ToolBarButton.cs,v $
+// Revision 1.5  2004/08/25 20:04:40  ravindra
+// Added the missing divider code and grip for ToolBar Control.
+//
 // Revision 1.4  2004/08/22 00:03:20  ravindra
 // Fixed toolbar control signatures.
 //
@@ -73,7 +76,8 @@ namespace System.Windows.Forms
 		private string text = "";
 		private string toolTip = "";
 		private bool visible = true;
-		private Point location = new Point (0, 0);
+		private Point location = new Point (ThemeEngine.Current.ToolBarGripWidth,
+						    ThemeEngine.Current.ToolBarGripWidth);
 		private bool wrapper = false;
 		private bool hilight = false;
 		private bool pressed = false; // this is to check for mouse down on a button