Author: jpobst
Date: 2007-08-28 17:48:15 -0400 (Tue, 28 Aug 2007)
New Revision: 84983

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
Log:
2007-08-28  Jonathan Pobst  <[EMAIL PROTECTED]>

        * Control.cs, XPlatUI.cs, XPlatUIDriver.cs, XPlatUIWin32.cs: Implement
        IsKeyLocked.

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-08-28 20:58:47 UTC (rev 84982)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-08-28 21:48:15 UTC (rev 84983)
@@ -1,5 +1,10 @@
 2007-08-28  Jonathan Pobst  <[EMAIL PROTECTED]>
 
+       * Control.cs, XPlatUI.cs, XPlatUIDriver.cs, XPlatUIWin32.cs: Implement
+       IsKeyLocked.
+
+2007-08-28  Jonathan Pobst  <[EMAIL PROTECTED]>
+
        * Cursor.cs: Add HotSpot, hook into XPlatUI.GetCursorInfo.
        * XPlatUIWin32.cs: Implement hotspot lookup in GetCursorInfo.
 

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2007-08-28 20:58:47 UTC (rev 84982)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2007-08-28 21:48:15 UTC (rev 84983)
@@ -3471,6 +3471,21 @@
                        return 
Control.ControlNativeWindow.ControlFromHandle(handle);
                }
 
+#if NET_2_0
+               [MonoTODO ("Only implemented for Win32, others always return 
false")]
+               public static bool IsKeyLocked (Keys keyVal)
+               {
+                       switch (keyVal) {
+                               case Keys.CapsLock:
+                               case Keys.NumLock:
+                               case Keys.Scroll:
+                                       return XplatUI.IsKeyLocked 
((VirtualKeys)keyVal);
+                               default:
+                                       throw new NotSupportedException 
("keyVal must be CapsLock, NumLock, or ScrollLock");
+                       }
+               }
+#endif
+
                public static bool IsMnemonic(char charCode, string text) {
                        int amp;
 

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs       
2007-08-28 20:58:47 UTC (rev 84982)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs       
2007-08-28 21:48:15 UTC (rev 84983)
@@ -746,6 +746,14 @@
                        return driver.IsEnabled(handle);
                }
 
+               internal static bool IsKeyLocked (VirtualKeys key)
+               {
+                       #if DriverDebug || DriverDebugState
+                               Console.WriteLine("IsKeyLocked({0}): Called, 
Result={1}", key, driver.IsKeyLocked(key));
+                       #endif
+                       return driver.IsKeyLocked (key);
+               }
+
                internal static bool IsVisible(IntPtr handle) {
                        #if DriverDebug || DriverDebugState
                                Console.WriteLine("IsVisible({0}): Called, 
Result={1}", Window(handle), driver.IsVisible(handle));

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs 
2007-08-28 20:58:47 UTC (rev 84982)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIDriver.cs 
2007-08-28 21:48:15 UTC (rev 84983)
@@ -280,6 +280,7 @@
                internal abstract bool SetVisible(IntPtr handle, bool visible, 
bool activate);
                internal abstract bool IsVisible(IntPtr handle);
                internal abstract bool IsEnabled(IntPtr handle);
+               internal virtual bool IsKeyLocked (VirtualKeys key) { return 
false; }
                internal abstract IntPtr SetParent(IntPtr handle, IntPtr 
parent);
                internal abstract IntPtr GetParent(IntPtr handle);
 

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs  
2007-08-28 20:58:47 UTC (rev 84982)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUIWin32.cs  
2007-08-28 21:48:15 UTC (rev 84983)
@@ -2155,6 +2155,11 @@
                internal override bool IsEnabled(IntPtr handle) {
                        return IsWindowEnabled (handle);
                }
+
+               internal override bool IsKeyLocked (VirtualKeys key)
+               {
+                       return (Win32GetKeyState (key) & 1) == 1;
+               }
                
                internal override bool IsVisible(IntPtr handle) {
                        return IsWindowVisible (handle);

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

Reply via email to