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

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

Issue 195035: Use MAKEPOINTS instead of GET_X/Y_LPARAM to reduce a dependency on ATL.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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
« no previous file with comments | « views/controls/tree/tree_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #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 <atlbase.h>
9 #include <atlapp.h> // for GET_X/Y_LPARAM
10 #include <commctrl.h> 8 #include <commctrl.h>
11 #include <shlobj.h> 9 #include <shlobj.h>
12 10
13 #include "app/l10n_util_win.h" 11 #include "app/l10n_util_win.h"
12 #include "base/gfx/point.h"
14 #include "base/message_loop.h" 13 #include "base/message_loop.h"
15 14
16 namespace views { 15 namespace views {
17 16
18 /////////////////////////////////////////////////////////////////////////////// 17 ///////////////////////////////////////////////////////////////////////////////
19 // AeroTooltipManager, public: 18 // AeroTooltipManager, public:
20 19
21 AeroTooltipManager::AeroTooltipManager(Widget* widget) 20 AeroTooltipManager::AeroTooltipManager(Widget* widget)
22 : TooltipManagerWin(widget), 21 : TooltipManagerWin(widget),
23 initial_delay_(0) { 22 initial_delay_(0) {
24 } 23 }
25 24
26 AeroTooltipManager::~AeroTooltipManager() { 25 AeroTooltipManager::~AeroTooltipManager() {
27 if (initial_timer_) 26 if (initial_timer_)
28 initial_timer_->Disown(); 27 initial_timer_->Disown();
29 } 28 }
30 29
31 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) {
32 if (initial_timer_) 31 if (initial_timer_)
33 initial_timer_->Disown(); 32 initial_timer_->Disown();
34 33
35 if (u_msg == WM_MOUSEMOVE || u_msg == WM_NCMOUSEMOVE) { 34 if (u_msg == WM_MOUSEMOVE || u_msg == WM_NCMOUSEMOVE) {
36 int x = GET_X_LPARAM(l_param); 35 gfx::Point mouse_pos(l_param);
37 int y = GET_Y_LPARAM(l_param); 36 if (last_mouse_x_ != mouse_pos.x() || last_mouse_y_ != mouse_pos.y()) {
38 if (last_mouse_x_ != x || last_mouse_y_ != y) { 37 last_mouse_x_ = mouse_pos.x();
39 last_mouse_x_ = x; 38 last_mouse_y_ = mouse_pos.y();
40 last_mouse_y_ = y;
41 HideKeyboardTooltip(); 39 HideKeyboardTooltip();
42 UpdateTooltip(x, y); 40 UpdateTooltip(mouse_pos.x(), mouse_pos.y());
43 } 41 }
44 42
45 // Delay opening of the tooltip just in case the user moves their 43 // Delay opening of the tooltip just in case the user moves their
46 // mouse to another control. We defer this from Init because we get 44 // mouse to another control. We defer this from Init because we get
47 // zero if we query it too soon. 45 // zero if we query it too soon.
48 if (!initial_delay_) { 46 if (!initial_delay_) {
49 initial_delay_ = static_cast<int>( 47 initial_delay_ = static_cast<int>(
50 ::SendMessage(tooltip_hwnd_, TTM_GETDELAYTIME, TTDT_INITIAL, 0)); 48 ::SendMessage(tooltip_hwnd_, TTM_GETDELAYTIME, TTDT_INITIAL, 0));
51 } 49 }
52 initial_timer_ = new InitialTimer(this, initial_delay_); 50 initial_timer_ = new InitialTimer(this, initial_delay_);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 void AeroTooltipManager::InitialTimer::Disown() { 117 void AeroTooltipManager::InitialTimer::Disown() {
120 manager_ = NULL; 118 manager_ = NULL;
121 } 119 }
122 120
123 void AeroTooltipManager::InitialTimer::Execute() { 121 void AeroTooltipManager::InitialTimer::Execute() {
124 if (manager_) 122 if (manager_)
125 manager_->OnTimer(); 123 manager_->OnTimer();
126 } 124 }
127 125
128 } // namespace views 126 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/tree/tree_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698