Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: ui/views/examples/label_example.cc

Issue 343513002: Refactor views::Label and gfx::RenderText shadow functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove forbidden static FontList. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/views/controls/label.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 label->SetHorizontalAlignment(gfx::ALIGN_RIGHT); 57 label->SetHorizontalAlignment(gfx::ALIGN_RIGHT);
58 container->AddChildView(label); 58 container->AddChildView(label);
59 59
60 label = new Label(ASCIIToUTF16("A left-aligned blue label.")); 60 label = new Label(ASCIIToUTF16("A left-aligned blue label."));
61 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 61 label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
62 label->SetEnabledColor(SK_ColorBLUE); 62 label->SetEnabledColor(SK_ColorBLUE);
63 container->AddChildView(label); 63 container->AddChildView(label);
64 64
65 label = new Label(ASCIIToUTF16("A Courier-18 label with a halo and shadow.")); 65 label = new Label(ASCIIToUTF16("A Courier-18 label with a halo and shadow."));
66 label->SetFontList(gfx::FontList("Courier, 18px")); 66 label->SetFontList(gfx::FontList("Courier, 18px"));
67 label->SetShadowColors(SK_ColorGRAY, SK_ColorLTGRAY); 67 label->set_shadows(gfx::ShadowValues(1,
68 label->SetShadowOffset(2, 2); 68 gfx::ShadowValue(gfx::Point(2, 2), 0, SK_ColorGRAY)));
69 label->set_halo_color(SK_ColorGREEN); 69 label->set_halo_color(SK_ColorGREEN);
70 container->AddChildView(label); 70 container->AddChildView(label);
71 71
72 label = new PreferredSizeLabel(); 72 label = new PreferredSizeLabel();
73 label->SetText(ASCIIToUTF16("A long label will elide toward its logical end " 73 label->SetText(ASCIIToUTF16("A long label will elide toward its logical end "
74 "if the text's width exceeds the label's available width.")); 74 "if the text's width exceeds the label's available width."));
75 container->AddChildView(label); 75 container->AddChildView(label);
76 76
77 label = new PreferredSizeLabel(); 77 label = new PreferredSizeLabel();
78 label->SetElideBehavior(gfx::FADE_TAIL); 78 label->SetElideBehavior(gfx::FADE_TAIL);
79 label->SetText(ASCIIToUTF16("Some long labels will fade, rather than elide, " 79 label->SetText(ASCIIToUTF16("Some long labels will fade, rather than elide, "
80 "if the text's width exceeds the label's available width.")); 80 "if the text's width exceeds the label's available width."));
81 container->AddChildView(label); 81 container->AddChildView(label);
82 82
83 label = new PreferredSizeLabel(); 83 label = new PreferredSizeLabel();
84 label->SetText(ASCIIToUTF16("A multi-line label will wrap onto subsequent " 84 label->SetText(ASCIIToUTF16("A multi-line label will wrap onto subsequent "
85 "lines if the text's width exceeds the label's available width.")); 85 "lines if the text's width exceeds the label's available width."));
86 label->SetMultiLine(true); 86 label->SetMultiLine(true);
87 container->AddChildView(label); 87 container->AddChildView(label);
88 88
89 label = new Label(WideToUTF16(L"Password!")); 89 label = new Label(WideToUTF16(L"Password!"));
90 label->SetObscured(true); 90 label->SetObscured(true);
91 container->AddChildView(label); 91 container->AddChildView(label);
92 } 92 }
93 93
94 } // namespace examples 94 } // namespace examples
95 } // namespace views 95 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/label.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698