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

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

Issue 308083011: Add support for painting halos on Views Labels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Draw halos over shadows; refine function order and example. 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 label = new Label(WideToUTF16(L"A UTF16 surrogate pair: \x5d0\x5b0")); 62 label = new Label(WideToUTF16(L"A UTF16 surrogate pair: \x5d0\x5b0"));
63 label->SetHorizontalAlignment(gfx::ALIGN_RIGHT); 63 label->SetHorizontalAlignment(gfx::ALIGN_RIGHT);
64 container->AddChildView(label); 64 container->AddChildView(label);
65 65
66 label = new Label(ASCIIToUTF16("A left-aligned blue label.")); 66 label = new Label(ASCIIToUTF16("A left-aligned blue label."));
67 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 67 label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
68 label->SetEnabledColor(SK_ColorBLUE); 68 label->SetEnabledColor(SK_ColorBLUE);
69 container->AddChildView(label); 69 container->AddChildView(label);
70 70
71 label = new Label(ASCIIToUTF16("A Courier-18 label with a shadow.")); 71 label = new Label(ASCIIToUTF16("A Courier-18 label with a halo and shadow."));
72 label->SetFontList(gfx::FontList("Courier, 18px")); 72 label->SetFontList(gfx::FontList("Courier, 18px"));
73 label->SetShadowColors(SK_ColorGRAY, SK_ColorLTGRAY); 73 label->SetShadowColors(SK_ColorGRAY, SK_ColorLTGRAY);
74 label->SetShadowOffset(1, 1); 74 label->SetShadowOffset(2, 2);
75 label->set_halo_color(SK_ColorGREEN);
75 container->AddChildView(label); 76 container->AddChildView(label);
76 77
77 label = new PreferredSizeLabel(); 78 label = new PreferredSizeLabel();
78 label->SetText(ASCIIToUTF16("A long label will elide toward its logical end " 79 label->SetText(ASCIIToUTF16("A long label will elide toward its logical end "
79 "if the text's width exceeds the label's available width.")); 80 "if the text's width exceeds the label's available width."));
80 container->AddChildView(label); 81 container->AddChildView(label);
81 82
82 label = new PreferredSizeLabel(); 83 label = new PreferredSizeLabel();
83 label->SetText(ASCIIToUTF16("A multi-line label will wrap onto subsequent " 84 label->SetText(ASCIIToUTF16("A multi-line label will wrap onto subsequent "
84 "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."));
85 label->SetMultiLine(true); 86 label->SetMultiLine(true);
86 container->AddChildView(label); 87 container->AddChildView(label);
87 88
88 label = new Label(WideToUTF16(L"Password!")); 89 label = new Label(WideToUTF16(L"Password!"));
89 label->SetObscured(true); 90 label->SetObscured(true);
90 container->AddChildView(label); 91 container->AddChildView(label);
91 } 92 }
92 93
93 } // namespace examples 94 } // namespace examples
94 } // 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