| 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/text_button.h" | 5 #include "ui/views/controls/button/text_button.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 TextButtonBorder::TextButtonBorder() { | 71 TextButtonBorder::TextButtonBorder() { |
| 72 } | 72 } |
| 73 | 73 |
| 74 TextButtonBorder::~TextButtonBorder() { | 74 TextButtonBorder::~TextButtonBorder() { |
| 75 } | 75 } |
| 76 | 76 |
| 77 gfx::Insets TextButtonBorder::GetInsets() const { | 77 gfx::Insets TextButtonBorder::GetInsets() const { |
| 78 return insets_; | 78 return insets_; |
| 79 } | 79 } |
| 80 | 80 |
| 81 gfx::Size TextButtonBorder::GetMinimumSize() const { |
| 82 return gfx::Size(); |
| 83 } |
| 84 |
| 81 void TextButtonBorder::SetInsets(const gfx::Insets& insets) { | 85 void TextButtonBorder::SetInsets(const gfx::Insets& insets) { |
| 82 insets_ = insets; | 86 insets_ = insets; |
| 83 } | 87 } |
| 84 | 88 |
| 85 TextButtonBorder* TextButtonBorder::AsTextButtonBorder() { | 89 TextButtonBorder* TextButtonBorder::AsTextButtonBorder() { |
| 86 return this; | 90 return this; |
| 87 } | 91 } |
| 88 | 92 |
| 89 const TextButtonBorder* TextButtonBorder::AsTextButtonBorder() const { | 93 const TextButtonBorder* TextButtonBorder::AsTextButtonBorder() const { |
| 90 return this; | 94 return this; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 canvas->SaveLayerAlpha(static_cast<uint8>( | 132 canvas->SaveLayerAlpha(static_cast<uint8>( |
| 129 button->GetAnimation()->CurrentValueBetween(0, 255))); | 133 button->GetAnimation()->CurrentValueBetween(0, 255))); |
| 130 painter->Paint(canvas, view.size()); | 134 painter->Paint(canvas, view.size()); |
| 131 canvas->Restore(); | 135 canvas->Restore(); |
| 132 } else { | 136 } else { |
| 133 painter->Paint(canvas, view.size()); | 137 painter->Paint(canvas, view.size()); |
| 134 } | 138 } |
| 135 } | 139 } |
| 136 } | 140 } |
| 137 | 141 |
| 142 gfx::Size TextButtonDefaultBorder::GetMinimumSize() const { |
| 143 gfx::Size size; |
| 144 if (normal_painter_) |
| 145 size.SetToMax(normal_painter_->GetMinimumSize()); |
| 146 if (hot_painter_) |
| 147 size.SetToMax(hot_painter_->GetMinimumSize()); |
| 148 if (pushed_painter_) |
| 149 size.SetToMax(pushed_painter_->GetMinimumSize()); |
| 150 return size; |
| 151 } |
| 152 |
| 138 | 153 |
| 139 // TextButtonNativeThemeBorder ------------------------------------------------ | 154 // TextButtonNativeThemeBorder ------------------------------------------------ |
| 140 | 155 |
| 141 TextButtonNativeThemeBorder::TextButtonNativeThemeBorder( | 156 TextButtonNativeThemeBorder::TextButtonNativeThemeBorder( |
| 142 NativeThemeDelegate* delegate) | 157 NativeThemeDelegate* delegate) |
| 143 : delegate_(delegate) { | 158 : delegate_(delegate) { |
| 144 SetInsets(gfx::Insets(kPreferredNativeThemePaddingVertical, | 159 SetInsets(gfx::Insets(kPreferredNativeThemePaddingVertical, |
| 145 kPreferredNativeThemePaddingHorizontal, | 160 kPreferredNativeThemePaddingHorizontal, |
| 146 kPreferredNativeThemePaddingVertical, | 161 kPreferredNativeThemePaddingVertical, |
| 147 kPreferredNativeThemePaddingHorizontal)); | 162 kPreferredNativeThemePaddingHorizontal)); |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 if (show_multiple_icon_states_) { | 727 if (show_multiple_icon_states_) { |
| 713 if (has_hover_icon_ && (state() == STATE_HOVERED)) | 728 if (has_hover_icon_ && (state() == STATE_HOVERED)) |
| 714 return icon_hover_; | 729 return icon_hover_; |
| 715 if (has_pushed_icon_ && (state() == STATE_PRESSED)) | 730 if (has_pushed_icon_ && (state() == STATE_PRESSED)) |
| 716 return icon_pushed_; | 731 return icon_pushed_; |
| 717 } | 732 } |
| 718 return icon_; | 733 return icon_; |
| 719 } | 734 } |
| 720 | 735 |
| 721 } // namespace views | 736 } // namespace views |
| OLD | NEW |