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

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

Issue 11535014: Replace StyleRange with BreakList; update RenderText, etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 7 years, 10 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/textfield/textfield.cc ('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 (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/utf_string_conversions.h" 7 #include "base/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/views/controls/button/checkbox.h" 10 #include "ui/views/controls/button/checkbox.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 layout->AddPaddingRow(0, 8); 249 layout->AddPaddingRow(0, 8);
250 } 250 }
251 251
252 void TextExample::ButtonPressed(Button* button, const ui::Event& event) { 252 void TextExample::ButtonPressed(Button* button, const ui::Event& event) {
253 int flags = text_view_->text_flags(); 253 int flags = text_view_->text_flags();
254 int style = text_view_->GetFontStyle(); 254 int style = text_view_->GetFontStyle();
255 SetFlagFromCheckbox(multiline_checkbox_, &flags, gfx::Canvas::MULTI_LINE); 255 SetFlagFromCheckbox(multiline_checkbox_, &flags, gfx::Canvas::MULTI_LINE);
256 SetFlagFromCheckbox(break_checkbox_, &flags, gfx::Canvas::CHARACTER_BREAK); 256 SetFlagFromCheckbox(break_checkbox_, &flags, gfx::Canvas::CHARACTER_BREAK);
257 SetFlagFromCheckbox(bold_checkbox_, &style, gfx::Font::BOLD); 257 SetFlagFromCheckbox(bold_checkbox_, &style, gfx::Font::BOLD);
258 SetFlagFromCheckbox(italic_checkbox_, &style, gfx::Font::ITALIC); 258 SetFlagFromCheckbox(italic_checkbox_, &style, gfx::Font::ITALIC);
259 SetFlagFromCheckbox(underline_checkbox_, &style, gfx::Font::UNDERLINED); 259 SetFlagFromCheckbox(underline_checkbox_, &style, gfx::Font::UNDERLINE);
260 text_view_->set_halo(halo_checkbox_->checked()); 260 text_view_->set_halo(halo_checkbox_->checked());
261 text_view_->set_text_flags(flags); 261 text_view_->set_text_flags(flags);
262 text_view_->SetFontStyle(style); 262 text_view_->SetFontStyle(style);
263 text_view_->SchedulePaint(); 263 text_view_->SchedulePaint();
264 } 264 }
265 265
266 void TextExample::OnSelectedIndexChanged(Combobox* combobox) { 266 void TextExample::OnSelectedIndexChanged(Combobox* combobox) {
267 int text_flags = text_view_->text_flags(); 267 int text_flags = text_view_->text_flags();
268 if (combobox == h_align_cb_) { 268 if (combobox == h_align_cb_) {
269 text_flags &= ~(gfx::Canvas::TEXT_ALIGN_LEFT | 269 text_flags &= ~(gfx::Canvas::TEXT_ALIGN_LEFT |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 text_flags |= gfx::Canvas::HIDE_PREFIX; 337 text_flags |= gfx::Canvas::HIDE_PREFIX;
338 break; 338 break;
339 } 339 }
340 } 340 }
341 text_view_->set_text_flags(text_flags); 341 text_view_->set_text_flags(text_flags);
342 text_view_->SchedulePaint(); 342 text_view_->SchedulePaint();
343 } 343 }
344 344
345 } // namespace examples 345 } // namespace examples
346 } // namespace views 346 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/textfield.cc ('k') | ui/views/examples/textfield_example.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698