| 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> |
| 11 | 11 |
| 12 #include "app/l10n_util.h" | 12 #include "app/l10n_util.h" |
| 13 #include "app/l10n_util_win.h" | 13 #include "app/l10n_util_win.h" |
| 14 #include "app/resource_bundle.h" | 14 #include "app/resource_bundle.h" |
| 15 #include "app/win/hwnd_util.h" | |
| 16 #include "base/i18n/rtl.h" | 15 #include "base/i18n/rtl.h" |
| 17 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 18 #include "gfx/canvas_skia.h" | 17 #include "gfx/canvas_skia.h" |
| 19 #include "gfx/favicon_size.h" | 18 #include "gfx/favicon_size.h" |
| 20 #include "gfx/font.h" | 19 #include "gfx/font.h" |
| 21 #include "gfx/icon_util.h" | 20 #include "gfx/icon_util.h" |
| 22 #include "skia/ext/skia_utils_win.h" | 21 #include "skia/ext/skia_utils_win.h" |
| 23 #include "third_party/skia/include/core/SkBitmap.h" | 22 #include "third_party/skia/include/core/SkBitmap.h" |
| 24 #include "third_party/skia/include/core/SkColorFilter.h" | 23 #include "third_party/skia/include/core/SkColorFilter.h" |
| 25 #include "ui/base/models/table_model.h" | 24 #include "ui/base/models/table_model.h" |
| 25 #include "ui/base/win/hwnd_util.h" |
| 26 #include "views/controls/native/native_view_host.h" | 26 #include "views/controls/native/native_view_host.h" |
| 27 #include "views/controls/table/table_view_observer.h" | 27 #include "views/controls/table/table_view_observer.h" |
| 28 | 28 |
| 29 using ui::TableColumn; | 29 using ui::TableColumn; |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 int GetViewIndexFromPoint(HWND window, const gfx::Point& p) { | 33 int GetViewIndexFromPoint(HWND window, const gfx::Point& p) { |
| 34 LVHITTESTINFO hit_info = {0}; | 34 LVHITTESTINFO hit_info = {0}; |
| 35 hit_info.pt.x = p.x(); | 35 hit_info.pt.x = p.x(); |
| (...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 } | 830 } |
| 831 | 831 |
| 832 if (!resizable_columns_) { | 832 if (!resizable_columns_) { |
| 833 // To disable the resizing of columns we'll filter the events happening on | 833 // To disable the resizing of columns we'll filter the events happening on |
| 834 // the header. We also need to intercept the HDM_LAYOUT to size the header | 834 // the header. We also need to intercept the HDM_LAYOUT to size the header |
| 835 // for the Chrome headers. | 835 // for the Chrome headers. |
| 836 HWND header = ListView_GetHeader(list_view_); | 836 HWND header = ListView_GetHeader(list_view_); |
| 837 DCHECK(header); | 837 DCHECK(header); |
| 838 SetWindowLongPtr(header, GWLP_USERDATA, | 838 SetWindowLongPtr(header, GWLP_USERDATA, |
| 839 reinterpret_cast<LONG_PTR>(&table_view_wrapper_)); | 839 reinterpret_cast<LONG_PTR>(&table_view_wrapper_)); |
| 840 header_original_handler_ = app::win::SetWindowProc(header, | 840 header_original_handler_ = ui::SetWindowProc(header, |
| 841 &TableView::TableHeaderWndProc); | 841 &TableView::TableHeaderWndProc); |
| 842 } | 842 } |
| 843 | 843 |
| 844 SetWindowLongPtr(list_view_, GWLP_USERDATA, | 844 SetWindowLongPtr(list_view_, GWLP_USERDATA, |
| 845 reinterpret_cast<LONG_PTR>(&table_view_wrapper_)); | 845 reinterpret_cast<LONG_PTR>(&table_view_wrapper_)); |
| 846 original_handler_ = | 846 original_handler_ = |
| 847 app::win::SetWindowProc(list_view_, &TableView::TableWndProc); | 847 ui::SetWindowProc(list_view_, &TableView::TableWndProc); |
| 848 | 848 |
| 849 // Bug 964884: detach the IME attached to this window. | 849 // Bug 964884: detach the IME attached to this window. |
| 850 // We should attach IMEs only when we need to input CJK strings. | 850 // We should attach IMEs only when we need to input CJK strings. |
| 851 ::ImmAssociateContextEx(list_view_, NULL, 0); | 851 ::ImmAssociateContextEx(list_view_, NULL, 0); |
| 852 | 852 |
| 853 UpdateContentOffset(); | 853 UpdateContentOffset(); |
| 854 column_sizes_valid_ = false; | 854 column_sizes_valid_ = false; |
| 855 | 855 |
| 856 return list_view_; | 856 return list_view_; |
| 857 } | 857 } |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1636 } | 1636 } |
| 1637 | 1637 |
| 1638 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { | 1638 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { |
| 1639 if (view_index_ == -1) | 1639 if (view_index_ == -1) |
| 1640 model_index_ = -1; | 1640 model_index_ = -1; |
| 1641 else | 1641 else |
| 1642 model_index_ = table_view_->ViewToModel(view_index_); | 1642 model_index_ = table_view_->ViewToModel(view_index_); |
| 1643 } | 1643 } |
| 1644 | 1644 |
| 1645 } // namespace views | 1645 } // namespace views |
| OLD | NEW |