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/utf_string_conversions.h" | 7 #include "base/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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 "Label Button")); | 147 "Label Button")); |
148 } else { | 148 } else { |
149 label_button_->SetText(!label_button_->GetText().empty() ? | 149 label_button_->SetText(!label_button_->GetText().empty() ? |
150 string16() : ASCIIToUTF16("Label Button")); | 150 string16() : ASCIIToUTF16("Label Button")); |
151 } | 151 } |
152 } else if (event.IsAltDown()) { | 152 } else if (event.IsAltDown()) { |
153 label_button_->SetImage(CustomButton::BS_NORMAL, | 153 label_button_->SetImage(CustomButton::BS_NORMAL, |
154 label_button_->GetImage(CustomButton::BS_NORMAL).isNull() ? | 154 label_button_->GetImage(CustomButton::BS_NORMAL).isNull() ? |
155 *icon_ : gfx::ImageSkia()); | 155 *icon_ : gfx::ImageSkia()); |
156 } else { | 156 } else { |
157 label_button_->SetHorizontalAlignment(static_cast<Label::Alignment>( | 157 label_button_->SetHorizontalAlignment( |
158 (label_button_->GetHorizontalAlignment() + 1) % 3)); | 158 static_cast<gfx::HorizontalAlignment>( |
| 159 (label_button_->GetHorizontalAlignment() + 1) % 3)); |
159 } | 160 } |
160 } else if (event.IsShiftDown()) { | 161 } else if (event.IsShiftDown()) { |
161 if (event.IsAltDown()) { | 162 if (event.IsAltDown()) { |
162 label_button_->SetText(ASCIIToUTF16( | 163 label_button_->SetText(ASCIIToUTF16( |
163 label_button_->GetText().length() > 20 ? "Label Button" : | 164 label_button_->GetText().length() > 20 ? "Label Button" : |
164 "StartofReallyReallyReallyReallyReallyReallyReally" | 165 "StartofReallyReallyReallyReallyReallyReallyReally" |
165 "ReallyReallyReallyReallyReallyReallyReally" | 166 "ReallyReallyReallyReallyReallyReallyReally" |
166 "ReallyReallyReallyReallyReallyReallyReallyLongButtonText")); | 167 "ReallyReallyReallyReallyReallyReallyReallyLongButtonText")); |
167 } else { | 168 } else { |
168 label_button_->SetNativeTheme(!label_button_->native_theme()); | 169 label_button_->SetNativeTheme(!label_button_->native_theme()); |
(...skipping 10 matching lines...) Expand all Loading... |
179 if (sender == text_button_) | 180 if (sender == text_button_) |
180 TextButtonPressed(event); | 181 TextButtonPressed(event); |
181 else if (sender == label_button_) | 182 else if (sender == label_button_) |
182 LabelButtonPressed(event); | 183 LabelButtonPressed(event); |
183 else | 184 else |
184 PrintStatus("Image Button Pressed! count: %d", ++count_); | 185 PrintStatus("Image Button Pressed! count: %d", ++count_); |
185 } | 186 } |
186 | 187 |
187 } // namespace examples | 188 } // namespace examples |
188 } // namespace views | 189 } // namespace views |
OLD | NEW |