| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_AERO_TOOLTIP_MANAGER_H_ | 5 #ifndef VIEWS_WIDGET_AERO_TOOLTIP_MANAGER_H_ |
| 6 #define VIEWS_WIDGET_AERO_TOOLTIP_MANAGER_H_ | 6 #define VIEWS_WIDGET_AERO_TOOLTIP_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
| 9 #include "base/task.h" | 9 #include "base/task.h" |
| 10 #include "views/widget/tooltip_manager.h" | 10 #include "views/widget/tooltip_manager_win.h" |
| 11 | 11 |
| 12 namespace views { | 12 namespace views { |
| 13 | 13 |
| 14 /////////////////////////////////////////////////////////////////////////////// | 14 /////////////////////////////////////////////////////////////////////////////// |
| 15 // AeroTooltipManager | 15 // AeroTooltipManager |
| 16 // | 16 // |
| 17 // Default Windows tooltips are broken when using our custom window frame | 17 // Default Windows tooltips are broken when using our custom window frame |
| 18 // - as soon as the tooltip receives a WM_MOUSEMOVE event, it starts spewing | 18 // - as soon as the tooltip receives a WM_MOUSEMOVE event, it starts spewing |
| 19 // NCHITTEST messages at its parent window (us). These messages have random | 19 // NCHITTEST messages at its parent window (us). These messages have random |
| 20 // x/y coordinates and can't be ignored, as the DwmDefWindowProc uses | 20 // x/y coordinates and can't be ignored, as the DwmDefWindowProc uses |
| 21 // NCHITTEST messages to determine how to highlight the caption buttons | 21 // NCHITTEST messages to determine how to highlight the caption buttons |
| 22 // (the buttons then flicker as the hit tests sent by the user's mouse | 22 // (the buttons then flicker as the hit tests sent by the user's mouse |
| 23 // trigger different effects to those sent by the tooltip). | 23 // trigger different effects to those sent by the tooltip). |
| 24 // | 24 // |
| 25 // So instead, we have to partially implement tooltips ourselves using | 25 // So instead, we have to partially implement tooltips ourselves using |
| 26 // TTF_TRACKed tooltips. | 26 // TTF_TRACKed tooltips. |
| 27 // | 27 // |
| 28 // TODO(glen): Resolve this with Microsoft. | 28 // TODO(glen): Resolve this with Microsoft. |
| 29 class AeroTooltipManager : public TooltipManager { | 29 class AeroTooltipManager : public TooltipManagerWin { |
| 30 public: | 30 public: |
| 31 AeroTooltipManager(Widget* widget, HWND parent); | 31 explicit AeroTooltipManager(Widget* widget); |
| 32 virtual ~AeroTooltipManager(); | 32 virtual ~AeroTooltipManager(); |
| 33 | 33 |
| 34 virtual void OnMouse(UINT u_msg, WPARAM w_param, LPARAM l_param); | 34 virtual void OnMouse(UINT u_msg, WPARAM w_param, LPARAM l_param); |
| 35 virtual void OnMouseLeave(); | 35 virtual void OnMouseLeave(); |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 void Init(); | 38 void Init(); |
| 39 void OnTimer(); | 39 void OnTimer(); |
| 40 | 40 |
| 41 class InitialTimer : public base::RefCounted<InitialTimer> { | 41 class InitialTimer : public base::RefCounted<InitialTimer> { |
| 42 public: | 42 public: |
| 43 InitialTimer(AeroTooltipManager* manager, int time); | 43 InitialTimer(AeroTooltipManager* manager, int time); |
| 44 void Disown(); | 44 void Disown(); |
| 45 void Execute(); | 45 void Execute(); |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 AeroTooltipManager* manager_; | 48 AeroTooltipManager* manager_; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 int initial_delay_; | 51 int initial_delay_; |
| 52 scoped_refptr<InitialTimer> initial_timer_; | 52 scoped_refptr<InitialTimer> initial_timer_; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 } // namespace views | 55 } // namespace views |
| 56 | 56 |
| 57 #endif // #ifndef VIEWS_WIDGET_AERO_TOOLTIP_MANAGER_H_ | 57 #endif // #ifndef VIEWS_WIDGET_AERO_TOOLTIP_MANAGER_H_ |
| OLD | NEW |