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

Side by Side Diff: aura/event.h

Issue 7886042: Move Aura to UI subdir. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef AURA_EVENT_H_
6 #define AURA_EVENT_H_
7 #pragma once
8
9 #include "aura/aura_export.h"
10 #include "base/basictypes.h"
11 #include "base/time.h"
12 #include "ui/base/events.h"
13 #include "ui/base/keycodes/keyboard_codes.h"
14 #include "ui/gfx/point.h"
15
16 #if defined(USE_X11)
17 typedef union _XEvent XEvent;
18 #endif
19
20 namespace aura {
21
22 #if defined(OS_WIN)
23 typedef MSG NativeEvent;
24 #elif defined(USE_X11)
25 typedef XEvent* NativeEvent;
26 #endif
27
28 class Window;
29
30 class AURA_EXPORT Event {
31 public:
32 const NativeEvent& native_event() const { return native_event_; }
33 ui::EventType type() const { return type_; }
34 const base::Time& time_stamp() const { return time_stamp_; }
35 int flags() const { return flags_; }
36
37 protected:
38 Event(ui::EventType type, int flags);
39 Event(NativeEvent native_event, ui::EventType type, int flags);
40 Event(const Event& copy);
41
42 private:
43 void operator=(const Event&);
44
45 // Safely initializes the native event members of this class.
46 void Init();
47 void InitWithNativeEvent(NativeEvent native_event);
48
49 NativeEvent native_event_;
50 ui::EventType type_;
51 base::Time time_stamp_;
52 int flags_;
53 };
54
55 class AURA_EXPORT LocatedEvent : public Event {
56 public:
57 int x() const { return location_.x(); }
58 int y() const { return location_.y(); }
59 gfx::Point location() const { return location_; }
60
61 protected:
62 explicit LocatedEvent(NativeEvent native_event);
63
64 // Create a new LocatedEvent which is identical to the provided model.
65 // If source / target windows are provided, the model location will be
66 // converted from |source| coordinate system to |target| coordinate system.
67 LocatedEvent(const LocatedEvent& model, Window* source, Window* target);
68
69 // Used for synthetic events in testing.
70 LocatedEvent(ui::EventType type, const gfx::Point& location, int flags);
71
72 gfx::Point location_;
73
74 private:
75 DISALLOW_COPY_AND_ASSIGN(LocatedEvent);
76 };
77
78 class AURA_EXPORT MouseEvent : public LocatedEvent {
79 public:
80 explicit MouseEvent(NativeEvent native_event);
81
82 // Create a new MouseEvent which is identical to the provided model.
83 // If source / target windows are provided, the model location will be
84 // converted from |source| coordinate system to |target| coordinate system.
85 MouseEvent(const MouseEvent& model, Window* source, Window* target);
86
87 // Used for synthetic events in testing.
88 MouseEvent(ui::EventType type, const gfx::Point& location, int flags);
89
90 private:
91 DISALLOW_COPY_AND_ASSIGN(MouseEvent);
92 };
93
94 class AURA_EXPORT KeyEvent : public Event {
95 public:
96 explicit KeyEvent(NativeEvent native_event);
97
98 // Used for synthetic events in testing.
99 KeyEvent(ui::EventType type,
100 ui::KeyboardCode key_code,
101 int flags);
102
103 ui::KeyboardCode key_code() const { return key_code_; }
104
105 private:
106 ui::KeyboardCode key_code_;
107 };
108
109 } // namespace aura
110
111 #endif // AURA_EVENT_H_
OLDNEW
« no previous file with comments | « aura/desktop_host_win.cc ('k') | aura/event.cc » ('j') | ui/aura/aura.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698