OLD | NEW |
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_MOUSE_WATCHER_H_ | 5 #ifndef VIEWS_MOUSE_WATCHER_H_ |
6 #define VIEWS_MOUSE_WATCHER_H_ | 6 #define 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" |
11 #include "ui/gfx/insets.h" | 11 #include "ui/gfx/insets.h" |
12 #include "views/views_api.h" | 12 #include "views/views_export.h" |
13 | 13 |
14 namespace views { | 14 namespace views { |
15 | 15 |
16 class View; | 16 class View; |
17 | 17 |
18 // MouseWatcherListener is notified when the mouse moves outside the view. | 18 // MouseWatcherListener is notified when the mouse moves outside the view. |
19 class VIEWS_API MouseWatcherListener { | 19 class VIEWS_EXPORT MouseWatcherListener { |
20 public: | 20 public: |
21 virtual void MouseMovedOutOfView() = 0; | 21 virtual void MouseMovedOutOfView() = 0; |
22 | 22 |
23 protected: | 23 protected: |
24 virtual ~MouseWatcherListener(); | 24 virtual ~MouseWatcherListener(); |
25 }; | 25 }; |
26 | 26 |
27 // MouseWatcher is used to watch mouse movement and notify its listener when the | 27 // MouseWatcher is used to watch mouse movement and notify its listener when the |
28 // mouse moves outside the bounds of a view. | 28 // mouse moves outside the bounds of a view. |
29 class VIEWS_API MouseWatcher { | 29 class VIEWS_EXPORT MouseWatcher { |
30 public: | 30 public: |
31 // Creates a new MouseWatcher. |hot_zone_insets| is added to the bounds of | 31 // Creates a new MouseWatcher. |hot_zone_insets| is added to the bounds of |
32 // the view to determine the active zone. For example, if | 32 // the view to determine the active zone. For example, if |
33 // |hot_zone_insets.bottom()| is 10, then the listener is not notified if | 33 // |hot_zone_insets.bottom()| is 10, then the listener is not notified if |
34 // the y coordinate is between the origin of the view and height of the view | 34 // the y coordinate is between the origin of the view and height of the view |
35 // plus 10. | 35 // plus 10. |
36 MouseWatcher(views::View* host, | 36 MouseWatcher(views::View* host, |
37 MouseWatcherListener* listener, | 37 MouseWatcherListener* listener, |
38 const gfx::Insets& hot_zone_insets); | 38 const gfx::Insets& hot_zone_insets); |
39 ~MouseWatcher(); | 39 ~MouseWatcher(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 // See description above setter. | 75 // See description above setter. |
76 int notify_on_exit_time_ms_; | 76 int notify_on_exit_time_ms_; |
77 | 77 |
78 DISALLOW_COPY_AND_ASSIGN(MouseWatcher); | 78 DISALLOW_COPY_AND_ASSIGN(MouseWatcher); |
79 }; | 79 }; |
80 | 80 |
81 } // namespace views | 81 } // namespace views |
82 | 82 |
83 #endif // VIEWS_MOUSE_WATCHER_H_ | 83 #endif // VIEWS_MOUSE_WATCHER_H_ |
OLD | NEW |