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 "chrome/views/tree_view.h" | 5 #include "chrome/views/tree_view.h" |
6 | 6 |
7 #include <shellapi.h> | 7 #include <shellapi.h> |
8 | 8 |
9 #include "base/win_util.h" | 9 #include "base/win_util.h" |
10 #include "chrome/app/theme/theme_resources.h" | 10 #include "chrome/app/theme/theme_resources.h" |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 y = bounds.top + (bounds.bottom - bounds.top) / 2; | 440 y = bounds.top + (bounds.bottom - bounds.top) / 2; |
441 valid_loc = true; | 441 valid_loc = true; |
442 } | 442 } |
443 } else if (show_context_menu_only_when_node_selected_) { | 443 } else if (show_context_menu_only_when_node_selected_) { |
444 return; | 444 return; |
445 } | 445 } |
446 if (!valid_loc) { | 446 if (!valid_loc) { |
447 x = width() / 2; | 447 x = width() / 2; |
448 y = height() / 2; | 448 y = height() / 2; |
449 } | 449 } |
450 CPoint screen_loc(x, y); | 450 gfx::Point screen_loc(x, y); |
451 ConvertPointToScreen(this, &screen_loc); | 451 ConvertPointToScreen(this, &screen_loc); |
452 GetContextMenuController()->ShowContextMenu(this, screen_loc.x, | 452 GetContextMenuController()->ShowContextMenu(this, screen_loc.x(), |
453 screen_loc.y, false); | 453 screen_loc.y(), false); |
454 } else if (!show_context_menu_only_when_node_selected_) { | 454 } else if (!show_context_menu_only_when_node_selected_) { |
455 GetContextMenuController()->ShowContextMenu(this, location.x, location.y, | 455 GetContextMenuController()->ShowContextMenu(this, location.x, location.y, |
456 true); | 456 true); |
457 } else if (GetSelectedNode()) { | 457 } else if (GetSelectedNode()) { |
458 // Make sure the mouse is over the selected node. | 458 // Make sure the mouse is over the selected node. |
459 TVHITTESTINFO hit_info; | 459 TVHITTESTINFO hit_info; |
460 CPoint local_loc(location); | 460 gfx::Point local_loc(location); |
461 ConvertPointToView(NULL, this, &local_loc); | 461 ConvertPointToView(NULL, this, &local_loc); |
462 hit_info.pt.x = local_loc.x; | 462 hit_info.pt.x = local_loc.x(); |
463 hit_info.pt.y = local_loc.y; | 463 hit_info.pt.y = local_loc.y(); |
464 HTREEITEM hit_item = TreeView_HitTest(tree_view_, &hit_info); | 464 HTREEITEM hit_item = TreeView_HitTest(tree_view_, &hit_info); |
465 if (hit_item && | 465 if (hit_item && |
466 GetNodeDetails(GetSelectedNode())->tree_item == hit_item && | 466 GetNodeDetails(GetSelectedNode())->tree_item == hit_item && |
467 (hit_info.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT | | 467 (hit_info.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT | |
468 TVHT_ONITEMINDENT)) != 0) { | 468 TVHT_ONITEMINDENT)) != 0) { |
469 GetContextMenuController()->ShowContextMenu(this, location.x, | 469 GetContextMenuController()->ShowContextMenu(this, location.x, |
470 location.y, true); | 470 location.y, true); |
471 } | 471 } |
472 } | 472 } |
473 } | 473 } |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 TreeView_SelectItem(tree->tree_view_, hit_item); | 585 TreeView_SelectItem(tree->tree_view_, hit_item); |
586 // Fall through and let the default handler process as well. | 586 // Fall through and let the default handler process as well. |
587 } | 587 } |
588 WNDPROC handler = tree->original_handler_; | 588 WNDPROC handler = tree->original_handler_; |
589 DCHECK(handler); | 589 DCHECK(handler); |
590 return CallWindowProc(handler, window, message, w_param, l_param); | 590 return CallWindowProc(handler, window, message, w_param, l_param); |
591 } | 591 } |
592 | 592 |
593 } // namespace ChromeViews | 593 } // namespace ChromeViews |
594 | 594 |
OLD | NEW |