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

Side by Side Diff: ui/views/widget/tooltip_manager_win.cc

Issue 9348025: Revert 116551 - Fix bug 62037: Task manager tooltips appear behind task manager if 'Always on Top... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 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 | « content/browser/renderer_host/render_widget_host_view_win.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) 2012 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 #include "ui/views/widget/tooltip_manager_win.h" 5 #include "ui/views/widget/tooltip_manager_win.h"
6 6
7 #include <windowsx.h> 7 #include <windowsx.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 if (tooltip_hwnd_) 83 if (tooltip_hwnd_)
84 DestroyWindow(tooltip_hwnd_); 84 DestroyWindow(tooltip_hwnd_);
85 if (keyboard_tooltip_hwnd_) 85 if (keyboard_tooltip_hwnd_)
86 DestroyWindow(keyboard_tooltip_hwnd_); 86 DestroyWindow(keyboard_tooltip_hwnd_);
87 } 87 }
88 88
89 bool TooltipManagerWin::Init() { 89 bool TooltipManagerWin::Init() {
90 DCHECK(!tooltip_hwnd_); 90 DCHECK(!tooltip_hwnd_);
91 // Create the tooltip control. 91 // Create the tooltip control.
92 tooltip_hwnd_ = CreateWindowEx( 92 tooltip_hwnd_ = CreateWindowEx(
93 WS_EX_TRANSPARENT | WS_EX_TOPMOST | l10n_util::GetExtendedTooltipStyles(), 93 WS_EX_TRANSPARENT | l10n_util::GetExtendedTooltipStyles(),
94 TOOLTIPS_CLASS, NULL, TTS_NOPREFIX, 0, 0, 0, 0, 94 TOOLTIPS_CLASS, NULL, TTS_NOPREFIX, 0, 0, 0, 0,
95 GetParent(), NULL, NULL, NULL); 95 GetParent(), NULL, NULL, NULL);
96 if (!tooltip_hwnd_) 96 if (!tooltip_hwnd_)
97 return false; 97 return false;
98 98
99 l10n_util::AdjustUIFontForWindow(tooltip_hwnd_); 99 l10n_util::AdjustUIFontForWindow(tooltip_hwnd_);
100 100
101 // This effectively turns off clipping of tooltips. We need this otherwise 101 // This effectively turns off clipping of tooltips. We need this otherwise
102 // multi-line text (\r\n) won't work right. The size doesn't really matter 102 // multi-line text (\r\n) won't work right. The size doesn't really matter
103 // (just as long as its bigger than the monitor's width) as we clip to the 103 // (just as long as its bigger than the monitor's width) as we clip to the
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 tooltip_text_.clear(); 326 tooltip_text_.clear();
327 } 327 }
328 HideKeyboardTooltip(); 328 HideKeyboardTooltip();
329 string16 tooltip_text; 329 string16 tooltip_text;
330 if (!focused_view->GetTooltipText(gfx::Point(), &tooltip_text)) 330 if (!focused_view->GetTooltipText(gfx::Point(), &tooltip_text))
331 return; 331 return;
332 gfx::Rect focused_bounds = focused_view->bounds(); 332 gfx::Rect focused_bounds = focused_view->bounds();
333 gfx::Point screen_point; 333 gfx::Point screen_point;
334 focused_view->ConvertPointToScreen(focused_view, &screen_point); 334 focused_view->ConvertPointToScreen(focused_view, &screen_point);
335 keyboard_tooltip_hwnd_ = CreateWindowEx( 335 keyboard_tooltip_hwnd_ = CreateWindowEx(
336 WS_EX_TRANSPARENT | WS_EX_TOPMOST | l10n_util::GetExtendedTooltipStyles(), 336 WS_EX_TRANSPARENT | l10n_util::GetExtendedTooltipStyles(),
337 TOOLTIPS_CLASS, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL); 337 TOOLTIPS_CLASS, NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
338 if (!keyboard_tooltip_hwnd_) 338 if (!keyboard_tooltip_hwnd_)
339 return; 339 return;
340 340
341 SendMessage(keyboard_tooltip_hwnd_, TTM_SETMAXTIPWIDTH, 0, 341 SendMessage(keyboard_tooltip_hwnd_, TTM_SETMAXTIPWIDTH, 0,
342 std::numeric_limits<int16>::max()); 342 std::numeric_limits<int16>::max());
343 int tooltip_width; 343 int tooltip_width;
344 int line_count; 344 int line_count;
345 TrimTooltipToFit(&tooltip_text, &tooltip_width, &line_count, 345 TrimTooltipToFit(&tooltip_text, &tooltip_width, &line_count,
346 screen_point.x(), screen_point.y()); 346 screen_point.x(), screen_point.y());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 keyboard_tooltip_hwnd_ = NULL; 382 keyboard_tooltip_hwnd_ = NULL;
383 } 383 }
384 } 384 }
385 385
386 void TooltipManagerWin::DestroyKeyboardTooltipWindow(HWND window_to_destroy) { 386 void TooltipManagerWin::DestroyKeyboardTooltipWindow(HWND window_to_destroy) {
387 if (keyboard_tooltip_hwnd_ == window_to_destroy) 387 if (keyboard_tooltip_hwnd_ == window_to_destroy)
388 HideKeyboardTooltip(); 388 HideKeyboardTooltip();
389 } 389 }
390 390
391 } // namespace views 391 } // namespace views
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698