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/tree/tree_view.h" | 5 #include "views/controls/tree/tree_view.h" |
6 | 6 |
7 #include <shellapi.h> | 7 #include <atlbase.h> |
| 8 #include <atlapp.h> |
| 9 #include <atlmisc.h> |
8 | 10 |
9 #include "app/gfx/chrome_canvas.h" | 11 #include "app/gfx/chrome_canvas.h" |
10 #include "app/gfx/icon_util.h" | 12 #include "app/gfx/icon_util.h" |
11 #include "app/l10n_util.h" | 13 #include "app/l10n_util.h" |
12 #include "app/l10n_util_win.h" | 14 #include "app/l10n_util_win.h" |
13 #include "app/resource_bundle.h" | 15 #include "app/resource_bundle.h" |
14 #include "base/stl_util-inl.h" | 16 #include "base/stl_util-inl.h" |
15 #include "base/win_util.h" | 17 #include "base/win_util.h" |
16 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.h" |
17 #include "views/focus/focus_manager.h" | 19 #include "views/focus/focus_manager.h" |
18 #include "views/widget/widget.h" | 20 #include "views/widget/widget.h" |
19 | 21 |
20 namespace views { | 22 namespace views { |
21 | 23 |
22 TreeView::TreeView() | 24 TreeView::TreeView() |
23 : tree_view_(NULL), | 25 : tree_view_(NULL), |
24 model_(NULL), | 26 model_(NULL), |
25 editable_(true), | 27 editable_(true), |
26 next_id_(0), | 28 next_id_(0), |
27 controller_(NULL), | 29 controller_(NULL), |
28 editing_node_(NULL), | 30 editing_node_(NULL), |
29 root_shown_(true), | 31 root_shown_(true), |
30 process_enter_(false), | 32 process_enter_(false), |
31 show_context_menu_only_when_node_selected_(true), | 33 show_context_menu_only_when_node_selected_(true), |
32 select_on_right_mouse_down_(true), | 34 select_on_right_mouse_down_(true), |
33 wrapper_(this), | 35 ALLOW_THIS_IN_INITIALIZER_LIST(wrapper_(this)), |
34 original_handler_(NULL), | 36 original_handler_(NULL), |
35 drag_enabled_(false), | 37 drag_enabled_(false), |
36 has_custom_icons_(false), | 38 has_custom_icons_(false), |
37 image_list_(NULL) { | 39 image_list_(NULL) { |
38 } | 40 } |
39 | 41 |
40 TreeView::~TreeView() { | 42 TreeView::~TreeView() { |
41 if (model_) | 43 if (model_) |
42 model_->SetObserver(NULL); | 44 model_->SetObserver(NULL); |
43 // Both param_to_details_map_ and node_to_details_map_ have the same value, | 45 // Both param_to_details_map_ and node_to_details_map_ have the same value, |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 Accelerator accelerator(Accelerator(static_cast<int>(virtual_key_code), | 476 Accelerator accelerator(Accelerator(static_cast<int>(virtual_key_code), |
475 win_util::IsShiftPressed(), | 477 win_util::IsShiftPressed(), |
476 win_util::IsCtrlPressed(), | 478 win_util::IsCtrlPressed(), |
477 win_util::IsAltPressed())); | 479 win_util::IsAltPressed())); |
478 fm->ProcessAccelerator(accelerator); | 480 fm->ProcessAccelerator(accelerator); |
479 return true; | 481 return true; |
480 } | 482 } |
481 return false; | 483 return false; |
482 } | 484 } |
483 | 485 |
484 void TreeView::OnContextMenu(const CPoint& location) { | 486 void TreeView::OnContextMenu(const WTL::CPoint& location) { |
485 if (!GetContextMenuController()) | 487 if (!GetContextMenuController()) |
486 return; | 488 return; |
487 | 489 |
488 if (location.x == -1 && location.y == -1) { | 490 if (location.x == -1 && location.y == -1) { |
489 // Let NativeControl's implementation handle keyboard gesture. | 491 // Let NativeControl's implementation handle keyboard gesture. |
490 NativeControl::OnContextMenu(location); | 492 NativeControl::OnContextMenu(location); |
491 return; | 493 return; |
492 } | 494 } |
493 | 495 |
494 if (show_context_menu_only_when_node_selected_) { | 496 if (show_context_menu_only_when_node_selected_) { |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 } | 738 } |
737 // Fall through and let the default handler process as well. | 739 // Fall through and let the default handler process as well. |
738 break; | 740 break; |
739 } | 741 } |
740 WNDPROC handler = tree->original_handler_; | 742 WNDPROC handler = tree->original_handler_; |
741 DCHECK(handler); | 743 DCHECK(handler); |
742 return CallWindowProc(handler, window, message, w_param, l_param); | 744 return CallWindowProc(handler, window, message, w_param, l_param); |
743 } | 745 } |
744 | 746 |
745 } // namespace views | 747 } // namespace views |
OLD | NEW |