| 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 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 public: | 22 public: |
| 23 virtual void MouseMovedOutOfHost() = 0; | 23 virtual void MouseMovedOutOfHost() = 0; |
| 24 | 24 |
| 25 protected: | 25 protected: |
| 26 virtual ~MouseWatcherListener(); | 26 virtual ~MouseWatcherListener(); |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 // The MouseWatcherHost determines what region is to be monitored. | 29 // The MouseWatcherHost determines what region is to be monitored. |
| 30 class VIEWS_EXPORT MouseWatcherHost { | 30 class VIEWS_EXPORT MouseWatcherHost { |
| 31 public: | 31 public: |
| 32 // The MouseEventType can be used as a hint. | 32 // The type of mouse event. |
| 33 enum MouseEventType { | 33 enum MouseEventType { |
| 34 // The mouse moved within the window which was current when the MouseWatcher | |
| 35 // was created. | |
| 36 MOUSE_MOVE, | 34 MOUSE_MOVE, |
| 37 // The mouse moved exited the window which was current when the MouseWatcher | 35 MOUSE_EXIT, |
| 38 // was created. | 36 MOUSE_PRESS |
| 39 MOUSE_EXIT | |
| 40 }; | 37 }; |
| 41 | 38 |
| 42 virtual ~MouseWatcherHost(); | 39 virtual ~MouseWatcherHost(); |
| 43 | 40 |
| 44 // Return false when the mouse has moved outside the monitored region. | 41 // Return false when the mouse has moved outside the monitored region. |
| 45 virtual bool Contains(const gfx::Point& screen_point, | 42 virtual bool Contains(const gfx::Point& screen_point, |
| 46 MouseEventType type) = 0; | 43 MouseEventType type) = 0; |
| 47 }; | 44 }; |
| 48 | 45 |
| 49 // MouseWatcher is used to watch mouse movement and notify its listener when the | 46 // MouseWatcher is used to watch mouse movement and notify its listener when the |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 88 |
| 92 // See description above setter. | 89 // See description above setter. |
| 93 base::TimeDelta notify_on_exit_time_; | 90 base::TimeDelta notify_on_exit_time_; |
| 94 | 91 |
| 95 DISALLOW_COPY_AND_ASSIGN(MouseWatcher); | 92 DISALLOW_COPY_AND_ASSIGN(MouseWatcher); |
| 96 }; | 93 }; |
| 97 | 94 |
| 98 } // namespace views | 95 } // namespace views |
| 99 | 96 |
| 100 #endif // UI_VIEWS_MOUSE_WATCHER_H_ | 97 #endif // UI_VIEWS_MOUSE_WATCHER_H_ |
| OLD | NEW |