| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_views.h" | 5 #include "views/widget/tooltip_manager_views.h" |
| 6 | 6 |
| 7 #if defined(USE_X11) | 7 #if defined(USE_X11) |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 #include <X11/extensions/XInput2.h> | 9 #include <X11/extensions/XInput2.h> |
| 10 #endif | 10 #endif |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 !tooltip_view_->GetTooltipText(gfx::Point(), &tooltip_text_)) | 178 !tooltip_view_->GetTooltipText(gfx::Point(), &tooltip_text_)) |
| 179 tooltip_text_.clear(); | 179 tooltip_text_.clear(); |
| 180 | 180 |
| 181 if (tooltip_text_.empty()) { | 181 if (tooltip_text_.empty()) { |
| 182 tooltip_widget_->Hide(); | 182 tooltip_widget_->Hide(); |
| 183 } else { | 183 } else { |
| 184 int max_width, line_count; | 184 int max_width, line_count; |
| 185 string16 tooltip_text(tooltip_text_); | 185 string16 tooltip_text(tooltip_text_); |
| 186 TrimTooltipToFit(&tooltip_text, &max_width, &line_count, | 186 TrimTooltipToFit(&tooltip_text, &max_width, &line_count, |
| 187 curr_mouse_pos_.x(), curr_mouse_pos_.y()); | 187 curr_mouse_pos_.x(), curr_mouse_pos_.y()); |
| 188 tooltip_label_.SetText(tooltip_text); | 188 tooltip_label_.SetText(UTF16ToWideHack(tooltip_text)); |
| 189 | 189 |
| 190 SetTooltipBounds(curr_mouse_pos_, max_width, | 190 SetTooltipBounds(curr_mouse_pos_, max_width, |
| 191 tooltip_label_.GetPreferredSize().height()); | 191 tooltip_label_.GetPreferredSize().height()); |
| 192 tooltip_widget_->Show(); | 192 tooltip_widget_->Show(); |
| 193 } | 193 } |
| 194 } | 194 } |
| 195 | 195 |
| 196 void TooltipManagerViews::SetTooltipBounds(gfx::Point mouse_pos, | 196 void TooltipManagerViews::SetTooltipBounds(gfx::Point mouse_pos, |
| 197 int tooltip_width, | 197 int tooltip_width, |
| 198 int tooltip_height) { | 198 int tooltip_height) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 222 if (tooltip_timer_.IsRunning()) | 222 if (tooltip_timer_.IsRunning()) |
| 223 tooltip_timer_.Reset(); | 223 tooltip_timer_.Reset(); |
| 224 curr_mouse_pos_.SetPoint(x, y); | 224 curr_mouse_pos_.SetPoint(x, y); |
| 225 | 225 |
| 226 // If tooltip is visible, we may want to hide it. If it is not, we are ok. | 226 // If tooltip is visible, we may want to hide it. If it is not, we are ok. |
| 227 if (tooltip_widget_->IsVisible()) | 227 if (tooltip_widget_->IsVisible()) |
| 228 UpdateIfRequired(curr_mouse_pos_.x(), curr_mouse_pos_.y(), false); | 228 UpdateIfRequired(curr_mouse_pos_.x(), curr_mouse_pos_.y(), false); |
| 229 } | 229 } |
| 230 | 230 |
| 231 } // namespace views | 231 } // namespace views |
| OLD | NEW |