OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. |
3 * Copyright (C) 2008 Collabora, Ltd. All rights reserved. | 3 * Copyright (C) 2008 Collabora, Ltd. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 28 matching lines...) Expand all Loading... |
39 PlatformKeyboardEvent() | 39 PlatformKeyboardEvent() |
40 : PlatformEvent(PlatformEvent::KeyDown) | 40 : PlatformEvent(PlatformEvent::KeyDown) |
41 , m_windowsVirtualKeyCode(0) | 41 , m_windowsVirtualKeyCode(0) |
42 , m_nativeVirtualKeyCode(0) | 42 , m_nativeVirtualKeyCode(0) |
43 , m_autoRepeat(false) | 43 , m_autoRepeat(false) |
44 , m_isKeypad(false) | 44 , m_isKeypad(false) |
45 , m_isSystemKey(false) | 45 , m_isSystemKey(false) |
46 { | 46 { |
47 } | 47 } |
48 | 48 |
49 PlatformKeyboardEvent(Type type, const String& text, const String& unmodifie
dText, const String& keyIdentifier, const String& code, int windowsVirtualKeyCod
e, int nativeVirtualKeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey,
Modifiers modifiers, double timestamp) | 49 PlatformKeyboardEvent(Type type, const String& text, const String& unmodifie
dText, const String& keyIdentifier, const String& code, const String& key, int w
indowsVirtualKeyCode, int nativeVirtualKeyCode, bool isAutoRepeat, bool isKeypad
, bool isSystemKey, Modifiers modifiers, double timestamp) |
50 : PlatformEvent(type, modifiers, timestamp) | 50 : PlatformEvent(type, modifiers, timestamp) |
51 , m_text(text) | 51 , m_text(text) |
52 , m_unmodifiedText(unmodifiedText) | 52 , m_unmodifiedText(unmodifiedText) |
53 , m_keyIdentifier(keyIdentifier) | 53 , m_keyIdentifier(keyIdentifier) |
54 , m_code(code) | 54 , m_code(code) |
| 55 , m_key(key) |
55 , m_windowsVirtualKeyCode(windowsVirtualKeyCode) | 56 , m_windowsVirtualKeyCode(windowsVirtualKeyCode) |
56 , m_nativeVirtualKeyCode(nativeVirtualKeyCode) | 57 , m_nativeVirtualKeyCode(nativeVirtualKeyCode) |
57 , m_autoRepeat(isAutoRepeat) | 58 , m_autoRepeat(isAutoRepeat) |
58 , m_isKeypad(isKeypad) | 59 , m_isKeypad(isKeypad) |
59 , m_isSystemKey(isSystemKey) | 60 , m_isSystemKey(isSystemKey) |
60 { | 61 { |
61 } | 62 } |
62 | 63 |
63 PLATFORM_EXPORT void disambiguateKeyDownEvent(Type); | 64 PLATFORM_EXPORT void disambiguateKeyDownEvent(Type); |
64 | 65 |
65 // Text as as generated by processing a virtual key code with a keyboard lay
out | 66 // Text as as generated by processing a virtual key code with a keyboard lay
out |
66 // (in most cases, just a character code, but the layout can emit several | 67 // (in most cases, just a character code, but the layout can emit several |
67 // characters in a single keypress event on some platforms). | 68 // characters in a single keypress event on some platforms). |
68 // This may bear no resemblance to the ultimately inserted text if an input
method | 69 // This may bear no resemblance to the ultimately inserted text if an input
method |
69 // processes the input. | 70 // processes the input. |
70 // Will be null for KeyUp and RawKeyDown events. | 71 // Will be null for KeyUp and RawKeyDown events. |
71 String text() const { return m_text; } | 72 String text() const { return m_text; } |
72 | 73 |
73 // Text that would have been generated by the keyboard if no modifiers were
pressed | 74 // Text that would have been generated by the keyboard if no modifiers were
pressed |
74 // (except for Shift); useful for shortcut (accelerator) key handling. | 75 // (except for Shift); useful for shortcut (accelerator) key handling. |
75 // Otherwise, same as text(). | 76 // Otherwise, same as text(). |
76 String unmodifiedText() const { return m_unmodifiedText; } | 77 String unmodifiedText() const { return m_unmodifiedText; } |
77 | 78 |
78 String keyIdentifier() const { return m_keyIdentifier; } | 79 String keyIdentifier() const { return m_keyIdentifier; } |
79 | 80 |
80 String code() const { return m_code; } | 81 String code() const { return m_code; } |
| 82 String key() const { return m_key; } |
81 | 83 |
82 // Most compatible Windows virtual key code associated with the event. | 84 // Most compatible Windows virtual key code associated with the event. |
83 // Zero for Char events. | 85 // Zero for Char events. |
84 int windowsVirtualKeyCode() const { return m_windowsVirtualKeyCode; } | 86 int windowsVirtualKeyCode() const { return m_windowsVirtualKeyCode; } |
85 | 87 |
86 int nativeVirtualKeyCode() const { return m_nativeVirtualKeyCode; } | 88 int nativeVirtualKeyCode() const { return m_nativeVirtualKeyCode; } |
87 | 89 |
88 bool isAutoRepeat() const { return m_autoRepeat; } | 90 bool isAutoRepeat() const { return m_autoRepeat; } |
89 bool isKeypad() const { return m_isKeypad; } | 91 bool isKeypad() const { return m_isKeypad; } |
90 bool isSystemKey() const { return m_isSystemKey; } | 92 bool isSystemKey() const { return m_isSystemKey; } |
91 | 93 |
92 PLATFORM_EXPORT static bool currentCapsLockState(); | 94 PLATFORM_EXPORT static bool currentCapsLockState(); |
93 PLATFORM_EXPORT static void getCurrentModifierState(bool& shiftKey, bool& ct
rlKey, bool& altKey, bool& metaKey); | 95 PLATFORM_EXPORT static void getCurrentModifierState(bool& shiftKey, bool& ct
rlKey, bool& altKey, bool& metaKey); |
94 | 96 |
95 protected: | 97 protected: |
96 String m_text; | 98 String m_text; |
97 String m_unmodifiedText; | 99 String m_unmodifiedText; |
98 String m_keyIdentifier; | 100 String m_keyIdentifier; |
99 String m_code; | 101 String m_code; |
| 102 String m_key; |
100 int m_windowsVirtualKeyCode; | 103 int m_windowsVirtualKeyCode; |
101 int m_nativeVirtualKeyCode; | 104 int m_nativeVirtualKeyCode; |
102 bool m_autoRepeat; | 105 bool m_autoRepeat; |
103 bool m_isKeypad; | 106 bool m_isKeypad; |
104 bool m_isSystemKey; | 107 bool m_isSystemKey; |
105 }; | 108 }; |
106 | 109 |
107 } // namespace blink | 110 } // namespace blink |
108 | 111 |
109 #endif // PlatformKeyboardEvent_h | 112 #endif // PlatformKeyboardEvent_h |
OLD | NEW |