Index: ui/views/examples/label_example.cc |
diff --git a/ui/views/examples/label_example.cc b/ui/views/examples/label_example.cc |
index 83dd9227ceb8d50848995e7c69909c9c1ca6110d..a4a91133f2fab1d081161c4df8269f18db48971b 100644 |
--- a/ui/views/examples/label_example.cc |
+++ b/ui/views/examples/label_example.cc |
@@ -21,26 +21,20 @@ namespace { |
// A Label with a constrained preferred size to demonstrate eliding or wrapping. |
class PreferredSizeLabel : public Label { |
public: |
- PreferredSizeLabel(); |
- virtual ~PreferredSizeLabel(); |
+ PreferredSizeLabel() : Label() { |
+ SetBorder(Border::CreateSolidBorder(2, SK_ColorCYAN)); |
+ } |
+ virtual ~PreferredSizeLabel() {} |
// Label: |
- virtual gfx::Size GetPreferredSize() const OVERRIDE; |
+ virtual gfx::Size GetPreferredSize() const OVERRIDE { |
+ return gfx::Size(100, 40); |
+ } |
private: |
DISALLOW_COPY_AND_ASSIGN(PreferredSizeLabel); |
}; |
-PreferredSizeLabel::PreferredSizeLabel() : Label() { |
- SetBorder(Border::CreateSolidBorder(2, SK_ColorCYAN)); |
-} |
- |
-PreferredSizeLabel::~PreferredSizeLabel() {} |
- |
-gfx::Size PreferredSizeLabel::GetPreferredSize() const { |
- return gfx::Size(100, 40); |
-} |
- |
} // namespace |
LabelExample::LabelExample() : ExampleBase("Label") {} |
@@ -81,6 +75,12 @@ void LabelExample::CreateExampleView(View* container) { |
container->AddChildView(label); |
label = new PreferredSizeLabel(); |
+ label->SetElideBehavior(gfx::FADE_TAIL); |
+ label->SetText(ASCIIToUTF16("Some long labels will fade, rather than elide, " |
+ "if the text's width exceeds the label's available width.")); |
+ container->AddChildView(label); |
+ |
+ label = new PreferredSizeLabel(); |
label->SetText(ASCIIToUTF16("A multi-line label will wrap onto subsequent " |
"lines if the text's width exceeds the label's available width.")); |
label->SetMultiLine(true); |