Author: jpobst
Date: 2007-01-16 11:41:52 -0500 (Tue, 16 Jan 2007)
New Revision: 71150

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
Log:
2007-01-16  Jonathan Pobst  <[EMAIL PROTECTED]>

        * Control.cs: PreferredSize fix.

        * Form.cs: Add several 2.0 events, properties, and methods.

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-01-16 16:18:05 UTC (rev 71149)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-01-16 16:41:52 UTC (rev 71150)
@@ -1,3 +1,9 @@
+2007-01-16  Jonathan Pobst  <[EMAIL PROTECTED]>
+
+       * Control.cs: PreferredSize fix.
+
+       * Form.cs: Add several 2.0 events, properties, and methods.
+
 2007-01-16  Gert Driesen  <[EMAIL PROTECTED]>
 
        * Form.cs: Provide meaningful message when MdiParent is assigned a

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2007-01-16 16:18:05 UTC (rev 71149)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2007-01-16 16:41:52 UTC (rev 71150)
@@ -1917,7 +1917,7 @@
                        set {
                                if (maximum_size != value) {
                                        maximum_size = value;
-                                       if (parent != null) 
parent.PerformLayout ();
+                                       Size = PreferredSize;
                                }
                        }
                }
@@ -1929,7 +1929,7 @@
                        set {
                                if (minimum_size != value) {
                                        minimum_size = value;
-                                       if (parent != null) 
parent.PerformLayout ();
+                                       Size = PreferredSize;
                                }
                        }
                }
@@ -2684,6 +2684,7 @@
                }
 
 #if NET_2_0
+               [Browsable (false)]
                public Size PreferredSize {
                        get { return this.GetPreferredSize (Size.Empty); }
                }

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs  
2007-01-16 16:18:05 UTC (rev 71149)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs  
2007-01-16 16:41:52 UTC (rev 71150)
@@ -90,6 +90,7 @@
 #if NET_2_0
                private MenuStrip               main_menu_strip;
                private bool                    show_icon;
+               private bool                    shown_raised;  // The shown 
event is only raised once
 #endif
                #endregion      // Local Variables
 
@@ -550,6 +551,12 @@
                                }
                        }
                }
+               
+               [Browsable (false)]
+               public new Padding Margin {
+                       get { return base.Margin; }
+                       set { base.Margin = value; }
+               }
 #endif
 
                [DefaultValue(true)]
@@ -872,8 +879,6 @@
                                        UpdateStyles ();
                                        
                                        XplatUI.SetIcon (this.Handle, value == 
true ? this.Icon : null);
-                                       
-                                       Message msg = new Message ();
                                        XplatUI.InvalidateNC (this.Handle);
                                }
                        }
@@ -965,8 +970,18 @@
                        set { base.TabIndex = value; }
                }
 
+#if NET_2_0
                [Browsable(false)]
                
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+               [EditorBrowsable(EditorBrowsableState.Never)]
+               public new bool TabStop {
+                       get { return base.TabStop; }
+                       set { base.TabStop = value; }
+               }
+#endif
+
+               [Browsable(false)]
+               
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
                [EditorBrowsable(EditorBrowsableState.Advanced)]
                public bool TopLevel {
                        get {
@@ -1308,6 +1323,21 @@
                        DesktopLocation = new Point(x, y);
                }
 
+#if NET_2_0
+               public void Show (IWin32Window owner)
+               {
+                       if (owner == null)
+                               this.Owner = null;
+                       else
+                               this.Owner = Control.FromHandle 
(owner.Handle).TopLevelControl as Form;
+
+                       if (owner == this)
+                               throw new InvalidOperationException ("The 
'owner' cannot be the form being shown.");
+
+                       base.Show ();
+               }
+#endif
+
                public DialogResult ShowDialog() {
                        return ShowDialog(this.owner);
                }
@@ -1897,6 +1927,14 @@
                        has_been_visible = value || has_been_visible;
                        base.SetVisibleCore (value);
                        is_changing_visible_state = false;
+                       
+#if NET_2_0
+                       // Shown event is only called once, the first time the 
form is made visible
+                       if (value && !shown_raised) {
+                               this.OnShown (EventArgs.Empty);
+                               shown_raised = true;
+                       }
+#endif
                }
 
                protected override void UpdateDefaultButton() {
@@ -1939,6 +1977,9 @@
                                        if (!is_modal) {
                                                if (!FireClosingEvents 
(CloseReason.UserClosing)) {
                                                        OnClosed 
(EventArgs.Empty);
+#if NET_2_0
+                                                       OnFormClosed (new 
FormClosedEventArgs (CloseReason.UserClosing));
+#endif
                                                        closing = true;
                                                        Dispose ();
                                                }
@@ -1952,6 +1993,9 @@
                                                }
                                                else {
                                                        OnClosed 
(EventArgs.Empty);
+#if NET_2_0
+                                                       OnFormClosed (new 
FormClosedEventArgs (CloseReason.UserClosing));
+#endif
                                                        closing = true;
                                                        Hide ();
                                                }
@@ -2456,6 +2500,38 @@
                        remove { base.TabStopChanged -= value; }
                }
 
+
+               [EditorBrowsable (EditorBrowsableState.Always)]
+               protected override void OnBackgroundImageChanged (EventArgs e)
+               {
+                       base.OnBackgroundImageChanged (e);
+               }
+
+               [EditorBrowsable (EditorBrowsableState.Always)]
+               protected override void OnBackgroundImageLayoutChanged 
(EventArgs e)
+               {
+                       base.OnBackgroundImageLayoutChanged (e);
+               }
+
+               [EditorBrowsable (EditorBrowsableState.Advanced)]
+               protected override void OnEnabledChanged (EventArgs e)
+               {
+                       base.OnEnabledChanged (e);
+               }
+
+               [EditorBrowsable (EditorBrowsableState.Advanced)]
+               protected override void OnEnter (EventArgs e)
+               {
+                       base.OnEnter (e);
+               }
+
+               [EditorBrowsable (EditorBrowsableState.Advanced)]
+               protected virtual void OnFormClosed (FormClosedEventArgs e) {
+                       FormClosedEventHandler eh = 
(FormClosedEventHandler)(Events[FormClosedEvent]);
+                       if (eh != null)
+                               eh (this, e);
+               }
+               
                // Consider calling FireClosingEvents instead of calling this 
directly.
                [EditorBrowsable (EditorBrowsableState.Advanced)]
                protected virtual void OnFormClosing (FormClosingEventArgs e)
@@ -2465,7 +2541,22 @@
                                eh (this, e);
                }
 
+               [MonoTODO ("Not hooked up to event")]
                [EditorBrowsable (EditorBrowsableState.Advanced)]
+               protected virtual void OnHelpButtonClicked (CancelEventArgs e)
+               {
+                       CancelEventHandler eh = 
(CancelEventHandler)(Events[HelpButtonClickedEvent]);
+                       if (eh != null)
+                               eh (this, e);
+               }
+
+               [EditorBrowsable (EditorBrowsableState.Advanced)]
+               protected override void OnLayout (LayoutEventArgs levent)
+               {
+                       base.OnLayout (levent);
+               }
+
+               [EditorBrowsable (EditorBrowsableState.Advanced)]
                protected virtual void OnResizeBegin (EventArgs e)
                {
                        EventHandler eh = (EventHandler) (Events 
[ResizeBeginEvent]);
@@ -2480,6 +2571,14 @@
                        if (eh != null)
                                eh (this, e);
                }
+
+               [EditorBrowsable (EditorBrowsableState.Advanced)]
+               protected virtual void OnShown (EventArgs e)
+               {
+                       EventHandler eh = (EventHandler) (Events [ShownEvent]);
+                       if (eh != null)
+                               eh (this, e);
+               }
 #endif
        }
 }

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

Reply via email to