| 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/label_example.h" | 5 #include "ui/views/examples/label_example.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "ui/gfx/geometry/vector2d.h" |
| 8 #include "ui/views/background.h" | 9 #include "ui/views/background.h" |
| 9 #include "ui/views/border.h" | 10 #include "ui/views/border.h" |
| 10 #include "ui/views/controls/button/checkbox.h" | 11 #include "ui/views/controls/button/checkbox.h" |
| 11 #include "ui/views/controls/combobox/combobox.h" | 12 #include "ui/views/controls/combobox/combobox.h" |
| 12 #include "ui/views/controls/label.h" | 13 #include "ui/views/controls/label.h" |
| 13 #include "ui/views/controls/textfield/textfield.h" | 14 #include "ui/views/controls/textfield/textfield.h" |
| 14 #include "ui/views/examples/example_combobox_model.h" | 15 #include "ui/views/examples/example_combobox_model.h" |
| 15 #include "ui/views/layout/box_layout.h" | 16 #include "ui/views/layout/box_layout.h" |
| 16 #include "ui/views/layout/grid_layout.h" | 17 #include "ui/views/layout/grid_layout.h" |
| 17 #include "ui/views/view.h" | 18 #include "ui/views/view.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 83 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 83 label->SetEnabledColor(SK_ColorBLUE); | 84 label->SetEnabledColor(SK_ColorBLUE); |
| 84 container->AddChildView(label); | 85 container->AddChildView(label); |
| 85 | 86 |
| 86 label = new Label(WideToUTF16(L"Password!")); | 87 label = new Label(WideToUTF16(L"Password!")); |
| 87 label->SetObscured(true); | 88 label->SetObscured(true); |
| 88 container->AddChildView(label); | 89 container->AddChildView(label); |
| 89 | 90 |
| 90 label = new Label(ASCIIToUTF16("A Courier-18 label with shadows.")); | 91 label = new Label(ASCIIToUTF16("A Courier-18 label with shadows.")); |
| 91 label->SetFontList(gfx::FontList("Courier, 18px")); | 92 label->SetFontList(gfx::FontList("Courier, 18px")); |
| 92 gfx::ShadowValues shadows(1, gfx::ShadowValue(gfx::Point(), 1, SK_ColorRED)); | 93 gfx::ShadowValues shadows(1, |
| 94 gfx::ShadowValue(gfx::Vector2d(), 1, SK_ColorRED)); |
| 93 gfx::ShadowValue shadow(gfx::Point(2, 2), 0, SK_ColorGRAY); | 95 gfx::ShadowValue shadow(gfx::Point(2, 2), 0, SK_ColorGRAY); |
| 94 shadows.push_back(shadow); | 96 shadows.push_back(shadow); |
| 95 label->SetShadows(shadows); | 97 label->SetShadows(shadows); |
| 96 container->AddChildView(label); | 98 container->AddChildView(label); |
| 97 | 99 |
| 98 label = new PreferredSizeLabel(); | 100 label = new PreferredSizeLabel(); |
| 99 label->SetText(ASCIIToUTF16("A long label will elide toward its logical end " | 101 label->SetText(ASCIIToUTF16("A long label will elide toward its logical end " |
| 100 "if the text's width exceeds the label's available width.")); | 102 "if the text's width exceeds the label's available width.")); |
| 101 container->AddChildView(label); | 103 container->AddChildView(label); |
| 102 | 104 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 example_combobox_models_.push_back(model); | 208 example_combobox_models_.push_back(model); |
| 207 Combobox* combobox = new Combobox(model); | 209 Combobox* combobox = new Combobox(model); |
| 208 combobox->SetSelectedIndex(0); | 210 combobox->SetSelectedIndex(0); |
| 209 combobox->set_listener(this); | 211 combobox->set_listener(this); |
| 210 layout->AddView(combobox); | 212 layout->AddView(combobox); |
| 211 return combobox; | 213 return combobox; |
| 212 } | 214 } |
| 213 | 215 |
| 214 } // namespace examples | 216 } // namespace examples |
| 215 } // namespace views | 217 } // namespace views |
| OLD | NEW |