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 #include <vector> | 10 #include <vector> |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 if (view != last_tooltip_view_) { | 308 if (view != last_tooltip_view_) { |
309 // NOTE: This *must* be sent regardless of the visibility of the tooltip. | 309 // NOTE: This *must* be sent regardless of the visibility of the tooltip. |
310 // It triggers Windows to ask for the tooltip again. | 310 // It triggers Windows to ask for the tooltip again. |
311 SendMessage(tooltip_hwnd_, TTM_POP, 0, 0); | 311 SendMessage(tooltip_hwnd_, TTM_POP, 0, 0); |
312 last_tooltip_view_ = view; | 312 last_tooltip_view_ = view; |
313 } else if (last_tooltip_view_ != NULL) { | 313 } else if (last_tooltip_view_ != NULL) { |
314 // Tooltip is showing, and mouse is over the same view. See if the tooltip | 314 // Tooltip is showing, and mouse is over the same view. See if the tooltip |
315 // text has changed. | 315 // text has changed. |
316 gfx::Point view_point = mouse_pos; | 316 gfx::Point view_point = mouse_pos; |
317 View::ConvertPointToTarget(root_view, last_tooltip_view_, &view_point); | 317 View::ConvertPointToTarget(root_view, last_tooltip_view_, &view_point); |
318 string16 new_tooltip_text; | 318 base::string16 new_tooltip_text; |
319 bool has_tooltip_text = | 319 bool has_tooltip_text = |
320 last_tooltip_view_->GetTooltipText(view_point, &new_tooltip_text); | 320 last_tooltip_view_->GetTooltipText(view_point, &new_tooltip_text); |
321 if (!has_tooltip_text || (new_tooltip_text != tooltip_text_)) { | 321 if (!has_tooltip_text || (new_tooltip_text != tooltip_text_)) { |
322 // The text has changed, hide the popup. | 322 // The text has changed, hide the popup. |
323 SendMessage(tooltip_hwnd_, TTM_POP, 0, 0); | 323 SendMessage(tooltip_hwnd_, TTM_POP, 0, 0); |
324 if (has_tooltip_text && !new_tooltip_text.empty() && tooltip_showing_) { | 324 if (has_tooltip_text && !new_tooltip_text.empty() && tooltip_showing_) { |
325 // New text is valid, show the popup. | 325 // New text is valid, show the popup. |
326 SendMessage(tooltip_hwnd_, TTM_POPUP, 0, 0); | 326 SendMessage(tooltip_hwnd_, TTM_POPUP, 0, 0); |
327 } | 327 } |
328 } | 328 } |
(...skipping 19 matching lines...) Expand all Loading... |
348 // Forward the message onto the tooltip. | 348 // Forward the message onto the tooltip. |
349 MSG msg; | 349 MSG msg; |
350 msg.hwnd = GetParent(); | 350 msg.hwnd = GetParent(); |
351 msg.message = u_msg; | 351 msg.message = u_msg; |
352 msg.wParam = w_param; | 352 msg.wParam = w_param; |
353 msg.lParam = l_param; | 353 msg.lParam = l_param; |
354 SendMessage(tooltip_hwnd_, TTM_RELAYEVENT, 0, (LPARAM)&msg); | 354 SendMessage(tooltip_hwnd_, TTM_RELAYEVENT, 0, (LPARAM)&msg); |
355 } | 355 } |
356 | 356 |
357 } // namespace views | 357 } // namespace views |
OLD | NEW |