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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 range->start = 7; | 138 range->start = 7; |
139 range->length = 3; | 139 range->length = 3; |
140 } else { | 140 } else { |
141 range->start = model_index; | 141 range->start = model_index; |
142 range->length = 1; | 142 range->length = 1; |
143 } | 143 } |
144 } | 144 } |
145 | 145 |
146 void TableExample::OnSelectionChanged() { | 146 void TableExample::OnSelectionChanged() { |
147 PrintStatus("Selected: %s", | 147 PrintStatus("Selected: %s", |
148 UTF16ToASCII(GetText(table_->selection_model().active(), | 148 base::UTF16ToASCII(GetText(table_->selection_model().active(), |
149 0)).c_str()); | 149 0)).c_str()); |
150 } | 150 } |
151 | 151 |
152 void TableExample::OnDoubleClick() { | 152 void TableExample::OnDoubleClick() { |
153 PrintStatus("Double Click: %s", | 153 PrintStatus("Double Click: %s", |
154 UTF16ToASCII(GetText(table_->selection_model().active(), | 154 base::UTF16ToASCII(GetText(table_->selection_model().active(), |
155 0)).c_str()); | 155 0)).c_str()); |
156 } | 156 } |
157 | 157 |
158 void TableExample::OnMiddleClick() {} | 158 void TableExample::OnMiddleClick() {} |
159 | 159 |
160 void TableExample::OnKeyDown(ui::KeyboardCode virtual_keycode) {} | 160 void TableExample::OnKeyDown(ui::KeyboardCode virtual_keycode) {} |
161 | 161 |
162 void TableExample::ButtonPressed(Button* sender, const ui::Event& event) { | 162 void TableExample::ButtonPressed(Button* sender, const ui::Event& event) { |
163 int index = 0; | 163 int index = 0; |
164 bool show = true; | 164 bool show = true; |
165 if (sender == column1_visible_checkbox_) { | 165 if (sender == column1_visible_checkbox_) { |
166 index = 0; | 166 index = 0; |
167 show = column1_visible_checkbox_->checked(); | 167 show = column1_visible_checkbox_->checked(); |
168 } else if (sender == column2_visible_checkbox_) { | 168 } else if (sender == column2_visible_checkbox_) { |
169 index = 1; | 169 index = 1; |
170 show = column2_visible_checkbox_->checked(); | 170 show = column2_visible_checkbox_->checked(); |
171 } else if (sender == column3_visible_checkbox_) { | 171 } else if (sender == column3_visible_checkbox_) { |
172 index = 2; | 172 index = 2; |
173 show = column3_visible_checkbox_->checked(); | 173 show = column3_visible_checkbox_->checked(); |
174 } else if (sender == column4_visible_checkbox_) { | 174 } else if (sender == column4_visible_checkbox_) { |
175 index = 3; | 175 index = 3; |
176 show = column4_visible_checkbox_->checked(); | 176 show = column4_visible_checkbox_->checked(); |
177 } | 177 } |
178 table_->SetColumnVisibility(index, show); | 178 table_->SetColumnVisibility(index, show); |
179 } | 179 } |
180 | 180 |
181 } // namespace examples | 181 } // namespace examples |
182 } // namespace views | 182 } // namespace views |
OLD | NEW |