Chromium Code Reviews| 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 "ui/base/resource/resource_bundle.h" | 8 #include "ui/base/resource/resource_bundle.h" |
| 9 #include "ui/gfx/image/image.h" | 9 #include "ui/gfx/image/image.h" |
| 10 #include "ui/resources/grit/ui_resources.h" | 10 #include "ui/resources/grit/ui_resources.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 | 61 |
| 62 md_button_ = | 62 md_button_ = |
| 63 MdTextButton::Create(this, base::ASCIIToUTF16("Material design")); | 63 MdTextButton::Create(this, base::ASCIIToUTF16("Material design")); |
| 64 container->AddChildView(md_button_); | 64 container->AddChildView(md_button_); |
| 65 | 65 |
| 66 md_default_button_ = | 66 md_default_button_ = |
| 67 MdTextButton::Create(this, base::ASCIIToUTF16("Default")); | 67 MdTextButton::Create(this, base::ASCIIToUTF16("Default")); |
| 68 md_default_button_->SetIsDefault(true); | 68 md_default_button_->SetIsDefault(true); |
| 69 container->AddChildView(md_default_button_); | 69 container->AddChildView(md_default_button_); |
| 70 | 70 |
| 71 md_prominent_button_ = | |
|
sky
2016/11/07 17:03:31
Remove field too.
| |
| 72 MdTextButton::Create(this, base::ASCIIToUTF16("Call to action")); | |
| 73 md_prominent_button_->SetProminent(true); | |
| 74 container->AddChildView(md_prominent_button_); | |
| 75 | |
| 76 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 71 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 77 image_button_ = new ImageButton(this); | 72 image_button_ = new ImageButton(this); |
| 78 image_button_->SetFocusForPlatform(); | 73 image_button_->SetFocusForPlatform(); |
| 79 image_button_->set_request_focus_on_press(true); | 74 image_button_->set_request_focus_on_press(true); |
| 80 image_button_->SetImage(ImageButton::STATE_NORMAL, | 75 image_button_->SetImage(ImageButton::STATE_NORMAL, |
| 81 rb.GetImageNamed(IDR_CLOSE).ToImageSkia()); | 76 rb.GetImageNamed(IDR_CLOSE).ToImageSkia()); |
| 82 image_button_->SetImage(ImageButton::STATE_HOVERED, | 77 image_button_->SetImage(ImageButton::STATE_HOVERED, |
| 83 rb.GetImageNamed(IDR_CLOSE_H).ToImageSkia()); | 78 rb.GetImageNamed(IDR_CLOSE_H).ToImageSkia()); |
| 84 image_button_->SetImage(ImageButton::STATE_PRESSED, | 79 image_button_->SetImage(ImageButton::STATE_PRESSED, |
| 85 rb.GetImageNamed(IDR_CLOSE_P).ToImageSkia()); | 80 rb.GetImageNamed(IDR_CLOSE_P).ToImageSkia()); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 } else if (sender == md_button_ || sender == md_default_button_ || | 129 } else if (sender == md_button_ || sender == md_default_button_ || |
| 135 sender == md_prominent_button_) { | 130 sender == md_prominent_button_) { |
| 136 static_cast<CustomButton*>(sender)->StartThrobbing(5); | 131 static_cast<CustomButton*>(sender)->StartThrobbing(5); |
| 137 } else { | 132 } else { |
| 138 PrintStatus("Image Button Pressed! count: %d", ++count_); | 133 PrintStatus("Image Button Pressed! count: %d", ++count_); |
| 139 } | 134 } |
| 140 } | 135 } |
| 141 | 136 |
| 142 } // namespace examples | 137 } // namespace examples |
| 143 } // namespace views | 138 } // namespace views |
| OLD | NEW |