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

Side by Side Diff: ui/views/widget/tooltip_manager_views.h

Issue 8769011: Reland change for aura tooltips that was revert due to build break: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moved exclude to gyp file Created 9 years 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 | « ui/views/widget/tooltip_manager_aura.cc ('k') | ui/views/widget/tooltip_manager_views.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_VIEWS_WIDGET_TOOLTIP_MANAGER_VIEWS_H_
6 #define UI_VIEWS_WIDGET_TOOLTIP_MANAGER_VIEWS_H_
7 #pragma once
8
9 #include "base/message_loop.h"
10 #include "base/timer.h"
11 #include "ui/views/controls/label.h"
12 #include "ui/views/view.h"
13 #include "ui/views/widget/native_widget.h"
14 #include "ui/views/widget/tooltip_manager.h"
15 #include "ui/views/widget/widget_delegate.h"
16
17 #if defined(USE_X11)
18 typedef union _XEvent XEvent;
19 #endif
20
21 namespace views {
22
23 class MouseEvent;
24 class Widget;
25
26 // TooltipManager implementation for Views.
27 class TooltipManagerViews : public TooltipManager {
28 public:
29 explicit TooltipManagerViews(views::View* root_view);
30 virtual ~TooltipManagerViews();
31
32 // Updates the state of the tooltip based on the mouse event. The mouse event
33 // is the same event that goes to a Widget (i.e. it is in the Widget's
34 // coordinate system).
35 void UpdateForMouseEvent(const MouseEvent& event);
36
37 // TooltipManager.
38 virtual void UpdateTooltip() OVERRIDE;
39 virtual void TooltipTextChanged(View* view) OVERRIDE;
40 virtual void ShowKeyboardTooltip(View* view) OVERRIDE;
41 virtual void HideKeyboardTooltip() OVERRIDE;
42
43 private:
44 void TooltipTimerFired();
45 View* GetViewForTooltip(int x, int y, bool for_keyboard);
46
47 // Updates the tooltip if required (if there is any change in the tooltip
48 // text or the view.
49 void UpdateIfRequired(int x, int y, bool for_keyboard);
50
51 // Updates the tooltip. Gets the tooltip text from tooltip_view_ and displays
52 // it at the current mouse position.
53 void Update();
54
55 // Adjusts the bounds given by the arguments to fit inside the parent view
56 // and applies the adjusted bounds to the tooltip_label_.
57 void SetTooltipBounds(gfx::Point mouse_pos, int tooltip_width,
58 int tooltip_height);
59
60 // Creates a widget of type TYPE_TOOLTIP
61 Widget* CreateTooltip();
62
63 // Invoked when the mose moves.
64 void OnMouseMoved(int x, int y);
65
66 scoped_ptr<Widget> tooltip_widget_;
67 views::View* root_view_;
68 View* tooltip_view_;
69 string16 tooltip_text_;
70 Label tooltip_label_;
71
72 gfx::Point curr_mouse_pos_;
73 base::RepeatingTimer<TooltipManagerViews> tooltip_timer_;
74
75 DISALLOW_COPY_AND_ASSIGN(TooltipManagerViews);
76 };
77
78 } // namespace views
79
80 #endif // UI_VIEWS_WIDGET_TOOLTIP_MANAGER_VIEWS_H_
OLDNEW
« no previous file with comments | « ui/views/widget/tooltip_manager_aura.cc ('k') | ui/views/widget/tooltip_manager_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698