Author: pbartok
Date: 2005-03-11 04:09:47 -0500 (Fri, 11 Mar 2005)
New Revision: 41681

Added:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.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/Control.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIOSX.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
Log:
2005-03-11  Peter Bartok  <[EMAIL PROTECTED]>

        * Form.cs:
          - Rudimentary Mdi support
          - Removed outdated FormParent code
          - Implemented lots of missing properties and methods, still missing
            transparency support
          - Added missing attributes
          - Implemented support for MaximumBounds
          - Added firing of various events
        * XplatUI.cs: Added SetIcon() method
        * XplatUIDriver.cs: Added SetIcon() abstract
        * XplatUIOSX.cs: Stubbed out SetIcon() method
        * XplatUIX11.cs: 
          - Implemented SetIcon() support
          - Moved SetMenu() and SetBorderStyle() to proper alphabetical pos
          - Switched to unix line endings
        * XplatUIWin32.cs:
          - Made POINT internal so for can access it as part of MINMAX
          - Implemented SetIcon() support
          - Implemented support for CLIENTCREATESTRUCT (but might have to drop
            native Mdi support again, might have to go managed)
        * Control.cs: Now fires the StyleChanged event
        * MdiClient.cs: Added; still mostly empty

2005-03-11  Peter Bartok  <[EMAIL PROTECTED]>

        * System.Windows.Forms.dll.sources: Added MdiClient.cs



Modified: trunk/mcs/class/Managed.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/ChangeLog     2005-03-11 08:42:39 UTC 
(rev 41680)
+++ trunk/mcs/class/Managed.Windows.Forms/ChangeLog     2005-03-11 09:09:47 UTC 
(rev 41681)
@@ -1,3 +1,7 @@
+2005-03-11  Peter Bartok  <[EMAIL PROTECTED]>
+
+       * System.Windows.Forms.dll.sources: Added MdiClient.cs
+
 2005-03-10  Peter Bartok  <[EMAIL PROTECTED]>
 
        * System.Windows.Forms.dll.sources: Added SaveFileDialog.cs

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2005-03-11 08:42:39 UTC (rev 41680)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2005-03-11 09:09:47 UTC (rev 41681)
@@ -1,3 +1,28 @@
+2005-03-11  Peter Bartok  <[EMAIL PROTECTED]>
+
+       * Form.cs:
+         - Rudimentary Mdi support
+         - Removed outdated FormParent code
+         - Implemented lots of missing properties and methods, still missing
+           transparency support
+         - Added missing attributes
+         - Implemented support for MaximumBounds
+         - Added firing of various events
+       * XplatUI.cs: Added SetIcon() method
+       * XplatUIDriver.cs: Added SetIcon() abstract
+       * XplatUIOSX.cs: Stubbed out SetIcon() method
+       * XplatUIX11.cs: 
+         - Implemented SetIcon() support
+         - Moved SetMenu() and SetBorderStyle() to proper alphabetical pos
+         - Switched to unix line endings
+       * XplatUIWin32.cs:
+         - Made POINT internal so for can access it as part of MINMAX
+         - Implemented SetIcon() support
+         - Implemented support for CLIENTCREATESTRUCT (but might have to drop
+           native Mdi support again, might have to go managed)
+       * Control.cs: Now fires the StyleChanged event
+       * MdiClient.cs: Added; still mostly empty
+
 2005-03-10  Peter Bartok  <[EMAIL PROTECTED]>
 
        * SaveFileDialog.cs: Added emtpy file

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2005-03-11 08:42:39 UTC (rev 41680)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2005-03-11 09:09:47 UTC (rev 41681)
@@ -2984,6 +2984,7 @@
                        } else {
                                control_style &= ~flag;
                        }
+                       OnStyleChanged(EventArgs.Empty);
                }
 
                protected void SetTopLevel(bool value) {

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs  
2005-03-11 08:42:39 UTC (rev 41680)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs  
2005-03-11 09:09:47 UTC (rev 41681)
@@ -61,148 +61,21 @@
                private FormStartPosition       start_position;
                private Form                    owner;
                private Form.ControlCollection  owned_forms;
+               private MdiClient               mdi_container;
+               private Form                    mdi_parent;
                private bool                    key_preview;
                private MainMenu                menu;
                private Icon                    icon;
                private Size                    maximum_size;
                private Size                    minimum_size;
+               private SizeGripStyle           size_grip_style;
+               private Rectangle               maximized_bounds;
+               private Rectangle               default_maximized_bounds;
                #endregion      // Local Variables
 
-               #region Private Classes
-#if no
-               // This class will take over for the client area
-               internal class FormParentWindow : Control {
-                       #region FormParentWindow Class Local Variables
-                       internal Form   owner;
-                       #endregion      // FormParentWindow Class Local 
Variables
+               #region Private & Internal Methods
+               #endregion      // Private & Internal Methods
 
-                       #region FormParentWindow Class Constructor
-                       internal FormParentWindow(Form owner) : base() {
-                               this.owner = owner;
-
-                               this.Width = 250;
-                               this.Height = 250;
-
-                               BackColor = owner.BackColor;
-                               Text = "FormParent";
-                               this.Dock = DockStyle.Fill;
-                               this.is_visible = false;
-
-                               // We must set this via the internal var, the 
SetTopLevel method will too much stuff
-                               is_toplevel = true;
-
-                               MouseDown += new MouseEventHandler 
(OnMouseDownForm); 
-                               MouseMove += new MouseEventHandler 
(OnMouseMoveForm); 
-                               owner.TextChanged += new 
EventHandler(OnFormTextChanged);
-                               CreateControl();                // Create us 
right away, we have code referencing this.window
-                       }
-                       #endregion      // FormParentWindow Class Constructor
-
-                       #region FormParentWindow Class Protected Instance 
Methods
-                       protected override void OnResize(EventArgs e) {
-                               base.OnResize(e);
-
-                               if (owner.menu == null) {
-                                       owner.SetBoundsCore(0, 0, 
ClientSize.Width, ClientSize.Height, BoundsSpecified.All);
-                               } else {
-                                       int menu_height;
-
-                                       menu_height = 
MenuAPI.MenuBarCalcSize(DeviceContext, owner.Menu.menu_handle, 
ClientSize.Width);
-                                       Invalidate (new Rectangle (0, 0, 
ClientSize.Width, menu_height));                                       
-                                       owner.SetBoundsCore(0, menu_height, 
ClientSize.Width, ClientSize.Height-menu_height, BoundsSpecified.All);
-                               }
-                       }
-
-                       protected override void OnPaint(PaintEventArgs pevent) {
-                               OnDrawMenu (pevent.Graphics);
-                       }
-
-                       protected override void Select(bool directed, bool 
forward) {
-                               base.Select (directed, forward);
-                       }
-
-                       protected override void WndProc(ref Message m) {
-                               switch((Msg)m.Msg) {
-                                       case Msg.WM_CLOSE: {
-                                               CancelEventArgs args = new 
CancelEventArgs();
-
-                                               owner.OnClosing(args);
-
-                                               if (!args.Cancel) {
-                                                       
owner.OnClosed(EventArgs.Empty);
-                                                       owner.closing = true;
-                                                       base.WndProc(ref m);
-                                                       break;
-                                               }
-                                               return;
-                                       }
-
-                                       case Msg.WM_ACTIVATE: {
-                                               if (m.WParam != 
(IntPtr)WindowActiveFlags.WA_INACTIVE) {
-                                                       
owner.OnActivated(EventArgs.Empty);
-                                               } else {
-                                                       
owner.OnDeactivate(EventArgs.Empty);
-                                               }
-                                               return;
-                                       }
-
-#if topmost_workaround
-                                       case Msg.WM_ACTIVATE: {
-                                                       if 
(this.OwnedForms.Length>0) {
-                                                               
XplatUI.SetZOrder(this.OwnedForms[0].window.Handle, this.window.Handle, false, 
false);
-                                                       }
-                                               break;
-                                       }
-#endif
-
-                                       case Msg.WM_SETFOCUS: {
-                                               owner.WndProc(ref m);
-                                               return;
-                                       }
-
-                                       case Msg.WM_KILLFOCUS: {
-                                               owner.WndProc(ref m);
-                                               return;
-                                       }
-
-                                       default: {
-                                               base.WndProc (ref m);
-                                               return;
-                                       }
-                               }
-                       }
-                       #endregion      // FormParentWindow Class Protected 
Instance Methods
-
-                       #region FormParentWindow Class Private & Internal 
Methods
-                       internal void MenuChanged() {
-                               OnResize(EventArgs.Empty);
-                       }
-
-                       private void OnMouseDownForm (object sender, 
MouseEventArgs e) {                        
-                               if (owner.menu != null)
-                                       owner.menu.OnMouseDown (owner, e);
-                       }
-
-                       private void OnMouseMoveForm (object sender, 
MouseEventArgs e) {                        
-                               if (owner.menu != null)
-                                       owner.menu.OnMouseMove (owner, e);
-                       }
-               
-               
-                       private void OnDrawMenu (Graphics dc) {
-                                                               
-                               if (owner.menu != null) {
-                                       MenuAPI.DrawMenuBar (owner.menu);
-                               }
-                       }
-                       private void OnFormTextChanged(object sender, EventArgs 
e) {
-                               this.Text = ((Control)sender).Text;
-                       }
-                       #endregion      // FormParentWindow Class Private & 
Internal Methods
-               }
-#endif
-               #endregion      // Private Classes
-
                #region Public Classes
                public new class ControlCollection : Control.ControlCollection {
                        Form    form_owner;
@@ -228,7 +101,7 @@
                        }
                }
                #endregion      // Public Classes
-                       
+
                #region Public Constructor & Destructor
                public Form() {
                        closing = false;
@@ -250,11 +123,13 @@
                        ime_mode = ImeMode.NoControl;
                        is_visible = false;
                        is_toplevel = true;
+                       size_grip_style = SizeGripStyle.Auto;
+                       maximized_bounds = Rectangle.Empty;
+                       default_maximized_bounds = Rectangle.Empty;
                        owned_forms = new Form.ControlCollection(this);
                }
                #endregion      // Public Constructor & Destructor
 
-
                #region Public Static Properties
 
                public static Form ActiveForm {
@@ -285,6 +160,7 @@
                #endregion      // Public Static Properties
 
                #region Public Instance Properties
+               [DefaultValue(null)]
                public IButtonControl AcceptButton {
                        get {
                                return accept_button;
@@ -294,7 +170,20 @@
                                accept_button = value;
                        }
                }
+
+               [MonoTODO("Figure out a way for transparency support in 
windows")]
+               [Browsable(false)]
+               
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+               public bool AllowTransparency {
+                       get {
+                               return false;
+                       }
+
+                       set {
+                       }
+               }
                        
+               [DefaultValue(true)]
                public bool AutoScale {
                        get {
                                return autoscale;
@@ -305,6 +194,9 @@
                        }
                }
 
+               [Localizable(true)]
+               [Browsable(false)]
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
                public virtual Size AutoScaleBaseSize {
                        get {
                                return autoscale_base_size;
@@ -315,6 +207,26 @@
                        }
                }
 
+               [Localizable(true)]
+               public override bool AutoScroll {
+                       get {
+                               return base.AutoScroll;
+                       }
+                       set {
+                               base.AutoScroll = value;
+                       }
+               }
+
+               public override Color BackColor {
+                       get {
+                               return base.BackColor;
+                       }
+                       set {
+                               base.BackColor = value;
+                       }
+               }
+
+               [DefaultValue(null)]
                public IButtonControl CancelButton {
                        get {
                                return cancel_button;
@@ -325,6 +237,8 @@
                        }
                }
 
+               
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+               [Localizable(true)]
                public Size ClientSize {
                        get {
                                return base.ClientSize;
@@ -335,6 +249,7 @@
                        }
                }
 
+               [DefaultValue(true)]
                public bool ControlBox {
                        get {
                                return control_box;
@@ -348,7 +263,8 @@
                        }
                }
 
-               [MonoTODO("make sure we return screen coords")]
+               [Browsable(false)]
+               
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
                public Rectangle DesktopBounds {
                        get {
                                return new Rectangle(Location, Size);
@@ -359,7 +275,8 @@
                        }
                }
 
-               [MonoTODO("make sure we return screen coords")]
+               [Browsable(false)]
+               
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
                public Point DesktopLocation {
                        get {
                                return Location;
@@ -370,6 +287,8 @@
                        }
                }
 
+               [Browsable(false)]
+               
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
                public DialogResult DialogResult {
                        get {
                                return dialog_result;
@@ -384,16 +303,19 @@
                        }
                }
 
+               [DefaultValue(FormBorderStyle.Sizable)]
+               [DispId(-504)]
                public FormBorderStyle FormBorderStyle {
                        get {
                                return formBorderStyle;
                        }
                        set {
                                formBorderStyle = value;
-                               Invalidate ();
+                               UpdateStyles();
                        }
                }
 
+               [DefaultValue(false)]
                public bool HelpButton {
                        get {
                                return help_button;
@@ -407,6 +329,8 @@
                        }
                }
 
+               [Localizable(true)]
+               [AmbientValue(null)]
                public Icon Icon {
                        get {
                                return icon;
@@ -415,16 +339,46 @@
                        set {
                                if (icon != value) {
                                        icon = value;
+
+                                       XplatUI.SetIcon(window.Handle, icon);
                                }
                        }
                }
 
+               [Browsable(false)]
+               
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+               public bool IsMdiChild {
+                       get {
+                               return mdi_parent != null;
+                       }
+               }
+
+               [DefaultValue(false)]
+               public bool IsMdiContainer {
+                       get {
+                               return mdi_container != null;
+                       }
+
+                       set {
+                               if (value && mdi_container == null) {
+                                       mdi_container = new MdiClient();
+                                       Controls.Add(mdi_container);
+                               } else if (!value && mdi_container != null) {
+                                       Controls.Remove(mdi_container);
+                                       mdi_container.Dispose();
+                               }
+                       }
+               }
+
+               [Browsable(false)]
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
                public bool IsRestrictedWindow {
                        get {
                                return false;
                        }
                }
 
+               [DefaultValue(false)]
                public bool KeyPreview {
                        get {
                                return key_preview;
@@ -435,6 +389,7 @@
                        }
                }
 
+               [DefaultValue(true)]
                public bool MaximizeBox {
                        get {
                                return maximize_box;
@@ -447,6 +402,9 @@
                        }
                }
 
+               [DefaultValue(typeof(Size), "{Width=0, Height=0}")]
+               [Localizable(true)]
+               [RefreshProperties(RefreshProperties.Repaint)]
                public Size MaximumSize {
                        get {
                                return maximum_size;
@@ -455,10 +413,50 @@
                        set {
                                if (maximum_size != value) {
                                        maximum_size = value;
+                                       OnMaximumSizeChanged(EventArgs.Empty);
                                }
                        }
                }
 
+               [Browsable(false)]
+               
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+               public Form[] MdiChildren {
+                       get {
+                               if (mdi_container != null) {
+                                       Form[] form_list;
+
+                                       form_list = new 
Form[mdi_container.Controls.Count];
+                                       for (int i = 0; i < 
mdi_container.Controls.Count; i++) {
+                                               form_list[i] = 
(Form)mdi_container.Controls[i];
+                                       }
+                                       return form_list;
+                               } else {
+                                       return new Form[0];
+                               }
+                       }
+               }
+
+               [MonoTODO("Finish setter")]
+               [Browsable(false)]
+               
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+               public Form MdiParent {
+                       get {
+                               return mdi_parent;
+                       }
+
+                       set {
+                               if (mdi_parent != null) {
+                                       mdi_parent.Controls.Remove(this);
+                               }
+
+                               mdi_parent = value;
+                               if (mdi_parent != null) {
+                                       mdi_parent.Controls.Add(this);
+                               }
+                       }
+               }
+
+               [DefaultValue(null)]
                public MainMenu Menu {
                        get {
                                return menu;
@@ -481,6 +479,7 @@
                        }
                }
 
+               [DefaultValue(true)]
                public bool MinimizeBox {
                        get {
                                return minimize_box;
@@ -493,6 +492,9 @@
                        }
                }
 
+               [DefaultValue(typeof(Size), "{Width=0, Height=0}")]
+               [Localizable(true)]
+               [RefreshProperties(RefreshProperties.Repaint)]
                public Size MinimumSize {
                        get {
                                return minimum_size;
@@ -501,16 +503,21 @@
                        set {
                                if (minimum_size != value) {
                                        minimum_size = value;
+                                       OnMinimumSizeChanged(EventArgs.Empty);
                                }
                        }
                }
 
+               [Browsable(false)]
+               
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
                public bool Modal  {
                        get {
                                return is_modal;
                        }
                }
 
+               [Browsable(false)]
+               
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
                public Form[] OwnedForms {
                        get {
                                Form[] form_list;
@@ -525,6 +532,8 @@
                        }
                }
 
+               [Browsable(false)]
+               
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
                public Form Owner {
                        get {
                                return owner;
@@ -546,6 +555,7 @@
                        }
                }
 
+               [DefaultValue(true)]
                public bool ShowInTaskbar {
                        get {
                                return show_in_taskbar;
@@ -558,6 +568,8 @@
                        }
                }
 
+               
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+               [Localizable(false)]
                public Size Size {
                        get {
                                return Size;
@@ -568,6 +580,20 @@
                        }
                }
 
+               [MonoTODO("Trigger something when GripStyle is set")]
+               [DefaultValue(SizeGripStyle.Auto)]
+               public SizeGripStyle SizeGripStyle {
+                       get {
+                               return size_grip_style;
+                       }
+
+                       set {
+                               size_grip_style = value;
+                       }
+               }
+
+               [DefaultValue(FormStartPosition.WindowsDefaultLocation)]
+               [Localizable(true)]
                public FormStartPosition StartPosition {
                        get {
                                return start_position;
@@ -579,19 +605,12 @@
                                        if (IsHandleCreated) {
                                                switch(start_position) {
                                                        case 
FormStartPosition.CenterParent: {
-                                                               if 
(Parent!=null && Width>0 && Height>0) {
-                                                                       
this.Location = new Point(Parent.Size.Width/2-Width/2, 
Parent.Size.Height/2-Height/2);
-                                                               }
+                                                               
CenterToParent();
                                                                break;
                                                        }
 
                                                        case 
FormStartPosition.CenterScreen: {
-                                                               if (Width>0 && 
Height>0) {
-                                                                       Size    
DisplaySize;
-
-                                                                       
XplatUI.GetDisplaySize(out DisplaySize);
-                                                                       
this.Location = new Point(DisplaySize.Width/2-Width/2, 
DisplaySize.Height/2-Height/2);
-                                                               }
+                                                               
CenterToScreen();
                                                                break;
                                                        }
 
@@ -604,6 +623,22 @@
                        }
                }
 
+               [Browsable(false)]
+               
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+               [EditorBrowsable(EditorBrowsableState.Never)]
+               public int TabIndex {
+                       get {
+                               return base.TabIndex;
+                       }
+
+                       set {
+                               base.TabIndex = value;
+                       }
+               }
+
+               [Browsable(false)]
+               
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
                public bool TopLevel {
                        get {
                                return GetTopLevel();
@@ -614,6 +649,7 @@
                        }
                }
 
+               [DefaultValue(false)]
                public bool TopMost {
                        get {
                                return topmost;
@@ -627,6 +663,7 @@
                        }
                }
 
+               [DefaultValue(FormWindowState.Normal)]
                public FormWindowState WindowState {
                        get {
                                return XplatUI.GetWindowState(window.Handle);
@@ -648,10 +685,10 @@
                                cp = new CreateParams();
 
                                cp.Caption = "FormWindow";
-                               cp.ClassName=XplatUI.DefaultClassName;
+                               cp.ClassName = XplatUI.DefaultClassName;
                                cp.ClassStyle = 0;
-                               cp.ExStyle=0;
-                               cp.Param=0;
+                               cp.ExStyle = 0;
+                               cp.Param = 0;
                                cp.Parent = IntPtr.Zero;
 //                             if (start_position == 
FormStartPosition.WindowsDefaultLocation) {
                                        cp.X = unchecked((int)0x80000000);
@@ -663,10 +700,46 @@
                                cp.Width = Width;
                                cp.Height = Height;
                                
-                               cp.Style = 
(int)(WindowStyles.WS_OVERLAPPEDWINDOW | 
-                                       WindowStyles.WS_CLIPSIBLINGS | 
-                                       WindowStyles.WS_CLIPCHILDREN);
+                               cp.Style = (int)(WindowStyles.WS_CLIPSIBLINGS | 
WindowStyles.WS_CLIPCHILDREN);
 
+                               switch (FormBorderStyle) {
+                                       case FormBorderStyle.Fixed3D: {
+                                               cp.Style |= 
(int)WindowStyles.WS_CAPTION;
+                                               cp.ExStyle |= 
(int)WindowStyles.WS_EX_OVERLAPPEDWINDOW;
+                                               break;
+                                       }
+
+                                       case FormBorderStyle.FixedDialog: {
+                                               cp.Style |= 
(int)WindowStyles.WS_CAPTION;
+                                               cp.ExStyle |= 
(int)(WindowStyles.WS_EX_DLGMODALFRAME | WindowStyles.WS_EX_WINDOWEDGE);
+                                               break;
+                                       }
+
+                                       case FormBorderStyle.FixedSingle: {
+                                               cp.Style |= 
(int)WindowStyles.WS_CAPTION;
+                                               cp.ExStyle |= 
(int)(WindowStyles.WS_EX_WINDOWEDGE);
+                                               break;
+                                       }
+
+                                       case FormBorderStyle.FixedToolWindow: {
+                                               cp.Style |= 
(int)WindowStyles.WS_CAPTION;
+                                               cp.ExStyle |= 
(int)(WindowStyles.WS_EX_WINDOWEDGE | WindowStyles.WS_EX_TOOLWINDOW);
+                                               break;
+                                       }
+
+                                       case FormBorderStyle.Sizable: {
+                                               cp.Style |= 
(int)WindowStyles.WS_OVERLAPPEDWINDOW;
+                                               cp.ExStyle |= 
(int)(WindowStyles.WS_EX_WINDOWEDGE);
+                                               break;
+                                       }
+
+                                       case FormBorderStyle.SizableToolWindow: 
{
+                                               cp.Style |= 
(int)WindowStyles.WS_OVERLAPPEDWINDOW;
+                                               cp.ExStyle |= 
(int)(WindowStyles.WS_EX_WINDOWEDGE | WindowStyles.WS_EX_TOOLWINDOW);
+                                               break;
+                                       }
+                               }
+
                                if (ShowInTaskbar) {
                                        cp.ExStyle |= 
(int)WindowStyles.WS_EX_APPWINDOW;
                                }
@@ -690,21 +763,44 @@
                        }
                }
 
+               protected override ImeMode DefaultImeMode {
+                       get {
+                               return ImeMode.NoControl;
+                       }
+               }
+
                protected override Size DefaultSize {
                        get {
                                return new Size (250, 250);
                        }
                }               
 
-               protected override void OnPaint (PaintEventArgs pevent)
-               {
-                       base.OnPaint (pevent);
-               }               
-               
+               protected Rectangle MaximizedBounds {
+                       get {
+                               if (maximized_bounds != Rectangle.Empty) {
+                                       return maximized_bounds;
+                               }
+                               return default_maximized_bounds;
+                       }
+
+                       set {
+                               maximized_bounds = value;
+                               OnMaximizedBoundsChanged(EventArgs.Empty);
+                       }
+               }
                #endregion      // Protected Instance Properties
 
+               #region Public Static Methods
+               [MonoTODO("Figure out the math")]
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               public static SizeF GetAutoScaleSize(Font font) {
+                       SizeF   result;
 
-               #region Public Static Methods
+                       result = new SizeF(250, 250);
+                       result.Width *= font.SizeInPoints / 12;
+                       result.Height *= font.SizeInPoints / 12;
+                       return result;
+               }
                #endregion      // Public Static Methods
 
                #region Public Instance Methods
@@ -722,6 +818,22 @@
                        owned_forms.Add(ownedForm);
                }
 
+               public void Close () {
+                       CancelEventArgs args = new CancelEventArgs ();
+                       OnClosing (args);
+                       if (!args.Cancel) {
+                               OnClosed (EventArgs.Empty);
+                               closing = true;
+                               return;
+                       }
+               }
+
+               public void LayoutMdi(MdiLayout value) {
+                       if (mdi_container != null) {
+                               mdi_container.LayoutMdi(value);
+                       }
+               }
+
                public void RemoveOwnedForm(Form ownedForm) {
                        owned_forms.Remove(ownedForm);
                }
@@ -788,24 +900,119 @@
                        return DialogResult;
                }
 
-               public void Close ()
-               {
-                       CancelEventArgs args = new CancelEventArgs ();
-                       OnClosing (args);
-                       if (!args.Cancel) {
-                               OnClosed (EventArgs.Empty);
-                               closing = true;
-                               return;
+               public override string ToString() {
+                       return GetType().FullName.ToString() + ", Text: " + 
Text;
+               }
+               #endregion      // Public Instance Methods
+
+               #region Protected Instance Methods
+               [MonoTODO("Finish when MDI is more complete")]
+               protected void ActivateMdiChild(Form form) {
+                       OnMdiChildActivate(EventArgs.Empty);
+                       throw new NotImplementedException();
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected override void AdjustFormScrollbars(bool 
displayScrollbars) {
+                       base.AdjustFormScrollbars (displayScrollbars);
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected void ApplyAutoScaling() {
+                       // Hm, not sure what this does
+               }
+
+               protected void CenterToParent() {
+                       Control ctl;
+                       int     w;
+                       int     h;
+
+                       if (Width > 0) {
+                               w = Width;
+                       } else {
+                               w = DefaultSize.Width;
                        }
+
+                       if (Height > 0) {
+                               h = Height;
+                       } else {
+                               h = DefaultSize.Height;
+                       }
+
+                       ctl = null;
+                       if (parent != null) {
+                               ctl = parent;
+                       } else if (owner != null) {
+                               ctl = owner;
+                       }
+
+                       if (owner != null) {
+                               this.Location = new Point(ctl.Left + ctl.Width 
/ 2 - w /2, ctl.Top + ctl.Height / 2 - h / 2);
+                       }
                }
 
-               #endregion      // Public Instance Methods
+               protected void CenterToScreen() {
+                       Size    DisplaySize;
+                       int     w;
+                       int     h;
 
-               #region Protected Instance Methods
+                       if (Width > 0) {
+                               w = Width;
+                       } else {
+                               w = DefaultSize.Width;
+                       }
+
+                       if (Height > 0) {
+                               h = Height;
+                       } else {
+                               h = DefaultSize.Height;
+                       }
+
+                       XplatUI.GetDisplaySize(out DisplaySize);
+                       this.Location = new Point(DisplaySize.Width / 2 - w / 
2, DisplaySize.Height / 2 - h / 2);
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected override Control.ControlCollection 
CreateControlsInstance() {
+                       return base.CreateControlsInstance ();
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
                protected override void CreateHandle() {
                        base.CreateHandle ();
                }
 
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected override void DefWndProc(ref Message m) {
+                       base.DefWndProc (ref m);
+               }
+
+               protected override void Dispose(bool disposing) {
+                       base.Dispose (disposing);
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected virtual void OnActivated(EventArgs e) {
+                       if (Activated != null) {
+                               Activated(this, e);
+                       }
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected virtual void OnClosed(EventArgs e) {
+                       if (Closed != null) {
+                               Closed(this, e);
+                       }
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected virtual void 
OnClosing(System.ComponentModel.CancelEventArgs e) {
+                       if (Closing != null) {
+                               Closing(this, e);
+                       }
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
                protected override void OnCreateControl() {
                        base.OnCreateControl ();
                        if (this.ActiveControl == null) {
@@ -819,19 +1026,116 @@
                        OnLocationChanged(EventArgs.Empty);
                }
 
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected virtual void OnDeactivate(EventArgs e) {
+                       if (Deactivate != null) {
+                               Deactivate(this, e);
+                       }
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected override void OnFontChanged(EventArgs e) {
+                       base.OnFontChanged (e);
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
                protected override void OnHandleCreated(EventArgs e) {
                        base.OnHandleCreated (e);
                }
 
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
                protected override void OnHandleDestroyed(EventArgs e) {
                        base.OnHandleDestroyed (e);
                }
 
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected virtual void 
OnInputLanguageChanged(InputLanguageChangedEventArgs e) {
+                       if (InputLanguageChanged!=null) {
+                               InputLanguageChanged(this, e);
+                       }
+               }
 
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected virtual void 
OnInputLanguageChanging(InputLanguageChangingEventArgs e) {
+                       if (InputLanguageChanging!=null) {
+                               InputLanguageChanging(this, e);
+                       }
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected virtual void OnLoad(EventArgs e) {
+                       if (Load != null) {
+                               Load(this, e);
+                       }
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected virtual void OnMaximizedBoundsChanged(EventArgs e) {
+                       if (MaximizedBoundsChanged != null) {
+                               MaximizedBoundsChanged(this, e);
+                       }
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected virtual void OnMaximumSizeChanged(EventArgs e) {
+                       if (MaximumSizeChanged != null) {
+                               MaximumSizeChanged(this, e);
+                       }
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected virtual void OnMdiChildActivate(EventArgs e) {
+                       if (MdiChildActivate != null) {
+                               MdiChildActivate(this, e);
+                       }
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected virtual void OnMenuComplete(EventArgs e) {
+                       if (MenuComplete != null) {
+                               MenuComplete(this, e);
+                       }
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected virtual void OnMenuStart(EventArgs e) {
+                       if (MenuStart != null) {
+                               MenuStart(this, e);
+                       }
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected virtual void OnMinimumSizeChanged(EventArgs e) {
+                       if (MinimumSizeChanged != null) {
+                               MinimumSizeChanged(this, e);
+                       }
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected override void OnPaint (PaintEventArgs pevent) {
+                       base.OnPaint (pevent);
+               }               
+               
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
                protected override void OnResize(EventArgs e) {
                        base.OnResize(e);
                }
 
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected override void OnStyleChanged(EventArgs e) {
+                       base.OnStyleChanged (e);
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected override void OnTextChanged(EventArgs e) {
+                       base.OnTextChanged (e);
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected override void OnVisibleChanged(EventArgs e) {
+                       base.OnVisibleChanged (e);
+               }
+
                protected override bool ProcessCmdKey(ref Message msg, Keys 
keyData) {
                        if (base.ProcessCmdKey (ref msg, keyData)) {
                                return true;
@@ -845,6 +1149,11 @@
                        return false;
                }
 
+               // LAMESPEC - Not documented that Form overrides 
ProcessDialogChar; class-status showed
+               protected override bool ProcessDialogChar(char charCode) {
+                       return base.ProcessDialogChar (charCode);
+               }
+
                protected override bool ProcessDialogKey(Keys keyData) {
                        if ((keyData & Keys.Modifiers) == 0) {
                                if (keyData == Keys.Enter && accept_button != 
null) {
@@ -867,6 +1176,36 @@
                        return base.ProcessKeyPreview (ref msg);
                }
 
+               protected override bool ProcessTabKey(bool forward) {
+                       return SelectNextControl(ActiveControl, forward, true, 
true, true);
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected override void ScaleCore(float dx, float dy) {
+                       base.ScaleCore (dx, dy);
+               }
+
+               protected override void Select(bool directed, bool forward) {
+                       Form    parent;
+
+                       if (directed) {
+                               base.SelectNextControl(null, forward, true, 
true, true);
+                       }
+
+                       parent = this.ParentForm;
+                       if (parent != null) {
+                               parent.ActiveControl = this;
+                       }
+
+                       Activate();
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected override void SetBoundsCore(int x, int y, int width, 
int height, BoundsSpecified specified) {
+                       base.SetBoundsCore (x, y, width, height, specified);
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
                protected override void SetClientSizeCore(int x, int y) {
                        if ((minimum_size.Width != 0) && (x < 
minimum_size.Width)) {
                                x = minimum_size.Width;
@@ -883,7 +1222,16 @@
                        base.SetClientSizeCore (x, y);
                }
 
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
+               protected override void SetVisibleCore(bool value) {
+                       base.SetVisibleCore (value);
+               }
 
+               protected override void UpdateDefaultButton() {
+                       base.UpdateDefaultButton ();
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Advanced)]
                protected override void WndProc(ref Message m) {
                        switch((Msg)m.Msg) {
                                case Msg.WM_CLOSE: {
@@ -965,6 +1313,22 @@
                                        break;
                                }
 
+                               case Msg.WM_GETMINMAXINFO: {
+                                       XplatUIWin32.MINMAXINFO mmi;
+
+                                       if (m.LParam != IntPtr.Zero) {
+                                               mmi = 
(XplatUIWin32.MINMAXINFO)Marshal.PtrToStructure(m.LParam, 
typeof(XplatUIWin32.MINMAXINFO));
+                                               default_maximized_bounds = new 
Rectangle(mmi.ptMaxPosition.x, mmi.ptMaxPosition.y, mmi.ptMaxSize.x, 
mmi.ptMaxSize.y);
+                                               if (maximized_bounds != 
Rectangle.Empty) {
+                                                       mmi.ptMaxSize.x = 
maximized_bounds.Width;
+                                                       mmi.ptMaxSize.y = 
maximized_bounds.Height;
+                                               }
+
+                                               Marshal.StructureToPtr(mmi, 
m.LParam, false);
+                                       }
+                                       break;
+                               }
+
                                default: {
                                        base.WndProc (ref m);
                                        break;
@@ -974,84 +1338,6 @@
                #endregion      // Protected Instance Methods
 
                #region Events
-               protected virtual void OnActivated(EventArgs e) {
-                       if (Activated != null) {
-                               Activated(this, e);
-                       }
-               }
-
-               protected virtual void OnClosed(EventArgs e) {
-                       if (Closed != null) {
-                               Closed(this, e);
-                       }
-               }
-
-               protected virtual void 
OnClosing(System.ComponentModel.CancelEventArgs e) {
-                       if (Closing != null) {
-                               Closing(this, e);
-                       }
-               }
-
-               protected virtual void OnDeactivate(EventArgs e) {
-                       if (Deactivate != null) {
-                               Deactivate(this, e);
-                       }
-               }
-
-               protected virtual void 
OnInputLanguageChanged(InputLanguageChangedEventArgs e) {
-                       if (InputLanguageChanged!=null) {
-                               InputLanguageChanged(this, e);
-                       }
-               }
-
-               protected virtual void 
OnInputLanguageChanging(InputLanguageChangingEventArgs e) {
-                       if (InputLanguageChanging!=null) {
-                               InputLanguageChanging(this, e);
-                       }
-               }
-
-               protected virtual void OnLoad(EventArgs e) {
-                       if (Load != null) {
-                               Load(this, e);
-                       }
-               }
-
-               protected virtual void OnMaximizedBoundsChanged(EventArgs e) {
-                       if (MaximizedBoundsChanged != null) {
-                               MaximizedBoundsChanged(this, e);
-                       }
-               }
-
-               protected virtual void OnMaximumSizeChanged(EventArgs e) {
-                       if (MaximumSizeChanged != null) {
-                               MaximumSizeChanged(this, e);
-                       }
-               }
-
-               protected virtual void OnMdiChildActivate(EventArgs e) {
-                       if (MdiChildActivate != null) {
-                               MdiChildActivate(this, e);
-                       }
-               }
-
-               protected virtual void OnMenuComplete(EventArgs e) {
-                       if (MenuComplete != null) {
-                               MenuComplete(this, e);
-                       }
-               }
-
-               protected virtual void OnMenuStart(EventArgs e) {
-                       if (MenuStart != null) {
-                               MenuStart(this, e);
-                       }
-               }
-
-               protected virtual void OnMinimumSizeChanged(EventArgs e) {
-                       if (MinimumSizeChanged != null) {
-                               MinimumSizeChanged(this, e);
-                       }
-               }
-
                public event EventHandler Activated;
                public event EventHandler Closed;
                public event CancelEventHandler Closing;

Added: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs     
2005-03-11 08:42:39 UTC (rev 41680)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs     
2005-03-11 09:09:47 UTC (rev 41681)
@@ -0,0 +1,136 @@
+// 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) 2005 Novell, Inc. (http://www.novell.com)
+//
+// Authors:
+//     Peter Bartok    [EMAIL PROTECTED]
+//
+//
+
+// NOT COMPLETE
+
+using System.Collections;
+using System.ComponentModel;
+using System.Drawing;
+
+namespace System.Windows.Forms {
+       [DesignTimeVisible(false)]
+       [ToolboxItem(false)]
+       public sealed class MdiClient : Control {
+               #region Local Variables
+               #endregion      // Local Variables
+
+               #region Public Classes
+               public new class ControlCollection : Control.ControlCollection {
+                       MdiClient       owner;
+
+                       public ControlCollection(MdiClient owner) : base(owner) 
{
+                               this.owner = owner;
+                       }
+
+                       public override void Add(Control value) {
+                               if ((value is Form) == false || 
(((Form)value).IsMdiChild)) {
+                                       throw new ArgumentException("Form must 
be MdiChild");
+                               }
+
+                               for (int i=0; i<list.Count; i++) {
+                                       if (list[i]==value) {
+                                               // Do we need to do anything 
here?
+                                               return;
+                                       }
+                               }
+                               list.Add(value);
+                               //((Form)value).owner=(Form)owner;
+                       }
+
+                       public override void Remove(Control value) {
+                               //((Form)value).owner = null;
+                               base.Remove (value);
+                       }
+               }
+               #endregion      // Public Classes
+
+               #region Public Constructors
+               public MdiClient() {
+               }
+               #endregion      // Public Constructors
+
+               #region Public Instance Properties
+               public override System.Drawing.Image BackgroundImage {
+                       get {
+                               return base.BackgroundImage;
+                       }
+                       set {
+                               base.BackgroundImage = value;
+                       }
+               }
+
+               public Form[] MdiChildren {
+                       get {
+                               Form[]  children;
+
+                               children = new Form[Controls.Count];
+                               Controls.CopyTo(children, 0);
+
+                               return children;
+                       }
+               }
+               #endregion      // Public Instance Properties
+
+               #region Protected Instance Properties
+               protected override CreateParams CreateParams {
+                       get {
+                               XplatUIWin32.CLIENTCREATESTRUCT ccs;
+                               CreateParams                    cp;
+
+                               cp = base.CreateParams;
+
+                               if (parent != null) {
+                                       cp.X = 0;
+                                       cp.Y = 0;
+                                       cp.Width = parent.Width;
+                                       cp.Height = parent.Height;
+                               }
+
+
+                               ccs = new 
System.Windows.Forms.XplatUIWin32.CLIENTCREATESTRUCT();
+                               ccs.hWindowMenu = IntPtr.Zero;
+                               ccs.idFirstChild = 27577;
+                               cp.Param = ccs;
+
+                               cp.ClassName = "MDICLIENT";
+                               cp.Style |= (int)(WindowStyles.WS_CHILD | 
WindowStyles.WS_VISIBLE);
+                               cp.ExStyle |= (int)WindowStyles.WS_EX_MDICHILD;
+
+                               return cp;
+                       }
+               }
+               #endregion      // Protected Instance Properties
+
+               #region Public Instance Methods
+               public void LayoutMdi(MdiLayout value) {
+                       throw new NotImplementedException();
+               }
+               #endregion      // Public Instance Methods
+
+               #region Protected Instance Methods
+               #endregion      // Protected Instance Methods
+       }
+}

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs       
2005-03-11 08:42:39 UTC (rev 41680)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs       
2005-03-11 09:09:47 UTC (rev 41681)
@@ -77,7 +77,7 @@
 
                #region Constructor & Destructor
                static XplatUI() {
-                       Console.WriteLine("Mono System.Windows.Forms Assembly 
[Revision: 40575; built: 2005/1/13 1:47:46]");
+                       Console.WriteLine("Mono System.Windows.Forms Assembly 
[Revision: 41586; built: 2005/2/9 1:7:30]");
 
                        // Don't forget to throw the mac in here somewhere, too
                        default_class_name="SWFClass";
@@ -549,6 +549,13 @@
                        driver.SetFocus(handle);
                }
 
+               internal static void SetIcon(IntPtr handle, Icon icon) {
+                       #if DriverDebug
+                               Console.WriteLine("SetIcon({0:X}, {1}): 
Called", handle.ToInt32(), icon);
+                       #endif
+                       driver.SetIcon(handle, icon);
+               }
+
                internal static void SetMenu(IntPtr handle, IntPtr menu_handle) 
{
                        #if DriverDebug
                                Console.WriteLine("SetMenu({0:X}, {1:X}): 
Called", handle.ToInt32(), menu_handle.ToInt32());

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs 
2005-03-11 08:42:39 UTC (rev 41680)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs 
2005-03-11 09:09:47 UTC (rev 41681)
@@ -192,6 +192,8 @@
                internal abstract Point GetMenuOrigin(IntPtr hwnd);
                internal abstract void ReleaseMenuDC(IntPtr hwnd, Graphics dc);
 
+               internal abstract void SetIcon(IntPtr handle, Icon icon);
+
                // System information
 
                internal abstract int KeyboardSpeed { get; } 

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIOSX.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIOSX.cs    
2005-03-11 08:42:39 UTC (rev 41680)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIOSX.cs    
2005-03-11 09:09:47 UTC (rev 41681)
@@ -1447,6 +1447,12 @@
                        PostMessage(handle, Msg.WM_SETFOCUS, FocusWindow, 
IntPtr.Zero);
                        FocusWindow = handle;
                }
+
+               [MonoTODO]
+               internal override void SetIcon(IntPtr handle, Icon icon) {
+                       throw new NotImplementedException();
+               }
+
                
                internal override void SetModal(IntPtr handle, bool Modal) {
                        IntPtr hWnd = GetControlOwner (Hwnd.ObjectFromHandle 
(handle).WholeWindow);

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs  
2005-03-11 08:42:39 UTC (rev 41680)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs  
2005-03-11 09:09:47 UTC (rev 41681)
@@ -83,7 +83,7 @@
                }
 
                [StructLayout(LayoutKind.Sequential)]
-               private struct POINT {
+               internal struct POINT {
                        internal int            x;
                        internal int            y;
                }
@@ -472,6 +472,35 @@
                        DCX_USESTYLE                    = 0x00010000,
                        DCX_VALIDATE                    = 0x00200000
                }
+
+               [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
+               internal struct CLIENTCREATESTRUCT {
+                       internal IntPtr                 hWindowMenu;
+                       internal uint                   idFirstChild;
+               }
+
+               private enum ClassLong : int {
+                       GCL_MENUNAME                    = -8,
+                       GCL_HBRBACKGROUND               = -10,
+                       GCL_HCURSOR                     = -12,
+                       GCL_HICON                       = -14,
+                       GCL_HMODULE                     = -16,
+                       GCL_CBWNDEXTRA                  = -18,
+                       GCL_CBCLSEXTRA                  = -20,
+                       GCL_WNDPROC                     = -24,
+                       GCL_STYLE                       = -26,
+                       GCW_ATOM                        = -32,
+                       GCL_HICONSM                     = -34
+               }
+
+               [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
+               internal struct MINMAXINFO {
+                       internal POINT                  ptReserved;
+                       internal POINT                  ptMaxSize;
+                       internal POINT                  ptMaxPosition;
+                       internal POINT                  ptMinTrackSize;
+                       internal POINT                  ptMaxTrackSize;
+               }
                #endregion
 
                #region Constructor & Destructor
@@ -773,6 +802,7 @@
                        IntPtr  WindowHandle;
                        IntPtr  ParentHandle;
                        Hwnd    hwnd;
+                       IntPtr  lParam;
 
                        hwnd = new Hwnd();
 
@@ -782,8 +812,19 @@
                                // We need to use our foster parent window 
until this poor child gets it's parent assigned
                                ParentHandle=FosterParent;
                        }
-                       WindowHandle = Win32CreateWindow((uint)cp.ExStyle, 
cp.ClassName, cp.Caption, (uint)cp.Style, cp.X, cp.Y, cp.Width, cp.Height, 
ParentHandle, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
 
+                       lParam = IntPtr.Zero;
+                       if (cp.Param != null && cp.Param is CLIENTCREATESTRUCT) 
{
+                               lParam = 
Marshal.AllocHGlobal(Marshal.SizeOf(cp.Param));
+                               Marshal.StructureToPtr(cp.Param, lParam, false);
+                       }
+
+                       WindowHandle = Win32CreateWindow((uint)cp.ExStyle, 
cp.ClassName, cp.Caption, (uint)cp.Style, cp.X, cp.Y, cp.Width, cp.Height, 
ParentHandle, IntPtr.Zero, IntPtr.Zero, lParam);
+
+                       if (lParam != IntPtr.Zero) {
+                               Marshal.FreeHGlobal(lParam);
+                       }
+
                        if (WindowHandle==IntPtr.Zero) {
                                uint error = Win32GetLastError();
 
@@ -1542,10 +1583,13 @@
 
 
                internal override void ReleaseMenuDC(IntPtr hwnd, Graphics dc) {
-                       
                        dc.Dispose();
                }
 
+               internal override void SetIcon(IntPtr hwnd, Icon icon) {
+                       Win32SendMessage(hwnd, Msg.WM_SETICON, (IntPtr)1, 
icon.Handle); // 1 = large icon (0 would be small)
+               }
+
                internal override int KeyboardSpeed {
                        get {
                                Console.WriteLine ("KeyboardSpeed: need to 
query Windows");
@@ -1805,6 +1849,12 @@
 
                [DllImport ("user32.dll", EntryPoint="IsWindowVisible", 
CallingConvention=CallingConvention.StdCall)]
                private extern static bool IsWindowVisible(IntPtr hwnd);
+
+               [DllImport ("user32.dll", EntryPoint="SetClassLong", 
CallingConvention=CallingConvention.StdCall)]
+               private extern static bool Win32SetClassLong(IntPtr hwnd, 
ClassLong nIndex, IntPtr dwNewLong);
+
+               [DllImport ("user32.dll", EntryPoint="SendMessageW", 
CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)]
+               private extern static bool Win32SendMessage(IntPtr hwnd, Msg 
msg, IntPtr wParam, IntPtr lParam);
                #endregion
        }
 }

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2005-03-11 08:42:39 UTC (rev 41680)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs    
2005-03-11 09:09:47 UTC (rev 41681)
@@ -47,6 +47,7 @@
 using System.Collections;
 using System.Diagnostics;
 using System.Drawing;
+using System.Drawing.Imaging;
 using System.IO;
 using System.Net;
 using System.Net.Sockets;
@@ -210,11 +211,11 @@
                                this.MinorCode = MinorCode;
                        }
 
-                       public override string Message {
-                               get {
-                                       return GetMessage(Display, ResourceID, 
Serial, ErrorCode, RequestCode, MinorCode);
-                               }
-                       }
+                       public override string Message {
+                               get {
+                                       return GetMessage(Display, ResourceID, 
Serial, ErrorCode, RequestCode, MinorCode);
+                               }
+                       }
 
                        public static string GetMessage(IntPtr Display, IntPtr 
ResourceID, IntPtr Serial, byte ErrorCode, XRequest RequestCode, byte 
MinorCode) {
                                StringBuilder   sb;
@@ -224,9 +225,9 @@
                                sb = new StringBuilder(160);
                                XGetErrorText(Display, ErrorCode, sb, 
sb.Capacity);
                                x_error_text = sb.ToString();
-
-                               error = String.Format("\n  Error: {0}\n  
Request:     {1:D} ({2})\n  Resource ID: 0x{3:x}\n  Serial:      {4}", 
x_error_text, RequestCode, RequestCode, ResourceID.ToInt32(), Serial);
-                               return error;
+
+                               error = String.Format("\n  Error: {0}\n  
Request:     {1:D} ({2})\n  Resource ID: 0x{3:x}\n  Serial:      {4}", 
x_error_text, RequestCode, RequestCode, ResourceID.ToInt32(), Serial);
+                               return error;
                        }
                }
                #endregion      // XExceptionClass
@@ -329,41 +330,41 @@
                }
 
                internal static void Where() {
-                       Console.WriteLine("Here: {0}\n", WhereString());
-               }
-
+                       Console.WriteLine("Here: {0}\n", WhereString());
+               }
+
                internal static string WhereString() {
                        StackTrace      stack;
                        StackFrame      frame;
-                       string          newline;
-                       string          unknown;
-                       StringBuilder   sb;
-                       MethodBase      method;
-
-                       newline = String.Format("{0}\t {1} ", 
Environment.NewLine, Locale.GetText("at"));
-                       unknown = Locale.GetText("<unknown method>");
-                       sb = new StringBuilder();
-                       stack = new StackTrace(true);
-
-                       for (int i = 0; i < stack.FrameCount; i++) {
-                               frame = stack.GetFrame(i);
-                               sb.Append(newline);
-
-                               method = frame.GetMethod();
-                               if (method != null) {
-                                       #if not
-                                               
sb.AppendFormat(frame.ToString());
-                                       #endif
-                                       if (frame.GetFileLineNumber() != 0) {
-                                               sb.AppendFormat("{0}.{1} () 
[{2}:{3}]", method.DeclaringType.FullName, method.Name, 
Path.GetFileName(frame.GetFileName()), frame.GetFileLineNumber());
-                                       } else {
-                                               sb.AppendFormat("{0}.{1} ()", 
method.DeclaringType.FullName, method.Name);
-                                       }
-                               } else { 
-                                       sb.Append(unknown);
-                               }
-                       }
-                       return sb.ToString();
+                       string          newline;
+                       string          unknown;
+                       StringBuilder   sb;
+                       MethodBase      method;
+
+                       newline = String.Format("{0}\t {1} ", 
Environment.NewLine, Locale.GetText("at"));
+                       unknown = Locale.GetText("<unknown method>");
+                       sb = new StringBuilder();
+                       stack = new StackTrace(true);
+
+                       for (int i = 0; i < stack.FrameCount; i++) {
+                               frame = stack.GetFrame(i);
+                               sb.Append(newline);
+
+                               method = frame.GetMethod();
+                               if (method != null) {
+                                       #if not
+                                               
sb.AppendFormat(frame.ToString());
+                                       #endif
+                                       if (frame.GetFileLineNumber() != 0) {
+                                               sb.AppendFormat("{0}.{1} () 
[{2}:{3}]", method.DeclaringType.FullName, method.Name, 
Path.GetFileName(frame.GetFileName()), frame.GetFileLineNumber());
+                                       } else {
+                                               sb.AppendFormat("{0}.{1} ()", 
method.DeclaringType.FullName, method.Name);
+                                       }
+                               } else { 
+                                       sb.Append(unknown);
+                               }
+                       }
+                       return sb.ToString();
                }
                #endregion      // Internal Methods
 
@@ -593,6 +594,28 @@
                        }
                }
 
+               private void SetIcon(Hwnd hwnd, Icon icon) {
+                       Bitmap          bitmap;
+                       int             size;
+                       uint[]          data;
+                       int             index;
+
+                       bitmap = icon.ToBitmap();
+                       index = 0;
+                       size = bitmap.Width * bitmap.Height + 2;
+                       data = new uint[size];
+
+                       data[index++] = (uint)bitmap.Width;
+                       data[index++] = (uint)bitmap.Height;
+
+                       for (int y = 0; y < bitmap.Height; y++) {
+                               for (int x = 0; x < bitmap.Width; x++) {
+                                       data[index++] = 
(uint)bitmap.GetPixel(x, y).ToArgb();
+                               }
+                       }
+                       XChangeProperty(DisplayHandle, hwnd.whole_window, 
NetAtoms[(int)NA._NET_WM_ICON], Atom.XA_CARDINAL, 32, PropertyMode.Replace, 
data, size);
+               }
+
                private void WakeupMain () {
                        wake.BeginSend (new byte [] { 0xFF }, 0, 1, 
SocketFlags.None, null, null);
                }
@@ -1704,8 +1727,8 @@
 
                internal override void DestroyCursor(IntPtr cursor) {
                        lock (XlibLock) {
-                               XFreeCursor(DisplayHandle, cursor);
-                       }
+                               XFreeCursor(DisplayHandle, cursor);
+                       }
                }
 
                internal override void DestroyWindow(IntPtr handle) {
@@ -2591,6 +2614,15 @@
                        WakeupMain ();
                }
 
+               internal override void SetBorderStyle(IntPtr handle, 
BorderStyle border_style) {
+                       Hwnd    hwnd;
+
+                       hwnd = Hwnd.ObjectFromHandle(handle);
+                       hwnd.border_style = border_style;
+
+                       // FIXME - do we need to trigger some resize?
+               }
+
                internal override void SetCaretPos(IntPtr handle, int x, int y) 
{
                        if (Caret.Hwnd == handle) {
                                Caret.Timer.Stop();
@@ -2661,6 +2693,24 @@
                        //XSetInputFocus(DisplayHandle, 
Hwnd.ObjectFromHandle(handle).client_window, RevertTo.None, IntPtr.Zero);
                }
 
+               internal override void SetIcon(IntPtr handle, Icon icon) {
+                       Hwnd    hwnd;
+
+                       hwnd = Hwnd.ObjectFromHandle(handle);
+                       if (hwnd != null) {
+                               SetIcon(hwnd, icon);
+                       }
+               }
+
+               internal override void SetMenu(IntPtr handle, IntPtr 
menu_handle) {
+                       Hwnd    hwnd;
+
+                       hwnd = Hwnd.ObjectFromHandle(handle);
+                       hwnd.menu_handle = menu_handle;
+
+                       // FIXME - do we need to trigger some resize?
+               }
+
                internal override void SetModal(IntPtr handle, bool Modal) {
                        if (Modal) {
                                ModalWindows.Push(handle);
@@ -2760,24 +2810,6 @@
                        }
                }
 
-               internal override void SetBorderStyle(IntPtr handle, 
BorderStyle border_style) {
-                       Hwnd    hwnd;
-
-                       hwnd = Hwnd.ObjectFromHandle(handle);
-                       hwnd.border_style = border_style;
-
-                       // FIXME - do we need to trigger some resize?
-               }
-
-               internal override void SetMenu(IntPtr handle, IntPtr 
menu_handle) {
-                       Hwnd    hwnd;
-
-                       hwnd = Hwnd.ObjectFromHandle(handle);
-                       hwnd.menu_handle = menu_handle;
-
-                       // FIXME - do we need to trigger some resize?
-               }
-
                internal override void SetWindowPos(IntPtr handle, int x, int 
y, int width, int height) {
                        Hwnd            hwnd;
                        Rectangle       client_rect;
@@ -2910,70 +2942,70 @@
                }
 
                internal override bool SystrayAdd(IntPtr handle, string tip, 
Icon icon, out ToolTip tt) {
-                       GetSystrayManagerWindow();
-
-                       if (SystrayMgrWindow != IntPtr.Zero) {
-                               uint[]          atoms;
-                               XSizeHints      size_hints;
-                               Hwnd            hwnd;
-
+                       GetSystrayManagerWindow();
+
+                       if (SystrayMgrWindow != IntPtr.Zero) {
+                               uint[]          atoms;
+                               XSizeHints      size_hints;
+                               Hwnd            hwnd;
+
                                hwnd = Hwnd.ObjectFromHandle(handle);
-
-                               size_hints = new XSizeHints();
-
-                               size_hints.flags = 
(IntPtr)(XSizeHintsFlags.PMinSize | XSizeHintsFlags.PMaxSize | 
XSizeHintsFlags.PBaseSize);
-                               size_hints.min_width = icon.Width;
-                               size_hints.min_height = icon.Height;
-
-                               size_hints.max_width = icon.Width;
-                               size_hints.max_height = icon.Height;
-
-                               size_hints.base_width = icon.Width;
-                               size_hints.base_height = icon.Height;
-                               XSetWMNormalHints(DisplayHandle, 
hwnd.whole_window, ref size_hints);
-
+
+                               size_hints = new XSizeHints();
+
+                               size_hints.flags = 
(IntPtr)(XSizeHintsFlags.PMinSize | XSizeHintsFlags.PMaxSize | 
XSizeHintsFlags.PBaseSize);
+                               size_hints.min_width = icon.Width;
+                               size_hints.min_height = icon.Height;
+
+                               size_hints.max_width = icon.Width;
+                               size_hints.max_height = icon.Height;
+
+                               size_hints.base_width = icon.Width;
+                               size_hints.base_height = icon.Height;
+                               XSetWMNormalHints(DisplayHandle, 
hwnd.whole_window, ref size_hints);
+
                                atoms = new uint[2];
                                atoms[0] = 1;   // Version 1
                                atoms[1] = 1;   // We're not mapped
 
                                // This line cost me 3 days...
-                               XChangeProperty(DisplayHandle, 
hwnd.whole_window, NetAtoms[(int)NA._XEMBED_INFO], 
NetAtoms[(int)NA._XEMBED_INFO], 32, PropertyMode.Replace, atoms, 2);
-
-                               // Need to pick some reasonable defaults
-                               tt = new ToolTip();
-                               tt.AutomaticDelay = 100;
-                               tt.InitialDelay = 250;
-                               tt.ReshowDelay = 250;
-                               tt.ShowAlways = true;
-
-                               if ((tip != null) && (tip != string.Empty)) {
-                                       
tt.SetToolTip(Control.FromHandle(handle), tip);
-                                       tt.Active = true;
-                               } else {
-                                       tt.Active = false;
-                               }
-
-                               // Make sure the window exists
-                               XSync(DisplayHandle, hwnd.whole_window);
-
-                               SendNetClientMessage(SystrayMgrWindow, 
(IntPtr)NetAtoms[(int)NA._NET_SYSTEM_TRAY_OPCODE], IntPtr.Zero, 
(IntPtr)SystrayRequest.SYSTEM_TRAY_REQUEST_DOCK, hwnd.whole_window);
-                               return true;
-                       }
-                       tt = null;
-                       return false;
+                               XChangeProperty(DisplayHandle, 
hwnd.whole_window, NetAtoms[(int)NA._XEMBED_INFO], 
NetAtoms[(int)NA._XEMBED_INFO], 32, PropertyMode.Replace, atoms, 2);
+
+                               // Need to pick some reasonable defaults
+                               tt = new ToolTip();
+                               tt.AutomaticDelay = 100;
+                               tt.InitialDelay = 250;
+                               tt.ReshowDelay = 250;
+                               tt.ShowAlways = true;
+
+                               if ((tip != null) && (tip != string.Empty)) {
+                                       
tt.SetToolTip(Control.FromHandle(handle), tip);
+                                       tt.Active = true;
+                               } else {
+                                       tt.Active = false;
+                               }
+
+                               // Make sure the window exists
+                               XSync(DisplayHandle, hwnd.whole_window);
+
+                               SendNetClientMessage(SystrayMgrWindow, 
(IntPtr)NetAtoms[(int)NA._NET_SYSTEM_TRAY_OPCODE], IntPtr.Zero, 
(IntPtr)SystrayRequest.SYSTEM_TRAY_REQUEST_DOCK, hwnd.whole_window);
+                               return true;
+                       }
+                       tt = null;
+                       return false;
                }
 
                internal override bool SystrayChange(IntPtr handle, string tip, 
Icon icon, ref ToolTip tt) {
-                       Control control;
-
-                       control = Control.FromHandle(handle);
-                       if (control != null && tt != null) {
-                               tt.SetToolTip(control, tip);
-                               tt.Active = true;
-                               return true;
-                       } else {
-                               return false;
-                       }
+                       Control control;
+
+                       control = Control.FromHandle(handle);
+                       if (control != null && tt != null) {
+                               tt.SetToolTip(control, tip);
+                               tt.Active = true;
+                               return true;
+                       } else {
+                               return false;
+                       }
                }
 
                internal override void SystrayRemove(IntPtr handle, ref ToolTip 
tt) {
@@ -2981,14 +3013,14 @@
 
                        hwnd = Hwnd.ObjectFromHandle(handle);
 
-                       XUnmapWindow(DisplayHandle, hwnd.whole_window);
-                       SetParent(hwnd.whole_window, FosterParent);
-
-                       // The caller can now re-dock it later...
-                       if (tt != null) {
-                               tt.Dispose();
-                               tt = null;
-                       }
+                       XUnmapWindow(DisplayHandle, hwnd.whole_window);
+                       SetParent(hwnd.whole_window, FosterParent);
+
+                       // The caller can now re-dock it later...
+                       if (tt != null) {
+                               tt.Dispose();
+                               tt = null;
+                       }
                }
 
                internal override bool Text(IntPtr handle, string text) {
@@ -3182,6 +3214,9 @@
                [DllImport ("libX11", EntryPoint="XChangeProperty")]
                internal extern static int XChangeProperty(IntPtr display, 
IntPtr window, int property, int format, int type, PropertyMode  mode, IntPtr 
atoms, int nelements);
 
+               [DllImport ("libX11", EntryPoint="XChangeProperty")]
+               internal extern static int XChangeProperty(IntPtr display, 
IntPtr window, int property, Atom format, int type, PropertyMode  mode, IntPtr 
atoms, int nelements);
+
                [DllImport ("libX11", EntryPoint="XDeleteProperty")]
                internal extern static int XDeleteProperty(IntPtr display, 
IntPtr window, int property);
 

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources      
2005-03-11 08:42:39 UTC (rev 41680)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources      
2005-03-11 09:09:47 UTC (rev 41681)
@@ -179,6 +179,7 @@
 System.Windows.Forms/ListViewItem.cs
 System.Windows.Forms/ListViewItemConverter.cs
 System.Windows.Forms/MainMenu.cs
+System.Windows.Forms/MdiClient.cs
 System.Windows.Forms/MdiLayout.cs
 System.Windows.Forms/MeasureItemEventHandler.cs
 System.Windows.Forms/MeasureItemEventArgs.cs

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

Reply via email to