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_border.h" | 5 #include "ui/views/controls/button/label_button_border.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "grit/ui_resources.h" | 8 #include "grit/ui_resources.h" |
9 #include "third_party/skia/include/core/SkPaint.h" | 9 #include "third_party/skia/include/core/SkPaint.h" |
10 #include "third_party/skia/include/effects/SkLerpXfermode.h" | 10 #include "third_party/skia/include/effects/SkLerpXfermode.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // Draw the Views focus border for the native theme style. | 151 // Draw the Views focus border for the native theme style. |
152 if (style() == Button::STYLE_NATIVE_TEXTBUTTON && | 152 if (style() == Button::STYLE_NATIVE_TEXTBUTTON && |
153 view.focus_border() && extra.button.is_focused) | 153 view.focus_border() && extra.button.is_focused) |
154 view.focus_border()->Paint(view, canvas); | 154 view.focus_border()->Paint(view, canvas); |
155 } | 155 } |
156 | 156 |
157 gfx::Insets LabelButtonBorder::GetInsets() const { | 157 gfx::Insets LabelButtonBorder::GetInsets() const { |
158 return insets_; | 158 return insets_; |
159 } | 159 } |
160 | 160 |
| 161 gfx::Size LabelButtonBorder::GetMinimumSize() const { |
| 162 gfx::Size minimum_size; |
| 163 for (int i = 0; i < 2; ++i) { |
| 164 for (int j = 0; j < Button::STATE_COUNT; ++j) { |
| 165 if (painters_[i][j]) |
| 166 minimum_size.SetToMax(painters_[i][j]->GetMinimumSize()); |
| 167 } |
| 168 } |
| 169 return minimum_size; |
| 170 } |
| 171 |
161 Painter* LabelButtonBorder::GetPainter(bool focused, | 172 Painter* LabelButtonBorder::GetPainter(bool focused, |
162 Button::ButtonState state) { | 173 Button::ButtonState state) { |
163 return painters_[focused ? 1 : 0][state].get(); | 174 return painters_[focused ? 1 : 0][state].get(); |
164 } | 175 } |
165 | 176 |
166 void LabelButtonBorder::SetPainter(bool focused, | 177 void LabelButtonBorder::SetPainter(bool focused, |
167 Button::ButtonState state, | 178 Button::ButtonState state, |
168 Painter* painter) { | 179 Painter* painter) { |
169 painters_[focused ? 1 : 0][state].reset(painter); | 180 painters_[focused ? 1 : 0][state].reset(painter); |
170 } | 181 } |
171 | 182 |
172 } // namespace views | 183 } // namespace views |
OLD | NEW |