OLD | NEW |
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/table_example.h" | 5 #include "ui/views/examples/table_example.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 std::vector<ui::TableColumn> columns; | 64 std::vector<ui::TableColumn> columns; |
65 columns.push_back(TestTableColumn(0, "Fruit")); | 65 columns.push_back(TestTableColumn(0, "Fruit")); |
66 columns[0].percent = 1; | 66 columns[0].percent = 1; |
67 columns.push_back(TestTableColumn(1, "Color")); | 67 columns.push_back(TestTableColumn(1, "Color")); |
68 columns.push_back(TestTableColumn(2, "Origin")); | 68 columns.push_back(TestTableColumn(2, "Origin")); |
69 columns.push_back(TestTableColumn(3, "Price")); | 69 columns.push_back(TestTableColumn(3, "Price")); |
70 columns.back().alignment = ui::TableColumn::RIGHT; | 70 columns.back().alignment = ui::TableColumn::RIGHT; |
71 table_ = new TableView(this, columns, ICON_AND_TEXT, true); | 71 table_ = new TableView(this, columns, ICON_AND_TEXT, true); |
72 table_->SetGrouper(this); | 72 table_->SetGrouper(this); |
73 table_->SetObserver(this); | 73 table_->SetObserver(this); |
74 icon1_.setConfig(SkBitmap::kARGB_8888_Config, 16, 16); | 74 icon1_.allocN32Pixels(16, 16); |
75 icon1_.allocPixels(); | |
76 SkCanvas canvas1(icon1_); | 75 SkCanvas canvas1(icon1_); |
77 canvas1.drawColor(SK_ColorRED); | 76 canvas1.drawColor(SK_ColorRED); |
78 | 77 |
79 icon2_.setConfig(SkBitmap::kARGB_8888_Config, 16, 16); | 78 icon2_.allocN32Pixels(16, 16); |
80 icon2_.allocPixels(); | |
81 SkCanvas canvas2(icon2_); | 79 SkCanvas canvas2(icon2_); |
82 canvas2.drawColor(SK_ColorBLUE); | 80 canvas2.drawColor(SK_ColorBLUE); |
83 | 81 |
84 ColumnSet* column_set = layout->AddColumnSet(0); | 82 ColumnSet* column_set = layout->AddColumnSet(0); |
85 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, | 83 column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1, |
86 GridLayout::USE_PREF, 0, 0); | 84 GridLayout::USE_PREF, 0, 0); |
87 layout->StartRow(1 /* expand */, 0); | 85 layout->StartRow(1 /* expand */, 0); |
88 layout->AddView(table_->CreateParentIfNecessary()); | 86 layout->AddView(table_->CreateParentIfNecessary()); |
89 | 87 |
90 column_set = layout->AddColumnSet(1); | 88 column_set = layout->AddColumnSet(1); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 show = column3_visible_checkbox_->checked(); | 171 show = column3_visible_checkbox_->checked(); |
174 } else if (sender == column4_visible_checkbox_) { | 172 } else if (sender == column4_visible_checkbox_) { |
175 index = 3; | 173 index = 3; |
176 show = column4_visible_checkbox_->checked(); | 174 show = column4_visible_checkbox_->checked(); |
177 } | 175 } |
178 table_->SetColumnVisibility(index, show); | 176 table_->SetColumnVisibility(index, show); |
179 } | 177 } |
180 | 178 |
181 } // namespace examples | 179 } // namespace examples |
182 } // namespace views | 180 } // namespace views |
OLD | NEW |