| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 container->AddChildView(styled_button); | 58 container->AddChildView(styled_button); |
| 59 | 59 |
| 60 LabelButton* disabled_button = | 60 LabelButton* disabled_button = |
| 61 new LabelButton(this, ASCIIToUTF16("Disabled Button")); | 61 new LabelButton(this, ASCIIToUTF16("Disabled Button")); |
| 62 disabled_button->SetStyle(Button::STYLE_BUTTON); | 62 disabled_button->SetStyle(Button::STYLE_BUTTON); |
| 63 disabled_button->SetState(Button::STATE_DISABLED); | 63 disabled_button->SetState(Button::STATE_DISABLED); |
| 64 container->AddChildView(disabled_button); | 64 container->AddChildView(disabled_button); |
| 65 | 65 |
| 66 container->AddChildView(new BlueButton(this, ASCIIToUTF16("Blue Button"))); | 66 container->AddChildView(new BlueButton(this, ASCIIToUTF16("Blue Button"))); |
| 67 | 67 |
| 68 container->AddChildView( | 68 container->AddChildView(MdTextButton::CreateStandardButton( |
| 69 new MdTextButton(nullptr, base::ASCIIToUTF16("Material design"))); | 69 nullptr, base::ASCIIToUTF16("Material design"))); |
| 70 | 70 |
| 71 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 71 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 72 image_button_ = new ImageButton(this); | 72 image_button_ = new ImageButton(this); |
| 73 image_button_->SetFocusable(true); | 73 image_button_->SetFocusable(true); |
| 74 image_button_->SetImage(ImageButton::STATE_NORMAL, | 74 image_button_->SetImage(ImageButton::STATE_NORMAL, |
| 75 rb.GetImageNamed(IDR_CLOSE).ToImageSkia()); | 75 rb.GetImageNamed(IDR_CLOSE).ToImageSkia()); |
| 76 image_button_->SetImage(ImageButton::STATE_HOVERED, | 76 image_button_->SetImage(ImageButton::STATE_HOVERED, |
| 77 rb.GetImageNamed(IDR_CLOSE_H).ToImageSkia()); | 77 rb.GetImageNamed(IDR_CLOSE_H).ToImageSkia()); |
| 78 image_button_->SetImage(ImageButton::STATE_PRESSED, | 78 image_button_->SetImage(ImageButton::STATE_PRESSED, |
| 79 rb.GetImageNamed(IDR_CLOSE_P).ToImageSkia()); | 79 rb.GetImageNamed(IDR_CLOSE_P).ToImageSkia()); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 void ButtonExample::ButtonPressed(Button* sender, const ui::Event& event) { | 115 void ButtonExample::ButtonPressed(Button* sender, const ui::Event& event) { |
| 116 if (sender == label_button_) | 116 if (sender == label_button_) |
| 117 LabelButtonPressed(event); | 117 LabelButtonPressed(event); |
| 118 else | 118 else |
| 119 PrintStatus("Image Button Pressed! count: %d", ++count_); | 119 PrintStatus("Image Button Pressed! count: %d", ++count_); |
| 120 } | 120 } |
| 121 | 121 |
| 122 } // namespace examples | 122 } // namespace examples |
| 123 } // namespace views | 123 } // namespace views |
| OLD | NEW |