| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VIEWS_WIDGET_TOOLTIP_MANAGER_WIN_H_ | 5 #ifndef VIEWS_WIDGET_TOOLTIP_MANAGER_WIN_H_ |
| 6 #define VIEWS_WIDGET_TOOLTIP_MANAGER_WIN_H_ | 6 #define VIEWS_WIDGET_TOOLTIP_MANAGER_WIN_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #include <commctrl.h> | 10 #include <commctrl.h> |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // | 55 // |
| 56 // Lastly, you'll need to override GetTooltipManager. | 56 // Lastly, you'll need to override GetTooltipManager. |
| 57 // | 57 // |
| 58 // See NativeWidgetWin for an example of this in action. | 58 // See NativeWidgetWin for an example of this in action. |
| 59 class TooltipManagerWin : public TooltipManager { | 59 class TooltipManagerWin : public TooltipManager { |
| 60 public: | 60 public: |
| 61 // Creates a TooltipManager for the specified Widget and parent window. | 61 // Creates a TooltipManager for the specified Widget and parent window. |
| 62 explicit TooltipManagerWin(Widget* widget); | 62 explicit TooltipManagerWin(Widget* widget); |
| 63 virtual ~TooltipManagerWin(); | 63 virtual ~TooltipManagerWin(); |
| 64 | 64 |
| 65 // Initializes the TooltipManager returning whether initialization was |
| 66 // successful. If this returns false the TooltipManager should be destroyed |
| 67 // and not used. |
| 68 bool Init(); |
| 69 |
| 65 // Notification that the view hierarchy has changed in some way. | 70 // Notification that the view hierarchy has changed in some way. |
| 66 virtual void UpdateTooltip(); | 71 virtual void UpdateTooltip(); |
| 67 | 72 |
| 68 // Invoked when the tooltip text changes for the specified views. | 73 // Invoked when the tooltip text changes for the specified views. |
| 69 virtual void TooltipTextChanged(View* view); | 74 virtual void TooltipTextChanged(View* view); |
| 70 | 75 |
| 71 // Invoked when toolbar icon gets focus. | 76 // Invoked when toolbar icon gets focus. |
| 72 virtual void ShowKeyboardTooltip(View* view); | 77 virtual void ShowKeyboardTooltip(View* view); |
| 73 | 78 |
| 74 // Invoked when toolbar loses focus. | 79 // Invoked when toolbar loses focus. |
| 75 virtual void HideKeyboardTooltip(); | 80 virtual void HideKeyboardTooltip(); |
| 76 | 81 |
| 77 // Message handlers. These forward to the tooltip control. | 82 // Message handlers. These forward to the tooltip control. |
| 78 virtual void OnMouse(UINT u_msg, WPARAM w_param, LPARAM l_param); | 83 virtual void OnMouse(UINT u_msg, WPARAM w_param, LPARAM l_param); |
| 79 LRESULT OnNotify(int w_param, NMHDR* l_param, bool* handled); | 84 LRESULT OnNotify(int w_param, NMHDR* l_param, bool* handled); |
| 80 | 85 |
| 81 protected: | 86 protected: |
| 82 virtual void Init(); | |
| 83 | |
| 84 // Returns the Widget we're showing tooltips for. | 87 // Returns the Widget we're showing tooltips for. |
| 85 gfx::NativeView GetParent(); | 88 gfx::NativeView GetParent(); |
| 86 | 89 |
| 87 // Updates the tooltip for the specified location. | 90 // Updates the tooltip for the specified location. |
| 88 void UpdateTooltip(const gfx::Point& location); | 91 void UpdateTooltip(const gfx::Point& location); |
| 89 | 92 |
| 90 // Tooltip control window. | 93 // Tooltip control window. |
| 91 HWND tooltip_hwnd_; | 94 HWND tooltip_hwnd_; |
| 92 | 95 |
| 93 // Tooltip information. | 96 // Tooltip information. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // Used to register DestroyTooltipWindow function with PostDelayedTask | 144 // Used to register DestroyTooltipWindow function with PostDelayedTask |
| 142 // function. | 145 // function. |
| 143 ScopedRunnableMethodFactory<TooltipManagerWin> keyboard_tooltip_factory_; | 146 ScopedRunnableMethodFactory<TooltipManagerWin> keyboard_tooltip_factory_; |
| 144 | 147 |
| 145 DISALLOW_COPY_AND_ASSIGN(TooltipManagerWin); | 148 DISALLOW_COPY_AND_ASSIGN(TooltipManagerWin); |
| 146 }; | 149 }; |
| 147 | 150 |
| 148 } // namespace views | 151 } // namespace views |
| 149 | 152 |
| 150 #endif // VIEWS_WIDGET_TOOLTIP_MANAGER_WIN_H_ | 153 #endif // VIEWS_WIDGET_TOOLTIP_MANAGER_WIN_H_ |
| OLD | NEW |