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

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

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix some new gfx::Screen additions Created 8 years, 2 months 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
OLDNEW
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 UI_VIEWS_WIDGET_TOOLTIP_MANAGER_H_ 5 #ifndef UI_VIEWS_WIDGET_TOOLTIP_MANAGER_H_
6 #define UI_VIEWS_WIDGET_TOOLTIP_MANAGER_H_ 6 #define UI_VIEWS_WIDGET_TOOLTIP_MANAGER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/string16.h" 11 #include "base/string16.h"
12 #include "ui/gfx/native_widget_types.h"
12 #include "ui/views/views_export.h" 13 #include "ui/views/views_export.h"
13 14
14 namespace gfx { 15 namespace gfx {
15 class Font; 16 class Font;
16 } // namespace gfx 17 } // namespace gfx
17 18
18 namespace views { 19 namespace views {
19 20
20 class View; 21 class View;
21 22
22 // TooltipManager takes care of the wiring to support tooltips for Views. You 23 // TooltipManager takes care of the wiring to support tooltips for Views. You
23 // almost never need to interact directly with TooltipManager, rather look to 24 // almost never need to interact directly with TooltipManager, rather look to
24 // the various tooltip methods on View. 25 // the various tooltip methods on View.
25 class VIEWS_EXPORT TooltipManager { 26 class VIEWS_EXPORT TooltipManager {
26 public: 27 public:
27 // Returns the height of tooltips. This should only be invoked from within 28 // Returns the height of tooltips. This should only be invoked from within
28 // GetTooltipTextOrigin. 29 // GetTooltipTextOrigin.
29 static int GetTooltipHeight(); 30 static int GetTooltipHeight();
30 31
31 // Returns the default font used by tooltips. 32 // Returns the default font used by tooltips.
32 static gfx::Font GetDefaultFont(); 33 static gfx::Font GetDefaultFont();
33 34
34 // Returns the maximum width of the tooltip. |x| and |y| give the location 35 // Returns the maximum width of the tooltip. |x| and |y| give the location
35 // the tooltip is to be displayed on in screen coordinates. 36 // the tooltip is to be displayed on in screen coordinates.
oshima 2012/10/10 17:58:23 update the comment
scottmg 2012/10/10 19:04:47 Done.
36 static int GetMaxWidth(int x, int y); 37 static int GetMaxWidth(int x, int y, gfx::NativeView context);
37 38
38 TooltipManager() {} 39 TooltipManager() {}
39 virtual ~TooltipManager() {} 40 virtual ~TooltipManager() {}
40 41
41 // Notification that the view hierarchy has changed in some way. 42 // Notification that the view hierarchy has changed in some way.
42 virtual void UpdateTooltip() = 0; 43 virtual void UpdateTooltip() = 0;
43 44
44 // Invoked when the tooltip text changes for the specified views. 45 // Invoked when the tooltip text changes for the specified views.
45 virtual void TooltipTextChanged(View* view) = 0; 46 virtual void TooltipTextChanged(View* view) = 0;
46 47
47 // Invoked when toolbar icon gets focus. 48 // Invoked when toolbar icon gets focus.
48 virtual void ShowKeyboardTooltip(View* view) = 0; 49 virtual void ShowKeyboardTooltip(View* view) = 0;
49 50
50 // Invoked when toolbar loses focus. 51 // Invoked when toolbar loses focus.
51 virtual void HideKeyboardTooltip() = 0; 52 virtual void HideKeyboardTooltip() = 0;
52 53
53 protected: 54 protected:
54 // Trims the tooltip to fit, setting |text| to the clipped result, 55 // Trims the tooltip to fit, setting |text| to the clipped result,
55 // |max_width| to the width (in pixels) of the clipped text and |line_count| 56 // |max_width| to the width (in pixels) of the clipped text and |line_count|
56 // to the number of lines of text in the tooltip. |x| and |y| give the 57 // to the number of lines of text in the tooltip. |x| and |y| give the
57 // location of the tooltip in screen coordinates. 58 // location of the tooltip in screen coordinates.
oshima 2012/10/10 17:58:23 ditto
scottmg 2012/10/10 19:04:47 Done.
58 static void TrimTooltipToFit(string16* text, 59 static void TrimTooltipToFit(string16* text,
59 int* max_width, 60 int* max_width,
60 int* line_count, 61 int* line_count,
61 int x, 62 int x,
62 int y); 63 int y,
64 gfx::NativeView context);
63 }; 65 };
64 66
65 } // namespace views 67 } // namespace views
66 68
67 #endif // UI_VIEWS_WIDGET_TOOLTIP_MANAGER_H_ 69 #endif // UI_VIEWS_WIDGET_TOOLTIP_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698