| 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/views/border.h" | 8 #include "ui/views/border.h" |
| 9 #include "ui/views/controls/label.h" | 9 #include "ui/views/controls/label.h" |
| 10 #include "ui/views/layout/box_layout.h" | 10 #include "ui/views/layout/box_layout.h" |
| 11 #include "ui/views/view.h" | 11 #include "ui/views/view.h" |
| 12 | 12 |
| 13 using base::ASCIIToUTF16; | 13 using base::ASCIIToUTF16; |
| 14 using base::WideToUTF16; |
| 14 | 15 |
| 15 namespace views { | 16 namespace views { |
| 16 namespace examples { | 17 namespace examples { |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 // A Label with a constrained preferred size to demonstrate eliding or wrapping. | 21 // A Label with a constrained preferred size to demonstrate eliding or wrapping. |
| 21 class PreferredSizeLabel : public Label { | 22 class PreferredSizeLabel : public Label { |
| 22 public: | 23 public: |
| 23 PreferredSizeLabel(); | 24 PreferredSizeLabel(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 79 |
| 79 label = new PreferredSizeLabel(); | 80 label = new PreferredSizeLabel(); |
| 80 label->SetText(ASCIIToUTF16("A multi-line label will wrap onto subsequent " | 81 label->SetText(ASCIIToUTF16("A multi-line label will wrap onto subsequent " |
| 81 "lines if the text's width exceeds the label's available width.")); | 82 "lines if the text's width exceeds the label's available width.")); |
| 82 label->SetMultiLine(true); | 83 label->SetMultiLine(true); |
| 83 container->AddChildView(label); | 84 container->AddChildView(label); |
| 84 } | 85 } |
| 85 | 86 |
| 86 } // namespace examples | 87 } // namespace examples |
| 87 } // namespace views | 88 } // namespace views |
| OLD | NEW |