| 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 "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 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 | 1067 |
| 1068 case LVN_MARQUEEBEGIN: // We don't want the marque selection. | 1068 case LVN_MARQUEEBEGIN: // We don't want the marque selection. |
| 1069 return 1; | 1069 return 1; |
| 1070 | 1070 |
| 1071 default: | 1071 default: |
| 1072 break; | 1072 break; |
| 1073 } | 1073 } |
| 1074 return 0; | 1074 return 0; |
| 1075 } | 1075 } |
| 1076 | 1076 |
| 1077 void TableView::OnDestroy() { | |
| 1078 if (table_type_ == ICON_AND_TEXT) { | |
| 1079 HIMAGELIST image_list = | |
| 1080 ListView_GetImageList(GetNativeControlHWND(), LVSIL_SMALL); | |
| 1081 DCHECK(image_list); | |
| 1082 if (image_list) | |
| 1083 ImageList_Destroy(image_list); | |
| 1084 } | |
| 1085 } | |
| 1086 | |
| 1087 // Returns result, unless ascending is false in which case -result is returned. | 1077 // Returns result, unless ascending is false in which case -result is returned. |
| 1088 static int SwapCompareResult(int result, bool ascending) { | 1078 static int SwapCompareResult(int result, bool ascending) { |
| 1089 return ascending ? result : -result; | 1079 return ascending ? result : -result; |
| 1090 } | 1080 } |
| 1091 | 1081 |
| 1092 int TableView::CompareRows(int model_row1, int model_row2) { | 1082 int TableView::CompareRows(int model_row1, int model_row2) { |
| 1093 if (model_->HasGroups()) { | 1083 if (model_->HasGroups()) { |
| 1094 // By default ListView sorts the elements regardless of groups. In such | 1084 // By default ListView sorts the elements regardless of groups. In such |
| 1095 // a situation the groups display only the items they contain. This results | 1085 // a situation the groups display only the items they contain. This results |
| 1096 // in the visual order differing from the item indices. I could not find | 1086 // in the visual order differing from the item indices. I could not find |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1538 } | 1528 } |
| 1539 | 1529 |
| 1540 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { | 1530 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { |
| 1541 if (view_index_ == -1) | 1531 if (view_index_ == -1) |
| 1542 model_index_ = -1; | 1532 model_index_ = -1; |
| 1543 else | 1533 else |
| 1544 model_index_ = table_view_->view_to_model(view_index_); | 1534 model_index_ = table_view_->view_to_model(view_index_); |
| 1545 } | 1535 } |
| 1546 | 1536 |
| 1547 } // namespace views | 1537 } // namespace views |
| OLD | NEW |