| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/tooltip_manager_win.h" | 5 #include "views/widget/tooltip_manager_win.h" |
| 6 | 6 |
| 7 #include <windowsx.h> | 7 #include <windowsx.h> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "app/l10n_util_win.h" | 10 #include "app/l10n_util_win.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 last_tooltip_view_, &view_loc); | 166 last_tooltip_view_, &view_loc); |
| 167 if (last_tooltip_view_->GetTooltipText(view_loc, &tooltip_text_) && | 167 if (last_tooltip_view_->GetTooltipText(view_loc, &tooltip_text_) && |
| 168 !tooltip_text_.empty()) { | 168 !tooltip_text_.empty()) { |
| 169 // View has a valid tip, copy it into TOOLTIPINFO. | 169 // View has a valid tip, copy it into TOOLTIPINFO. |
| 170 clipped_text_ = tooltip_text_; | 170 clipped_text_ = tooltip_text_; |
| 171 gfx::Point screen_loc = last_mouse_pos_; | 171 gfx::Point screen_loc = last_mouse_pos_; |
| 172 View::ConvertPointToScreen(widget_->GetRootView(), &screen_loc); | 172 View::ConvertPointToScreen(widget_->GetRootView(), &screen_loc); |
| 173 TrimTooltipToFit(&clipped_text_, &tooltip_width_, &line_count_, | 173 TrimTooltipToFit(&clipped_text_, &tooltip_width_, &line_count_, |
| 174 screen_loc.x(), screen_loc.y()); | 174 screen_loc.x(), screen_loc.y()); |
| 175 // Adjust the clipped tooltip text for locale direction. | 175 // Adjust the clipped tooltip text for locale direction. |
| 176 base::i18n::AdjustStringForLocaleDirection(clipped_text_, | 176 base::i18n::AdjustStringForLocaleDirection(&clipped_text_); |
| 177 &clipped_text_); | |
| 178 tooltip_info->lpszText = const_cast<WCHAR*>(clipped_text_.c_str()); | 177 tooltip_info->lpszText = const_cast<WCHAR*>(clipped_text_.c_str()); |
| 179 } else { | 178 } else { |
| 180 tooltip_text_.clear(); | 179 tooltip_text_.clear(); |
| 181 } | 180 } |
| 182 } | 181 } |
| 183 *handled = true; | 182 *handled = true; |
| 184 return 0; | 183 return 0; |
| 185 } | 184 } |
| 186 case TTN_POP: | 185 case TTN_POP: |
| 187 tooltip_showing_ = false; | 186 tooltip_showing_ = false; |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 keyboard_tooltip_hwnd_ = NULL; | 374 keyboard_tooltip_hwnd_ = NULL; |
| 376 } | 375 } |
| 377 } | 376 } |
| 378 | 377 |
| 379 void TooltipManagerWin::DestroyKeyboardTooltipWindow(HWND window_to_destroy) { | 378 void TooltipManagerWin::DestroyKeyboardTooltipWindow(HWND window_to_destroy) { |
| 380 if (keyboard_tooltip_hwnd_ == window_to_destroy) | 379 if (keyboard_tooltip_hwnd_ == window_to_destroy) |
| 381 HideKeyboardTooltip(); | 380 HideKeyboardTooltip(); |
| 382 } | 381 } |
| 383 | 382 |
| 384 } // namespace views | 383 } // namespace views |
| OLD | NEW |