Author: jpobst
Date: 2006-10-05 10:31:16 -0400 (Thu, 05 Oct 2006)
New Revision: 66289

Added:
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripComboBox.cs
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripControlHost.cs
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripProgressBar.cs
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripTextBox.cs
Modified:
   trunk/mcs/class/Managed.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripItem.cs
Log:
2006-10-05  Jonathan Pobst  <[EMAIL PROTECTED]>

        * ToolStripComboBox.cs, ToolStripControlHost.cs, ToolStripProgressBar,
          ToolStripTextBox.cs: Initial commit.
        * ToolStripItem.cs: Fixes for OnLayout, BackColor, Parent.

Modified: trunk/mcs/class/Managed.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/ChangeLog     2006-10-05 14:14:52 UTC 
(rev 66288)
+++ trunk/mcs/class/Managed.Windows.Forms/ChangeLog     2006-10-05 14:31:16 UTC 
(rev 66289)
@@ -1,3 +1,7 @@
+2006-10-05  Jonathan Pobst  <[EMAIL PROTECTED]>
+       * System.Windows.Forms.dll.sources: Add ToolStripComboBox.cs,
+       ToolStripControlHost.cs, ToolStripProgressBar.cs, ToolStripTextBox.cs.
+
 2006-10-03  Sebastien Pouliot  <[EMAIL PROTECTED]> 
 
        * System.Windows.Forms_test.dll.sources: Add ContainerControlTest.cs
@@ -3,5 +7,5 @@
        to the unit tests build.
 
-2006-10-02  Jonathan Pobst  <[EMAIL PROTECTED]>
+2006-10-02  Jonathan Pobst  <[EMAIL PROTECTED]>
        * System.Windows.Forms.dll.sources: Add ToolStrip* classes.
 

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-10-05 14:14:52 UTC (rev 66288)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-10-05 14:31:16 UTC (rev 66289)
@@ -1,3 +1,9 @@
+2006-10-05  Jonathan Pobst  <[EMAIL PROTECTED]>
+
+       * ToolStripComboBox.cs, ToolStripControlHost.cs, ToolStripProgressBar,
+         ToolStripTextBox.cs: Initial commit.
+       * ToolStripItem.cs: Fixes for OnLayout, BackColor, Parent.
+
 2006-10-05  Jackson Harper  <[EMAIL PROTECTED]>
 
        * TabControl.cs: We need to invalidate the tab control area when

Added: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripComboBox.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripComboBox.cs 
    2006-10-05 14:14:52 UTC (rev 66288)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripComboBox.cs 
    2006-10-05 14:31:16 UTC (rev 66289)
@@ -0,0 +1,272 @@
+//
+// ToolStripComboBox.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Jonathan Pobst
+//
+// Authors:
+//     Jonathan Pobst ([EMAIL PROTECTED])
+//
+#if NET_2_0
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms
+{
+       public class ToolStripComboBox : ToolStripControlHost
+       {
+               #region Public Constructors
+               public ToolStripComboBox () : base (new 
ToolStripComboBoxControl ())
+               {
+               }
+
+               public ToolStripComboBox (Control c) : base (c)
+               {
+                       throw new NotSupportedException ();
+               }
+
+               public ToolStripComboBox (string name) : this ()
+               {
+                       base.Control.Name = name;
+               }
+               #endregion
+
+               #region Public Properties
+               public ComboBox ComboBox {
+                       get { return (ComboBox)base.Control; }
+               }
+
+               public ComboBoxStyle DropDownStyle {
+                       get { return this.ComboBox.DropDownStyle; }
+                       set { this.ComboBox.DropDownStyle = value; }
+               }
+
+               public int DropDownWidth {
+                       get { return this.ComboBox.DropDownWidth; }
+                       set { this.ComboBox.DropDownWidth = value; }
+               }
+
+               public bool DroppedDown {
+                       get { return this.ComboBox.DroppedDown; }
+                       set { this.ComboBox.DroppedDown = value; }
+               }
+
+               [Localizable (true)]
+               public bool IntegralHeight {
+                       get { return this.ComboBox.IntegralHeight; }
+                       set { this.ComboBox.IntegralHeight = value; }
+               }
+
+               [Localizable (true)]
+               public ComboBox.ObjectCollection Items {
+                       get { return this.ComboBox.Items; }
+               }
+
+               [Localizable (true)]
+               public int MaxDropDownItems {
+                       get { return this.ComboBox.MaxDropDownItems; }
+                       set { this.ComboBox.MaxDropDownItems = value; }
+               }
+
+               [Localizable (true)]
+               public int MaxLength {
+                       get { return this.ComboBox.MaxLength; }
+                       set { this.ComboBox.MaxLength = value; }
+               }
+
+               public int SelectedIndex {
+                       get { return this.ComboBox.SelectedIndex; }
+                       set { this.ComboBox.SelectedIndex = value; }
+               }
+
+               [Bindable (true)]
+               public Object SelectedItem {
+                       get { return this.ComboBox.SelectedItem; }
+                       set { this.ComboBox.SelectedItem = value; }
+               }
+
+               public string SelectedText {
+                       get { return this.ComboBox.SelectedText; }
+                       set { this.ComboBox.SelectedText = value; }
+               }
+
+               public int SelectionLength {
+                       get { return this.ComboBox.SelectionLength; }
+                       set { this.ComboBox.SelectionLength = value; }
+               }
+
+               public int SelectionStart {
+                       get { return this.ComboBox.SelectionStart; }
+                       set { this.ComboBox.SelectionStart = value; }
+               }
+
+               public bool Sorted {
+                       get { return this.ComboBox.Sorted; }
+                       set { this.ComboBox.Sorted = value; }
+               }
+               #endregion
+
+               #region Protected Properties
+               protected internal override Padding DefaultMargin { get { 
return new Padding (2); } }
+               protected override Size DefaultSize { get { return new Size 
(100, 22); } }
+               #endregion
+
+               #region Public Methods
+               public void BeginUpdate ()
+               {
+                       this.ComboBox.BeginUpdate ();
+               }
+
+               public void EndUpdate ()
+               {
+                       this.ComboBox.EndUpdate ();
+               }
+
+               public int FindString (string s)
+               {
+                       return this.ComboBox.FindString (s);
+               }
+
+               public int FindString (string s, int startIndex)
+               {
+                       return this.ComboBox.FindString (s, startIndex);
+               }
+
+               public int FindStringExact (string s)
+               {
+                       return this.ComboBox.FindStringExact (s);
+               }
+
+               public int FindStringExact (string s, int startIndex)
+               {
+                       return this.ComboBox.FindStringExact (s, startIndex);
+               }
+
+               public int GetItemHeight (int index)
+               {
+                       return this.ComboBox.GetItemHeight (index);
+               }
+
+               public override Size GetPreferredSize (Size constrainingSize)
+               {
+                       return base.GetPreferredSize (constrainingSize);
+               }
+
+               public void Select (int start, int length)
+               {
+                       this.ComboBox.Select (start, length);
+               }
+
+               public void SelectAll ()
+               {
+                       this.ComboBox.SelectAll ();
+               }
+
+               public override string ToString ()
+               {
+                       return this.ComboBox.ToString ();
+               }
+               #endregion
+
+               #region Protected Methods
+               protected virtual void OnDropDown (EventArgs e)
+               {
+                       if (DropDown != null) DropDown (this, e);
+               }
+
+               protected virtual void OnDropDownClosed (EventArgs e)
+               {
+                       if (DropDownClosed != null) DropDownClosed (this, e);
+               }
+
+               protected virtual void OnDropDownStyleChanged (EventArgs e)
+               {
+                       if (DropDownStyleChanged != null) DropDownStyleChanged 
(this, e);
+               }
+
+               protected virtual void OnSelectedIndexChanged (EventArgs e)
+               {
+                       if (SelectedIndexChanged != null) SelectedIndexChanged 
(this, e);
+               }
+
+               protected virtual void OnSelectionChangeCommitted (EventArgs e)
+               {
+               }
+
+               [MonoTODO ("Needs to hook into DropDownClosed and TextUpdate 
when ComboBox 2.0 has them.")]
+               protected override void OnSubscribeControlEvents (Control 
control)
+               {
+                       base.OnSubscribeControlEvents (control);
+
+                       this.ComboBox.DropDown += new EventHandler 
(HandleDropDown);
+                       this.ComboBox.DropDownStyleChanged += new EventHandler 
(HandleDropDownStyleChanged);
+                       this.ComboBox.SelectedIndexChanged += new EventHandler 
(HandleSelectedIndexChanged);
+               }
+
+               protected virtual void OnTextUpdate (EventArgs e)
+               {
+                       if (TextUpdate != null) TextUpdate (this, e);
+               }
+
+               protected override void OnUnsubscribeControlEvents (Control 
control)
+               {
+                       base.OnUnsubscribeControlEvents (control);
+               }
+               #endregion
+
+               #region Public Events
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public event EventHandler DoubleClick;
+               public event EventHandler DropDown;
+               public event EventHandler DropDownClosed;
+               public event EventHandler DropDownStyleChanged;
+               public event EventHandler SelectedIndexChanged;
+               public event EventHandler TextUpdate;
+               #endregion
+
+               #region Private Methods
+               private void HandleDropDown (object sender, EventArgs e)
+               {
+                       OnDropDown (e);
+               }
+
+               private void HandleDropDownStyleChanged (object sender, 
EventArgs e)
+               {
+                       OnDisplayStyleChanged (e);
+               }
+
+               private void HandleSelectedIndexChanged (object sender, 
EventArgs e)
+               {
+                       OnSelectedIndexChanged (e);
+               }
+               #endregion
+
+               private class ToolStripComboBoxControl : ComboBox
+               {
+                       public ToolStripComboBoxControl () : base ()
+                       {
+                               this.border_style = BorderStyle.None;
+                       }
+               }
+       }
+}
+#endif
\ No newline at end of file

Added: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripControlHost.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripControlHost.cs
  2006-10-05 14:14:52 UTC (rev 66288)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripControlHost.cs
  2006-10-05 14:31:16 UTC (rev 66289)
@@ -0,0 +1,394 @@
+//
+// ToolStripControlHost.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Jonathan Pobst
+//
+// Authors:
+//     Jonathan Pobst ([EMAIL PROTECTED])
+//
+#if NET_2_0
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms
+{
+       public class ToolStripControlHost : ToolStripItem
+       {
+               private Control control;
+               private ContentAlignment control_align;
+               private bool double_click_enabled;
+               private ContentAlignment image_align;
+               private ToolStripItemImageScaling image_scaling;
+               private Color image_transparent_color;
+               private ContentAlignment text_align;
+               private TextImageRelation text_image_relation;
+
+               #region Public Constructors
+               public ToolStripControlHost (Control c) : base ()
+               {
+                       if (c == null)
+                               throw new ArgumentNullException ("c");
+
+                       this.control = c;
+                       this.control_align = ContentAlignment.MiddleCenter;
+                       this.OnSubscribeControlEvents (this.control);
+               }
+
+               public ToolStripControlHost (Control c, string name) : this (c)
+               {
+                       this.control.name = name;
+               }
+               #endregion
+
+               #region Public Properties
+               public override Color BackColor {
+                       get { return base.BackColor; }
+                       set { 
+                               base.BackColor = value;
+                               control.BackColor = value;
+                       }
+               }
+
+               public override bool CanSelect {
+                       get { return control.CanSelect; }
+               }
+
+               public Control Control {
+                       get { return this.control; }
+               }
+
+               public ContentAlignment ControlAlign {
+                       get { return this.control_align; }
+                       set {
+                               if (!Enum.IsDefined (typeof (ContentAlignment), 
value))
+                                       throw new InvalidEnumArgumentException 
(string.Format ("Enum argument value '{0}' is not valid for ContentAlignment", 
value));
+
+                               this.control_align = value;
+                       }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public override ToolStripItemDisplayStyle DisplayStyle {
+                       get { return base.DisplayStyle; }
+                       set { base.DisplayStyle = value; }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public bool DoubleClickEnabled {
+                       get { return this.double_click_enabled; }
+                       set { this.double_click_enabled = value; }
+               }
+
+               public override bool Enabled {
+                       get { return base.Enabled; }
+                       set {
+                               base.Enabled = value;
+                               control.Enabled = value;
+                       }
+               }
+
+               public virtual bool Focused {
+                       get { return control.Focused; }
+               }
+
+               public override Font Font {
+                       get { return base.Font; }
+                       set {
+                               base.Font = value;
+                               control.Font = value;
+                       }
+               }
+
+               public override Color ForeColor {
+                       get { return base.ForeColor; }
+                       set { 
+                               base.ForeColor = value;
+                               control.ForeColor = value;
+                       }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public override Image Image {
+                       get { return base.Image; }
+                       set { base.Image = value; }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public ContentAlignment ImageAlign {
+                       get { return this.image_align; }
+                       set { this.image_align = value; }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public ToolStripItemImageScaling ImageScaling {
+                       get { return this.image_scaling; }
+                       set { this.image_scaling = value; }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public Color ImageTransparentColor {
+                       get { return this.image_transparent_color; }
+                       set { this.image_transparent_color = value; }
+               }
+
+               public override bool Selected {
+                       get { return base.Selected; }
+               }
+
+               public override ISite Site {
+                       get { return base.Site; }
+                       set { 
+                               base.Site = value;
+                               control.Site = value;
+                       }
+               }
+
+               public override string Text {
+                       get { return base.Text; }
+                       set {
+                               base.Text = value;
+                               control.Text = value;
+                       }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public ContentAlignment TextAlign {
+                       get { return this.text_align; }
+                       set { this.text_align = value; }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public TextImageRelation TextImageRelation {
+                       get { return this.text_image_relation; }
+                       set { this.text_image_relation = value; }
+               }
+               #endregion
+
+               #region Protected Properties
+               protected override Size DefaultSize {
+                       get {
+                               if (control == null)
+                                       return new Size (23, 23);
+
+                               return control.GetPreferredSize (Size.Empty);
+                       }
+               }
+               #endregion
+
+               #region Public Methods
+               public void Focus ()
+               {
+                       control.Focus ();
+               }
+
+               public override Size GetPreferredSize (Size constrainingSize)
+               {
+                       return this.Size;
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public override void ResetBackColor ()
+               {
+                       base.ResetBackColor ();
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public override void ResetForeColor ()
+               {
+                       base.ResetForeColor ();
+               }
+               #endregion
+
+               #region Protected Methods
+               protected override void OnBoundsChanged (EventArgs e)
+               {
+                       base.OnBoundsChanged (e);
+
+                       if (this.Parent != null) {
+                               control.Size = this.Size;
+                               OnLayout (new LayoutEventArgs (null, 
string.Empty));
+                       }
+               }
+               
+               protected virtual void OnEnter (EventArgs e)
+               {
+                       if (Enter != null) Enter (this, e);
+               }
+
+               protected virtual void OnGotFocus (EventArgs e)
+               {
+                       if (GotFocus != null) GotFocus (this, e);
+               }
+               
+               protected virtual void OnHostedControlResize (EventArgs e)
+               {
+               }
+               
+               protected virtual void OnKeyDown (KeyEventArgs e)
+               {
+                       if (KeyDown != null) KeyDown (this, e);
+               }
+               
+               protected virtual void OnKeyPress (KeyPressEventArgs e)
+               {
+                       if (KeyPress != null) KeyPress (this, e);
+               }
+               
+               protected virtual void OnKeyUp (KeyEventArgs e)
+               {
+                       if (KeyUp != null) KeyUp (this, e);
+               }
+
+               protected override void OnLayout (LayoutEventArgs e)
+               {
+                       base.OnLayout (e);
+                       
+                       if (control != null)
+                               control.Bounds = AlignInRectangle (this.Bounds, 
control.Size, this.control_align);
+               }
+               
+               protected virtual void OnLeave (EventArgs e)
+               {
+                       if (Leave != null) Leave (this, e);
+               }
+               
+               protected virtual void OnLostFocus (EventArgs e)
+               {
+                       if (LostFocus != null) LostFocus (this, e);
+               }
+
+               protected override void OnPaint (PaintEventArgs e)
+               {
+                       base.OnPaint (e);
+               }
+               
+               protected override void OnParentChanged (ToolStrip oldParent, 
ToolStrip newParent)
+               {
+                       base.OnParentChanged (oldParent, newParent);
+
+                       if (oldParent != null)
+                               oldParent.Controls.Remove (control);
+
+                       if (newParent != null)
+                               newParent.Controls.Add (control);
+               }
+               
+               protected virtual void OnSubscribeControlEvents (Control 
control)
+               {
+                       this.control.Enter += new EventHandler (HandleEnter);
+                       this.control.GotFocus += new EventHandler 
(HandleGotFocus);
+                       this.control.KeyDown += new KeyEventHandler 
(HandleKeyDown);
+                       this.control.KeyPress += new KeyPressEventHandler 
(HandleKeyPress);
+                       this.control.KeyUp += new KeyEventHandler (HandleKeyUp);
+                       this.control.Leave += new EventHandler (HandleLeave);
+                       this.control.LostFocus += new EventHandler 
(HandleLostFocus);
+                       this.control.Validated += new EventHandler 
(HandleValidated);
+                       this.control.Validating += new CancelEventHandler 
(HandleValidating);
+               }
+               
+               protected virtual void OnUnsubscribeControlEvents (Control 
control)
+               {
+               }
+               
+               protected virtual void OnValidated (EventArgs e)
+               {
+                       if (Validated != null) Validated (this, e);
+               }
+               
+               protected virtual void OnValidating (CancelEventArgs e)
+               {
+                       if (Validating != null) Validating (this, e);
+               }
+               #endregion
+
+               #region Public Events
+               public event EventHandler DisplayStyleChanged;
+               public event EventHandler Enter;
+               public event EventHandler GotFocus;
+               public event KeyEventHandler KeyDown;
+               public event KeyPressEventHandler KeyPress;
+               public event KeyEventHandler KeyUp;
+               public event EventHandler Leave;
+               public event EventHandler LostFocus;
+               public event EventHandler Validated;
+               public event CancelEventHandler Validating;
+               #endregion
+
+               #region Private Methods
+               private void HandleEnter (object sender, EventArgs e)
+               {
+                       this.OnEnter (e);
+               }
+
+               private void HandleGotFocus (object sender, EventArgs e)
+               {
+                       this.OnGotFocus (e);
+               }
+
+               private void HandleKeyDown (object sender, KeyEventArgs e)
+               {
+                       this.OnKeyDown (e);
+               }
+
+               private void HandleKeyPress (object sender, KeyPressEventArgs e)
+               {
+                       this.OnKeyPress (e);
+               }
+
+               private void HandleKeyUp (object sender, KeyEventArgs e)
+               {
+                       this.OnKeyUp (e);
+               }
+
+               private void HandleLeave (object sender, EventArgs e)
+               {
+                       this.OnLeave (e);
+               }
+
+               private void HandleLostFocus (object sender, EventArgs e)
+               {
+                       this.OnLostFocus (e);
+               }
+
+               private void HandleValidated (object sender, EventArgs e)
+               {
+                       this.OnValidated (e);
+               }
+               
+               private void HandleValidating (object sender, CancelEventArgs e)
+               {
+                       this.OnValidating (e);
+               }
+               #endregion
+       }
+}
+#endif
\ No newline at end of file

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripItem.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripItem.cs 
2006-10-05 14:14:52 UTC (rev 66288)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripItem.cs 
2006-10-05 14:31:16 UTC (rev 66289)
@@ -108,6 +108,7 @@
                        this.visible = true;
 
                        this.Click = onClick;
+                       OnLayout (new LayoutEventArgs (null, ""));
                }
                #endregion
 
@@ -152,7 +153,7 @@
                        }
                }
 
-               public Color BackColor {
+               public virtual Color BackColor {
                        get { return this.back_color; }
                        set {
                                if (this.back_color != value) {
@@ -252,7 +253,8 @@
                        get { return this.bounds.Height; }
                        set { 
                                this.bounds.Height = value; 
-                               this.CalculateAutoSize (); 
+                               this.CalculateAutoSize ();
+                               this.OnBoundsChanged (EventArgs.Empty);
                                this.Invalidate (); 
                        }
                }
@@ -360,7 +362,8 @@
                        get { return this.bounds.Size; }
                        set { 
                                this.bounds.Size = value; 
-                               this.CalculateAutoSize (); 
+                               this.CalculateAutoSize ();
+                               OnBoundsChanged (EventArgs.Empty);
                        }
                }
 
@@ -435,6 +438,7 @@
                        set { 
                                this.bounds.Width = value; 
                                this.CalculateAutoSize (); 
+                               this.OnBoundsChanged(EventArgs.Empty);
                        }
                }
                #endregion
@@ -448,7 +452,11 @@
                protected internal virtual bool DismissWhenClicked { get { 
return false; } }
                protected internal ToolStrip Parent {
                        get { return this.parent; }
-                       set { this.parent = value; }
+                       set { 
+                               ToolStrip old_parent = this.parent;
+                               this.parent = value; 
+                               OnParentChanged(old_parent, this.parent);
+                       }
                }
                protected internal virtual bool ShowKeyboardCues { get { return 
true; } }
                #endregion
@@ -536,6 +544,7 @@
 
                protected virtual void OnBoundsChanged (EventArgs e)
                {
+                       OnLayout (new LayoutEventArgs(null, ""));
                }
 
                protected virtual void OnClick (EventArgs e)
@@ -642,6 +651,10 @@
                        if (Paint != null) Paint (this, e);
                }
 
+               protected virtual void OnParentChanged (ToolStrip oldParent, 
ToolStrip newParent)
+               {
+               }
+               
                protected virtual void OnTextChanged (EventArgs e)
                {
                        if (TextChanged != null) TextChanged (this, e);
@@ -707,7 +720,7 @@
 
                internal void CalculateAutoSize ()
                {
-                       if (!this.auto_size)
+                       if (!this.auto_size || this is ToolStripControlHost)
                                return;
 
                        this.text_size = TextRenderer.MeasureText (this.Text, 
this.Font);

Added: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripProgressBar.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripProgressBar.cs
  2006-10-05 14:14:52 UTC (rev 66288)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripProgressBar.cs
  2006-10-05 14:31:16 UTC (rev 66289)
@@ -0,0 +1,141 @@
+//
+// ToolStripProgressBar.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Jonathan Pobst
+//
+// Authors:
+//     Jonathan Pobst ([EMAIL PROTECTED])
+//
+#if NET_2_0
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms
+{
+       public class ToolStripProgressBar : ToolStripControlHost
+       {
+               #region Public Constructors
+               public ToolStripProgressBar () : base (new ProgressBar ())
+               {
+               }
+
+               public ToolStripProgressBar (string name) : this ()
+               {
+                       this.Control.Name = name;
+               }
+               #endregion
+
+               #region Public Properties
+               public int Maximum {
+                       get { return this.ProgressBar.Maximum; }
+                       set { this.ProgressBar.Maximum = value; }
+               }
+
+               public int Minimum {
+                       get { return this.ProgressBar.Minimum; }
+                       set { this.ProgressBar.Minimum = value; }
+               }
+
+               public ProgressBar ProgressBar {
+                       get { return (ProgressBar)base.Control; }
+               }
+
+               public int Step {
+                       get { return this.ProgressBar.Step; }
+                       set { this.ProgressBar.Step = value; }
+               }
+
+               public ProgressBarStyle Style {
+                       get { return this.ProgressBar.Style; }
+                       set { this.ProgressBar.Style = value; }
+               }
+
+               public override string Text {
+                       get { return base.Text; }
+                       set { base.Text = value; }
+               }
+
+               [Bindable (true)]
+               public int Value {
+                       get { return this.ProgressBar.Value; }
+                       set { this.ProgressBar.Value = value; }
+               }
+               #endregion
+
+               #region Protected Properties
+               protected internal override Padding DefaultMargin { get { 
return new Padding (1, 2, 1, 1); } }
+               protected override Size DefaultSize { get { return new Size 
(100, 15); } }
+               #endregion
+
+               #region Public Methods
+               public void Increment (int value)
+               {
+                       this.ProgressBar.Increment (value);
+               }
+
+               public void PerformStep ()
+               {
+                       this.ProgressBar.PerformStep ();
+               }
+               #endregion
+
+               #region Protected Methods
+               protected override void OnSubscribeControlEvents (Control 
control)
+               {
+                       base.OnSubscribeControlEvents (control);
+               }
+
+               protected override void OnUnsubscribeControlEvents (Control 
control)
+               {
+                       base.OnUnsubscribeControlEvents (control);
+               }
+               #endregion
+
+               #region Public Events
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public event KeyEventHandler KeyDown;
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public event KeyPressEventHandler KeyPress;
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public event KeyEventHandler KeyUp;
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public event EventHandler LocationChanged;
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public event EventHandler OwnerChanged;
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public event EventHandler TextChanged;
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public event EventHandler Validated;
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public event CancelEventHandler Validating;
+               #endregion
+       }
+}
+#endif
\ No newline at end of file

Added: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripTextBox.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripTextBox.cs  
    2006-10-05 14:14:52 UTC (rev 66288)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStripTextBox.cs  
    2006-10-05 14:31:16 UTC (rev 66289)
@@ -0,0 +1,346 @@
+//
+// ToolStripTextBox.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Jonathan Pobst
+//
+// Authors:
+//     Jonathan Pobst ([EMAIL PROTECTED])
+//
+#if NET_2_0
+using System.Drawing;
+using System.ComponentModel;
+
+namespace System.Windows.Forms
+{
+       public class ToolStripTextBox : ToolStripControlHost
+       {
+               private BorderStyle border_style;
+
+               #region Public Constructors
+               public ToolStripTextBox () : base (new ToolStripTextBoxControl 
())
+               {
+                       base.Control.border_style = BorderStyle.None;
+                       this.border_style = BorderStyle.FixedSingle;
+               }
+
+               public ToolStripTextBox (Control c) : base (c)
+               {
+               }
+
+               public ToolStripTextBox (string name) : this ()
+               {
+                       base.Control.Name = name;
+               }
+               #endregion
+
+               #region Public Properties
+               public bool AcceptsReturn {
+                       get { return this.TextBox.AcceptsReturn; }
+                       set { this.TextBox.AcceptsReturn = value; }
+               }
+
+               public bool AcceptsTab {
+                       get { return this.TextBox.AcceptsTab; }
+                       set { this.TextBox.AcceptsTab = value; }
+               }
+
+               public BorderStyle BorderStyle {
+                       get { return this.border_style; }
+                       set { this.border_style = value; }
+               }
+
+               public bool CanUndo {
+                       get { return this.TextBox.CanUndo; }
+               }
+
+               public CharacterCasing CharacterCasing {
+                       get { return this.TextBox.CharacterCasing; }
+                       set { this.TextBox.CharacterCasing = value; }
+               }
+
+               public bool HideSelection {
+                       get { return this.TextBox.HideSelection; }
+                       set { this.TextBox.HideSelection = value; }
+               }
+
+               [Localizable (true)]
+               public string[] Lines {
+                       get { return this.TextBox.Lines; }
+                       set { this.TextBox.Lines = value; }
+               }
+
+               [Localizable (true)]
+               public int MaxLength {
+                       get { return this.TextBox.MaxLength; }
+                       set { this.TextBox.MaxLength = value; }
+               }
+
+               public bool Modified {
+                       get { return this.TextBox.Modified; }
+                       set { this.TextBox.Modified = value; }
+               }
+
+               [Localizable (true)]
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public bool Multiline {
+                       get { return this.TextBox.Multiline; }
+                       set { this.TextBox.Multiline = value; }
+               }
+
+               public bool ReadOnly {
+                       get { return this.TextBox.ReadOnly; }
+                       set { this.TextBox.ReadOnly = value; }
+               }
+
+               public string SelectedText {
+                       get { return this.TextBox.SelectedText; }
+                       set { this.TextBox.SelectedText = value; }
+               }
+
+               public int SelectionLength {
+                       get { return this.TextBox.SelectionLength; }
+                       set { this.TextBox.SelectionLength = value; }
+               }
+
+               public int SelectionStart {
+                       get { return this.TextBox.SelectionStart; }
+                       set { this.TextBox.SelectionStart = value; }
+               }
+
+               public TextBox TextBox {
+                       get { return (TextBox)base.Control; }
+               }
+
+               [Localizable (true)]
+               public HorizontalAlignment TextBoxTextAlign {
+                       get { return this.TextBox.TextAlign; }
+                       set { this.TextBox.TextAlign = value; }
+               }
+
+               public int TextLength {
+                       get { return this.TextBox.TextLength; }
+               }
+
+               [Localizable (true)]
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public bool WordWrap {
+                       get { return this.TextBox.WordWrap; }
+                       set { this.TextBox.WordWrap = value; }
+               }
+               #endregion
+
+               #region Protected Properties
+               protected internal override Padding DefaultMargin { get { 
return new Padding (1, 0, 1, 0); } }
+               protected override Size DefaultSize { get { return new Size 
(100, 22); } }
+               #endregion
+
+               #region Public Methods
+               public void AppendText (string text)
+               {
+                       this.TextBox.AppendText (text);
+               }
+
+               public void Clear ()
+               {
+                       this.TextBox.Clear ();
+               }
+
+               public void ClearUndo ()
+               {
+                       this.TextBox.ClearUndo ();
+               }
+
+               public void Copy ()
+               {
+                       this.TextBox.Copy ();
+               }
+
+               public void Cut ()
+               {
+                       this.TextBox.Cut ();
+               }
+
+               public override Size GetPreferredSize (Size constrainingSize)
+               {
+                       return this.DefaultSize;
+               }
+
+               public void Paste ()
+               {
+                       this.TextBox.Paste ();
+               }
+
+               public void ScrollToCaret ()
+               {
+                       this.TextBox.ScrollToCaret ();
+               }
+
+               public void Select (int start, int length)
+               {
+                       this.TextBox.Select (start, length);
+               }
+
+               public void SelectAll ()
+               {
+                       this.TextBox.SelectAll ();
+               }
+
+               public void Undo ()
+               {
+                       this.TextBox.Undo ();
+               }
+               #endregion
+
+               #region Protected Methods
+               protected virtual void OnAcceptsTabChanged (EventArgs e)
+               {
+                       if (AcceptsTabChanged != null) AcceptsTabChanged (this, 
e);
+               }
+
+               protected virtual void OnBorderStyleChanged (EventArgs e)
+               {
+                       if (BorderStyleChanged != null) BorderStyleChanged 
(this, e);
+               }
+
+               protected virtual void OnHideSelectionChanged (EventArgs e)
+               {
+                       if (HideSelectionChanged != null) HideSelectionChanged 
(this, e);
+               }
+
+               protected virtual void OnModifiedChanged (EventArgs e)
+               {
+                       if (ModifiedChanged != null) ModifiedChanged (this, e);
+               }
+
+               protected virtual void OnMultilineChanged (EventArgs e)
+               {
+                       if (MultilineChanged != null) MultilineChanged (this, 
e);
+               }
+
+               protected virtual void OnReadOnlyChanged (EventArgs e)
+               {
+                       if (ReadOnlyChanged != null) ReadOnlyChanged (this, e);
+               }
+
+               protected override void OnSubscribeControlEvents (Control 
control)
+               {
+                       base.OnSubscribeControlEvents (control);
+
+                       this.TextBox.AcceptsTabChanged += new EventHandler 
(HandleAcceptsTabChanged);
+                       this.TextBox.BorderStyleChanged += new EventHandler 
(HandleBorderStyleChanged);
+                       this.TextBox.HideSelectionChanged += new EventHandler 
(HandleHideSelectionChanged);
+                       this.TextBox.ModifiedChanged += new EventHandler 
(HandleModifiedChanged);
+                       this.TextBox.MultilineChanged += new EventHandler 
(HandleMultilineChanged);
+                       this.TextBox.ReadOnlyChanged += new EventHandler 
(HandleReadOnlyChanged);
+                       this.TextBox.TextAlignChanged += new EventHandler 
(HandleTextAlignChanged);
+               }
+
+               protected override void OnUnsubscribeControlEvents (Control 
control)
+               {
+                       base.OnUnsubscribeControlEvents (control);
+               }
+               #endregion
+
+               #region Public Events
+               public event EventHandler AcceptsTabChanged;
+               public event EventHandler BorderStyleChanged;
+               public event EventHandler HideSelectionChanged;
+               public event EventHandler ModifiedChanged;
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public event EventHandler MultilineChanged;
+               public event EventHandler ReadOnlyChanged;
+               public event EventHandler TextBoxTextAlignChanged;
+               #endregion
+
+               #region Private Methods
+               private void HandleTextAlignChanged (object sender, EventArgs e)
+               {
+                       if (TextBoxTextAlignChanged != null) 
TextBoxTextAlignChanged (this, e);
+               }
+
+               private void HandleReadOnlyChanged (object sender, EventArgs e)
+               {
+                       OnReadOnlyChanged (e);
+               }
+
+               private void HandleMultilineChanged (object sender, EventArgs e)
+               {
+                       OnMultilineChanged (e);
+               }
+
+               private void HandleModifiedChanged (object sender, EventArgs e)
+               {
+                       OnModifiedChanged (e);
+               }
+
+               private void HandleHideSelectionChanged (object sender, 
EventArgs e)
+               {
+                       OnHideSelectionChanged (e);
+               }
+
+               private void HandleBorderStyleChanged (object sender, EventArgs 
e)
+               {
+                       OnBorderStyleChanged (e);
+               }
+
+               private void HandleAcceptsTabChanged (object sender, EventArgs 
e)
+               {
+                       OnAcceptsTabChanged (e);
+               }
+               #endregion
+
+               private class ToolStripTextBoxControl : TextBox
+               {
+                       public ToolStripTextBoxControl () : base ()
+                       {
+                       }
+
+                       protected override void OnMouseEnter (EventArgs e)
+                       {
+                               base.OnMouseEnter (e);
+                               Invalidate ();
+                       }
+
+                       protected override void OnMouseLeave (EventArgs e)
+                       {
+                               base.OnMouseLeave (e);
+                               Invalidate ();
+                       }
+
+                       protected override void OnPaint (PaintEventArgs e)
+                       {
+                               base.OnPaint (e);
+                               if (this.Focused || is_entered || 
this.border_style == BorderStyle.FixedSingle) {
+                                       ToolStripRenderer tsr = (this.parent as 
ToolStrip).Renderer;
+
+                                       if (tsr is 
ToolStripProfessionalRenderer)
+                                               using (Pen p = new Pen ((tsr as 
ToolStripProfessionalRenderer).ColorTable.ButtonSelectedBorder))
+                                                       
e.Graphics.DrawRectangle (p, new Rectangle (0, 0, this.Width - 1, this.Height - 
1));
+                               }
+                       }
+               }
+       }
+}
+#endif
\ No newline at end of file

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources      
2006-10-05 14:14:52 UTC (rev 66288)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources      
2006-10-05 14:31:16 UTC (rev 66289)
@@ -609,9 +609,11 @@
 System.Windows.Forms/ToolStripArrowRenderEventArgs.cs
 System.Windows.Forms/ToolStripArrowRenderEventHandler.cs
 System.Windows.Forms/ToolStripButton.cs
+System.Windows.Forms/ToolStripComboBox.cs
 System.Windows.Forms/ToolStripContentPanel.cs
 System.Windows.Forms/ToolStripContentPanelRenderEventArgs.cs
 System.Windows.Forms/ToolStripContentPanelRenderEventHandler.cs
+System.Windows.Forms/ToolStripControlHost.cs
 System.Windows.Forms/ToolStripDropDownCloseReason.cs
 System.Windows.Forms/ToolStripDropDownClosedEventArgs.cs
 System.Windows.Forms/ToolStripDropDownClosedEventHandler.cs
@@ -648,6 +650,7 @@
 System.Windows.Forms/ToolStripPanelRenderEventArgs.cs
 System.Windows.Forms/ToolStripPanelRenderEventHandler.cs
 System.Windows.Forms/ToolStripProfessionalRenderer.cs
+System.Windows.Forms/ToolStripProgressBar.cs
 System.Windows.Forms/ToolStripRenderer.cs
 System.Windows.Forms/ToolStripRenderEventArgs.cs
 System.Windows.Forms/ToolStripRenderEventHandler.cs
@@ -657,6 +660,7 @@
 System.Windows.Forms/ToolStripSeparatorRenderEventHandler.cs
 System.Windows.Forms/ToolStripSplitStackLayout.cs
 System.Windows.Forms/ToolStripStatusLabelBorderSides.cs
+System.Windows.Forms/ToolStripTextBox.cs
 System.Windows.Forms/ToolStripTextDirection.cs
 System.Windows.Forms/ToolTip.cs
 System.Windows.Forms/ToolTipIcon.cs

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to