| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/controls/button/text_button.h" | 5 #include "views/controls/button/text_button.h" |
| 6 | 6 |
| 7 #include <algorithm> |
| 8 |
| 7 #include "app/gfx/canvas.h" | 9 #include "app/gfx/canvas.h" |
| 8 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| 9 #include "app/throb_animation.h" | 11 #include "app/throb_animation.h" |
| 10 #include "app/resource_bundle.h" | 12 #include "app/resource_bundle.h" |
| 11 #include "views/controls/button/button.h" | 13 #include "views/controls/button/button.h" |
| 12 #include "views/event.h" | 14 #include "views/event.h" |
| 13 #include "grit/app_resources.h" | 15 #include "grit/app_resources.h" |
| 14 | 16 |
| 15 namespace views { | 17 namespace views { |
| 16 | 18 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 text_size_.SetSize(font_.GetStringWidth(text_), font_.height()); | 179 text_size_.SetSize(font_.GetStringWidth(text_), font_.height()); |
| 178 max_text_size_.SetSize(std::max(max_text_size_.width(), text_size_.width()), | 180 max_text_size_.SetSize(std::max(max_text_size_.width(), text_size_.width()), |
| 179 std::max(max_text_size_.height(), | 181 std::max(max_text_size_.height(), |
| 180 text_size_.height())); | 182 text_size_.height())); |
| 181 } | 183 } |
| 182 | 184 |
| 183 void TextButton::SetIcon(const SkBitmap& icon) { | 185 void TextButton::SetIcon(const SkBitmap& icon) { |
| 184 icon_ = icon; | 186 icon_ = icon; |
| 185 } | 187 } |
| 186 | 188 |
| 189 void TextButton::SetFont(const gfx::Font& font) { |
| 190 font_ = font; |
| 191 } |
| 192 |
| 187 void TextButton::SetEnabledColor(SkColor color) { | 193 void TextButton::SetEnabledColor(SkColor color) { |
| 188 color_enabled_ = color; | 194 color_enabled_ = color; |
| 189 UpdateColor(); | 195 UpdateColor(); |
| 190 } | 196 } |
| 191 | 197 |
| 192 void TextButton::SetDisabledColor(SkColor color) { | 198 void TextButton::SetDisabledColor(SkColor color) { |
| 193 color_disabled_ = color; | 199 color_disabled_ = color; |
| 194 UpdateColor(); | 200 UpdateColor(); |
| 195 } | 201 } |
| 196 | 202 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 bool TextButton::OnMousePressed(const MouseEvent& e) { | 338 bool TextButton::OnMousePressed(const MouseEvent& e) { |
| 333 RequestFocus(); | 339 RequestFocus(); |
| 334 return true; | 340 return true; |
| 335 } | 341 } |
| 336 | 342 |
| 337 void TextButton::Paint(gfx::Canvas* canvas) { | 343 void TextButton::Paint(gfx::Canvas* canvas) { |
| 338 Paint(canvas, false); | 344 Paint(canvas, false); |
| 339 } | 345 } |
| 340 | 346 |
| 341 } // namespace views | 347 } // namespace views |
| OLD | NEW |