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/controls/label.h" | 5 #include "ui/views/controls/label.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 #include <vector> | 10 #include <vector> |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 w = std::max(0, w - GetInsets().width()); | 219 w = std::max(0, w - GetInsets().width()); |
220 int h = font_.GetHeight(); | 220 int h = font_.GetHeight(); |
221 gfx::Canvas::SizeStringInt(text_, font_, &w, &h, ComputeDrawStringFlags()); | 221 gfx::Canvas::SizeStringInt(text_, font_, &w, &h, ComputeDrawStringFlags()); |
222 return h + GetInsets().height(); | 222 return h + GetInsets().height(); |
223 } | 223 } |
224 | 224 |
225 std::string Label::GetClassName() const { | 225 std::string Label::GetClassName() const { |
226 return kViewClassName; | 226 return kViewClassName; |
227 } | 227 } |
228 | 228 |
229 bool Label::HitTest(const gfx::Point& l) const { | 229 bool Label::HitTestRect(const gfx::Rect& rect) const { |
230 return false; | 230 return false; |
231 } | 231 } |
232 | 232 |
233 void Label::OnMouseMoved(const MouseEvent& event) { | 233 void Label::OnMouseMoved(const MouseEvent& event) { |
234 UpdateContainsMouse(event); | 234 UpdateContainsMouse(event); |
235 } | 235 } |
236 | 236 |
237 void Label::OnMouseEntered(const MouseEvent& event) { | 237 void Label::OnMouseEntered(const MouseEvent& event) { |
238 UpdateContainsMouse(event); | 238 UpdateContainsMouse(event); |
239 } | 239 } |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 ui::ELIDE_IN_MIDDLE); | 490 ui::ELIDE_IN_MIDDLE); |
491 } else { | 491 } else { |
492 *paint_text = text_; | 492 *paint_text = text_; |
493 } | 493 } |
494 | 494 |
495 *text_bounds = GetTextBounds(); | 495 *text_bounds = GetTextBounds(); |
496 *flags = ComputeDrawStringFlags(); | 496 *flags = ComputeDrawStringFlags(); |
497 } | 497 } |
498 | 498 |
499 } // namespace views | 499 } // namespace views |
OLD | NEW |