OLD | NEW |
---|---|
(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 UI_AURA_SHELL_SHELL_TOOLTIP_MANAGER_H_ | |
6 #define UI_AURA_SHELL_SHELL_TOOLTIP_MANAGER_H_ | |
7 #pragma once | |
8 | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/string16.h" | |
11 #include "base/timer.h" | |
12 #include "ui/aura/client/tooltip_client.h" | |
13 #include "ui/aura/event_filter.h" | |
14 #include "ui/aura/window_observer.h" | |
15 #include "ui/aura_shell/aura_shell_export.h" | |
16 #include "ui/base/events.h" | |
Ben Goodger (Google)
2011/11/30 22:52:20
don't think you need thsi one here either
varunjain
2011/11/30 23:25:52
Done.
| |
17 #include "ui/gfx/point.h" | |
18 | |
19 namespace aura { | |
20 class KeyEvent; | |
21 class MouseEvent; | |
22 class TouchEvent; | |
23 class Window; | |
24 } | |
25 | |
26 namespace gfx { | |
27 class Canvas; | |
Ben Goodger (Google)
2011/11/30 22:52:20
you can get rid of this now
varunjain
2011/11/30 23:25:52
Done.
| |
28 } | |
29 | |
30 namespace aura_shell { | |
31 | |
32 // ShellTooltipManager provides tooltip functionality for aura shell. | |
33 class AURA_SHELL_EXPORT ShellTooltipManager : public aura::TooltipClient, | |
34 public aura::EventFilter, | |
35 public aura::WindowObserver { | |
36 public: | |
37 ShellTooltipManager(); | |
38 virtual ~ShellTooltipManager(); | |
39 | |
40 // Overridden from aura::TooltipClient. | |
41 void UpdateTooltip(aura::Window* target); | |
42 | |
43 // Overridden from aura::EventFilter. | |
44 virtual bool PreHandleKeyEvent(aura::Window* target, | |
45 aura::KeyEvent* event) OVERRIDE; | |
46 virtual bool PreHandleMouseEvent(aura::Window* target, | |
47 aura::MouseEvent* event) OVERRIDE; | |
48 virtual ui::TouchStatus PreHandleTouchEvent(aura::Window* target, | |
49 aura::TouchEvent* event) OVERRIDE; | |
50 | |
51 // Overridden from aura::WindowObserver. | |
52 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; | |
53 | |
54 private: | |
55 class Tooltip; | |
56 | |
57 void TooltipTimerFired(); | |
58 | |
59 // Updates the tooltip if required (if there is any change in the tooltip | |
60 // text or the aura::Window. | |
61 void UpdateIfRequired(); | |
62 | |
63 aura::Window* tooltip_window_; | |
64 string16 tooltip_text_; | |
65 scoped_ptr<Tooltip> tooltip_; | |
66 | |
67 base::RepeatingTimer<ShellTooltipManager> tooltip_timer_; | |
68 | |
69 gfx::Point curr_mouse_loc_; | |
70 | |
71 DISALLOW_COPY_AND_ASSIGN(ShellTooltipManager); | |
72 }; | |
73 | |
74 } // namespace aura_shell | |
75 | |
76 #endif // UI_AURA_SHELL_SHELL_TOOLTIP_MANAGER_H_ | |
OLD | NEW |