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

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

Issue 152473008: More or less implement RenderTextHarfBuzz (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
« ui/gfx/render_text_harfbuzz.cc ('K') | « ui/gfx/render_text_win.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 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 "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "ui/events/event.h" 8 #include "ui/events/event.h"
9 #include "ui/gfx/render_text.h" 9 #include "ui/gfx/render_text.h"
10 #include "ui/views/background.h" 10 #include "ui/views/background.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 render_text_view_(NULL), 92 render_text_view_(NULL),
93 label_(NULL), 93 label_(NULL),
94 textfield_(NULL), 94 textfield_(NULL),
95 label_checkbox_(NULL) { 95 label_checkbox_(NULL) {
96 } 96 }
97 97
98 MultilineExample::~MultilineExample() { 98 MultilineExample::~MultilineExample() {
99 } 99 }
100 100
101 void MultilineExample::CreateExampleView(View* container) { 101 void MultilineExample::CreateExampleView(View* container) {
102 const char kTestString[] = "test string asdf 1234 test string asdf 1234 " 102 const wchar_t kTestString[] = L"qwerty"
103 "test string asdf 1234 test string asdf 1234"; 103 L"\x627\x644\x631\x626\x64A\x633\x64A\x629"
104 L"asdfgh";
104 105
105 render_text_view_ = new RenderTextView(); 106 render_text_view_ = new RenderTextView();
106 render_text_view_->SetText(ASCIIToUTF16(kTestString)); 107 render_text_view_->SetText(kTestString);
107 108
108 label_ = new Label(); 109 label_ = new Label();
109 label_->SetText(ASCIIToUTF16(kTestString)); 110 label_->SetText(kTestString);
110 label_->SetMultiLine(true); 111 label_->SetMultiLine(true);
111 label_->SetBorder(Border::CreateSolidBorder(2, SK_ColorCYAN)); 112 label_->SetBorder(Border::CreateSolidBorder(2, SK_ColorCYAN));
112 113
113 label_checkbox_ = new Checkbox(ASCIIToUTF16("views::Label:")); 114 label_checkbox_ = new Checkbox(ASCIIToUTF16("views::Label:"));
114 label_checkbox_->SetChecked(true); 115 label_checkbox_->SetChecked(true);
115 label_checkbox_->set_listener(this); 116 label_checkbox_->set_listener(this);
116 label_checkbox_->set_request_focus_on_press(false); 117 label_checkbox_->set_request_focus_on_press(false);
117 118
118 textfield_ = new Textfield(); 119 textfield_ = new Textfield();
119 textfield_->set_controller(this); 120 textfield_->set_controller(this);
120 textfield_->SetText(ASCIIToUTF16(kTestString)); 121 textfield_->SetText(kTestString);
121 122
122 GridLayout* layout = new GridLayout(container); 123 GridLayout* layout = new GridLayout(container);
123 container->SetLayoutManager(layout); 124 container->SetLayoutManager(layout);
124 125
125 ColumnSet* column_set = layout->AddColumnSet(0); 126 ColumnSet* column_set = layout->AddColumnSet(0);
126 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 127 column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER,
127 0.0f, GridLayout::USE_PREF, 0, 0); 128 0.0f, GridLayout::USE_PREF, 0, 0);
128 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 129 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL,
129 1.0f, GridLayout::FIXED, 0, 0); 130 1.0f, GridLayout::FIXED, 0, 0);
130 131
(...skipping 27 matching lines...) Expand all
158 void MultilineExample::ButtonPressed(Button* sender, const ui::Event& event) { 159 void MultilineExample::ButtonPressed(Button* sender, const ui::Event& event) {
159 DCHECK_EQ(sender, label_checkbox_); 160 DCHECK_EQ(sender, label_checkbox_);
160 label_->SetText(label_checkbox_->checked() ? textfield_->text() : 161 label_->SetText(label_checkbox_->checked() ? textfield_->text() :
161 base::string16()); 162 base::string16());
162 container()->Layout(); 163 container()->Layout();
163 container()->SchedulePaint(); 164 container()->SchedulePaint();
164 } 165 }
165 166
166 } // namespace examples 167 } // namespace examples
167 } // namespace views 168 } // namespace views
OLDNEW
« ui/gfx/render_text_harfbuzz.cc ('K') | « ui/gfx/render_text_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698