Selaa lähdekoodia

- Implemented SystemInformation class
- Fixed menu visibility on Win32
- Preventing Popup menus from popping up partially offscreen

svn path=/trunk/mcs/; revision=39769

Peter Dennis Bartok 21 vuotta sitten
vanhempi
sitoutus
c69e15d7c6

+ 6 - 0
mcs/class/Managed.Windows.Forms/ChangeLog

@@ -1,3 +1,9 @@
+2005-01-29  Peter Bartok  <[email protected]>
+
+	* System.Windows.Forms.dll.Sources: Added ArrangeDirection.cs and
+	  ArrangeStartingPosition.cs
+	* SWF.csproj: Updated
+
 2005-01-28  Peter Bartok  <[email protected]>
 
 	* SWF.csproj: Updated with all the latest files

+ 11 - 1
mcs/class/Managed.Windows.Forms/SWF.csproj

@@ -188,13 +188,23 @@
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "System.Windows.Forms\Application.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
                 <File
                     RelPath = "System.Windows.Forms\ApplicationContext.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
                 <File
-                    RelPath = "System.Windows.Forms\Application.cs"
+                    RelPath = "System.Windows.Forms\ArrangeDirection.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "System.Windows.Forms\ArrangeStartingPosition.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />

+ 3 - 1
mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources

@@ -19,8 +19,10 @@ System.Windows.Forms/AccessibleStates.cs
 System.Windows.Forms/AmbientProperties.cs
 System.Windows.Forms/AnchorStyles.cs
 System.Windows.Forms/Appearance.cs
-System.Windows.Forms/ApplicationContext.cs
 System.Windows.Forms/Application.cs
+System.Windows.Forms/ApplicationContext.cs
+System.Windows.Forms/ArrangeDirection.cs
+System.Windows.Forms/ArrangeStartingPosition.cs
 System.Windows.Forms/AsyncMethodData.cs
 System.Windows.Forms/AsyncMethodResult.cs
 System.Windows.Forms/BaseCollection.cs

+ 36 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ArrangeDirection.cs

@@ -0,0 +1,36 @@
+// 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]
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+	public enum ArrangeDirection {
+		Left		= 0,
+		Right		= 0,
+		Down		= 4,
+		Up		= 4
+	}
+}

+ 37 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ArrangeStartingPosition.cs

@@ -0,0 +1,37 @@
+// 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]
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+	public enum ArrangeStartingPosition {
+		BottomLeft	= 0,
+		BottomRight	= 1,
+		TopLeft		= 2,
+		TopRight	= 3,
+		Hide		= 8
+	}
+}

+ 14 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog

@@ -1,3 +1,17 @@
+2005-01-29  Peter Bartok  <[email protected]>
+
+	* ArrangeDirection.cs: Added
+	* ArrangeStartingPositon.cs: Added
+	* SystemInformation.cs: Implemented
+	* XplatUI.cs, XplatUIDriver.cs, XplatUIOSX.cs, XplatUIWin32.cs,
+	  XplatUIX11.cs, Theme.cs: Added/implemented new static properties 
+	  used by SystemInformation class
+	* X11Strucs.cs: Added XSizeHints structure
+	* MenuAPI.cs:
+	  - Fixed CreateParams to make sure the menu window is always visible
+	  - TrackPopupMenu: Added check to make sure we don't draw the
+	    menu offscreen
+
 2005-01-29  Peter Bartok  <[email protected]>
 
 	* HandleData.cs: Added method for altering invalid area

+ 17 - 4
mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs

@@ -257,8 +257,19 @@ namespace System.Windows.Forms
 
 			MENUITEM select_item = GetNextItem (hMenu, ItemNavigation.First);
 
-			if (select_item != null)
+			if (select_item != null) {
 				MenuAPI.SelectItem (hMenu, select_item, false, tracker);
+			}
+
+			// Make sure the menu is always visible and does not 'leave' the screen
+			// What is menu.Width/Height? It seemed to be 0/0
+			if ((pnt.X + menu.Wnd.Width) > SystemInformation.WorkingArea.Width) {
+				pnt.X -= menu.Wnd.Width;
+			}
+
+			if ((pnt.X + menu.Wnd.Height) > SystemInformation.WorkingArea.Height) {
+				pnt.Y -= menu.Wnd.Height;
+			}
 
 			menu.Wnd.Location =  menu.Wnd.PointToClient (pnt);			
 			
@@ -1079,22 +1090,24 @@ namespace System.Windows.Forms
 			Paint += new PaintEventHandler (OnPaintPUW);
 			SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
 			SetStyle (ControlStyles.ResizeRedraw | ControlStyles.Opaque, true);
+			is_visible = false;
 		}
 
 		protected override CreateParams CreateParams
 		{
 			get {
 				CreateParams cp = base.CreateParams;
-				cp.Style = unchecked ((int)(WindowStyles.WS_POPUP | WindowStyles.WS_VISIBLE | WindowStyles.WS_CLIPSIBLINGS | WindowStyles.WS_CLIPCHILDREN));
-				cp.ExStyle |= (int)WindowStyles.WS_EX_TOOLWINDOW;
+				cp.Caption = "Menu PopUp";
+				cp.Style = unchecked ((int)(WindowStyles.WS_POPUP));
+				cp.ExStyle |= (int)(WindowStyles.WS_EX_TOOLWINDOW | WindowStyles.WS_EX_TOPMOST);
 				return cp;
 			}
 		}
 
 		public void ShowWindow ()
 		{
-			Capture = true;
 			Show ();
+			Capture = true;
 			Refresh ();
 		}
 		

+ 377 - 5
mcs/class/Managed.Windows.Forms/System.Windows.Forms/SystemInformation.cs

@@ -21,23 +21,395 @@
 //
 // Authors:
 //	Miguel de Icaza ([email protected]).
+//	Peter Bartok	([email protected])
 //
-//
+
+// NOT COMPLETE
+
+using System;
+using System.Drawing;
 
 namespace System.Windows.Forms {
-	
 	public class SystemInformation {
-	
-		public static int KeyboardSpeed {
+		#region Constructor
+		internal SystemInformation() {
+		}
+		#endregion
+
+		#region Public Static Properties
+		public static ArrangeDirection ArrangeDirection {
+			get {
+				return ThemeEngine.Current.ArrangeDirection;
+			}
+		}
+
+		public static ArrangeStartingPosition ArrangeStartingPosition {
+			get {
+				return ThemeEngine.Current.ArrangeStartingPosition;
+			}
+		}
+
+		public static BootMode BootMode {
+			get {
+				return BootMode.Normal;
+			}
+		}
+
+		public static Size Border3DSize {
+			get {
+				return ThemeEngine.Current.Border3DSize;
+			}
+		}
+
+		public static Size BorderSize {
+			get {
+				return ThemeEngine.Current.Border3DSize;
+			}
+		}
+
+		public static Size CaptionButtonSize {
+			get {
+				return ThemeEngine.Current.CaptionButtonSize;
+			}
+		}
+
+		public static int CaptionHeight {
+			get {
+				return ThemeEngine.Current.CaptionHeight;
+			}
+		}
+
+		public static string ComputerName {
+			get {
+				return Environment.MachineName;
+			}
+		}
+
+		public static Size CursorSize {
+			get {
+				return XplatUI.CursorSize;
+			}
+		}
+
+		public static bool DbcsEnabled {
+			get {
+				return false;
+			}
+		}
+
+		public static bool DebugOS {
+			get {
+				return false;
+			}
+		}
+
+		public static Size DoubleClickSize {
+			get {
+				return ThemeEngine.Current.DoubleClickSize;
+			}
+		}
+
+		public static int DoubleClickTime {
+			get {
+				return ThemeEngine.Current.DoubleClickTime;
+			}
+		}
+
+		public static bool DragFullWindows {
+			get {
+				return XplatUI.DragFullWindows;
+			}
+		}
+
+		public static Size DragSize {
+			get {
+				return XplatUI.DragSize;
+			}
+		}
+
+		public static Size FixedFrameBorderSize {
+			get {
+				return ThemeEngine.Current.FixedFrameBorderSize;
+			}
+		}
+
+		public static Size FrameBorderSize {
+			get {
+				return ThemeEngine.Current.FrameBorderSize;
+			}
+		}
+
+		public static bool HighContrast {
+			get {
+				return false;
+			}
+		}
+
+		public static int HorizontalScrollBarArrowWidth {
+			get {
+				return ThemeEngine.Current.HorizontalScrollBarArrowWidth;
+			}
+		}
+
+		public static int HorizontalScrollBarHeight {
+			get {
+				return ThemeEngine.Current.HorizontalScrollBarHeight;
+			}
+		}
+
+		public static int HorizontalScrollBarThumbWidth {
+			get {
+				return ThemeEngine.Current.HorizontalScrollBarThumbWidth;
+			}
+		}
+
+		public static Size IconSize {
+			get {
+				return XplatUI.IconSize;
+			}
+		}
+
+		public static Size IconSpacingSize {
+			get {
+				return ThemeEngine.Current.IconSpacingSize;
+			}
+		}
+
+		public static int KanjiWindowHeight {
+			get {
+				return 0;
+			}
+		}
+
+		public static Size MaxWindowTrackSize {
+			get {
+				return XplatUI.MaxWindowTrackSize;
+			}
+		}
+
+		public static Size MenuButtonSize {
+			get {
+				return ThemeEngine.Current.MenuButtonSize;
+			}
+		}
+
+		public static Size MenuCheckSize {
+			get {
+				return ThemeEngine.Current.MenuCheckSize;
+			}
+		}
+
+		public static Font MenuFont {
+			get {
+				return ThemeEngine.Current.MenuFont;
+			}
+		}
+
+		public static int MenuHeight {
+			get {
+				return ThemeEngine.Current.MenuHeight;
+			}
+		}
+
+		public static bool MidEastEnabled {
+			get {
+				return false; // ??? how do we decide?
+			}
+		}
+
+		public static Size MinimizedWindowSize {
+			get {
+				return XplatUI.MinimizedWindowSize;
+			}
+		}
+
+		public static Size MinimizedWindowSpacingSize {
+			get {
+				return XplatUI.MinimizedWindowSpacingSize;
+			}
+		}
+
+		public static Size MinimumWindowSize {
+			get {
+				return XplatUI.MinimumWindowSize;
+			}
+		}
+
+		public static Size MinWindowTrackSize {
+			get {
+				return XplatUI.MinWindowTrackSize;
+			}
+		}
+
+		public static int MonitorCount {
+			get {
+				return 1;		// Why bother...
+			}
+		}
+
+		public static bool MonitorsSameDisplayFormat {
+			get {
+				return true;
+			}
+		}
+
+		public static int MouseButtons {
+			get {
+				return XplatUI.MouseButtonCount;
+			}
+		}
+
+		public static bool MouseButtonsSwapped {
+			get {
+				return XplatUI.MouseButtonsSwapped;
+			}
+		}
+
+		public static bool MousePresent {
+			get {
+				return true;
+			}
+		}
+
+		public static bool MouseWheelPresent {
+			get {
+				return XplatUI.MouseWheelPresent;
+			}
+		}
+
+		public static int MouseWheelScrollLines {
+			get {
+				return ThemeEngine.Current.MouseWheelScrollLines;
+			}
+		}
+
+		public static bool NativeMouseWheelSupport {
+			get {
+				return MouseWheelPresent;
+			}
+		}
+
+		public static bool Network {
+			get {
+				return true;
+			}
+		}
+
+		public static bool PenWindows {
+			get {
+				return false;
+			}
+		}
+
+		public static Size PrimaryMonitorMaximizedWindowSize {
+			get {
+				return new Size(WorkingArea.Width, WorkingArea.Height);
+			}
+		}
+
+		public static Size PrimaryMonitorSize {
+			get {
+				return new Size(WorkingArea.Width, WorkingArea.Height);
+			}
+		}
+
+		public static bool RightAlignedMenus {
+			get {
+				return ThemeEngine.Current.RightAlignedMenus;
+			}
+		}
+
+		public static bool Secure {
+			get {
+				return true;		// FIXME - figure out if we're running 98/Me and return false
+			}
+		}
+
+		public static bool ShowSounds {
+			get {
+				return false;
+			}
+		}
+
+		public static Size SmallIconSize {
+			get {
+				return XplatUI.SmallIconSize;
+			}
+		}
+
+		public static Size ToolWindowCaptionButtonSize {
+			get {
+				return ThemeEngine.Current.ToolWindowCaptionButtonSize;
+			}
+		}
+
+		public static Size ToolWindowCaptionHeight {
+			get {
+				return ThemeEngine.Current.ToolWindowCaptionHeight;
+			}
+		}
+
+		public static string UserDomainName {
+			get {
+				return Environment.UserDomainName;
+			}
+		}
+
+		public static bool UserInteractive {
+			get {
+				return Environment.UserInteractive;
+			}
+		}
+
+		public static string UserName {
+			get {
+				return Environment.UserName;
+			}
+		}
+
+		public static int VerticalScrollBarArrowHeight {
+			get {
+				return ThemeEngine.Current.VerticalScrollBarArrowHeight;
+			}
+		}
+
+		public static int VerticalScrollBarThumbHeight {
+			get {
+				return ThemeEngine.Current.VerticalScrollBarThumbHeight;
+			}
+		}
+
+		public static int VerticalScrollBarWidth {
+			get {
+				return ThemeEngine.Current.VerticalScrollBarWidth;
+			}
+		}
+
+		public static Rectangle VirtualScreen {
+			get {
+				return XplatUI.VirtualScreen;
+			}
+		}
+
+		public static Rectangle WorkingArea {
+			get {
+				return XplatUI.WorkingArea;
+			}
+		}
+		#endregion	// Public Static Properties
+
+		#region Internal Static Properties
+		internal static int KeyboardSpeed {
 			get {
 				return XplatUI.KeyboardSpeed;
 			}
 		}
 	
-		public static int KeyboardDelay {
+		internal static int KeyboardDelay {
 			get {
 				return XplatUI.KeyboardDelay;
 			}
 		}
+		#endregion	// Internal Static Properties
 	}
 }

+ 150 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Theme.cs

@@ -226,6 +226,156 @@ namespace System.Windows.Forms
 			syscolors.SetValue (color, (int) idx);
 		}
 
+		// Theme/UI specific defaults
+		public virtual ArrangeDirection ArrangeDirection  {
+			get {
+				return ArrangeDirection.Down;
+			}
+		}
+
+		public virtual ArrangeStartingPosition ArrangeStartingPosition {
+			get {
+				return ArrangeStartingPosition.BottomLeft;
+			}
+		}
+
+		public virtual Size Border3DSize {
+			get {
+				return new Size(2, 2);
+			}
+		}
+
+		public virtual Size BorderSize {
+			get {
+				return new Size(1, 1);
+			}
+		}
+
+		public virtual Size CaptionButtonSize {
+			get {
+				return new Size(18, 18);
+			}
+		}
+
+		public virtual int CaptionHeight {
+			get {
+				return 19;
+			}
+		}
+
+		public virtual Size DoubleClickSize {
+			get {
+				return new Size(4, 4);
+			}
+		}
+
+		public virtual int DoubleClickTime {
+			get {
+				return 500;
+			}
+		}
+
+		public virtual Size FixedFrameBorderSize {
+			get {
+				return new Size(3, 3);
+			}
+		}
+
+		public virtual Size FrameBorderSize {
+			get {
+				return new Size(4, 4);
+			}
+		}
+
+		public virtual int HorizontalScrollBarArrowWidth {
+			get {
+				return 12;
+			}
+		}
+
+		public virtual int HorizontalScrollBarHeight {
+			get {
+				return 12;
+			}
+		}
+
+		public virtual int HorizontalScrollBarThumbWidth {
+			get {
+				return 12;
+			}
+		}
+
+		public virtual Size IconSpacingSize {
+			get {
+				return new Size(75, 75);
+			}
+		}
+
+		public virtual Size MenuButtonSize {
+			get {
+				return new Size(18, 18);
+			}
+		}
+
+		public virtual Size MenuCheckSize {
+			get {
+				return new Size(13, 13);
+			}
+		}
+
+		public virtual Font MenuFont {
+			get {
+				return default_font;
+			}
+		}
+
+		public virtual int MenuHeight {
+			get {
+				return 19;
+			}
+		}
+
+		public virtual int MouseWheelScrollLines {
+			get {
+				return 3;
+			}
+		}
+
+		public virtual bool RightAlignedMenus {
+			get {
+				return false;
+			}
+		}
+
+		public virtual Size ToolWindowCaptionButtonSize {
+			get {
+				return new Size(15, 15);
+			}
+		}
+
+		public virtual Size ToolWindowCaptionHeight {
+			get {
+				return new Size(16, 16);
+			}
+		}
+
+		public virtual int VerticalScrollBarArrowHeight {
+			get {
+				return 12;
+			}
+		}
+
+		public virtual int VerticalScrollBarThumbHeight {
+			get {
+				return 12;
+			}
+		}
+
+		public virtual int VerticalScrollBarWidth {
+			get {
+				return 12;
+			}
+		}
 		#region Principal Theme Methods
 		// To let the theme now that a change of defaults (colors, etc) was detected and force a re-read (and possible recreation of cached resources)
 		public abstract void ResetDefaults();

+ 10 - 1
mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11Structs.cs

@@ -1317,6 +1317,15 @@ namespace System.Windows.Forms {
 		internal IntPtr			icon_mask;
 		internal IntPtr			window_group;
 	}
-	
+
+	[StructLayout(LayoutKind.Sequential)]
+	internal struct XIconSize {
+		internal int			min_width;
+		internal int			min_height;
+		internal int			max_width;
+		internal int			max_height;
+		internal int			width_inc;
+		internal int			height_inc;
+	}
 }
 

+ 92 - 1
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs

@@ -35,7 +35,7 @@ using System.Runtime.InteropServices;
 
 /// X11 Version
 namespace System.Windows.Forms {
-	public class XplatUI {
+	internal class XplatUI {
 		#region Local Variables
 		static XplatUIDriver		driver;
 		static String			default_class_name;
@@ -71,6 +71,7 @@ namespace System.Windows.Forms {
 					driver.DropTarget=value;
 				}
 			}
+
 		}
 		#endregion	// Subclasses
 
@@ -106,6 +107,96 @@ namespace System.Windows.Forms {
 				default_class_name=value;
 			}
 		}
+
+		static public Size CursorSize {
+			get {
+				return driver.CursorSize;
+			}
+		}
+
+		static public bool DragFullWindows {
+			get {
+				return driver.DragFullWindows;
+			}
+		}
+
+		static public Size DragSize {
+			get {
+				return driver.DragSize;
+			}
+		}
+
+		static public Size IconSize {
+			get {
+				return driver.IconSize;
+			}
+		}
+
+		static public Size MaxWindowTrackSize {
+			get {
+				return driver.MaxWindowTrackSize;
+			}
+		}
+
+		static public Size MinimizedWindowSize {
+			get {
+				return driver.MinimizedWindowSize;
+			}
+		}
+
+		static public Size MinimizedWindowSpacingSize {
+			get {
+				return driver.MinimizedWindowSpacingSize;
+			}
+		}
+
+		static public Size MinimumWindowSize {
+			get {
+				return driver.MinimumWindowSize;
+			}
+		}
+
+		static public Size MinWindowTrackSize {
+			get {
+				return driver.MinWindowTrackSize;
+			}
+		}
+
+		static public Size SmallIconSize {
+			get {
+				return driver.SmallIconSize;
+			}
+		}
+
+		static public int MouseButtonCount {
+			get {
+				return driver.MouseButtonCount;
+			}
+		}
+
+		static public bool MouseButtonsSwapped {
+			get {
+				return driver.MouseButtonsSwapped;
+			}
+		}
+
+		static public bool MouseWheelPresent {
+			get {
+				return driver.MouseWheelPresent;
+			}
+		}
+
+		static public Rectangle VirtualScreen {
+			get {
+				return driver.VirtualScreen;
+			}
+		}
+
+		static public Rectangle WorkingArea {
+			get {
+				return driver.WorkingArea;
+			}
+		}
 		#endregion	// Public Static Properties
 
                 internal static event EventHandler Idle {

+ 16 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs

@@ -80,6 +80,22 @@ namespace System.Windows.Forms {
 			set {
 			}
 		}
+
+		internal abstract Size CursorSize { get; }
+		internal abstract bool DragFullWindows { get; }
+		internal abstract Size DragSize { get; }
+		internal abstract Size IconSize { get; }
+		internal abstract Size MaxWindowTrackSize { get; }
+		internal abstract Size MinimizedWindowSize { get; }
+		internal abstract Size MinimizedWindowSpacingSize { get; }
+		internal abstract Size MinimumWindowSize { get; }
+		internal abstract Size MinWindowTrackSize { get; }
+		internal abstract Size SmallIconSize { get; }
+		internal abstract int MouseButtonCount { get; }
+		internal abstract bool MouseButtonsSwapped { get; }
+		internal abstract bool MouseWheelPresent { get; }
+		internal abstract Rectangle VirtualScreen { get; }
+		internal abstract Rectangle WorkingArea { get; }
 		#endregion	// XplatUI Driver Properties
 
                 internal abstract event EventHandler Idle;

+ 105 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIOSX.cs

@@ -111,6 +111,111 @@ namespace System.Windows.Forms {
 			}
 		}
 
+		[MonoTODO]
+		internal override Size CursorSize {
+			get {
+				throw new NotImplementedException ();
+			}
+		}
+
+		[MonoTODO]
+		internal override bool DragFullWindows {
+			get {
+				throw new NotImplementedException ();
+			}
+		}
+
+		[MonoTODO]
+		internal override Size DragSize {
+			get {
+				throw new NotImplementedException ();
+			}
+		}
+
+		[MonoTODO]
+		internal override Size IconSize {
+			get {
+				throw new NotImplementedException ();
+			}
+		}
+
+		[MonoTODO]
+		internal override Size MaxWindowTrackSize {
+			get {
+				throw new NotImplementedException ();
+			}
+		}
+
+		[MonoTODO]
+		internal override Size MinimizedWindowSize {
+			get {
+				throw new NotImplementedException ();
+			}
+		}
+
+		[MonoTODO]
+		internal override Size MinimizedWindowSpacingSize {
+			get {
+				throw new NotImplementedException ();
+			}
+		}
+
+		[MonoTODO]
+		internal override Size MinimumWindowSize {
+			get {
+				throw new NotImplementedException ();
+			}
+		}
+
+		[MonoTODO]
+		internal override Size MinWindowTrackSize {
+			get {
+				throw new NotImplementedException ();
+			}
+		}
+
+		[MonoTODO]
+		internal override Size SmallIconSize {
+			get {
+				throw new NotImplementedException ();
+			}
+		}
+
+		[MonoTODO]
+		internal override int MouseButtonCount {
+			get {
+				throw new NotImplementedException ();
+			}
+		}
+
+		[MonoTODO]
+		internal override bool MouseButtonsSwapped {
+			get {
+				throw new NotImplementedException ();
+			}
+		}
+
+		[MonoTODO]
+		internal override bool MouseWheelPresent {
+			get {
+				throw new NotImplementedException ();
+			}
+		}
+
+		[MonoTODO]
+		internal override Rectangle VirtualScreen {
+			get {
+				throw new NotImplementedException ();
+			}
+		}
+
+		[MonoTODO]
+		internal override Rectangle WorkingArea {
+			get {
+				throw new NotImplementedException ();
+			}
+		}
+
 		private XplatUIOSX() {
 			viewEventHandler = new CarbonEventHandler (ViewHandler);
 			windowEventHandler = new CarbonEventHandler (WindowHandler);

+ 92 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs

@@ -563,6 +563,97 @@ namespace System.Windows.Forms {
 				}
 			}
 		}
+
+		internal override Size CursorSize {
+			get {
+				return new Size(Win32GetSystemMetrics(SystemMetrics.SM_CXCURSOR), Win32GetSystemMetrics(SystemMetrics.SM_CYCURSOR));
+			}
+		}
+
+		internal override bool DragFullWindows {
+			get {
+				return true;
+			}
+		}
+
+		internal override Size DragSize {
+			get {
+				return new Size(Win32GetSystemMetrics(SystemMetrics.SM_CXDRAG), Win32GetSystemMetrics(SystemMetrics.SM_CYDRAG));
+			}
+		}
+
+		internal override Size IconSize {
+			get {
+				return new Size(Win32GetSystemMetrics(SystemMetrics.SM_CXICON), Win32GetSystemMetrics(SystemMetrics.SM_CYICON));
+			}
+		}
+
+		internal override Size MaxWindowTrackSize {
+			get {
+				return new Size(Win32GetSystemMetrics(SystemMetrics.SM_CXMAXTRACK), Win32GetSystemMetrics(SystemMetrics.SM_CYMAXTRACK));
+			}
+		}
+
+		internal override Size MinimizedWindowSize {
+			get {
+				return new Size(Win32GetSystemMetrics(SystemMetrics.SM_CXMINIMIZED), Win32GetSystemMetrics(SystemMetrics.SM_CYMINIMIZED));
+			}
+		}
+
+		internal override Size MinimizedWindowSpacingSize {
+			get {
+				return new Size(Win32GetSystemMetrics(SystemMetrics.SM_CXMINSPACING), Win32GetSystemMetrics(SystemMetrics.SM_CYMINSPACING));
+			}
+		}
+
+		internal override Size MinimumWindowSize {
+			get {
+				return new Size(Win32GetSystemMetrics(SystemMetrics.SM_CXMIN), Win32GetSystemMetrics(SystemMetrics.SM_CYMIN));
+			}
+		}
+
+		internal override Size MinWindowTrackSize {
+			get {
+				return new Size(Win32GetSystemMetrics(SystemMetrics.SM_CXMINTRACK), Win32GetSystemMetrics(SystemMetrics.SM_CYMINTRACK));
+			}
+		}
+
+		internal override Size SmallIconSize {
+			get {
+				return new Size(Win32GetSystemMetrics(SystemMetrics.SM_CXSMICON), Win32GetSystemMetrics(SystemMetrics.SM_CYSMICON));
+			}
+		}
+
+		internal override int MouseButtonCount {
+			get {
+				return Win32GetSystemMetrics(SystemMetrics.SM_CMOUSEBUTTONS);
+			}
+		}
+
+		internal override bool MouseButtonsSwapped {
+			get {
+				return Win32GetSystemMetrics(SystemMetrics.SM_SWAPBUTTON) != 0;
+			}
+		}
+
+		internal override bool MouseWheelPresent {
+			get {
+				return Win32GetSystemMetrics(SystemMetrics.SM_MOUSEWHEELPRESENT) != 0;
+			}
+		}
+
+		internal override Rectangle VirtualScreen {
+			get {
+				return new Rectangle(	Win32GetSystemMetrics(SystemMetrics.SM_XVIRTUALSCREEN), Win32GetSystemMetrics(SystemMetrics.SM_YVIRTUALSCREEN),
+							Win32GetSystemMetrics(SystemMetrics.SM_CXVIRTUALSCREEN), Win32GetSystemMetrics(SystemMetrics.SM_CYVIRTUALSCREEN));
+			}
+		}
+
+		internal override Rectangle WorkingArea {
+			get {
+				return new Rectangle(0, 0, Win32GetSystemMetrics(SystemMetrics.SM_CXSCREEN), Win32GetSystemMetrics(SystemMetrics.SM_CYSCREEN));
+			}
+		}
 		#endregion	// Static Properties
 
 		#region Singleton Specific Code
@@ -983,6 +1074,7 @@ namespace System.Windows.Forms {
 		}
 
 		internal override bool SetVisible(IntPtr handle, bool visible) {
+Console.WriteLine("Win32 Driver called, setting {0} visible: {1}", Control.FromHandle(handle).Text, visible);
 			if (visible) {
 				Win32ShowWindow(handle, WindowPlacementFlags.SW_SHOWNORMAL);
 			} else {

+ 231 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs

@@ -209,6 +209,234 @@ namespace System.Windows.Forms {
 				return 1; // ie, 500 ms
 			}
 		}
+
+		internal override Size CursorSize {
+			get {
+				int	x;
+				int	y;
+
+				if (XQueryBestCursor(DisplayHandle, root_window, 32, 32, out x, out y) != 0) {
+					return new Size(x, y);
+				} else {
+					return new Size(16, 16);
+				}
+			}
+		}
+
+		internal override bool DragFullWindows {
+			get {
+				return true;
+			}
+		}
+
+		internal override Size DragSize {
+			get {
+				return new Size(4, 4);
+			}
+		}
+
+		internal override Size IconSize {
+			get {
+				IntPtr		list;
+				XIconSize	size;
+				int		count;
+
+				if (XGetIconSizes(DisplayHandle, root_window, out list, out count) != 0) {
+					long		current;
+					int		largest;
+
+					current = (long)list;
+					largest = 0;
+
+					size = new XIconSize();
+
+					for (int i = 0; i < count; i++) {
+						size = (XIconSize)Marshal.PtrToStructure((IntPtr)current, size.GetType());
+						current += Marshal.SizeOf(size);
+
+						// Look for our preferred size
+						if (size.min_width == 32) {
+							XFree(list);
+							return new Size(32, 32);
+						}
+
+						if (size.max_width == 32) {
+							XFree(list);
+							return new Size(32, 32);
+						}
+
+						if (size.min_width < 32 && size.max_width > 32) {
+							int	x;
+
+							// check if we can fit one
+							x = size.min_width;
+							while (x < size.max_width) {
+								x += size.width_inc;
+								if (x == 32) {
+									XFree(list);
+									return new Size(32, 32);
+								}
+							}
+						}
+
+						if (largest < size.max_width) {
+							largest = size.max_width;
+						}
+					}
+
+					// We didn't find a match or we wouldn't be here
+					return new Size(largest, largest);
+
+				} else {
+					return new Size(32, 32);
+				}
+			}
+		}
+
+		internal override Size MaxWindowTrackSize {
+			get {
+				return new Size (WorkingArea.Width, WorkingArea.Height);
+			}
+		}
+
+		[MonoTODO]
+		internal override Size MinimizedWindowSize {
+			get {
+				return new Size(1, 1);
+			}
+		}
+
+		[MonoTODO]
+		internal override Size MinimizedWindowSpacingSize {
+			get {
+				return new Size(1, 1);
+			}
+		}
+
+		[MonoTODO]
+		internal override Size MinimumWindowSize {
+			get {
+				return new Size(1, 1);
+			}
+		}
+
+		[MonoTODO]
+		internal override Size MinWindowTrackSize {
+			get {
+				return new Size(1, 1);
+			}
+		}
+
+		internal override Size SmallIconSize {
+			get {
+				IntPtr		list;
+				XIconSize	size;
+				int		count;
+
+				if (XGetIconSizes(DisplayHandle, root_window, out list, out count) != 0) {
+					long		current;
+					int		smallest;
+
+					current = (long)list;
+					smallest = 0;
+
+					size = new XIconSize();
+
+					for (int i = 0; i < count; i++) {
+						size = (XIconSize)Marshal.PtrToStructure((IntPtr)current, size.GetType());
+						current += Marshal.SizeOf(size);
+
+						// Look for our preferred size
+						if (size.min_width == 16) {
+							XFree(list);
+							return new Size(16, 16);
+						}
+
+						if (size.max_width == 16) {
+							XFree(list);
+							return new Size(16, 16);
+						}
+
+						if (size.min_width < 16 && size.max_width > 16) {
+							int	x;
+
+							// check if we can fit one
+							x = size.min_width;
+							while (x < size.max_width) {
+								x += size.width_inc;
+								if (x == 16) {
+									XFree(list);
+									return new Size(16, 16);
+								}
+							}
+						}
+
+						if (smallest == 0 || smallest > size.min_width) {
+							smallest = size.min_width;
+						}
+					}
+
+					// We didn't find a match or we wouldn't be here
+					return new Size(smallest, smallest);
+
+				} else {
+					return new Size(16, 16);
+				}
+			}
+		}
+
+		internal override int MouseButtonCount {
+			get {
+				return 3;
+			}
+		}
+
+		internal override bool MouseButtonsSwapped {
+			get {
+				return false;	// FIXME - how to detect?
+			}
+		}
+
+		internal override bool MouseWheelPresent {
+			get {
+				return true;	// FIXME - how to detect?
+			}
+		}
+
+		internal override Rectangle VirtualScreen {
+			get {
+				return WorkingArea;
+			}
+		}
+
+		internal override Rectangle WorkingArea {
+			get {
+				Atom			actual_atom;
+				int			actual_format;
+				int			nitems;
+				int			bytes_after;
+				IntPtr			prop = IntPtr.Zero;
+				int			width;
+				int			height;
+
+				XGetWindowProperty(DisplayHandle, root_window, XInternAtom(DisplayHandle, "_NET_DESKTOP_GEOMETRY", false), 0, 256, false, Atom.XA_CARDINAL, out actual_atom, out actual_format, out nitems, out bytes_after, ref prop);
+				if ((nitems == 2) && (prop != IntPtr.Zero)) {
+					width = Marshal.ReadInt32(prop, 0);
+					height = Marshal.ReadInt32(prop, 4);
+
+					XFree(prop);
+					return new Rectangle(0, 0, width, height);
+				} else {
+					int	x;
+					int	y;
+					int	client_width;
+					int	client_height;
+
+					GetWindowPos(root_window, true, out x, out y, out width, out height, out client_width, out client_height);
+					return new Rectangle(x, y, width, height);
+				}
+			}
+		}
 		#endregion	// Properties
 
 		#region Constructor & Destructor
@@ -2494,6 +2722,9 @@ namespace System.Windows.Forms {
 
 		[DllImport ("libX11", EntryPoint="XSync")]
 		internal extern static void XSync(IntPtr display, IntPtr window);
+
+		[DllImport ("libX11", EntryPoint="XGetIconSizes")]
+		internal extern static int XGetIconSizes(IntPtr display, IntPtr window, out IntPtr size_list, out int count);
 		#endregion
 	}
 }