Fix build break
[chromium-blink-merge.git] / ui / views / widget / tooltip_manager.h
blob105cc5fef392845b2e28eef62156607da80b6329
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.
5 #ifndef UI_VIEWS_WIDGET_TOOLTIP_MANAGER_H_
6 #define UI_VIEWS_WIDGET_TOOLTIP_MANAGER_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/string16.h"
12 #include "ui/gfx/native_widget_types.h"
13 #include "ui/views/views_export.h"
15 namespace gfx {
16 class Font;
17 } // namespace gfx
19 namespace views {
21 class View;
23 // TooltipManager takes care of the wiring to support tooltips for Views. You
24 // almost never need to interact directly with TooltipManager, rather look to
25 // the various tooltip methods on View.
26 class VIEWS_EXPORT TooltipManager {
27 public:
28 // Returns the height of tooltips. This should only be invoked from within
29 // GetTooltipTextOrigin.
30 static int GetTooltipHeight();
32 // Returns the default font used by tooltips.
33 static gfx::Font GetDefaultFont();
35 // Returns the maximum width of the tooltip. |x| and |y| give the location
36 // the tooltip is to be displayed on in screen coordinates. |context| is
37 // used to determine which gfx::Screen should be used.
38 static int GetMaxWidth(int x, int y, gfx::NativeView context);
40 TooltipManager() {}
41 virtual ~TooltipManager() {}
43 // Notification that the view hierarchy has changed in some way.
44 virtual void UpdateTooltip() = 0;
46 // Invoked when the tooltip text changes for the specified views.
47 virtual void TooltipTextChanged(View* view) = 0;
49 // Invoked when toolbar icon gets focus.
50 virtual void ShowKeyboardTooltip(View* view) = 0;
52 // Invoked when toolbar loses focus.
53 virtual void HideKeyboardTooltip() = 0;
55 protected:
56 // Trims the tooltip to fit, setting |text| to the clipped result,
57 // |max_width| to the width (in pixels) of the clipped text and |line_count|
58 // to the number of lines of text in the tooltip. |x| and |y| give the
59 // location of the tooltip in screen coordinates. |context| is used to
60 // determine which gfx::Screen should be used.
61 static void TrimTooltipToFit(string16* text,
62 int* max_width,
63 int* line_count,
64 int x,
65 int y,
66 gfx::NativeView context);
69 } // namespace views
71 #endif // UI_VIEWS_WIDGET_TOOLTIP_MANAGER_H_