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

Side by Side Diff: views/event_win.cc

Issue 6034002: Replace Textfield::Keystroke with views::KeyEvent (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: key_code, ET_KEY_PRESS for WM_CHAR Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « views/event.h ('k') | views/examples/textfield_example.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "views/event.h" 5 #include "views/event.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 namespace views { 9 namespace views {
10 10
11 KeyEvent::KeyEvent(EventType type, app::KeyboardCode key_code,
12 int event_flags, int repeat_count, int message_flags,
13 UINT message)
14 : Event(type, event_flags),
15 key_code_(key_code),
16 repeat_count_(repeat_count),
17 message_flags_(message_flags),
18 message_(message) {
19 }
20
11 int Event::GetWindowsFlags() const { 21 int Event::GetWindowsFlags() const {
12 // TODO: need support for x1/x2. 22 // TODO: need support for x1/x2.
13 int result = 0; 23 int result = 0;
14 result |= (flags_ & EF_SHIFT_DOWN) ? MK_SHIFT : 0; 24 result |= (flags_ & EF_SHIFT_DOWN) ? MK_SHIFT : 0;
15 result |= (flags_ & EF_CONTROL_DOWN) ? MK_CONTROL : 0; 25 result |= (flags_ & EF_CONTROL_DOWN) ? MK_CONTROL : 0;
16 result |= (flags_ & EF_LEFT_BUTTON_DOWN) ? MK_LBUTTON : 0; 26 result |= (flags_ & EF_LEFT_BUTTON_DOWN) ? MK_LBUTTON : 0;
17 result |= (flags_ & EF_MIDDLE_BUTTON_DOWN) ? MK_MBUTTON : 0; 27 result |= (flags_ & EF_MIDDLE_BUTTON_DOWN) ? MK_MBUTTON : 0;
18 result |= (flags_ & EF_RIGHT_BUTTON_DOWN) ? MK_RBUTTON : 0; 28 result |= (flags_ & EF_RIGHT_BUTTON_DOWN) ? MK_RBUTTON : 0;
19 return result; 29 return result;
20 } 30 }
(...skipping 29 matching lines...) Expand all
50 if (GetKeyState(VK_CONTROL) & 0x80) 60 if (GetKeyState(VK_CONTROL) & 0x80)
51 flags |= Event::EF_CONTROL_DOWN; 61 flags |= Event::EF_CONTROL_DOWN;
52 return flags; 62 return flags;
53 } 63 }
54 64
55 bool KeyEvent::IsExtendedKey() const { 65 bool KeyEvent::IsExtendedKey() const {
56 return (message_flags_ & KF_EXTENDED) == KF_EXTENDED; 66 return (message_flags_ & KF_EXTENDED) == KF_EXTENDED;
57 } 67 }
58 68
59 } // namespace views 69 } // namespace views
OLDNEW
« no previous file with comments | « views/event.h ('k') | views/examples/textfield_example.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698