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 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 } | 1588 } |
1589 | 1589 |
1590 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { | 1590 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { |
1591 if (view_index_ == -1) | 1591 if (view_index_ == -1) |
1592 model_index_ = -1; | 1592 model_index_ = -1; |
1593 else | 1593 else |
1594 model_index_ = table_view_->ViewToModel(view_index_); | 1594 model_index_ = table_view_->ViewToModel(view_index_); |
1595 } | 1595 } |
1596 | 1596 |
1597 } // namespace views | 1597 } // namespace views |
OLD | NEW |