OLD | NEW |
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 #ifndef UI_VIEWS_MOUSE_WATCHER_H_ | 5 #ifndef UI_VIEWS_MOUSE_WATCHER_H_ |
6 #define UI_VIEWS_MOUSE_WATCHER_H_ | 6 #define UI_VIEWS_MOUSE_WATCHER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 enum MouseEventType { | 33 enum MouseEventType { |
34 // The mouse moved within the window which was current when the MouseWatcher | 34 // The mouse moved within the window which was current when the MouseWatcher |
35 // was created. | 35 // was created. |
36 MOUSE_MOVE, | 36 MOUSE_MOVE, |
37 // The mouse moved exited the window which was current when the MouseWatcher | 37 // The mouse moved exited the window which was current when the MouseWatcher |
38 // was created. | 38 // was created. |
39 MOUSE_EXIT | 39 MOUSE_EXIT |
40 }; | 40 }; |
41 | 41 |
42 virtual ~MouseWatcherHost(); | 42 virtual ~MouseWatcherHost(); |
| 43 |
43 // Return false when the mouse has moved outside the monitored region. | 44 // Return false when the mouse has moved outside the monitored region. |
44 virtual bool Contains( | 45 virtual bool Contains(const gfx::Point& screen_point, |
45 const gfx::Point& screen_point, | 46 MouseEventType type) = 0; |
46 MouseEventType type) = 0; | |
47 }; | 47 }; |
48 | 48 |
49 // MouseWatcher is used to watch mouse movement and notify its listener when the | 49 // MouseWatcher is used to watch mouse movement and notify its listener when the |
50 // mouse moves outside the bounds of a MouseWatcherHost. | 50 // mouse moves outside the bounds of a MouseWatcherHost. |
51 class VIEWS_EXPORT MouseWatcher { | 51 class VIEWS_EXPORT MouseWatcher { |
52 public: | 52 public: |
53 // Creates a new MouseWatcher. The |listener| will be notified when the |host| | 53 // Creates a new MouseWatcher. The |listener| will be notified when the |host| |
54 // determines that the mouse has moved outside its monitored region. | 54 // determines that the mouse has moved outside its monitored region. |
55 // |host| will be owned by the watcher and deleted upon completion. | 55 // |host| will be owned by the watcher and deleted upon completion. |
56 MouseWatcher(MouseWatcherHost* host, MouseWatcherListener* listener); | 56 MouseWatcher(MouseWatcherHost* host, MouseWatcherListener* listener); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 // See description above setter. | 90 // See description above setter. |
91 int notify_on_exit_time_ms_; | 91 int notify_on_exit_time_ms_; |
92 | 92 |
93 DISALLOW_COPY_AND_ASSIGN(MouseWatcher); | 93 DISALLOW_COPY_AND_ASSIGN(MouseWatcher); |
94 }; | 94 }; |
95 | 95 |
96 } // namespace views | 96 } // namespace views |
97 | 97 |
98 #endif // UI_VIEWS_MOUSE_WATCHER_H_ | 98 #endif // UI_VIEWS_MOUSE_WATCHER_H_ |
OLD | NEW |