OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/examples/table_example.h" | 5 #include "views/examples/table_example.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
10 #include "views/controls/button/checkbox.h" | 10 #include "views/controls/button/checkbox.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 column3_visible_checkbox_ = new views::Checkbox(L"Origin column visible"); | 30 column3_visible_checkbox_ = new views::Checkbox(L"Origin column visible"); |
31 column3_visible_checkbox_->SetChecked(true); | 31 column3_visible_checkbox_->SetChecked(true); |
32 column3_visible_checkbox_->set_listener(this); | 32 column3_visible_checkbox_->set_listener(this); |
33 column4_visible_checkbox_ = new views::Checkbox(L"Price column visible"); | 33 column4_visible_checkbox_ = new views::Checkbox(L"Price column visible"); |
34 column4_visible_checkbox_->SetChecked(true); | 34 column4_visible_checkbox_->SetChecked(true); |
35 column4_visible_checkbox_->set_listener(this); | 35 column4_visible_checkbox_->set_listener(this); |
36 | 36 |
37 views::GridLayout* layout = new views::GridLayout(container); | 37 views::GridLayout* layout = new views::GridLayout(container); |
38 container->SetLayoutManager(layout); | 38 container->SetLayoutManager(layout); |
39 | 39 |
40 std::vector<TableColumn> columns; | 40 std::vector<ui::TableColumn> columns; |
41 columns.push_back(TableColumn(0, L"Fruit", TableColumn::LEFT, 100)); | 41 columns.push_back(ui::TableColumn(0, L"Fruit", ui::TableColumn::LEFT, 100)); |
42 columns.push_back(TableColumn(1, L"Color", TableColumn::LEFT, 100)); | 42 columns.push_back(ui::TableColumn(1, L"Color", ui::TableColumn::LEFT, 100)); |
43 columns.push_back(TableColumn(2, L"Origin", TableColumn::LEFT, 100)); | 43 columns.push_back(ui::TableColumn(2, L"Origin", ui::TableColumn::LEFT, 100)); |
44 columns.push_back(TableColumn(3, L"Price", TableColumn::LEFT, 100)); | 44 columns.push_back(ui::TableColumn(3, L"Price", ui::TableColumn::LEFT, 100)); |
45 table_ = new views::TableView(this, columns, views::ICON_AND_TEXT, | 45 table_ = new views::TableView(this, columns, views::ICON_AND_TEXT, |
46 true, true, true); | 46 true, true, true); |
47 table_->SetObserver(this); | 47 table_->SetObserver(this); |
48 icon1_.setConfig(SkBitmap::kARGB_8888_Config, 16, 16); | 48 icon1_.setConfig(SkBitmap::kARGB_8888_Config, 16, 16); |
49 icon1_.allocPixels(); | 49 icon1_.allocPixels(); |
50 SkCanvas canvas1(icon1_); | 50 SkCanvas canvas1(icon1_); |
51 canvas1.drawColor(SK_ColorRED); | 51 canvas1.drawColor(SK_ColorRED); |
52 | 52 |
53 icon2_.setConfig(SkBitmap::kARGB_8888_Config, 16, 16); | 53 icon2_.setConfig(SkBitmap::kARGB_8888_Config, 16, 16); |
54 icon2_.allocPixels(); | 54 icon2_.allocPixels(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 index = 2; | 128 index = 2; |
129 show = column3_visible_checkbox_->checked(); | 129 show = column3_visible_checkbox_->checked(); |
130 } else if (sender == column4_visible_checkbox_) { | 130 } else if (sender == column4_visible_checkbox_) { |
131 index = 3; | 131 index = 3; |
132 show = column4_visible_checkbox_->checked(); | 132 show = column4_visible_checkbox_->checked(); |
133 } | 133 } |
134 table_->SetColumnVisibility(index, show); | 134 table_->SetColumnVisibility(index, show); |
135 } | 135 } |
136 | 136 |
137 } // namespace examples | 137 } // namespace examples |
OLD | NEW |