Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: views/widget/aero_tooltip_manager.cc

Issue 6756043: Consolidate Widget Event code, other cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Additional code consolidation, move base defs, nix MakeMSG, TooltipManager cleanup, etc. Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "views/widget/aero_tooltip_manager.h" 5 #include "views/widget/aero_tooltip_manager.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <commctrl.h> 8 #include <commctrl.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 10
(...skipping 10 matching lines...) Expand all
21 : TooltipManagerWin(widget), 21 : TooltipManagerWin(widget),
22 initial_delay_(0) { 22 initial_delay_(0) {
23 } 23 }
24 24
25 AeroTooltipManager::~AeroTooltipManager() { 25 AeroTooltipManager::~AeroTooltipManager() {
26 if (initial_timer_) 26 if (initial_timer_)
27 initial_timer_->Disown(); 27 initial_timer_->Disown();
28 } 28 }
29 29
30 void AeroTooltipManager::OnMouse(UINT u_msg, WPARAM w_param, LPARAM l_param) { 30 void AeroTooltipManager::OnMouse(UINT u_msg, WPARAM w_param, LPARAM l_param) {
31 if (u_msg == WM_MOUSELEAVE) {
32 last_mouse_pos_.SetPoint(-1, -1);
33 UpdateTooltip();
34 return;
35 }
36
31 if (initial_timer_) 37 if (initial_timer_)
32 initial_timer_->Disown(); 38 initial_timer_->Disown();
33 39
34 if (u_msg == WM_MOUSEMOVE || u_msg == WM_NCMOUSEMOVE) { 40 if (u_msg == WM_MOUSEMOVE || u_msg == WM_NCMOUSEMOVE) {
35 gfx::Point mouse_pos(l_param); 41 gfx::Point mouse_pos(l_param);
36 if (u_msg == WM_NCMOUSEMOVE) { 42 if (u_msg == WM_NCMOUSEMOVE) {
37 // NC message coordinates are in screen coordinates. 43 // NC message coordinates are in screen coordinates.
38 POINT temp = mouse_pos.ToPOINT(); 44 POINT temp = mouse_pos.ToPOINT();
39 ::MapWindowPoints(HWND_DESKTOP, GetParent(), &temp, 1); 45 ::MapWindowPoints(HWND_DESKTOP, GetParent(), &temp, 1);
40 mouse_pos.SetPoint(temp.x, temp.y); 46 mouse_pos.SetPoint(temp.x, temp.y);
(...skipping 14 matching lines...) Expand all
55 initial_timer_ = new InitialTimer(this); 61 initial_timer_ = new InitialTimer(this);
56 initial_timer_->Start(initial_delay_); 62 initial_timer_->Start(initial_delay_);
57 } else { 63 } else {
58 // Hide the tooltip and cancel any timers. 64 // Hide the tooltip and cancel any timers.
59 ::SendMessage(tooltip_hwnd_, TTM_POP, 0, 0); 65 ::SendMessage(tooltip_hwnd_, TTM_POP, 0, 0);
60 ::SendMessage(tooltip_hwnd_, TTM_TRACKACTIVATE, false, (LPARAM)&toolinfo_); 66 ::SendMessage(tooltip_hwnd_, TTM_TRACKACTIVATE, false, (LPARAM)&toolinfo_);
61 return; 67 return;
62 } 68 }
63 } 69 }
64 70
65 void AeroTooltipManager::OnMouseLeave() {
66 last_mouse_pos_.SetPoint(-1, -1);
67 UpdateTooltip();
68 }
69
70 /////////////////////////////////////////////////////////////////////////////// 71 ///////////////////////////////////////////////////////////////////////////////
71 // AeroTooltipManager, private: 72 // AeroTooltipManager, private:
72 73
73 void AeroTooltipManager::Init() { 74 void AeroTooltipManager::Init() {
74 // Create the tooltip control. 75 // Create the tooltip control.
75 tooltip_hwnd_ = CreateWindowEx( 76 tooltip_hwnd_ = CreateWindowEx(
76 WS_EX_TRANSPARENT | l10n_util::GetExtendedTooltipStyles(), 77 WS_EX_TRANSPARENT | l10n_util::GetExtendedTooltipStyles(),
77 TOOLTIPS_CLASS, NULL, TTS_NOPREFIX, 0, 0, 0, 0, 78 TOOLTIPS_CLASS, NULL, TTS_NOPREFIX, 0, 0, 0, 0,
78 GetParent(), NULL, NULL, NULL); 79 GetParent(), NULL, NULL, NULL);
79 80
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 void AeroTooltipManager::InitialTimer::Disown() { 125 void AeroTooltipManager::InitialTimer::Disown() {
125 manager_ = NULL; 126 manager_ = NULL;
126 } 127 }
127 128
128 void AeroTooltipManager::InitialTimer::Execute() { 129 void AeroTooltipManager::InitialTimer::Execute() {
129 if (manager_) 130 if (manager_)
130 manager_->OnTimer(); 131 manager_->OnTimer();
131 } 132 }
132 133
133 } // namespace views 134 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698