diff dynamin/gui/windows_window.d @ 72:8dac206ea523

Add shift/control/altDown to KeyEventArgs.
author Jordan Miner <jminer7@gmail.com>
date Tue, 11 Aug 2009 01:45:42 -0500
parents c138461bf845
children d5928da5a1f0
line wrap: on
line diff
--- a/dynamin/gui/windows_window.d	Mon Aug 10 17:04:08 2009 -0500
+++ b/dynamin/gui/windows_window.d	Tue Aug 11 01:45:42 2009 -0500
@@ -566,6 +566,9 @@
 		default: return MouseButton.None;
 		}
 	}
+	bool isKeyDown(int vk) {
+		return cast(bool)HIWORD(GetKeyState(vk));
+	}
 	//}}}
 	switch(uMsg) {
 	case WM_ENTERSIZEMOVE: //when the user starts moving or resizing the window
@@ -801,8 +804,9 @@
 	case WM_KEYDOWN:
 		//Stdout.format("WM_KEYDOWN:    {:x}", cast(int)wParam).newline;
 		Control focused = c.focusedControl ? c.focusedControl : c;
-		scope args = new KeyEventArgs(
-			VKToKey(wParam), cast(bool)(lParam & (1 << 30)) );
+		scope args = new KeyEventArgs(VKToKey(wParam),
+			cast(bool)(lParam & (1 << 30)), isKeyDown(VK_SHIFT),
+			isKeyDown(VK_CONTROL), isKeyDown(VK_MENU) );
 		focused.keyDown(args);
 		return 0;
 	case WM_SYSKEYUP:
@@ -812,7 +816,8 @@
 	case WM_KEYUP:
 		//Stdout.format("WM_KEYUP:    {:x}", cast(int)wParam).newline;
 		Control focused = c.focusedControl ? c.focusedControl : c;
-		scope args = new KeyEventArgs( VKToKey(wParam), false );
+		scope args = new KeyEventArgs( VKToKey(wParam), false,
+			isKeyDown(VK_SHIFT), isKeyDown(VK_CONTROL), isKeyDown(VK_MENU) );
 		focused.keyUp(args);
 		return 0;
 	case WM_CHAR: