Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: ui/views/examples/button_example.cc

Issue 2483753003: views examples: remove obsolete CTA button example (Closed)
Patch Set: remove md_prominent_button_ Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/examples/button_example.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_ =
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 113 }
119 } else if (event.IsAltDown()) { 114 } else if (event.IsAltDown()) {
120 label_button->SetIsDefault(!label_button->is_default()); 115 label_button->SetIsDefault(!label_button->is_default());
121 } else { 116 } else {
122 label_button->SetMinSize(gfx::Size()); 117 label_button->SetMinSize(gfx::Size());
123 } 118 }
124 example_view()->GetLayoutManager()->Layout(example_view()); 119 example_view()->GetLayoutManager()->Layout(example_view());
125 } 120 }
126 121
127 void ButtonExample::ButtonPressed(Button* sender, const ui::Event& event) { 122 void ButtonExample::ButtonPressed(Button* sender, const ui::Event& event) {
128 if (sender == label_button_) { 123 if (sender == label_button_)
129 LabelButtonPressed(label_button_, event); 124 LabelButtonPressed(label_button_, event);
130 } else if (sender == styled_button_) { 125 else if (sender == styled_button_)
131 LabelButtonPressed(styled_button_, event); 126 LabelButtonPressed(styled_button_, event);
132 } else if (sender == disabled_button_) { 127 else if (sender == disabled_button_)
133 LabelButtonPressed(disabled_button_, event); 128 LabelButtonPressed(disabled_button_, event);
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_) {
136 static_cast<CustomButton*>(sender)->StartThrobbing(5); 130 static_cast<CustomButton*>(sender)->StartThrobbing(5);
137 } else { 131 else
138 PrintStatus("Image Button Pressed! count: %d", ++count_); 132 PrintStatus("Image Button Pressed! count: %d", ++count_);
139 }
140 } 133 }
141 134
142 } // namespace examples 135 } // namespace examples
143 } // namespace views 136 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/examples/button_example.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698