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/button/label_button.h" | 5 #include "ui/views/controls/button/label_button.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "ui/gfx/animation/throb_animation.h" | 9 #include "ui/gfx/animation/throb_animation.h" |
10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 } | 328 } |
329 | 329 |
330 gfx::Point label_origin(label_area.origin()); | 330 gfx::Point label_origin(label_area.origin()); |
331 if (!image_size.IsEmpty() && adjusted_alignment != gfx::ALIGN_RIGHT) { | 331 if (!image_size.IsEmpty() && adjusted_alignment != gfx::ALIGN_RIGHT) { |
332 label_origin.set_x(image_origin.x() + image_size.width() + | 332 label_origin.set_x(image_origin.x() + image_size.width() + |
333 image_label_spacing_); | 333 image_label_spacing_); |
334 } | 334 } |
335 | 335 |
336 image_->SetBoundsRect(gfx::Rect(image_origin, image_size)); | 336 image_->SetBoundsRect(gfx::Rect(image_origin, image_size)); |
337 label_->SetBoundsRect(gfx::Rect(label_origin, label_size)); | 337 label_->SetBoundsRect(gfx::Rect(label_origin, label_size)); |
| 338 CustomButton::Layout(); |
338 } | 339 } |
339 | 340 |
340 const char* LabelButton::GetClassName() const { | 341 const char* LabelButton::GetClassName() const { |
341 return kViewClassName; | 342 return kViewClassName; |
342 } | 343 } |
343 | 344 |
344 void LabelButton::EnableCanvasFlippingForRTLUI(bool flip) { | 345 void LabelButton::EnableCanvasFlippingForRTLUI(bool flip) { |
345 CustomButton::EnableCanvasFlippingForRTLUI(flip); | 346 CustomButton::EnableCanvasFlippingForRTLUI(flip); |
346 image_->EnableCanvasFlippingForRTLUI(flip); | 347 image_->EnableCanvasFlippingForRTLUI(flip); |
347 } | 348 } |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 GetExtraParams(params); | 510 GetExtraParams(params); |
510 return ui::NativeTheme::kHovered; | 511 return ui::NativeTheme::kHovered; |
511 } | 512 } |
512 | 513 |
513 void LabelButton::ResetCachedPreferredSize() { | 514 void LabelButton::ResetCachedPreferredSize() { |
514 cached_preferred_size_valid_ = false; | 515 cached_preferred_size_valid_ = false; |
515 cached_preferred_size_ = gfx::Size(); | 516 cached_preferred_size_ = gfx::Size(); |
516 } | 517 } |
517 | 518 |
518 } // namespace views | 519 } // namespace views |
OLD | NEW |