1 // Copyright 2013 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_COREWM_TOOLTIP_WIN_H_
6 #define UI_VIEWS_COREWM_TOOLTIP_WIN_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/strings/string16.h"
11 #include "ui/gfx/geometry/point.h"
12 #include "ui/views/corewm/tooltip.h"
20 // Implementation of Tooltip that uses the native win32 control for showing the
22 class VIEWS_EXPORT TooltipWin
: public Tooltip
{
24 explicit TooltipWin(HWND parent
);
25 ~TooltipWin() override
;
27 // HandleNotify() is forwarded from DesktopWindowTreeHostWin to keep the
28 // native tooltip in sync.
29 bool HandleNotify(int w_param
, NMHDR
* l_param
, LRESULT
* l_result
);
32 // Ensures |tooltip_hwnd_| is valid. Returns true if valid, false if there
33 // a problem creating |tooltip_hwnd_|.
34 bool EnsureTooltipWindow();
36 // Sets the position of the tooltip.
37 void PositionTooltip();
40 int GetMaxWidth(const gfx::Point
& location
,
41 aura::Window
* context
) const override
;
42 void SetText(aura::Window
* window
,
43 const base::string16
& tooltip_text
,
44 const gfx::Point
& location
) override
;
47 bool IsVisible() override
;
49 // The window |tooltip_hwnd_| is parented to.
55 // Used to modify the tooltip.
58 // Is the tooltip showing?
61 // Location to show the tooltip at. In order to position the tooltip we need
62 // to know the size. The size is only available from TTN_SHOW, so we have to
66 DISALLOW_COPY_AND_ASSIGN(TooltipWin
);
72 #endif // UI_VIEWS_COREWM_TOOLTIP_WIN_H_