Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Side by Side Diff: Source/platform/PlatformKeyboardEvent.h

Issue 26510003: Moving all the PlatformEvent subclasses from core/platform to platform (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Rebase again Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/platform/PlatformGestureEvent.h ('k') | Source/platform/PlatformKeyboardEvent.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) 2008 Collabora, Ltd. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27 #ifndef PlatformKeyboardEvent_h
28 #define PlatformKeyboardEvent_h
29
30 #include "platform/PlatformEvent.h"
31 #include "platform/PlatformExport.h"
32 #include "wtf/text/WTFString.h"
33
34 namespace WebCore {
35
36 class PlatformKeyboardEvent : public PlatformEvent {
37 WTF_MAKE_FAST_ALLOCATED;
38 public:
39 PlatformKeyboardEvent()
40 : PlatformEvent(PlatformEvent::KeyDown)
41 , m_windowsVirtualKeyCode(0)
42 , m_nativeVirtualKeyCode(0)
43 , m_macCharCode(0)
44 , m_autoRepeat(false)
45 , m_isKeypad(false)
46 , m_isSystemKey(false)
47 {
48 }
49
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)
51 : PlatformEvent(type, modifiers, timestamp)
52 , m_text(text)
53 , m_unmodifiedText(unmodifiedText)
54 , m_keyIdentifier(keyIdentifier)
55 , m_windowsVirtualKeyCode(windowsVirtualKeyCode)
56 , m_nativeVirtualKeyCode(nativeVirtualKeyCode)
57 , m_macCharCode(macCharCode)
58 , m_autoRepeat(isAutoRepeat)
59 , m_isKeypad(isKeypad)
60 , m_isSystemKey(isSystemKey)
61 {
62 }
63
64 PLATFORM_EXPORT void disambiguateKeyDownEvent(Type);
65
66 // 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
68 // characters in a single keypress event on some platforms).
69 // This may bear no resemblance to the ultimately inserted text if an input method
70 // processes the input.
71 // Will be null for KeyUp and RawKeyDown events.
72 String text() const { return m_text; }
73
74 // Text that would have been generated by the keyboard if no modifiers were pressed
75 // (except for Shift); useful for shortcut (accelerator) key handling.
76 // Otherwise, same as text().
77 String unmodifiedText() const { return m_unmodifiedText; }
78
79 String keyIdentifier() const { return m_keyIdentifier; }
80
81 // Most compatible Windows virtual key code associated with the event.
82 // Zero for Char events.
83 int windowsVirtualKeyCode() const { return m_windowsVirtualKeyCode; }
84
85 int nativeVirtualKeyCode() const { return m_nativeVirtualKeyCode; }
86 int macCharCode() const { return m_macCharCode; }
87
88 bool isAutoRepeat() const { return m_autoRepeat; }
89 bool isKeypad() const { return m_isKeypad; }
90 bool isSystemKey() const { return m_isSystemKey; }
91
92 PLATFORM_EXPORT static bool currentCapsLockState();
93 PLATFORM_EXPORT static void getCurrentModifierState(bool& shiftKey, bool& ct rlKey, bool& altKey, bool& metaKey);
94
95 protected:
96 String m_text;
97 String m_unmodifiedText;
98 String m_keyIdentifier;
99 int m_windowsVirtualKeyCode;
100 int m_nativeVirtualKeyCode;
101 int m_macCharCode;
102 bool m_autoRepeat;
103 bool m_isKeypad;
104 bool m_isSystemKey;
105 };
106
107 } // namespace WebCore
108
109 #endif // PlatformKeyboardEvent_h
OLDNEW
« no previous file with comments | « Source/platform/PlatformGestureEvent.h ('k') | Source/platform/PlatformKeyboardEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698