Index: views/widget/tooltip_manager_win.h |
=================================================================== |
--- views/widget/tooltip_manager_win.h (revision 17029) |
+++ views/widget/tooltip_manager_win.h (working copy) |
@@ -2,15 +2,17 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef VIEWS_WIDGET_TOOLTIP_MANAGER_H_ |
-#define VIEWS_WIDGET_TOOLTIP_MANAGER_H_ |
+#ifndef VIEWS_WIDGET_TOOLTIP_MANAGER_WIN_H_ |
+#define VIEWS_WIDGET_TOOLTIP_MANAGER_WIN_H_ |
#include <windows.h> |
#include <commctrl.h> |
- |
#include <string> |
+ |
#include "base/basictypes.h" |
+#include "base/gfx/native_widget_types.h" |
#include "base/task.h" |
+#include "views/widget/tooltip_manager.h" |
namespace gfx { |
class Font; |
@@ -21,8 +23,9 @@ |
class View; |
class Widget; |
-// TooltipManager takes care of the wiring to support tooltips for Views. |
-// This class is intended to be used by Widgets. To use this, you must |
+// TooltipManager implementation for Windows. |
+// |
+// This class is intended to be used by WidgetWin. To use this, you must |
// do the following: |
// Add the following to your MSG_MAP: |
// |
@@ -49,34 +52,24 @@ |
// |
// Lastly, you'll need to override GetTooltipManager. |
// |
-// See XPFrame for an example of this in action. |
-class TooltipManager { |
+// See WidgetWin for an example of this in action. |
+class TooltipManagerWin : public TooltipManager { |
public: |
- // Returns the height of tooltips. This should only be invoked from within |
- // GetTooltipTextOrigin. |
- static int GetTooltipHeight(); |
- |
- // Returns the default font used by tooltips. |
- static gfx::Font GetDefaultFont(); |
- |
- // Returns the separator for lines of text in a tooltip. |
- static const std::wstring& GetLineSeparator(); |
- |
// Creates a TooltipManager for the specified Widget and parent window. |
- TooltipManager(Widget* widget, HWND parent); |
- virtual ~TooltipManager(); |
+ explicit TooltipManagerWin(Widget* widget); |
+ virtual ~TooltipManagerWin(); |
// Notification that the view hierarchy has changed in some way. |
- void UpdateTooltip(); |
+ virtual void UpdateTooltip(); |
// Invoked when the tooltip text changes for the specified views. |
- void TooltipTextChanged(View* view); |
+ virtual void TooltipTextChanged(View* view); |
// Invoked when toolbar icon gets focus. |
- void ShowKeyboardTooltip(View* view); |
+ virtual void ShowKeyboardTooltip(View* view); |
// Invoked when toolbar loses focus. |
- void HideKeyboardTooltip(); |
+ virtual void HideKeyboardTooltip(); |
// Message handlers. These forward to the tooltip control. |
virtual void OnMouse(UINT u_msg, WPARAM w_param, LPARAM l_param); |
@@ -87,12 +80,12 @@ |
protected: |
virtual void Init(); |
+ // Returns the Widget we're showing tooltips for. |
+ gfx::NativeView GetParent(); |
+ |
// Updates the tooltip for the specified location. |
void UpdateTooltip(int x, int y); |
- // Parent window the tooltip is added to. |
- HWND parent_; |
- |
// Tooltip control window. |
HWND tooltip_hwnd_; |
@@ -152,19 +145,16 @@ |
// Width of the last tooltip. |
int tooltip_width_; |
- // Height for a tooltip; lazily calculated. |
- static int tooltip_height_; |
- |
// control window for tooltip displayed using keyboard. |
HWND keyboard_tooltip_hwnd_; |
// Used to register DestroyTooltipWindow function with PostDelayedTask |
// function. |
- ScopedRunnableMethodFactory<TooltipManager> keyboard_tooltip_factory_; |
+ ScopedRunnableMethodFactory<TooltipManagerWin> keyboard_tooltip_factory_; |
- DISALLOW_EVIL_CONSTRUCTORS(TooltipManager); |
+ DISALLOW_COPY_AND_ASSIGN(TooltipManagerWin); |
}; |
} // namespace views |
-#endif // VIEWS_WIDGET_TOOLTIP_MANAGER_H_ |
+#endif // VIEWS_WIDGET_TOOLTIP_MANAGER_WIN_H_ |