| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 gfx::Font TooltipManager::GetDefaultFont() { | 54 gfx::Font TooltipManager::GetDefaultFont() { |
| 55 static gfx::Font* font = NULL; | 55 static gfx::Font* font = NULL; |
| 56 if (!font) | 56 if (!font) |
| 57 font = new gfx::Font(DetermineDefaultFont()); | 57 font = new gfx::Font(DetermineDefaultFont()); |
| 58 return *font; | 58 return *font; |
| 59 } | 59 } |
| 60 | 60 |
| 61 // static | 61 // static |
| 62 int TooltipManager::GetMaxWidth(int x, int y) { | 62 int TooltipManager::GetMaxWidth(int x, int y) { |
| 63 gfx::Rect monitor_bounds = | 63 gfx::Rect monitor_bounds = |
| 64 gfx::Screen::GetMonitorNearestPoint(gfx::Point(x, y)).bounds(); | 64 gfx::Screen::GetDisplayNearestPoint(gfx::Point(x, y)).bounds(); |
| 65 // Allow the tooltip to be almost as wide as the screen. | 65 // Allow the tooltip to be almost as wide as the screen. |
| 66 // Otherwise, we would truncate important text, since we're not word-wrapping | 66 // Otherwise, we would truncate important text, since we're not word-wrapping |
| 67 // the text onto multiple lines. | 67 // the text onto multiple lines. |
| 68 return monitor_bounds.width() == 0 ? 800 : monitor_bounds.width() - 30; | 68 return monitor_bounds.width() == 0 ? 800 : monitor_bounds.width() - 30; |
| 69 } | 69 } |
| 70 | 70 |
| 71 TooltipManagerWin::TooltipManagerWin(Widget* widget) | 71 TooltipManagerWin::TooltipManagerWin(Widget* widget) |
| 72 : widget_(widget), | 72 : widget_(widget), |
| 73 tooltip_hwnd_(NULL), | 73 tooltip_hwnd_(NULL), |
| 74 last_mouse_pos_(-1, -1), | 74 last_mouse_pos_(-1, -1), |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 keyboard_tooltip_hwnd_ = NULL; | 381 keyboard_tooltip_hwnd_ = NULL; |
| 382 } | 382 } |
| 383 } | 383 } |
| 384 | 384 |
| 385 void TooltipManagerWin::DestroyKeyboardTooltipWindow(HWND window_to_destroy) { | 385 void TooltipManagerWin::DestroyKeyboardTooltipWindow(HWND window_to_destroy) { |
| 386 if (keyboard_tooltip_hwnd_ == window_to_destroy) | 386 if (keyboard_tooltip_hwnd_ == window_to_destroy) |
| 387 HideKeyboardTooltip(); | 387 HideKeyboardTooltip(); |
| 388 } | 388 } |
| 389 | 389 |
| 390 } // namespace views | 390 } // namespace views |
| OLD | NEW |