Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(344)

Side by Side Diff: views/widget/tooltip_manager_views.cc

Issue 8113031: Change std::wstring to string16 for views::Label and views::Link (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/focus/focus_manager_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(UTF16ToWideHack(tooltip_text)); 188 tooltip_label_.SetText(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
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
OLDNEW
« no previous file with comments | « views/focus/focus_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698