| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 <windowsx.h> | 5 #include <windowsx.h> |
| 6 | 6 |
| 7 #include "chrome/views/table_view.h" | 7 #include "chrome/views/table_view.h" |
| 8 | 8 |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/win_util.h" | 10 #include "base/win_util.h" |
| (...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 // work. | 873 // work. |
| 874 if (table_type_ == CHECK_BOX_AND_TEXT) { | 874 if (table_type_ == CHECK_BOX_AND_TEXT) { |
| 875 start_column = 1; | 875 start_column = 1; |
| 876 item.iSubItem = 0; | 876 item.iSubItem = 0; |
| 877 item.mask = LVIF_TEXT | LVIF_STATE; | 877 item.mask = LVIF_TEXT | LVIF_STATE; |
| 878 item.stateMask = LVIS_STATEIMAGEMASK; | 878 item.stateMask = LVIS_STATEIMAGEMASK; |
| 879 for (int i = start; i < max_row; ++i) { | 879 for (int i = start; i < max_row; ++i) { |
| 880 std::wstring text = model_->GetText(i, visible_columns_[0]); | 880 std::wstring text = model_->GetText(i, visible_columns_[0]); |
| 881 item.iItem = i; | 881 item.iItem = i; |
| 882 item.pszText = const_cast<LPWSTR>(text.c_str()); | 882 item.pszText = const_cast<LPWSTR>(text.c_str()); |
| 883 item.state = INDEXTOSTATEIMAGEMASK(model_->IsChecked(i) ? 2 : 1) ; | 883 item.state = INDEXTOSTATEIMAGEMASK(model_->IsChecked(i) ? 2 : 1); |
| 884 ListView_SetItem(list_view_, &item); | 884 ListView_SetItem(list_view_, &item); |
| 885 } | 885 } |
| 886 } | 886 } |
| 887 if (start_column == column_count_) | 887 if (start_column == column_count_) |
| 888 return; | 888 return; |
| 889 | 889 |
| 890 item.stateMask = 0; | 890 item.stateMask = 0; |
| 891 item.mask = LVIF_TEXT; | 891 item.mask = LVIF_TEXT; |
| 892 if (table_type_ == ICON_AND_TEXT) { | 892 if (table_type_ == ICON_AND_TEXT) { |
| 893 item.mask |= LVIF_IMAGE; | 893 item.mask |= LVIF_IMAGE; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 table_view_observer_->OnDoubleClick(); | 928 table_view_observer_->OnDoubleClick(); |
| 929 } | 929 } |
| 930 } | 930 } |
| 931 | 931 |
| 932 void TableView::OnSelectedStateChanged(int item, bool is_selected) { | 932 void TableView::OnSelectedStateChanged(int item, bool is_selected) { |
| 933 if (!ignore_listview_change_ && table_view_observer_) { | 933 if (!ignore_listview_change_ && table_view_observer_) { |
| 934 table_view_observer_->OnSelectionChanged(); | 934 table_view_observer_->OnSelectionChanged(); |
| 935 } | 935 } |
| 936 } | 936 } |
| 937 | 937 |
| 938 void TableView::OnKeyDown(unsigned short virtual_keycode) { |
| 939 if (!ignore_listview_change_ && table_view_observer_) { |
| 940 table_view_observer_->OnKeyDown(virtual_keycode); |
| 941 } |
| 942 } |
| 943 |
| 938 void TableView::OnCheckedStateChanged(int item, bool is_checked) { | 944 void TableView::OnCheckedStateChanged(int item, bool is_checked) { |
| 939 if (!ignore_listview_change_) { | 945 if (!ignore_listview_change_) { |
| 940 model_->SetChecked(item, is_checked); | 946 model_->SetChecked(item, is_checked); |
| 941 } | 947 } |
| 942 } | 948 } |
| 943 | 949 |
| 944 int TableView::NextSelectedIndex(int item) { | 950 int TableView::NextSelectedIndex(int item) { |
| 945 if (!list_view_) | 951 if (!list_view_) |
| 946 return -1; | 952 return -1; |
| 947 DCHECK(item >= 0); | 953 DCHECK(item >= 0); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 index_ = table_view_->NextSelectedIndex(index_); | 1025 index_ = table_view_->NextSelectedIndex(index_); |
| 1020 return *this; | 1026 return *this; |
| 1021 } | 1027 } |
| 1022 | 1028 |
| 1023 int TableSelectionIterator::operator*() { | 1029 int TableSelectionIterator::operator*() { |
| 1024 return index_; | 1030 return index_; |
| 1025 } | 1031 } |
| 1026 | 1032 |
| 1027 } // namespace | 1033 } // namespace |
| 1028 | 1034 |
| OLD | NEW |