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_
10 #include "base/basictypes.h"
11 #include "base/strings/string16.h"
12 #include "ui/gfx/native_widget_types.h"
13 #include "ui/views/views_export.h"
25 // TooltipManager takes care of the wiring to support tooltips for Views. You
26 // almost never need to interact directly with TooltipManager, rather look to
27 // the various tooltip methods on View.
28 class VIEWS_EXPORT TooltipManager
{
30 // When a NativeView has capture all events are delivered to it. In some
31 // situations, such as menus, we want the tooltip to be shown for the
32 // NativeView the mouse is over, even if it differs from the NativeView that
33 // has capture (with menus the first menu shown has capture). To enable this
34 // if the NativeView that has capture has the same value for the property
35 // |kGroupingPropertyKey| as the NativeView the mouse is over the tooltip is
37 static const char kGroupingPropertyKey
[];
40 virtual ~TooltipManager() {}
42 // Returns the maximum width of the tooltip. |point| gives the location
43 // the tooltip is to be displayed on in screen coordinates. |context| is
44 // used to determine which gfx::Screen should be used.
45 virtual int GetMaxWidth(const gfx::Point
& location
,
46 gfx::NativeView context
) const = 0;
48 // Returns the font list used for tooltips.
49 virtual const gfx::FontList
& GetFontList() const = 0;
51 // Notification that the view hierarchy has changed in some way.
52 virtual void UpdateTooltip() = 0;
54 // Invoked when the tooltip text changes for the specified views.
55 virtual void TooltipTextChanged(View
* view
) = 0;
60 #endif // UI_VIEWS_WIDGET_TOOLTIP_MANAGER_H_