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

Side by Side Diff: ui/aura/event.h

Issue 8537012: Port IsShiftDown() and variants in views::Event to aura::Event. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | « no previous file | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef UI_AURA_EVENT_H_ 5 #ifndef UI_AURA_EVENT_H_
6 #define UI_AURA_EVENT_H_ 6 #define UI_AURA_EVENT_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/event_types.h" 10 #include "base/event_types.h"
(...skipping 11 matching lines...) Expand all
22 22
23 class Window; 23 class Window;
24 24
25 class AURA_EXPORT Event { 25 class AURA_EXPORT Event {
26 public: 26 public:
27 const base::NativeEvent& native_event() const { return native_event_; } 27 const base::NativeEvent& native_event() const { return native_event_; }
28 ui::EventType type() const { return type_; } 28 ui::EventType type() const { return type_; }
29 const base::Time& time_stamp() const { return time_stamp_; } 29 const base::Time& time_stamp() const { return time_stamp_; }
30 int flags() const { return flags_; } 30 int flags() const { return flags_; }
31 31
32 // The following methods return true if the respective keys were pressed at
33 // the time the event was created.
34 bool IsShiftDown() const { return (flags_ & ui::EF_SHIFT_DOWN) != 0; }
35 bool IsControlDown() const { return (flags_ & ui::EF_CONTROL_DOWN) != 0; }
36 bool IsCapsLockDown() const { return (flags_ & ui::EF_CAPS_LOCK_DOWN) != 0; }
37 bool IsAltDown() const { return (flags_ & ui::EF_ALT_DOWN) != 0; }
38
32 protected: 39 protected:
33 Event(ui::EventType type, int flags); 40 Event(ui::EventType type, int flags);
34 Event(const base::NativeEvent& native_event, ui::EventType type, int flags); 41 Event(const base::NativeEvent& native_event, ui::EventType type, int flags);
35 Event(const Event& copy); 42 Event(const Event& copy);
36 void set_type(ui::EventType type) { type_ = type; } 43 void set_type(ui::EventType type) { type_ = type; }
37 void set_flags(int flags) { flags_ = flags; } 44 void set_flags(int flags) { flags_ = flags; }
38 45
39 private: 46 private:
40 void operator=(const Event&); 47 void operator=(const Event&);
41 48
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 private: 156 private:
150 ui::KeyboardCode key_code_; 157 ui::KeyboardCode key_code_;
151 // True if this is a translated character event (vs. a raw key down). Both 158 // True if this is a translated character event (vs. a raw key down). Both
152 // share the same type: ui::ET_KEY_PRESSED. 159 // share the same type: ui::ET_KEY_PRESSED.
153 bool is_char_; 160 bool is_char_;
154 }; 161 };
155 162
156 } // namespace aura 163 } // namespace aura
157 164
158 #endif // UI_AURA_EVENT_H_ 165 #endif // UI_AURA_EVENT_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698