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

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

Issue 312233003: Add fade eliding for Views Labels; related cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refine alignment check; minor additional cleanup. 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/examples/label_example.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/text_example.h" 5 #include "ui/views/examples/text_example.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "ui/base/resource/resource_bundle.h" 8 #include "ui/base/resource/resource_bundle.h"
9 #include "ui/gfx/canvas.h" 9 #include "ui/gfx/canvas.h"
10 #include "ui/gfx/font_list.h" 10 #include "ui/gfx/font_list.h"
11 #include "ui/views/border.h" 11 #include "ui/views/border.h"
12 #include "ui/views/controls/button/checkbox.h" 12 #include "ui/views/controls/button/checkbox.h"
13 #include "ui/views/controls/combobox/combobox.h" 13 #include "ui/views/controls/combobox/combobox.h"
14 #include "ui/views/controls/label.h" 14 #include "ui/views/controls/label.h"
15 #include "ui/views/examples/example_combobox_model.h" 15 #include "ui/views/examples/example_combobox_model.h"
16 #include "ui/views/layout/grid_layout.h" 16 #include "ui/views/layout/grid_layout.h"
17 #include "ui/views/view.h" 17 #include "ui/views/view.h"
18 18
19 using base::ASCIIToUTF16;
20
21 namespace views { 19 namespace views {
22 namespace examples { 20 namespace examples {
23 21
24 namespace { 22 namespace {
25 23
26 // Number of columns in the view layout. 24 // Number of columns in the view layout.
27 const int kNumColumns = 10; 25 const int kNumColumns = 10;
28 26
29 const char kShortText[] = "Batman"; 27 const char kShortText[] = "The quick brown fox jumps over the lazy dog.";
30 const char kMediumText[] = "The quick brown fox jumps over the lazy dog.";
31 const char kLongText[] = 28 const char kLongText[] =
32 "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod " 29 "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod "
33 "tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim " 30 "tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim "
34 "veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea " 31 "veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea "
35 "commodo consequat. Duis aute irure dolor in reprehenderit in voluptate " 32 "commodo consequat.\nDuis aute irure dolor in reprehenderit in voluptate "
36 "velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint " 33 "velit esse cillum dolore eu fugiat nulla pariatur.\n\nExcepteur sint "
37 "occaecat cupidatat non proident, sunt in culpa qui officia deserunt " 34 "occaecat cupidatat non proident, sunt in culpa qui officia deserunt "
38 "mollit anim id est laborum."; 35 "mollit anim id est laborum.";
39 const char kAmpersandText[] = 36 const char kAmpersandText[] =
40 "The quick && &brown fo&x jumps over the lazy dog."; 37 "The quick && &brown fo&x jumps over the lazy dog.";
41 const char kNewlineText[] = 38 const wchar_t kRightToLeftText[] =
42 "The quick \nbrown fox jumps\n\n over the lazy dog."; 39 L"\x5e9\x5dc\x5d5\x5dd \x5d4\x5e2\x5d5\x5dc\x5dd! "
40 L"\x5e9\x5dc\x5d5\x5dd \x5d4\x5e2\x5d5\x5dc\x5dd! "
41 L"\x5e9\x5dc\x5d5\x5dd \x5d4\x5e2\x5d5\x5dc\x5dd! "
42 L"\x5e9\x5dc\x5d5\x5dd \x5d4\x5e2\x5d5\x5dc\x5dd! "
43 L"\x5e9\x5dc\x5d5\x5dd \x5d4\x5e2\x5d5\x5dc\x5dd! "
44 L"\x5e9\x5dc\x5d5\x5dd \x5d4\x5e2\x5d5\x5dc\x5dd! "
45 L"\x5e9\x5dc\x5d5\x5dd \x5d4\x5e2\x5d5\x5dc\x5dd! "
46 L"\x5e9\x5dc\x5d5\x5dd \x5d4\x5e2\x5d5\x5dc\x5dd!";
43 47
44 const char* kTextExamples[] = { 48 const char* kTextExamples[] = { "Short", "Long", "Ampersands", "RTL Hebrew", };
45 "Short", 49 const char* kElideBehaviors[] = { "Elide", "Truncate", "Fade", };
46 "Medium", 50 const char* kPrefixOptions[] = { "Default", "Show", "Hide", };
47 "Long", 51 const char* kHorizontalAligments[] = { "Default", "Left", "Center", "Right", };
48 "Ampersands",
49 "Newlines",
50 };
51
52 const char* kElidingBehaviors[] = {
53 "Ellipsis",
54 "None",
55 "Fade Tail",
56 "Fade Head",
57 };
58
59 const char* kPrefixOptions[] = {
60 "Default",
61 "Show",
62 "Hide",
63 };
64
65 const char* kHorizontalAligments[] = {
66 "Default",
67 "Left",
68 "Center",
69 "Right",
70 };
71 52
72 // Toggles bit |flag| on |flags| based on state of |checkbox|. 53 // Toggles bit |flag| on |flags| based on state of |checkbox|.
73 void SetFlagFromCheckbox(Checkbox* checkbox, int* flags, int flag) { 54 void SetFlagFromCheckbox(Checkbox* checkbox, int* flags, int flag) {
74 if (checkbox->checked()) 55 if (checkbox->checked())
75 *flags |= flag; 56 *flags |= flag;
76 else 57 else
77 *flags &= ~flag; 58 *flags &= ~flag;
78 } 59 }
79 60
80 } // namespace 61 } // namespace
81 62
82 // TextExample's content view, which is responsible for drawing a string with 63 // TextExample's content view, which draws stylized string.
83 // the specified style.
84 class TextExample::TextExampleView : public View { 64 class TextExample::TextExampleView : public View {
85 public: 65 public:
86 TextExampleView() 66 TextExampleView()
87 : text_(ASCIIToUTF16(kShortText)), 67 : text_(base::ASCIIToUTF16(kShortText)),
88 text_flags_(0), 68 flags_(0),
89 halo_(false), 69 halo_(false),
90 fade_(false), 70 elide_(gfx::TRUNCATE) {
91 fade_mode_(gfx::Canvas::TruncateFadeTail) {
92 } 71 }
93 72
94 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { 73 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE {
95 View::OnPaint(canvas); 74 View::OnPaint(canvas);
96 const gfx::Rect bounds = GetContentsBounds(); 75 const gfx::Rect bounds = GetContentsBounds();
97 76 const SkColor color = SK_ColorDKGRAY;
98 if (fade_) { 77 if (elide_ == gfx::FADE_TAIL) {
99 canvas->DrawFadeTruncatingStringRect(text_, fade_mode_, font_list_, 78 canvas->DrawFadedString(text_, font_list_, color, bounds, flags_);
100 SK_ColorDKGRAY, bounds);
101 } else if (halo_) { 79 } else if (halo_) {
102 canvas->DrawStringRectWithHalo(text_, font_list_, SK_ColorDKGRAY, 80 canvas->DrawStringRectWithHalo(text_, font_list_, color, SK_ColorYELLOW,
103 SK_ColorWHITE, bounds, text_flags_); 81 bounds, flags_);
104 } else { 82 } else {
105 canvas->DrawStringRectWithFlags(text_, font_list_, SK_ColorDKGRAY, bounds, 83 canvas->DrawStringRectWithFlags(text_, font_list_, color, bounds, flags_);
106 text_flags_);
107 } 84 }
108 } 85 }
109 86
110 int text_flags() const { return text_flags_; } 87 int flags() const { return flags_; }
111 void set_text_flags(int text_flags) { text_flags_ = text_flags; } 88 void set_flags(int flags) { flags_ = flags; }
89 void set_text(const base::string16& text) { text_ = text; }
90 void set_halo(bool halo) { halo_ = halo; }
91 void set_elide(gfx::ElideBehavior elide) { elide_ = elide; }
112 92
113 const base::string16& text() const { return text_; } 93 int GetStyle() const { return font_list_.GetFontStyle(); }
114 void set_text(const base::string16& text) { text_ = text; } 94 void SetStyle(int style) { font_list_ = font_list_.DeriveWithStyle(style); }
115
116 bool halo() const { return halo_; }
117 void set_halo(bool halo) { halo_ = halo; }
118
119 bool fade() const { return fade_; }
120 void set_fade(bool fade) { fade_ = fade; }
121
122 gfx::Canvas::TruncateFadeMode fade_mode() const { return fade_mode_; }
123 void set_fade_mode(gfx::Canvas::TruncateFadeMode mode) { fade_mode_ = mode; }
124
125 int GetFontStyle() const {
126 return font_list_.GetFontStyle();
127 }
128 void SetFontStyle(int style) {
129 font_list_ = font_list_.DeriveWithStyle(style);
130 }
131 95
132 private: 96 private:
133 // The font used for drawing the text. 97 // The font used for drawing the text.
134 gfx::FontList font_list_; 98 gfx::FontList font_list_;
135 99
136 // The text to draw. 100 // The text to draw.
137 base::string16 text_; 101 base::string16 text_;
138 102
139 // Text flags for passing to |DrawStringRect()|. 103 // Text flags for passing to |DrawStringRect()|.
140 int text_flags_; 104 int flags_;
141 105
142 // If |true|, specifies to call |DrawStringWithHalo()| instead of 106 // A flag to draw a halo around the text.
143 // |DrawStringRect()|.
144 bool halo_; 107 bool halo_;
145 108
146 // If |true|, specifies to call |DrawFadeTruncatingString()| instead of 109 // The eliding, fading, or truncating behavior.
147 // |DrawStringRect()|. 110 gfx::ElideBehavior elide_;
148 bool fade_;
149
150 // If |fade_| is |true|, fade mode parameter to |DrawFadeTruncatingString()|.
151 gfx::Canvas::TruncateFadeMode fade_mode_;
152 111
153 DISALLOW_COPY_AND_ASSIGN(TextExampleView); 112 DISALLOW_COPY_AND_ASSIGN(TextExampleView);
154 }; 113 };
155 114
156 TextExample::TextExample() : ExampleBase("Text Styles") { 115 TextExample::TextExample() : ExampleBase("Text Styles") {}
157 }
158 116
159 TextExample::~TextExample() { 117 TextExample::~TextExample() {
160 // Remove all the views first as some reference models in 118 // Remove the views first as some reference combobox models.
161 // |example_combobox_model_|.
162 container()->RemoveAllChildViews(true); 119 container()->RemoveAllChildViews(true);
163 } 120 }
164 121
165 Checkbox* TextExample::AddCheckbox(GridLayout* layout, const char* name) { 122 Checkbox* TextExample::AddCheckbox(GridLayout* layout, const char* name) {
166 Checkbox* checkbox = new Checkbox(ASCIIToUTF16(name)); 123 Checkbox* checkbox = new Checkbox(base::ASCIIToUTF16(name));
167 checkbox->set_listener(this); 124 checkbox->set_listener(this);
168 layout->AddView(checkbox); 125 layout->AddView(checkbox);
169 return checkbox; 126 return checkbox;
170 } 127 }
171 128
172 Combobox* TextExample::AddCombobox(GridLayout* layout, 129 Combobox* TextExample::AddCombobox(GridLayout* layout,
173 const char* name, 130 const char* name,
174 const char** strings, 131 const char** strings,
175 int count) { 132 int count) {
176 layout->StartRow(0, 0); 133 layout->StartRow(0, 0);
177 layout->AddView(new Label(ASCIIToUTF16(name))); 134 layout->AddView(new Label(base::ASCIIToUTF16(name)));
178 ExampleComboboxModel* combobox_model = new ExampleComboboxModel(strings, 135 ExampleComboboxModel* model = new ExampleComboboxModel(strings, count);
179 count); 136 example_combobox_model_.push_back(model);
180 example_combobox_model_.push_back(combobox_model); 137 Combobox* combobox = new Combobox(model);
181 Combobox* combobox = new Combobox(combobox_model);
182 combobox->SetSelectedIndex(0); 138 combobox->SetSelectedIndex(0);
183 combobox->set_listener(this); 139 combobox->set_listener(this);
184 layout->AddView(combobox, kNumColumns - 1, 1); 140 layout->AddView(combobox, kNumColumns - 1, 1);
185 return combobox; 141 return combobox;
186 } 142 }
187 143
188 void TextExample::CreateExampleView(View* container) { 144 void TextExample::CreateExampleView(View* container) {
189 text_view_ = new TextExampleView; 145 text_view_ = new TextExampleView;
190 text_view_->SetBorder(Border::CreateSolidBorder(1, SK_ColorGRAY)); 146 text_view_->SetBorder(Border::CreateSolidBorder(1, SK_ColorGRAY));
191
192 GridLayout* layout = new GridLayout(container); 147 GridLayout* layout = new GridLayout(container);
193 container->SetLayoutManager(layout); 148 container->SetLayoutManager(layout);
194
195 layout->AddPaddingRow(0, 8); 149 layout->AddPaddingRow(0, 8);
196 150
197 ColumnSet* column_set = layout->AddColumnSet(0); 151 ColumnSet* column_set = layout->AddColumnSet(0);
198 column_set->AddPaddingColumn(0, 8); 152 column_set->AddPaddingColumn(0, 8);
199 column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL, 153 column_set->AddColumn(GridLayout::LEADING, GridLayout::FILL,
200 0.1f, GridLayout::USE_PREF, 0, 0); 154 0.1f, GridLayout::USE_PREF, 0, 0);
201 for (int i = 0; i < kNumColumns - 1; i++) 155 for (int i = 0; i < kNumColumns - 1; i++)
202 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 156 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL,
203 0.1f, GridLayout::USE_PREF, 0, 0); 157 0.1f, GridLayout::USE_PREF, 0, 0);
204 column_set->AddPaddingColumn(0, 8); 158 column_set->AddPaddingColumn(0, 8);
205 159
206 h_align_cb_ = AddCombobox(layout, 160 h_align_cb_ = AddCombobox(layout, "H-Align", kHorizontalAligments,
207 "H-Align",
208 kHorizontalAligments,
209 arraysize(kHorizontalAligments)); 161 arraysize(kHorizontalAligments));
210 eliding_cb_ = AddCombobox(layout, 162 eliding_cb_ = AddCombobox(layout, "Eliding", kElideBehaviors,
211 "Eliding", 163 arraysize(kElideBehaviors));
212 kElidingBehaviors, 164 prefix_cb_ = AddCombobox(layout, "Prefix", kPrefixOptions,
213 arraysize(kElidingBehaviors));
214 prefix_cb_ = AddCombobox(layout,
215 "Prefix",
216 kPrefixOptions,
217 arraysize(kPrefixOptions)); 165 arraysize(kPrefixOptions));
218 text_cb_ = AddCombobox(layout, 166 text_cb_ = AddCombobox(layout, "Example Text", kTextExamples,
219 "Example Text",
220 kTextExamples,
221 arraysize(kTextExamples)); 167 arraysize(kTextExamples));
222 168
223 layout->StartRow(0, 0); 169 layout->StartRow(0, 0);
224 multiline_checkbox_ = AddCheckbox(layout, "Multiline"); 170 multiline_checkbox_ = AddCheckbox(layout, "Multiline");
225 break_checkbox_ = AddCheckbox(layout, "Character Break"); 171 break_checkbox_ = AddCheckbox(layout, "Character Break");
226 halo_checkbox_ = AddCheckbox(layout, "Text Halo"); 172 halo_checkbox_ = AddCheckbox(layout, "Halo");
227 bold_checkbox_ = AddCheckbox(layout, "Bold"); 173 bold_checkbox_ = AddCheckbox(layout, "Bold");
228 italic_checkbox_ = AddCheckbox(layout, "Italic"); 174 italic_checkbox_ = AddCheckbox(layout, "Italic");
229 underline_checkbox_ = AddCheckbox(layout, "Underline"); 175 underline_checkbox_ = AddCheckbox(layout, "Underline");
230 176
231 layout->AddPaddingRow(0, 32); 177 layout->AddPaddingRow(0, 20);
232
233 column_set = layout->AddColumnSet(1); 178 column_set = layout->AddColumnSet(1);
234 column_set->AddPaddingColumn(0, 16); 179 column_set->AddPaddingColumn(0, 16);
235 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 180 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL,
236 1, GridLayout::USE_PREF, 0, 0); 181 1, GridLayout::USE_PREF, 0, 0);
237 column_set->AddPaddingColumn(0, 16); 182 column_set->AddPaddingColumn(0, 16);
238 layout->StartRow(1, 1); 183 layout->StartRow(1, 1);
239 layout->AddView(text_view_); 184 layout->AddView(text_view_);
240
241 layout->AddPaddingRow(0, 8); 185 layout->AddPaddingRow(0, 8);
242 } 186 }
243 187
244 void TextExample::ButtonPressed(Button* button, const ui::Event& event) { 188 void TextExample::ButtonPressed(Button* button, const ui::Event& event) {
245 int flags = text_view_->text_flags(); 189 int flags = text_view_->flags();
246 int style = text_view_->GetFontStyle(); 190 int style = text_view_->GetStyle();
247 SetFlagFromCheckbox(multiline_checkbox_, &flags, gfx::Canvas::MULTI_LINE); 191 SetFlagFromCheckbox(multiline_checkbox_, &flags, gfx::Canvas::MULTI_LINE);
248 SetFlagFromCheckbox(break_checkbox_, &flags, gfx::Canvas::CHARACTER_BREAK); 192 SetFlagFromCheckbox(break_checkbox_, &flags, gfx::Canvas::CHARACTER_BREAK);
249 SetFlagFromCheckbox(bold_checkbox_, &style, gfx::Font::BOLD); 193 SetFlagFromCheckbox(bold_checkbox_, &style, gfx::Font::BOLD);
250 SetFlagFromCheckbox(italic_checkbox_, &style, gfx::Font::ITALIC); 194 SetFlagFromCheckbox(italic_checkbox_, &style, gfx::Font::ITALIC);
251 SetFlagFromCheckbox(underline_checkbox_, &style, gfx::Font::UNDERLINE); 195 SetFlagFromCheckbox(underline_checkbox_, &style, gfx::Font::UNDERLINE);
252 text_view_->set_halo(halo_checkbox_->checked()); 196 text_view_->set_halo(halo_checkbox_->checked());
253 text_view_->set_text_flags(flags); 197 text_view_->set_flags(flags);
254 text_view_->SetFontStyle(style); 198 text_view_->SetStyle(style);
255 text_view_->SchedulePaint(); 199 text_view_->SchedulePaint();
256 } 200 }
257 201
258 void TextExample::OnPerformAction(Combobox* combobox) { 202 void TextExample::OnPerformAction(Combobox* combobox) {
259 int text_flags = text_view_->text_flags(); 203 int flags = text_view_->flags();
260 if (combobox == h_align_cb_) { 204 if (combobox == h_align_cb_) {
261 text_flags &= ~(gfx::Canvas::TEXT_ALIGN_LEFT | 205 flags &= ~(gfx::Canvas::TEXT_ALIGN_LEFT |
262 gfx::Canvas::TEXT_ALIGN_CENTER | 206 gfx::Canvas::TEXT_ALIGN_CENTER |
263 gfx::Canvas::TEXT_ALIGN_RIGHT); 207 gfx::Canvas::TEXT_ALIGN_RIGHT);
264 switch (combobox->selected_index()) { 208 switch (combobox->selected_index()) {
265 case 0: 209 case 0:
266 break; 210 break;
267 case 1: 211 case 1:
268 text_flags |= gfx::Canvas::TEXT_ALIGN_LEFT; 212 flags |= gfx::Canvas::TEXT_ALIGN_LEFT;
269 break; 213 break;
270 case 2: 214 case 2:
271 text_flags |= gfx::Canvas::TEXT_ALIGN_CENTER; 215 flags |= gfx::Canvas::TEXT_ALIGN_CENTER;
272 break; 216 break;
273 case 3: 217 case 3:
274 text_flags |= gfx::Canvas::TEXT_ALIGN_RIGHT; 218 flags |= gfx::Canvas::TEXT_ALIGN_RIGHT;
275 break; 219 break;
276 } 220 }
277 } else if (combobox == text_cb_) { 221 } else if (combobox == text_cb_) {
278 switch (combobox->selected_index()) { 222 switch (combobox->selected_index()) {
279 case 0: 223 case 0:
280 text_view_->set_text(ASCIIToUTF16(kShortText)); 224 text_view_->set_text(base::ASCIIToUTF16(kShortText));
281 break; 225 break;
282 case 1: 226 case 1:
283 text_view_->set_text(ASCIIToUTF16(kMediumText)); 227 text_view_->set_text(base::ASCIIToUTF16(kLongText));
284 break; 228 break;
285 case 2: 229 case 2:
286 text_view_->set_text(ASCIIToUTF16(kLongText)); 230 text_view_->set_text(base::ASCIIToUTF16(kAmpersandText));
287 break; 231 break;
288 case 3: 232 case 3:
289 text_view_->set_text(ASCIIToUTF16(kAmpersandText)); 233 text_view_->set_text(base::WideToUTF16(kRightToLeftText));
290 break;
291 case 4:
292 text_view_->set_text(ASCIIToUTF16(kNewlineText));
293 break; 234 break;
294 } 235 }
295 } else if (combobox == eliding_cb_) { 236 } else if (combobox == eliding_cb_) {
296 switch (combobox->selected_index()) { 237 switch (combobox->selected_index()) {
297 case 0: 238 case 0:
298 text_flags &= ~gfx::Canvas::NO_ELLIPSIS; 239 text_view_->set_elide(gfx::ELIDE_TAIL);
299 text_view_->set_fade(false);
300 break; 240 break;
301 case 1: 241 case 1:
302 text_flags |= gfx::Canvas::NO_ELLIPSIS; 242 text_view_->set_elide(gfx::TRUNCATE);
303 text_view_->set_fade(false);
304 break; 243 break;
305 case 2: 244 case 2:
306 text_view_->set_fade_mode(gfx::Canvas::TruncateFadeTail); 245 text_view_->set_elide(gfx::FADE_TAIL);
307 text_view_->set_fade(true);
308 break;
309 case 3:
310 text_view_->set_fade_mode(gfx::Canvas::TruncateFadeHead);
311 text_view_->set_fade(true);
312 break; 246 break;
313 } 247 }
314 } else if (combobox == prefix_cb_) { 248 } else if (combobox == prefix_cb_) {
315 text_flags &= ~(gfx::Canvas::SHOW_PREFIX | gfx::Canvas::HIDE_PREFIX); 249 flags &= ~(gfx::Canvas::SHOW_PREFIX | gfx::Canvas::HIDE_PREFIX);
316 switch (combobox->selected_index()) { 250 switch (combobox->selected_index()) {
317 case 0: 251 case 0:
318 break; 252 break;
319 case 1: 253 case 1:
320 text_flags |= gfx::Canvas::SHOW_PREFIX; 254 flags |= gfx::Canvas::SHOW_PREFIX;
321 break; 255 break;
322 case 2: 256 case 2:
323 text_flags |= gfx::Canvas::HIDE_PREFIX; 257 flags |= gfx::Canvas::HIDE_PREFIX;
324 break; 258 break;
325 } 259 }
326 } 260 }
327 text_view_->set_text_flags(text_flags); 261 text_view_->set_flags(flags);
328 text_view_->SchedulePaint(); 262 text_view_->SchedulePaint();
329 } 263 }
330 264
331 } // namespace examples 265 } // namespace examples
332 } // namespace views 266 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/examples/label_example.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698