1 // Copyright (c) 2012 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_WM_PUBLIC_TOOLTIP_CLIENT_H_
6 #define UI_WM_PUBLIC_TOOLTIP_CLIENT_H_
8 #include "ui/aura/aura_export.h"
9 #include "ui/gfx/font.h"
19 class ScopedTooltipDisabler
;
21 class AURA_EXPORT TooltipClient
{
23 // Returns the max width of the tooltip when shown at the specified location.
24 virtual int GetMaxWidth(const gfx::Point
& point
,
25 aura::Window
* context
) const = 0;
27 // Informs the shell tooltip manager of change in tooltip for window |target|.
28 virtual void UpdateTooltip(Window
* target
) = 0;
30 // Sets the time after which the tooltip is hidden for Window |target|. If
31 // |timeout_in_ms| is <= 0, the tooltip is shown indefinitely.
32 virtual void SetTooltipShownTimeout(Window
* target
, int timeout_in_ms
) = 0;
35 // Enables/Disables tooltips. This is treated as a reference count. Consumers
36 // must use ScopedTooltipDisabler to enable/disabled tooltips.
37 virtual void SetTooltipsEnabled(bool enable
) = 0;
40 friend class ScopedTooltipDisabler
;
43 AURA_EXPORT
void SetTooltipClient(Window
* root_window
,
44 TooltipClient
* client
);
45 AURA_EXPORT TooltipClient
* GetTooltipClient(Window
* root_window
);
47 // Sets the text for the tooltip. The id is used to determine uniqueness when
48 // the text does not change. For example, if the tooltip text does not change,
49 // but the id does then the position of the tooltip is updated.
50 AURA_EXPORT
void SetTooltipText(Window
* window
,
51 base::string16
* tooltip_text
);
52 AURA_EXPORT
void SetTooltipId(Window
* window
, void* id
);
53 AURA_EXPORT
const base::string16
GetTooltipText(Window
* window
);
54 AURA_EXPORT
const void* GetTooltipId(Window
* window
);
59 #endif // UI_WM_PUBLIC_TOOLTIP_CLIENT_H_