| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 if (event.IsAltDown()) { | 62 if (event.IsAltDown()) { |
| 63 text_button_->SetMultiLine(!text_button_->multi_line()); | 63 text_button_->SetMultiLine(!text_button_->multi_line()); |
| 64 if (text_button_->multi_line()) { | 64 if (text_button_->multi_line()) { |
| 65 text_button_->SetText(ASCIIToUTF16("Multi-line text\n") + | 65 text_button_->SetText(ASCIIToUTF16("Multi-line text\n") + |
| 66 ASCIIToUTF16("is here to stay all the way!\n") + | 66 ASCIIToUTF16("is here to stay all the way!\n") + |
| 67 ASCIIToUTF16("123")); | 67 ASCIIToUTF16("123")); |
| 68 } else { | 68 } else { |
| 69 text_button_->SetText(ASCIIToUTF16("Button")); | 69 text_button_->SetText(ASCIIToUTF16("Button")); |
| 70 } | 70 } |
| 71 } else { | 71 } else { |
| 72 switch(text_button_->icon_placement()) { | 72 switch (text_button_->icon_placement()) { |
| 73 case TextButton::ICON_ON_LEFT: | 73 case TextButton::ICON_ON_LEFT: |
| 74 text_button_->set_icon_placement(TextButton::ICON_ON_RIGHT); | 74 text_button_->set_icon_placement(TextButton::ICON_ON_RIGHT); |
| 75 break; | 75 break; |
| 76 case TextButton::ICON_ON_RIGHT: | 76 case TextButton::ICON_ON_RIGHT: |
| 77 text_button_->set_icon_placement(TextButton::ICON_ON_LEFT); | 77 text_button_->set_icon_placement(TextButton::ICON_ON_LEFT); |
| 78 break; | 78 break; |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 } else if (event.IsAltDown()) { | 81 } else if (event.IsAltDown()) { |
| 82 if (text_button_->HasIcon()) | 82 if (text_button_->HasIcon()) |
| 83 text_button_->SetIcon(SkBitmap()); | 83 text_button_->SetIcon(SkBitmap()); |
| 84 else | 84 else |
| 85 text_button_->SetIcon(*icon_); | 85 text_button_->SetIcon(*icon_); |
| 86 } else { | 86 } else { |
| 87 switch(alignment_) { | 87 switch (alignment_) { |
| 88 case TextButton::ALIGN_LEFT: | 88 case TextButton::ALIGN_LEFT: |
| 89 alignment_ = TextButton::ALIGN_CENTER; | 89 alignment_ = TextButton::ALIGN_CENTER; |
| 90 break; | 90 break; |
| 91 case TextButton::ALIGN_CENTER: | 91 case TextButton::ALIGN_CENTER: |
| 92 alignment_ = TextButton::ALIGN_RIGHT; | 92 alignment_ = TextButton::ALIGN_RIGHT; |
| 93 break; | 93 break; |
| 94 case TextButton::ALIGN_RIGHT: | 94 case TextButton::ALIGN_RIGHT: |
| 95 alignment_ = TextButton::ALIGN_LEFT; | 95 alignment_ = TextButton::ALIGN_LEFT; |
| 96 break; | 96 break; |
| 97 } | 97 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 117 text_button_->set_border(new TextButtonBorder()); | 117 text_button_->set_border(new TextButtonBorder()); |
| 118 } | 118 } |
| 119 } else if (event.IsAltDown()) { | 119 } else if (event.IsAltDown()) { |
| 120 text_button_->SetIsDefault(!text_button_->is_default()); | 120 text_button_->SetIsDefault(!text_button_->is_default()); |
| 121 } | 121 } |
| 122 example_view()->GetLayoutManager()->Layout(example_view()); | 122 example_view()->GetLayoutManager()->Layout(example_view()); |
| 123 } | 123 } |
| 124 | 124 |
| 125 } // namespace examples | 125 } // namespace examples |
| 126 } // namespace views | 126 } // namespace views |
| OLD | NEW |