| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 container->AddChildView(new BlueButton(this, ASCIIToUTF16("Blue Button"))); | 60 container->AddChildView(new BlueButton(this, ASCIIToUTF16("Blue Button"))); |
| 61 | 61 |
| 62 container->AddChildView( | 62 container->AddChildView( |
| 63 MdTextButton::Create(nullptr, base::ASCIIToUTF16("Material design"))); | 63 MdTextButton::Create(nullptr, base::ASCIIToUTF16("Material design"))); |
| 64 MdTextButton* md_button = | 64 MdTextButton* md_button = |
| 65 MdTextButton::Create(nullptr, base::ASCIIToUTF16("Default")); | 65 MdTextButton::Create(nullptr, base::ASCIIToUTF16("Default")); |
| 66 md_button->SetIsDefault(true); | 66 md_button->SetIsDefault(true); |
| 67 container->AddChildView(md_button); | 67 container->AddChildView(md_button); |
| 68 md_button = | 68 md_button = |
| 69 MdTextButton::Create(nullptr, base::ASCIIToUTF16("Call to action")); | 69 MdTextButton::Create(nullptr, base::ASCIIToUTF16("Call to action")); |
| 70 md_button->SetCallToAction(true); | 70 md_button->SetProminent(true); |
| 71 container->AddChildView(md_button); | 71 container->AddChildView(md_button); |
| 72 | 72 |
| 73 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 73 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 74 image_button_ = new ImageButton(this); | 74 image_button_ = new ImageButton(this); |
| 75 image_button_->SetFocusForPlatform(); | 75 image_button_->SetFocusForPlatform(); |
| 76 image_button_->set_request_focus_on_press(true); | 76 image_button_->set_request_focus_on_press(true); |
| 77 image_button_->SetImage(ImageButton::STATE_NORMAL, | 77 image_button_->SetImage(ImageButton::STATE_NORMAL, |
| 78 rb.GetImageNamed(IDR_CLOSE).ToImageSkia()); | 78 rb.GetImageNamed(IDR_CLOSE).ToImageSkia()); |
| 79 image_button_->SetImage(ImageButton::STATE_HOVERED, | 79 image_button_->SetImage(ImageButton::STATE_HOVERED, |
| 80 rb.GetImageNamed(IDR_CLOSE_H).ToImageSkia()); | 80 rb.GetImageNamed(IDR_CLOSE_H).ToImageSkia()); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 else if (sender == styled_button_) | 127 else if (sender == styled_button_) |
| 128 LabelButtonPressed(styled_button_, event); | 128 LabelButtonPressed(styled_button_, event); |
| 129 else if (sender == disabled_button_) | 129 else if (sender == disabled_button_) |
| 130 LabelButtonPressed(disabled_button_, event); | 130 LabelButtonPressed(disabled_button_, event); |
| 131 else | 131 else |
| 132 PrintStatus("Image Button Pressed! count: %d", ++count_); | 132 PrintStatus("Image Button Pressed! count: %d", ++count_); |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace examples | 135 } // namespace examples |
| 136 } // namespace views | 136 } // namespace views |
| OLD | NEW |