| 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 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 namespace WebCore { | 34 namespace WebCore { |
| 35 | 35 |
| 36 class PlatformKeyboardEvent : public PlatformEvent { | 36 class PlatformKeyboardEvent : public PlatformEvent { |
| 37 WTF_MAKE_FAST_ALLOCATED; | 37 WTF_MAKE_FAST_ALLOCATED; |
| 38 public: | 38 public: |
| 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_macCharCode(0) | |
| 44 , m_autoRepeat(false) | 43 , m_autoRepeat(false) |
| 45 , m_isKeypad(false) | 44 , m_isKeypad(false) |
| 46 , m_isSystemKey(false) | 45 , m_isSystemKey(false) |
| 47 { | 46 { |
| 48 } | 47 } |
| 49 | 48 |
| 50 PlatformKeyboardEvent(Type type, const String& text, const String& unmodifie
dText, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtual
KeyCode, int macCharCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Mo
difiers modifiers, double timestamp) | 49 PlatformKeyboardEvent(Type type, const String& text, const String& unmodifie
dText, const String& keyIdentifier, int windowsVirtualKeyCode, int nativeVirtual
KeyCode, bool isAutoRepeat, bool isKeypad, bool isSystemKey, Modifiers modifiers
, double timestamp) |
| 51 : PlatformEvent(type, modifiers, timestamp) | 50 : PlatformEvent(type, modifiers, timestamp) |
| 52 , m_text(text) | 51 , m_text(text) |
| 53 , m_unmodifiedText(unmodifiedText) | 52 , m_unmodifiedText(unmodifiedText) |
| 54 , m_keyIdentifier(keyIdentifier) | 53 , m_keyIdentifier(keyIdentifier) |
| 55 , m_windowsVirtualKeyCode(windowsVirtualKeyCode) | 54 , m_windowsVirtualKeyCode(windowsVirtualKeyCode) |
| 56 , m_nativeVirtualKeyCode(nativeVirtualKeyCode) | 55 , m_nativeVirtualKeyCode(nativeVirtualKeyCode) |
| 57 , m_macCharCode(macCharCode) | |
| 58 , m_autoRepeat(isAutoRepeat) | 56 , m_autoRepeat(isAutoRepeat) |
| 59 , m_isKeypad(isKeypad) | 57 , m_isKeypad(isKeypad) |
| 60 , m_isSystemKey(isSystemKey) | 58 , m_isSystemKey(isSystemKey) |
| 61 { | 59 { |
| 62 } | 60 } |
| 63 | 61 |
| 64 PLATFORM_EXPORT void disambiguateKeyDownEvent(Type); | 62 PLATFORM_EXPORT void disambiguateKeyDownEvent(Type); |
| 65 | 63 |
| 66 // Text as as generated by processing a virtual key code with a keyboard lay
out | 64 // Text as as generated by processing a virtual key code with a keyboard lay
out |
| 67 // (in most cases, just a character code, but the layout can emit several | 65 // (in most cases, just a character code, but the layout can emit several |
| 68 // characters in a single keypress event on some platforms). | 66 // characters in a single keypress event on some platforms). |
| 69 // This may bear no resemblance to the ultimately inserted text if an input
method | 67 // This may bear no resemblance to the ultimately inserted text if an input
method |
| 70 // processes the input. | 68 // processes the input. |
| 71 // Will be null for KeyUp and RawKeyDown events. | 69 // Will be null for KeyUp and RawKeyDown events. |
| 72 String text() const { return m_text; } | 70 String text() const { return m_text; } |
| 73 | 71 |
| 74 // Text that would have been generated by the keyboard if no modifiers were
pressed | 72 // Text that would have been generated by the keyboard if no modifiers were
pressed |
| 75 // (except for Shift); useful for shortcut (accelerator) key handling. | 73 // (except for Shift); useful for shortcut (accelerator) key handling. |
| 76 // Otherwise, same as text(). | 74 // Otherwise, same as text(). |
| 77 String unmodifiedText() const { return m_unmodifiedText; } | 75 String unmodifiedText() const { return m_unmodifiedText; } |
| 78 | 76 |
| 79 String keyIdentifier() const { return m_keyIdentifier; } | 77 String keyIdentifier() const { return m_keyIdentifier; } |
| 80 | 78 |
| 81 // Most compatible Windows virtual key code associated with the event. | 79 // Most compatible Windows virtual key code associated with the event. |
| 82 // Zero for Char events. | 80 // Zero for Char events. |
| 83 int windowsVirtualKeyCode() const { return m_windowsVirtualKeyCode; } | 81 int windowsVirtualKeyCode() const { return m_windowsVirtualKeyCode; } |
| 84 | 82 |
| 85 int nativeVirtualKeyCode() const { return m_nativeVirtualKeyCode; } | 83 int nativeVirtualKeyCode() const { return m_nativeVirtualKeyCode; } |
| 86 int macCharCode() const { return m_macCharCode; } | |
| 87 | 84 |
| 88 bool isAutoRepeat() const { return m_autoRepeat; } | 85 bool isAutoRepeat() const { return m_autoRepeat; } |
| 89 bool isKeypad() const { return m_isKeypad; } | 86 bool isKeypad() const { return m_isKeypad; } |
| 90 bool isSystemKey() const { return m_isSystemKey; } | 87 bool isSystemKey() const { return m_isSystemKey; } |
| 91 | 88 |
| 92 PLATFORM_EXPORT static bool currentCapsLockState(); | 89 PLATFORM_EXPORT static bool currentCapsLockState(); |
| 93 PLATFORM_EXPORT static void getCurrentModifierState(bool& shiftKey, bool& ct
rlKey, bool& altKey, bool& metaKey); | 90 PLATFORM_EXPORT static void getCurrentModifierState(bool& shiftKey, bool& ct
rlKey, bool& altKey, bool& metaKey); |
| 94 | 91 |
| 95 protected: | 92 protected: |
| 96 String m_text; | 93 String m_text; |
| 97 String m_unmodifiedText; | 94 String m_unmodifiedText; |
| 98 String m_keyIdentifier; | 95 String m_keyIdentifier; |
| 99 int m_windowsVirtualKeyCode; | 96 int m_windowsVirtualKeyCode; |
| 100 int m_nativeVirtualKeyCode; | 97 int m_nativeVirtualKeyCode; |
| 101 int m_macCharCode; | |
| 102 bool m_autoRepeat; | 98 bool m_autoRepeat; |
| 103 bool m_isKeypad; | 99 bool m_isKeypad; |
| 104 bool m_isSystemKey; | 100 bool m_isSystemKey; |
| 105 }; | 101 }; |
| 106 | 102 |
| 107 } // namespace WebCore | 103 } // namespace WebCore |
| 108 | 104 |
| 109 #endif // PlatformKeyboardEvent_h | 105 #endif // PlatformKeyboardEvent_h |
| OLD | NEW |