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/gfx/font.h" | 10 #include "app/gfx/font.h" |
11 #include "app/l10n_util.h" | 11 #include "app/l10n_util.h" |
12 #include "app/l10n_util_win.h" | 12 #include "app/l10n_util_win.h" |
13 #include "app/win_util.h" | 13 #include "app/win_util.h" |
| 14 #include "base/i18n/rtl.h" |
14 #include "base/logging.h" | 15 #include "base/logging.h" |
15 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
16 #include "views/screen.h" | 17 #include "views/screen.h" |
17 #include "views/view.h" | 18 #include "views/view.h" |
18 #include "views/widget/root_view.h" | 19 #include "views/widget/root_view.h" |
19 #include "views/widget/widget.h" | 20 #include "views/widget/widget.h" |
20 | 21 |
21 namespace views { | 22 namespace views { |
22 | 23 |
23 static int tooltip_height_ = 0; | 24 static int tooltip_height_ = 0; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 last_tooltip_view_, &view_loc); | 168 last_tooltip_view_, &view_loc); |
168 if (last_tooltip_view_->GetTooltipText(view_loc, &tooltip_text_) && | 169 if (last_tooltip_view_->GetTooltipText(view_loc, &tooltip_text_) && |
169 !tooltip_text_.empty()) { | 170 !tooltip_text_.empty()) { |
170 // View has a valid tip, copy it into TOOLTIPINFO. | 171 // View has a valid tip, copy it into TOOLTIPINFO. |
171 clipped_text_ = tooltip_text_; | 172 clipped_text_ = tooltip_text_; |
172 gfx::Point screen_loc = last_mouse_pos_; | 173 gfx::Point screen_loc = last_mouse_pos_; |
173 View::ConvertPointToScreen(widget_->GetRootView(), &screen_loc); | 174 View::ConvertPointToScreen(widget_->GetRootView(), &screen_loc); |
174 TrimTooltipToFit(&clipped_text_, &tooltip_width_, &line_count_, | 175 TrimTooltipToFit(&clipped_text_, &tooltip_width_, &line_count_, |
175 screen_loc.x(), screen_loc.y()); | 176 screen_loc.x(), screen_loc.y()); |
176 // Adjust the clipped tooltip text for locale direction. | 177 // Adjust the clipped tooltip text for locale direction. |
177 l10n_util::AdjustStringForLocaleDirection(clipped_text_, | 178 base::i18n::AdjustStringForLocaleDirection(clipped_text_, |
178 &clipped_text_); | 179 &clipped_text_); |
179 tooltip_info->lpszText = const_cast<WCHAR*>(clipped_text_.c_str()); | 180 tooltip_info->lpszText = const_cast<WCHAR*>(clipped_text_.c_str()); |
180 } else { | 181 } else { |
181 tooltip_text_.clear(); | 182 tooltip_text_.clear(); |
182 } | 183 } |
183 } | 184 } |
184 *handled = true; | 185 *handled = true; |
185 return 0; | 186 return 0; |
186 } | 187 } |
187 case TTN_POP: | 188 case TTN_POP: |
188 tooltip_showing_ = false; | 189 tooltip_showing_ = false; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 keyboard_tooltip_hwnd_ = NULL; | 377 keyboard_tooltip_hwnd_ = NULL; |
377 } | 378 } |
378 } | 379 } |
379 | 380 |
380 void TooltipManagerWin::DestroyKeyboardTooltipWindow(HWND window_to_destroy) { | 381 void TooltipManagerWin::DestroyKeyboardTooltipWindow(HWND window_to_destroy) { |
381 if (keyboard_tooltip_hwnd_ == window_to_destroy) | 382 if (keyboard_tooltip_hwnd_ == window_to_destroy) |
382 HideKeyboardTooltip(); | 383 HideKeyboardTooltip(); |
383 } | 384 } |
384 | 385 |
385 } // namespace views | 386 } // namespace views |
OLD | NEW |