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 #include <limits> | 5 #include <limits> |
6 | 6 |
7 #include "chrome/common/gfx/chrome_font.h" | 7 #include "chrome/common/gfx/chrome_font.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "chrome/common/l10n_util.h" | 10 #include "chrome/common/l10n_util.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 // Clamp the tooltip length to kMaxTooltipLength so that we don't | 283 // Clamp the tooltip length to kMaxTooltipLength so that we don't |
284 // accidentally DOS the user with a mega tooltip (since Windows doesn't seem | 284 // accidentally DOS the user with a mega tooltip (since Windows doesn't seem |
285 // to do this itself). | 285 // to do this itself). |
286 if (text->length() > kMaxTooltipLength) | 286 if (text->length() > kMaxTooltipLength) |
287 *text = text->substr(0, kMaxTooltipLength); | 287 *text = text->substr(0, kMaxTooltipLength); |
288 | 288 |
289 // Determine the available width for the tooltip. | 289 // Determine the available width for the tooltip. |
290 gfx::Point screen_loc(position_x, position_y); | 290 gfx::Point screen_loc(position_x, position_y); |
291 View::ConvertPointToScreen(widget_->GetRootView(), &screen_loc); | 291 View::ConvertPointToScreen(widget_->GetRootView(), &screen_loc); |
292 gfx::Rect monitor_bounds = | 292 gfx::Rect monitor_bounds = |
293 win_util::GetMonitorBoundsForRect(gfx::Rect(screen_loc.x(), screen_loc.y()
, | 293 win_util::GetMonitorBoundsForRect(gfx::Rect(screen_loc.x(), |
| 294 screen_loc.y(), |
294 0, 0)); | 295 0, 0)); |
295 RECT tooltip_margin; | 296 RECT tooltip_margin; |
296 SendMessage(window, TTM_GETMARGIN, 0, (LPARAM)&tooltip_margin); | 297 SendMessage(window, TTM_GETMARGIN, 0, (LPARAM)&tooltip_margin); |
297 const int available_width = monitor_bounds.width() - tooltip_margin.left - | 298 const int available_width = monitor_bounds.width() - tooltip_margin.left - |
298 tooltip_margin.right; | 299 tooltip_margin.right; |
299 if (available_width <= 0) | 300 if (available_width <= 0) |
300 return; | 301 return; |
301 | 302 |
302 // Split the string. | 303 // Split the string. |
303 std::vector<std::wstring> lines; | 304 std::vector<std::wstring> lines; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 keyboard_tooltip_hwnd_ = NULL; | 436 keyboard_tooltip_hwnd_ = NULL; |
436 } | 437 } |
437 } | 438 } |
438 | 439 |
439 void TooltipManager::DestroyKeyboardTooltipWindow(HWND window_to_destroy) { | 440 void TooltipManager::DestroyKeyboardTooltipWindow(HWND window_to_destroy) { |
440 if (keyboard_tooltip_hwnd_ == window_to_destroy) | 441 if (keyboard_tooltip_hwnd_ == window_to_destroy) |
441 HideKeyboardTooltip(); | 442 HideKeyboardTooltip(); |
442 } | 443 } |
443 | 444 |
444 } // namespace views | 445 } // namespace views |
OLD | NEW |