| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 SetAnimationDuration(kHoverAnimationDurationMs); | 277 SetAnimationDuration(kHoverAnimationDurationMs); |
| 278 } | 278 } |
| 279 | 279 |
| 280 TextButtonBase::~TextButtonBase() { | 280 TextButtonBase::~TextButtonBase() { |
| 281 } | 281 } |
| 282 | 282 |
| 283 void TextButtonBase::SetIsDefault(bool is_default) { | 283 void TextButtonBase::SetIsDefault(bool is_default) { |
| 284 if (is_default == is_default_) | 284 if (is_default == is_default_) |
| 285 return; | 285 return; |
| 286 is_default_ = is_default; | 286 is_default_ = is_default; |
| 287 if (is_default_) | 287 if (is_default_) { |
| 288 AddAccelerator(ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE)); | 288 AddAccelerator(ui::Accelerator(ui::VKEY_RETURN, |
| 289 else | 289 ui::EF_NONE, |
| 290 RemoveAccelerator(ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE)); | 290 ui::ET_KEY_PRESSED)); |
| 291 } else { |
| 292 RemoveAccelerator(ui::Accelerator(ui::VKEY_RETURN, |
| 293 ui::EF_NONE, |
| 294 ui::ET_KEY_PRESSED)); |
| 295 } |
| 291 SchedulePaint(); | 296 SchedulePaint(); |
| 292 } | 297 } |
| 293 | 298 |
| 294 void TextButtonBase::SetText(const string16& text) { | 299 void TextButtonBase::SetText(const string16& text) { |
| 295 text_ = text; | 300 text_ = text; |
| 296 SetAccessibleName(text); | 301 SetAccessibleName(text); |
| 297 UpdateTextSize(); | 302 UpdateTextSize(); |
| 298 } | 303 } |
| 299 | 304 |
| 300 void TextButtonBase::SetFont(const gfx::Font& font) { | 305 void TextButtonBase::SetFont(const gfx::Font& font) { |
| (...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 #endif | 852 #endif |
| 848 } | 853 } |
| 849 | 854 |
| 850 void NativeTextButton::GetExtraParams( | 855 void NativeTextButton::GetExtraParams( |
| 851 ui::NativeTheme::ExtraParams* params) const { | 856 ui::NativeTheme::ExtraParams* params) const { |
| 852 TextButton::GetExtraParams(params); | 857 TextButton::GetExtraParams(params); |
| 853 params->button.has_border = true; | 858 params->button.has_border = true; |
| 854 } | 859 } |
| 855 | 860 |
| 856 } // namespace views | 861 } // namespace views |
| OLD | NEW |