| 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" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 virtual ~PreferredSizeLabel(); | 25 virtual ~PreferredSizeLabel(); |
| 26 | 26 |
| 27 // Label: | 27 // Label: |
| 28 virtual gfx::Size GetPreferredSize() OVERRIDE; | 28 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 DISALLOW_COPY_AND_ASSIGN(PreferredSizeLabel); | 31 DISALLOW_COPY_AND_ASSIGN(PreferredSizeLabel); |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 PreferredSizeLabel::PreferredSizeLabel() : Label() { | 34 PreferredSizeLabel::PreferredSizeLabel() : Label() { |
| 35 set_border(Border::CreateSolidBorder(2, SK_ColorCYAN)); | 35 SetBorder(Border::CreateSolidBorder(2, SK_ColorCYAN)); |
| 36 } | 36 } |
| 37 | 37 |
| 38 PreferredSizeLabel::~PreferredSizeLabel() {} | 38 PreferredSizeLabel::~PreferredSizeLabel() {} |
| 39 | 39 |
| 40 gfx::Size PreferredSizeLabel::GetPreferredSize() { return gfx::Size(100, 40); } | 40 gfx::Size PreferredSizeLabel::GetPreferredSize() { return gfx::Size(100, 40); } |
| 41 | 41 |
| 42 } // namespace | 42 } // namespace |
| 43 | 43 |
| 44 LabelExample::LabelExample() : ExampleBase("Label") {} | 44 LabelExample::LabelExample() : ExampleBase("Label") {} |
| 45 | 45 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 label = new PreferredSizeLabel(); | 80 label = new PreferredSizeLabel(); |
| 81 label->SetText(ASCIIToUTF16("A multi-line label will wrap onto subsequent " | 81 label->SetText(ASCIIToUTF16("A multi-line label will wrap onto subsequent " |
| 82 "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.")); |
| 83 label->SetMultiLine(true); | 83 label->SetMultiLine(true); |
| 84 container->AddChildView(label); | 84 container->AddChildView(label); |
| 85 } | 85 } |
| 86 | 86 |
| 87 } // namespace examples | 87 } // namespace examples |
| 88 } // namespace views | 88 } // namespace views |
| OLD | NEW |