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

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

Issue 2943823002: Remove gfx::DIAGONAL_STRIKE and supporting code. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « ui/gfx/text_constants.h ('k') | ui/views/examples/textfield_example.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/multiline_example.h" 5 #include "ui/views/examples/multiline_example.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 void SetText(const base::string16& new_contents) { 90 void SetText(const base::string16& new_contents) {
91 // Color and style the text inside |test_range| to test colors and styles. 91 // Color and style the text inside |test_range| to test colors and styles.
92 const size_t range_max = new_contents.length(); 92 const size_t range_max = new_contents.length();
93 gfx::Range color_range = ClampRange(gfx::Range(1, 21), range_max); 93 gfx::Range color_range = ClampRange(gfx::Range(1, 21), range_max);
94 gfx::Range bold_range = ClampRange(gfx::Range(4, 10), range_max); 94 gfx::Range bold_range = ClampRange(gfx::Range(4, 10), range_max);
95 gfx::Range italic_range = ClampRange(gfx::Range(7, 13), range_max); 95 gfx::Range italic_range = ClampRange(gfx::Range(7, 13), range_max);
96 96
97 render_text_->SetText(new_contents); 97 render_text_->SetText(new_contents);
98 render_text_->SetColor(SK_ColorBLACK); 98 render_text_->SetColor(SK_ColorBLACK);
99 render_text_->ApplyColor(0xFFFF0000, color_range); 99 render_text_->ApplyColor(0xFFFF0000, color_range);
100 render_text_->SetStyle(gfx::DIAGONAL_STRIKE, false);
101 render_text_->ApplyStyle(gfx::DIAGONAL_STRIKE, true, color_range);
102 render_text_->SetStyle(gfx::UNDERLINE, false); 100 render_text_->SetStyle(gfx::UNDERLINE, false);
103 render_text_->ApplyStyle(gfx::UNDERLINE, true, color_range); 101 render_text_->ApplyStyle(gfx::UNDERLINE, true, color_range);
104 render_text_->ApplyStyle(gfx::ITALIC, true, italic_range); 102 render_text_->ApplyStyle(gfx::ITALIC, true, italic_range);
105 render_text_->ApplyWeight(gfx::Font::Weight::BOLD, bold_range); 103 render_text_->ApplyWeight(gfx::Font::Weight::BOLD, bold_range);
106 InvalidateLayout(); 104 InvalidateLayout();
107 } 105 }
108 106
109 void SetMaxLines(int max_lines) { 107 void SetMaxLines(int max_lines) {
110 render_text_->SetMaxLines(max_lines); 108 render_text_->SetMaxLines(max_lines);
111 render_text_->SetElideBehavior(max_lines ? gfx::ELIDE_TAIL : gfx::NO_ELIDE); 109 render_text_->SetElideBehavior(max_lines ? gfx::ELIDE_TAIL : gfx::NO_ELIDE);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 : base::string16()); 199 : base::string16());
202 } else if (sender == elision_checkbox_) { 200 } else if (sender == elision_checkbox_) {
203 render_text_view_->SetMaxLines(elision_checkbox_->checked() ? 3 : 0); 201 render_text_view_->SetMaxLines(elision_checkbox_->checked() ? 3 : 0);
204 } 202 }
205 container()->Layout(); 203 container()->Layout();
206 container()->SchedulePaint(); 204 container()->SchedulePaint();
207 } 205 }
208 206
209 } // namespace examples 207 } // namespace examples
210 } // namespace views 208 } // namespace views
OLDNEW
« no previous file with comments | « ui/gfx/text_constants.h ('k') | ui/views/examples/textfield_example.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698