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

Side by Side Diff: views/events/event.h

Issue 7550038: Rename VIEWS_API to VIEWS_EXPORT. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 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/drag_utils.h ('k') | views/events/event_utils_win.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) 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 VIEWS_EVENTS_EVENT_H_ 5 #ifndef VIEWS_EVENTS_EVENT_H_
6 #define VIEWS_EVENTS_EVENT_H_ 6 #define VIEWS_EVENTS_EVENT_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 #include "ui/base/events.h" 11 #include "ui/base/events.h"
12 #include "ui/base/keycodes/keyboard_codes.h" 12 #include "ui/base/keycodes/keyboard_codes.h"
13 #include "ui/gfx/point.h" 13 #include "ui/gfx/point.h"
14 #include "views/native_types.h" 14 #include "views/native_types.h"
15 #include "views/views_api.h" 15 #include "views/views_export.h"
16 16
17 #if defined(USE_X11) 17 #if defined(USE_X11)
18 typedef union _XEvent XEvent; 18 typedef union _XEvent XEvent;
19 #endif 19 #endif
20 20
21 namespace ui { 21 namespace ui {
22 class OSExchangeData; 22 class OSExchangeData;
23 } 23 }
24 using ui::OSExchangeData; 24 using ui::OSExchangeData;
25 25
26 namespace views { 26 namespace views {
27 27
28 class View; 28 class View;
29 29
30 namespace internal { 30 namespace internal {
31 class NativeWidgetView; 31 class NativeWidgetView;
32 class RootView; 32 class RootView;
33 } 33 }
34 34
35 #if defined(OS_WIN) 35 #if defined(OS_WIN)
36 VIEWS_API bool IsClientMouseEvent(const views::NativeEvent& native_event); 36 VIEWS_EXPORT bool IsClientMouseEvent(const views::NativeEvent& native_event);
37 VIEWS_API bool IsNonClientMouseEvent(const views::NativeEvent& native_event); 37 VIEWS_EXPORT bool IsNonClientMouseEvent(const views::NativeEvent& native_event);
38 #endif 38 #endif
39 39
40 //////////////////////////////////////////////////////////////////////////////// 40 ////////////////////////////////////////////////////////////////////////////////
41 // 41 //
42 // Event class 42 // Event class
43 // 43 //
44 // An event encapsulates an input event that can be propagated into view 44 // An event encapsulates an input event that can be propagated into view
45 // hierarchies. An event has a type, some flags and a time stamp. 45 // hierarchies. An event has a type, some flags and a time stamp.
46 // 46 //
47 // Each major event type has a corresponding Event subclass. 47 // Each major event type has a corresponding Event subclass.
48 // 48 //
49 // Events are immutable but support copy 49 // Events are immutable but support copy
50 // 50 //
51 //////////////////////////////////////////////////////////////////////////////// 51 ////////////////////////////////////////////////////////////////////////////////
52 class VIEWS_API Event { 52 class VIEWS_EXPORT Event {
53 public: 53 public:
54 // This type exists to distinguish between the NativeEvent and NativeEvent2 54 // This type exists to distinguish between the NativeEvent and NativeEvent2
55 // constructors. 55 // constructors.
56 // TODO(beng): remove once we rid views of Gtk/Gdk. 56 // TODO(beng): remove once we rid views of Gtk/Gdk.
57 struct FromNativeEvent2 {}; 57 struct FromNativeEvent2 {};
58 58
59 const NativeEvent& native_event() const { return native_event_; } 59 const NativeEvent& native_event() const { return native_event_; }
60 const NativeEvent2& native_event_2() const { return native_event_2_; } 60 const NativeEvent2& native_event_2() const { return native_event_2_; }
61 ui::EventType type() const { return type_; } 61 ui::EventType type() const { return type_; }
62 const base::Time& time_stamp() const { return time_stamp_; } 62 const base::Time& time_stamp() const { return time_stamp_; }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 }; 131 };
132 132
133 //////////////////////////////////////////////////////////////////////////////// 133 ////////////////////////////////////////////////////////////////////////////////
134 // 134 //
135 // LocatedEvent class 135 // LocatedEvent class
136 // 136 //
137 // A generic event that is used for any events that is located at a specific 137 // A generic event that is used for any events that is located at a specific
138 // position in the screen. 138 // position in the screen.
139 // 139 //
140 //////////////////////////////////////////////////////////////////////////////// 140 ////////////////////////////////////////////////////////////////////////////////
141 class VIEWS_API LocatedEvent : public Event { 141 class VIEWS_EXPORT LocatedEvent : public Event {
142 public: 142 public:
143 int x() const { return location_.x(); } 143 int x() const { return location_.x(); }
144 int y() const { return location_.y(); } 144 int y() const { return location_.y(); }
145 const gfx::Point& location() const { return location_; } 145 const gfx::Point& location() const { return location_; }
146 146
147 protected: 147 protected:
148 explicit LocatedEvent(NativeEvent native_event); 148 explicit LocatedEvent(NativeEvent native_event);
149 LocatedEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native); 149 LocatedEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native);
150 150
151 // TODO(msw): Kill this legacy constructor when we update uses. 151 // TODO(msw): Kill this legacy constructor when we update uses.
(...skipping 14 matching lines...) Expand all
166 166
167 class TouchEvent; 167 class TouchEvent;
168 168
169 //////////////////////////////////////////////////////////////////////////////// 169 ////////////////////////////////////////////////////////////////////////////////
170 // 170 //
171 // MouseEvent class 171 // MouseEvent class
172 // 172 //
173 // A mouse event is used for any input event related to the mouse. 173 // A mouse event is used for any input event related to the mouse.
174 // 174 //
175 //////////////////////////////////////////////////////////////////////////////// 175 ////////////////////////////////////////////////////////////////////////////////
176 class VIEWS_API MouseEvent : public LocatedEvent { 176 class VIEWS_EXPORT MouseEvent : public LocatedEvent {
177 public: 177 public:
178 explicit MouseEvent(NativeEvent native_event); 178 explicit MouseEvent(NativeEvent native_event);
179 MouseEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native); 179 MouseEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native);
180 180
181 // Create a new MouseEvent which is identical to the provided model. 181 // Create a new MouseEvent which is identical to the provided model.
182 // If source / target views are provided, the model location will be converted 182 // If source / target views are provided, the model location will be converted
183 // from |source| coordinate system to |target| coordinate system. 183 // from |source| coordinate system to |target| coordinate system.
184 MouseEvent(const MouseEvent& model, View* source, View* target); 184 MouseEvent(const MouseEvent& model, View* source, View* target);
185 185
186 // Creates a new MouseEvent from a TouchEvent. The location of the TouchEvent 186 // Creates a new MouseEvent from a TouchEvent. The location of the TouchEvent
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 238
239 //////////////////////////////////////////////////////////////////////////////// 239 ////////////////////////////////////////////////////////////////////////////////
240 // 240 //
241 // TouchEvent class 241 // TouchEvent class
242 // 242 //
243 // A touch event is generated by touch screen and advanced track 243 // A touch event is generated by touch screen and advanced track
244 // pad devices. There is a deliberate direct correspondence between 244 // pad devices. There is a deliberate direct correspondence between
245 // TouchEvent and PlatformTouchPoint. 245 // TouchEvent and PlatformTouchPoint.
246 // 246 //
247 //////////////////////////////////////////////////////////////////////////////// 247 ////////////////////////////////////////////////////////////////////////////////
248 class VIEWS_API TouchEvent : public LocatedEvent { 248 class VIEWS_EXPORT TouchEvent : public LocatedEvent {
249 public: 249 public:
250 TouchEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native); 250 TouchEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native);
251 251
252 // Create a new touch event. 252 // Create a new touch event.
253 TouchEvent(ui::EventType type, 253 TouchEvent(ui::EventType type,
254 int x, 254 int x,
255 int y, 255 int y,
256 int flags, 256 int flags,
257 int touch_id, 257 int touch_id,
258 float radius_x, 258 float radius_x,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 296
297 DISALLOW_COPY_AND_ASSIGN(TouchEvent); 297 DISALLOW_COPY_AND_ASSIGN(TouchEvent);
298 }; 298 };
299 299
300 //////////////////////////////////////////////////////////////////////////////// 300 ////////////////////////////////////////////////////////////////////////////////
301 // KeyEvent class 301 // KeyEvent class
302 // 302 //
303 // KeyEvent encapsulates keyboard input events - key press and release. 303 // KeyEvent encapsulates keyboard input events - key press and release.
304 // 304 //
305 //////////////////////////////////////////////////////////////////////////////// 305 ////////////////////////////////////////////////////////////////////////////////
306 class VIEWS_API KeyEvent : public Event { 306 class VIEWS_EXPORT KeyEvent : public Event {
307 public: 307 public:
308 explicit KeyEvent(NativeEvent native_event); 308 explicit KeyEvent(NativeEvent native_event);
309 KeyEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native); 309 KeyEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native);
310 310
311 // Creates a new KeyEvent synthetically (i.e. not in response to an input 311 // Creates a new KeyEvent synthetically (i.e. not in response to an input
312 // event from the host environment). This is typically only used in testing as 312 // event from the host environment). This is typically only used in testing as
313 // some metadata obtainable from the underlying native event is not present. 313 // some metadata obtainable from the underlying native event is not present.
314 // It's also used by input methods to fabricate keyboard events. 314 // It's also used by input methods to fabricate keyboard events.
315 KeyEvent(ui::EventType type, 315 KeyEvent(ui::EventType type,
316 ui::KeyboardCode key_code, 316 ui::KeyboardCode key_code,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 }; 369 };
370 370
371 //////////////////////////////////////////////////////////////////////////////// 371 ////////////////////////////////////////////////////////////////////////////////
372 // 372 //
373 // MouseWheelEvent class 373 // MouseWheelEvent class
374 // 374 //
375 // A MouseWheelEvent is used to propagate mouse wheel user events. 375 // A MouseWheelEvent is used to propagate mouse wheel user events.
376 // Note: e.GetOffset() > 0 means scroll up / left. 376 // Note: e.GetOffset() > 0 means scroll up / left.
377 // 377 //
378 //////////////////////////////////////////////////////////////////////////////// 378 ////////////////////////////////////////////////////////////////////////////////
379 class VIEWS_API MouseWheelEvent : public MouseEvent { 379 class VIEWS_EXPORT MouseWheelEvent : public MouseEvent {
380 public: 380 public:
381 // See |offset| for details. 381 // See |offset| for details.
382 static const int kWheelDelta; 382 static const int kWheelDelta;
383 383
384 explicit MouseWheelEvent(NativeEvent native_event); 384 explicit MouseWheelEvent(NativeEvent native_event);
385 MouseWheelEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native); 385 MouseWheelEvent(NativeEvent2 native_event_2, FromNativeEvent2 from_native);
386 386
387 // The amount to scroll. This is in multiples of kWheelDelta. 387 // The amount to scroll. This is in multiples of kWheelDelta.
388 int offset() const { return offset_; } 388 int offset() const { return offset_; }
389 389
(...skipping 12 matching lines...) Expand all
402 }; 402 };
403 403
404 //////////////////////////////////////////////////////////////////////////////// 404 ////////////////////////////////////////////////////////////////////////////////
405 // 405 //
406 // DropTargetEvent class 406 // DropTargetEvent class
407 // 407 //
408 // A DropTargetEvent is sent to the view the mouse is over during a drag and 408 // A DropTargetEvent is sent to the view the mouse is over during a drag and
409 // drop operation. 409 // drop operation.
410 // 410 //
411 //////////////////////////////////////////////////////////////////////////////// 411 ////////////////////////////////////////////////////////////////////////////////
412 class VIEWS_API DropTargetEvent : public LocatedEvent { 412 class VIEWS_EXPORT DropTargetEvent : public LocatedEvent {
413 public: 413 public:
414 DropTargetEvent(const OSExchangeData& data, 414 DropTargetEvent(const OSExchangeData& data,
415 int x, 415 int x,
416 int y, 416 int y,
417 int source_operations) 417 int source_operations)
418 : LocatedEvent(ui::ET_DROP_TARGET_EVENT, gfx::Point(x, y), 0), 418 : LocatedEvent(ui::ET_DROP_TARGET_EVENT, gfx::Point(x, y), 0),
419 data_(data), 419 data_(data),
420 source_operations_(source_operations) { 420 source_operations_(source_operations) {
421 // TODO(msw): Hook up key state flags for CTRL + drag and drop, etc. 421 // TODO(msw): Hook up key state flags for CTRL + drag and drop, etc.
422 } 422 }
423 423
424 const OSExchangeData& data() const { return data_; } 424 const OSExchangeData& data() const { return data_; }
425 int source_operations() const { return source_operations_; } 425 int source_operations() const { return source_operations_; }
426 426
427 private: 427 private:
428 // Data associated with the drag/drop session. 428 // Data associated with the drag/drop session.
429 const OSExchangeData& data_; 429 const OSExchangeData& data_;
430 430
431 // Bitmask of supported ui::DragDropTypes::DragOperation by the source. 431 // Bitmask of supported ui::DragDropTypes::DragOperation by the source.
432 int source_operations_; 432 int source_operations_;
433 433
434 DISALLOW_COPY_AND_ASSIGN(DropTargetEvent); 434 DISALLOW_COPY_AND_ASSIGN(DropTargetEvent);
435 }; 435 };
436 436
437 } // namespace views 437 } // namespace views
438 438
439 #endif // VIEWS_EVENTS_EVENT_H_ 439 #endif // VIEWS_EVENTS_EVENT_H_
OLDNEW
« no previous file with comments | « views/drag_utils.h ('k') | views/events/event_utils_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698