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

Side by Side Diff: ui/views/events/event.cc

Issue 10535046: Add Windows commandline switch --enable-views-textfield. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert TextfieldController change. Created 8 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/events/event.h" 5 #include "ui/views/events/event.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/base/keycodes/keyboard_code_conversion.h" 8 #include "ui/base/keycodes/keyboard_code_conversion.h"
9 #include "ui/views/view.h" 9 #include "ui/views/view.h"
10 #include "ui/views/widget/root_view.h" 10 #include "ui/views/widget/root_view.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 KeyEvent::KeyEvent(ui::EventType type, 81 KeyEvent::KeyEvent(ui::EventType type,
82 ui::KeyboardCode key_code, 82 ui::KeyboardCode key_code,
83 int event_flags) 83 int event_flags)
84 : Event(type, event_flags), 84 : Event(type, event_flags),
85 key_code_(key_code), 85 key_code_(key_code),
86 character_(ui::GetCharacterFromKeyCode(key_code, event_flags)), 86 character_(ui::GetCharacterFromKeyCode(key_code, event_flags)),
87 unmodified_character_(0) { 87 unmodified_character_(0) {
88 } 88 }
89 89
90 bool KeyEvent::IsNumPadDigit() const {
91 if (key_code_ >= VK_NUMPAD0 && key_code_ <= VK_NUMPAD9)
92 return true;
93
94 // Check for num pad keys without NumLock.
95 // Note: there is no easy way to know if a the key that was pressed comes from
96 // the num pad or the rest of the keyboard. Investigating how
97 // TranslateMessage() generates the WM_KEYCHAR from an
98 // ALT + <NumPad sequences> it appears it looks at the extended key flag
99 // (which is on if the key pressed comes from one of the 3 clusters to
100 // the left of the numeric keypad). So we use it as well.
101 return ((flags() & ui::EF_EXTENDED) == 0) &&
102 ((key_code_ >= VK_PRIOR && key_code_ <= VK_DOWN) || // All but 0 and 5.
103 (key_code_ == VK_CLEAR) || (key_code_ == VK_INSERT)); // Keys 0 and 5.
104 }
105
90 //////////////////////////////////////////////////////////////////////////////// 106 ////////////////////////////////////////////////////////////////////////////////
91 // MouseEvent, public: 107 // MouseEvent, public:
92 108
93 MouseEvent::MouseEvent(const NativeEvent& native_event) 109 MouseEvent::MouseEvent(const NativeEvent& native_event)
94 : LocatedEvent(native_event) { 110 : LocatedEvent(native_event) {
95 } 111 }
96 112
97 MouseEvent::MouseEvent(const MouseEvent& model, View* source, View* target) 113 MouseEvent::MouseEvent(const MouseEvent& model, View* source, View* target)
98 : LocatedEvent(model, source, target) { 114 : LocatedEvent(model, source, target) {
99 } 115 }
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 #endif 263 #endif
248 264
249 GestureEventForTest::GestureEventForTest(ui::EventType type, 265 GestureEventForTest::GestureEventForTest(ui::EventType type,
250 int x, 266 int x,
251 int y, 267 int y,
252 int flags) 268 int flags)
253 : GestureEvent(type, x, y, flags) { 269 : GestureEvent(type, x, y, flags) {
254 } 270 }
255 271
256 } // namespace views 272 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698