| 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/strings/utf_string_conversions.h" | 7 #include "base/strings/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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 break; | 119 break; |
| 120 } | 120 } |
| 121 text_button_->set_alignment(alignment_); | 121 text_button_->set_alignment(alignment_); |
| 122 } | 122 } |
| 123 } else if (event.IsShiftDown()) { | 123 } else if (event.IsShiftDown()) { |
| 124 if (event.IsAltDown()) { | 124 if (event.IsAltDown()) { |
| 125 text_button_->SetText(ASCIIToUTF16( | 125 text_button_->SetText(ASCIIToUTF16( |
| 126 text_button_->text().length() < 50 ? kLongText : kTextButton)); | 126 text_button_->text().length() < 50 ? kLongText : kTextButton)); |
| 127 } else { | 127 } else { |
| 128 use_native_theme_border_ = !use_native_theme_border_; | 128 use_native_theme_border_ = !use_native_theme_border_; |
| 129 if (use_native_theme_border_) | 129 if (use_native_theme_border_) { |
| 130 text_button_->set_border(new TextButtonNativeThemeBorder(text_button_)); | 130 text_button_->SetBorder(scoped_ptr<views::Border>( |
| 131 else | 131 new TextButtonNativeThemeBorder(text_button_))); |
| 132 text_button_->set_border(new TextButtonDefaultBorder()); | 132 } else { |
| 133 text_button_->SetBorder( |
| 134 scoped_ptr<views::Border>(new TextButtonDefaultBorder())); |
| 135 } |
| 133 } | 136 } |
| 134 } else if (event.IsAltDown()) { | 137 } else if (event.IsAltDown()) { |
| 135 text_button_->SetIsDefault(!text_button_->is_default()); | 138 text_button_->SetIsDefault(!text_button_->is_default()); |
| 136 } else { | 139 } else { |
| 137 text_button_->ClearMaxTextSize(); | 140 text_button_->ClearMaxTextSize(); |
| 138 } | 141 } |
| 139 example_view()->GetLayoutManager()->Layout(example_view()); | 142 example_view()->GetLayoutManager()->Layout(example_view()); |
| 140 } | 143 } |
| 141 | 144 |
| 142 void ButtonExample::LabelButtonPressed(const ui::Event& event) { | 145 void ButtonExample::LabelButtonPressed(const ui::Event& event) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 if (sender == text_button_) | 183 if (sender == text_button_) |
| 181 TextButtonPressed(event); | 184 TextButtonPressed(event); |
| 182 else if (sender == label_button_) | 185 else if (sender == label_button_) |
| 183 LabelButtonPressed(event); | 186 LabelButtonPressed(event); |
| 184 else | 187 else |
| 185 PrintStatus("Image Button Pressed! count: %d", ++count_); | 188 PrintStatus("Image Button Pressed! count: %d", ++count_); |
| 186 } | 189 } |
| 187 | 190 |
| 188 } // namespace examples | 191 } // namespace examples |
| 189 } // namespace views | 192 } // namespace views |
| OLD | NEW |