| 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/examples/button_example.h" | 5 #include "ui/views/examples/button_example.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "grit/ui_resources.h" | 8 #include "grit/ui_resources.h" |
| 9 #include "ui/base/resource/resource_bundle.h" | 9 #include "ui/base/resource/resource_bundle.h" |
| 10 #include "ui/gfx/image/image.h" | 10 #include "ui/gfx/image/image.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 text_button_->SetText(ASCIIToUTF16("Button")); | 70 text_button_->SetText(ASCIIToUTF16("Button")); |
| 71 } | 71 } |
| 72 } else { | 72 } else { |
| 73 switch (text_button_->icon_placement()) { | 73 switch (text_button_->icon_placement()) { |
| 74 case TextButton::ICON_ON_LEFT: | 74 case TextButton::ICON_ON_LEFT: |
| 75 text_button_->set_icon_placement(TextButton::ICON_ON_RIGHT); | 75 text_button_->set_icon_placement(TextButton::ICON_ON_RIGHT); |
| 76 break; | 76 break; |
| 77 case TextButton::ICON_ON_RIGHT: | 77 case TextButton::ICON_ON_RIGHT: |
| 78 text_button_->set_icon_placement(TextButton::ICON_ON_LEFT); | 78 text_button_->set_icon_placement(TextButton::ICON_ON_LEFT); |
| 79 break; | 79 break; |
| 80 case TextButton::ICON_CENTERED: |
| 81 // Do nothing. |
| 82 break; |
| 80 } | 83 } |
| 81 } | 84 } |
| 82 } else if (event.IsAltDown()) { | 85 } else if (event.IsAltDown()) { |
| 83 if (text_button_->HasIcon()) | 86 if (text_button_->HasIcon()) |
| 84 text_button_->SetIcon(gfx::ImageSkia()); | 87 text_button_->SetIcon(gfx::ImageSkia()); |
| 85 else | 88 else |
| 86 text_button_->SetIcon(*icon_); | 89 text_button_->SetIcon(*icon_); |
| 87 } else { | 90 } else { |
| 88 switch (alignment_) { | 91 switch (alignment_) { |
| 89 case TextButton::ALIGN_LEFT: | 92 case TextButton::ALIGN_LEFT: |
| (...skipping 28 matching lines...) Expand all Loading... |
| 118 text_button_->set_border(new TextButtonBorder()); | 121 text_button_->set_border(new TextButtonBorder()); |
| 119 } | 122 } |
| 120 } else if (event.IsAltDown()) { | 123 } else if (event.IsAltDown()) { |
| 121 text_button_->SetIsDefault(!text_button_->is_default()); | 124 text_button_->SetIsDefault(!text_button_->is_default()); |
| 122 } | 125 } |
| 123 example_view()->GetLayoutManager()->Layout(example_view()); | 126 example_view()->GetLayoutManager()->Layout(example_view()); |
| 124 } | 127 } |
| 125 | 128 |
| 126 } // namespace examples | 129 } // namespace examples |
| 127 } // namespace views | 130 } // namespace views |
| OLD | NEW |