| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/controls/table/table_view.h" | 5 #include "views/controls/table/table_view.h" |
| 6 | 6 |
| 7 #include <commctrl.h> | 7 #include <commctrl.h> |
| 8 #include <windowsx.h> | 8 #include <windowsx.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 // | 363 // |
| 364 // When the model is set to NULL all the rows are removed. We don't notify | 364 // When the model is set to NULL all the rows are removed. We don't notify |
| 365 // the delegate in this case as setting the model to NULL is usually done as | 365 // the delegate in this case as setting the model to NULL is usually done as |
| 366 // the last step before being deleted and callers shouldn't have to deal with | 366 // the last step before being deleted and callers shouldn't have to deal with |
| 367 // getting a selection change when the model is being reset. | 367 // getting a selection change when the model is being reset. |
| 368 if (model_ && table_view_observer_ && had_selection && RowCount() == 0) | 368 if (model_ && table_view_observer_ && had_selection && RowCount() == 0) |
| 369 table_view_observer_->OnSelectionChanged(); | 369 table_view_observer_->OnSelectionChanged(); |
| 370 } | 370 } |
| 371 | 371 |
| 372 void TableView::AddColumn(const TableColumn& col) { | 372 void TableView::AddColumn(const TableColumn& col) { |
| 373 DCHECK_EQ(0, all_columns_.count(col.id)); | 373 DCHECK_EQ(0u, all_columns_.count(col.id)); |
| 374 all_columns_[col.id] = col; | 374 all_columns_[col.id] = col; |
| 375 } | 375 } |
| 376 | 376 |
| 377 void TableView::SetColumns(const std::vector<TableColumn>& columns) { | 377 void TableView::SetColumns(const std::vector<TableColumn>& columns) { |
| 378 // Remove the currently visible columns. | 378 // Remove the currently visible columns. |
| 379 while (!visible_columns_.empty()) | 379 while (!visible_columns_.empty()) |
| 380 SetColumnVisibility(visible_columns_.front(), false); | 380 SetColumnVisibility(visible_columns_.front(), false); |
| 381 | 381 |
| 382 all_columns_.clear(); | 382 all_columns_.clear(); |
| 383 for (std::vector<TableColumn>::const_iterator i = columns.begin(); | 383 for (std::vector<TableColumn>::const_iterator i = columns.begin(); |
| (...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1570 } | 1570 } |
| 1571 | 1571 |
| 1572 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { | 1572 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { |
| 1573 if (view_index_ == -1) | 1573 if (view_index_ == -1) |
| 1574 model_index_ = -1; | 1574 model_index_ = -1; |
| 1575 else | 1575 else |
| 1576 model_index_ = table_view_->view_to_model(view_index_); | 1576 model_index_ = table_view_->view_to_model(view_index_); |
| 1577 } | 1577 } |
| 1578 | 1578 |
| 1579 } // namespace views | 1579 } // namespace views |
| OLD | NEW |