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

Side by Side Diff: views/examples/table2_example.h

Issue 6038006: Leftover wstring removal from r70290 (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 12 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 | « no previous file | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #ifndef VIEWS_EXAMPLES_TABLE2_EXAMPLE_H_ 5 #ifndef VIEWS_EXAMPLES_TABLE2_EXAMPLE_H_
6 #define VIEWS_EXAMPLES_TABLE2_EXAMPLE_H_ 6 #define VIEWS_EXAMPLES_TABLE2_EXAMPLE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 column3_visible_checkbox_->SetChecked(true); 44 column3_visible_checkbox_->SetChecked(true);
45 column3_visible_checkbox_->set_listener(this); 45 column3_visible_checkbox_->set_listener(this);
46 column4_visible_checkbox_ = new views::Checkbox(L"Price column visible"); 46 column4_visible_checkbox_ = new views::Checkbox(L"Price column visible");
47 column4_visible_checkbox_->SetChecked(true); 47 column4_visible_checkbox_->SetChecked(true);
48 column4_visible_checkbox_->set_listener(this); 48 column4_visible_checkbox_->set_listener(this);
49 49
50 views::GridLayout* layout = new views::GridLayout(container); 50 views::GridLayout* layout = new views::GridLayout(container);
51 container->SetLayoutManager(layout); 51 container->SetLayoutManager(layout);
52 52
53 std::vector<TableColumn> columns; 53 std::vector<TableColumn> columns;
54 columns.push_back(TableColumn(0, L"Fruit", TableColumn::LEFT, 100)); 54 columns.push_back(TableColumn(0, ASCIIToUTF16("Fruit"), TableColumn::LEFT,
55 columns.push_back(TableColumn(1, L"Color", TableColumn::LEFT, 100)); 55 100));
56 columns.push_back(TableColumn(2, L"Origin", TableColumn::LEFT, 100)); 56 columns.push_back(TableColumn(1, ASCIIToUTF16("Color"), TableColumn::LEFT,
57 columns.push_back(TableColumn(3, L"Price", TableColumn::LEFT, 100)); 57 100));
58 columns.push_back(TableColumn(2, ASCIIToUTF16("Origin"), TableColumn::LEFT,
59 100));
60 columns.push_back(TableColumn(3, ASCIIToUTF16("Price"), TableColumn::LEFT,
61 100));
58 const int options = (views::TableView2::SINGLE_SELECTION | 62 const int options = (views::TableView2::SINGLE_SELECTION |
59 views::TableView2::RESIZABLE_COLUMNS | 63 views::TableView2::RESIZABLE_COLUMNS |
60 views::TableView2::AUTOSIZE_COLUMNS | 64 views::TableView2::AUTOSIZE_COLUMNS |
61 views::TableView2::HORIZONTAL_LINES | 65 views::TableView2::HORIZONTAL_LINES |
62 views::TableView2::VERTICAL_LINES); 66 views::TableView2::VERTICAL_LINES);
63 table_ = new views::TableView2(this, columns, views::ICON_AND_TEXT, 67 table_ = new views::TableView2(this, columns, views::ICON_AND_TEXT,
64 options); 68 options);
65 table_->SetObserver(this); 69 table_->SetObserver(this);
66 icon1.setConfig(SkBitmap::kARGB_8888_Config, 16, 16); 70 icon1.setConfig(SkBitmap::kARGB_8888_Config, 16, 16);
67 icon1.allocPixels(); 71 icon1.allocPixels();
(...skipping 23 matching lines...) Expand all
91 95
92 layout->StartRow(0 /* no expand */, 1); 96 layout->StartRow(0 /* no expand */, 1);
93 97
94 layout->AddView(column1_visible_checkbox_); 98 layout->AddView(column1_visible_checkbox_);
95 layout->AddView(column2_visible_checkbox_); 99 layout->AddView(column2_visible_checkbox_);
96 layout->AddView(column3_visible_checkbox_); 100 layout->AddView(column3_visible_checkbox_);
97 layout->AddView(column4_visible_checkbox_); 101 layout->AddView(column4_visible_checkbox_);
98 } 102 }
99 103
100 // TableModel implementation: 104 // TableModel implementation:
101 virtual int RowCount() { 105 virtual int RowCount() {
viettrungluu 2010/12/30 05:21:16 Arguably, you should include base/compiler_specifi
sadrul 2010/12/30 05:33:49 I am not really familiar with OVERRIDE. So I will
102 return 10; 106 return 10;
103 } 107 }
104 108
105 virtual std::wstring GetText(int row, int column_id) { 109 virtual string16 GetText(int row, int column_id) {
106 std::wstring cells[5][5] = { 110 std::string cells[5][5] = {
viettrungluu 2010/12/30 05:21:16 Comment: This may as well be made a const char* co
sadrul 2010/12/30 05:33:49 Making it const char* const sounds like a good ide
107 { L"Orange", L"Orange", L"South america", L"$5" }, 111 { "Orange", "Orange", "South america", "$5" },
108 { L"Apple", L"Green", L"Canada", L"$3" }, 112 { "Apple", "Green", "Canada", "$3" },
109 { L"Blue berries", L"Blue", L"Mexico", L"$10.3" }, 113 { "Blue berries", "Blue", "Mexico", "$10.3" },
110 { L"Strawberries", L"Red", L"California", L"$7" }, 114 { "Strawberries", "Red", "California", "$7" },
111 { L"Cantaloupe", L"Orange", L"South america", L"$5" }, 115 { "Cantaloupe", "Orange", "South america", "$5" },
viettrungluu 2010/12/30 05:21:16 (And, strictly speaking, C++ doesn't allow the tra
sadrul 2010/12/30 05:33:49 Fixed.
112 }; 116 };
113 return cells[row % 5][column_id]; 117 return ASCIIToUTF16(cells[row % 5][column_id]);
114 } 118 }
115 119
116 virtual SkBitmap GetIcon(int row) { 120 virtual SkBitmap GetIcon(int row) {
117 return row % 2 ? icon1 : icon2; 121 return row % 2 ? icon1 : icon2;
118 } 122 }
119 123
120 virtual void SetObserver(TableModelObserver* observer) { 124 virtual void SetObserver(TableModelObserver* observer) {
121 } 125 }
122 126
123 // TableViewObserver implementation: 127 // TableViewObserver implementation:
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 171
168 SkBitmap icon1; 172 SkBitmap icon1;
169 SkBitmap icon2; 173 SkBitmap icon2;
170 174
171 DISALLOW_COPY_AND_ASSIGN(Table2Example); 175 DISALLOW_COPY_AND_ASSIGN(Table2Example);
172 }; 176 };
173 177
174 } // namespace examples 178 } // namespace examples
175 179
176 #endif // VIEWS_EXAMPLES_TABLE2_EXAMPLE_H_ 180 #endif // VIEWS_EXAMPLES_TABLE2_EXAMPLE_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698