| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 layout->AddView(column1_visible_checkbox_); | 100 layout->AddView(column1_visible_checkbox_); |
| 101 layout->AddView(column2_visible_checkbox_); | 101 layout->AddView(column2_visible_checkbox_); |
| 102 layout->AddView(column3_visible_checkbox_); | 102 layout->AddView(column3_visible_checkbox_); |
| 103 layout->AddView(column4_visible_checkbox_); | 103 layout->AddView(column4_visible_checkbox_); |
| 104 } | 104 } |
| 105 | 105 |
| 106 int TableExample::RowCount() { | 106 int TableExample::RowCount() { |
| 107 return 10; | 107 return 10; |
| 108 } | 108 } |
| 109 | 109 |
| 110 string16 TableExample::GetText(int row, int column_id) { | 110 base::string16 TableExample::GetText(int row, int column_id) { |
| 111 if (row == -1) | 111 if (row == -1) |
| 112 return string16(); | 112 return base::string16(); |
| 113 | 113 |
| 114 const char* const cells[5][4] = { | 114 const char* const cells[5][4] = { |
| 115 { "Orange", "Orange", "South america", "$5" }, | 115 { "Orange", "Orange", "South america", "$5" }, |
| 116 { "Apple", "Green", "Canada", "$3" }, | 116 { "Apple", "Green", "Canada", "$3" }, |
| 117 { "Blue berries", "Blue", "Mexico", "$10.3" }, | 117 { "Blue berries", "Blue", "Mexico", "$10.3" }, |
| 118 { "Strawberries", "Red", "California", "$7" }, | 118 { "Strawberries", "Red", "California", "$7" }, |
| 119 { "Cantaloupe", "Orange", "South america", "$5" }, | 119 { "Cantaloupe", "Orange", "South america", "$5" }, |
| 120 }; | 120 }; |
| 121 return ASCIIToUTF16(cells[row % 5][column_id]); | 121 return ASCIIToUTF16(cells[row % 5][column_id]); |
| 122 } | 122 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 show = column3_visible_checkbox_->checked(); | 171 show = column3_visible_checkbox_->checked(); |
| 172 } else if (sender == column4_visible_checkbox_) { | 172 } else if (sender == column4_visible_checkbox_) { |
| 173 index = 3; | 173 index = 3; |
| 174 show = column4_visible_checkbox_->checked(); | 174 show = column4_visible_checkbox_->checked(); |
| 175 } | 175 } |
| 176 table_->SetColumnVisibility(index, show); | 176 table_->SetColumnVisibility(index, show); |
| 177 } | 177 } |
| 178 | 178 |
| 179 } // namespace examples | 179 } // namespace examples |
| 180 } // namespace views | 180 } // namespace views |
| OLD | NEW |