- Implemented SystemInformation class
authorPeter Dennis Bartok <pbartok@mono-cvs.ximian.com>
Sun, 30 Jan 2005 01:06:00 +0000 (01:06 -0000)
committerPeter Dennis Bartok <pbartok@mono-cvs.ximian.com>
Sun, 30 Jan 2005 01:06:00 +0000 (01:06 -0000)
- Fixed menu visibility on Win32
- Preventing Popup menus from popping up partially offscreen

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

15 files changed:
mcs/class/Managed.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/SWF.csproj
mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ArrangeDirection.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ArrangeStartingPosition.cs [new file with mode: 0644]
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/SystemInformation.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Theme.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/X11Structs.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIOSX.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIX11.cs

index 67ba0f16199926f0974058125c5bc77c04e5c7cd..9514f7a46c2a985b14bd363069a79223edfbaf5d 100644 (file)
@@ -1,3 +1,9 @@
+2005-01-29  Peter Bartok  <pbartok@novell.com>
+
+       * System.Windows.Forms.dll.Sources: Added ArrangeDirection.cs and
+         ArrangeStartingPosition.cs
+       * SWF.csproj: Updated
+
 2005-01-28  Peter Bartok  <pbartok@novell.com>
 
        * SWF.csproj: Updated with all the latest files
index f06ab3934e325bf62bb2b628d7d8fceedd0cd3a0..acbfaae3b66f32018e3bdc2821f8f7bb3ce7b028 100644 (file)
                     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"
                 />
index 33e1be7ce9ce468ef9345ae53bf537cd0e075c1e..2c0d0eff0e1a2e3dcef241f30000f2b26b31c9c2 100644 (file)
@@ -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
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ArrangeDirection.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ArrangeDirection.cs
new file mode 100644 (file)
index 0000000..59123e5
--- /dev/null
@@ -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    pbartok@novell.com
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+       public enum ArrangeDirection {
+               Left            = 0,
+               Right           = 0,
+               Down            = 4,
+               Up              = 4
+       }
+}
diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ArrangeStartingPosition.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ArrangeStartingPosition.cs
new file mode 100644 (file)
index 0000000..59584b8
--- /dev/null
@@ -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    pbartok@novell.com
+//
+//
+
+// COMPLETE
+
+namespace System.Windows.Forms {
+       public enum ArrangeStartingPosition {
+               BottomLeft      = 0,
+               BottomRight     = 1,
+               TopLeft         = 2,
+               TopRight        = 3,
+               Hide            = 8
+       }
+}
index cc3095ce6640869e693d7e53be1e9c837d755726..88fd744d3f62412a535205ad51f886ea1817d226 100644 (file)
@@ -1,3 +1,17 @@
+2005-01-29  Peter Bartok  <pbartok@novell.com>
+
+       * 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  <pbartok@novell.com>
 
        * HandleData.cs: Added method for altering invalid area
index 6ab1c7d1b2163ed38780ae9ad4a3c91c73755233..0cc6530924da954e7310da8a467931a1d46dd79f 100644 (file)
@@ -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 ();
                }
                
index ac011f61e67d0ca4f653930303a0617d54e8dbce..8fd7b146e3c584b9675095418874d7ca89a12b5b 100644 (file)
 //
 // Authors:
 //     Miguel de Icaza (miguel@novell.com).
+//     Peter Bartok    (pbartok@novell.com)
 //
-//
+
+// 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
        }
 }
index f035ba57c0ebe400a4b1a21b5398d8d661790070..8414fa8ec98ab4338d2da3d35f5701e63c586106 100644 (file)
@@ -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();
index a7669c1e99051ccf7a122c2f2074ae5131b02637..ae9e2f22ed69c177966424912325c2a09cf459ad 100644 (file)
@@ -1317,6 +1317,15 @@ namespace System.Windows.Forms {
                internal IntPtr                 icon_mask;
                internal IntPtr                 window_group;
        }
-       \r
+\r
+       [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;
+       }
 }
 
index ad6a46a39c04d860b1a4800acf42c7e2574560e6..903f7d9a21be41dc1d88ac3070442b895d43b661 100644 (file)
@@ -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 {
index 58346ad8ba5b9148fe0be76252ddc4d3204039f4..149ed839a38799767306bb04fe6f9d2de624000a 100644 (file)
@@ -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;
index 1c276858db7477a4f13ca39adfa3475612e195ad..23e259130414836e03cd26c7988c69f2772ecc9d 100644 (file)
@@ -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);
index ff5fcca9e3f5935619ffd514a3e35f9559f9377a..1beb1e2a9ccbb177669e3a4937b61b91286abb97 100644 (file)
@@ -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 {
index ec26e9cb6edeedb21b4a26b622ffa364533ab2ef..512b88b43caf18c8cc73953954f09cbcab178846 100644 (file)
@@ -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
        }
 }