| 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 <windowsx.h> | 7 #include <windowsx.h> |
| 8 #include <atlbase.h> | 8 #include <atlbase.h> |
| 9 #include <atlapp.h> | 9 #include <atlapp.h> |
| 10 #include <atlmisc.h> | 10 #include <atlmisc.h> |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 // else case: fall through to default processing. | 642 // else case: fall through to default processing. |
| 643 break; | 643 break; |
| 644 } | 644 } |
| 645 | 645 |
| 646 case WM_LBUTTONDBLCLK: { | 646 case WM_LBUTTONDBLCLK: { |
| 647 if (w_param == MK_LBUTTON) | 647 if (w_param == MK_LBUTTON) |
| 648 table_view->OnDoubleClick(); | 648 table_view->OnDoubleClick(); |
| 649 return 0; | 649 return 0; |
| 650 } | 650 } |
| 651 | 651 |
| 652 case WM_MBUTTONDOWN: { |
| 653 if (w_param == MK_MBUTTON) { |
| 654 int view_index = GetViewIndexFromMouseEvent(window, l_param); |
| 655 if (view_index != -1) { |
| 656 int model_index = table_view->view_to_model(view_index); |
| 657 // Clear all and select the row that was middle clicked. |
| 658 table_view->Select(model_index); |
| 659 table_view->OnMiddleClick(); |
| 660 } |
| 661 } |
| 662 return 0; |
| 663 } |
| 664 |
| 652 case WM_LBUTTONUP: { | 665 case WM_LBUTTONUP: { |
| 653 if (in_mouse_down) { | 666 if (in_mouse_down) { |
| 654 in_mouse_down = false; | 667 in_mouse_down = false; |
| 655 ReleaseCapture(); | 668 ReleaseCapture(); |
| 656 SetFocus(window); | 669 SetFocus(window); |
| 657 if (select_on_mouse_up) { | 670 if (select_on_mouse_up) { |
| 658 int view_index = GetViewIndexFromMouseEvent(window, l_param); | 671 int view_index = GetViewIndexFromMouseEvent(window, l_param); |
| 659 if (view_index != -1) | 672 if (view_index != -1) |
| 660 table_view->Select(table_view->view_to_model(view_index)); | 673 table_view->Select(table_view->view_to_model(view_index)); |
| 661 } | 674 } |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 SortItemsAndUpdateMapping(); | 1484 SortItemsAndUpdateMapping(); |
| 1472 } | 1485 } |
| 1473 } | 1486 } |
| 1474 | 1487 |
| 1475 void TableView::OnDoubleClick() { | 1488 void TableView::OnDoubleClick() { |
| 1476 if (!ignore_listview_change_ && table_view_observer_) { | 1489 if (!ignore_listview_change_ && table_view_observer_) { |
| 1477 table_view_observer_->OnDoubleClick(); | 1490 table_view_observer_->OnDoubleClick(); |
| 1478 } | 1491 } |
| 1479 } | 1492 } |
| 1480 | 1493 |
| 1494 void TableView::OnMiddleClick() { |
| 1495 if (!ignore_listview_change_ && table_view_observer_) |
| 1496 table_view_observer_->OnMiddleClick(); |
| 1497 } |
| 1498 |
| 1481 void TableView::OnSelectedStateChanged() { | 1499 void TableView::OnSelectedStateChanged() { |
| 1482 if (!ignore_listview_change_ && table_view_observer_) { | 1500 if (!ignore_listview_change_ && table_view_observer_) { |
| 1483 table_view_observer_->OnSelectionChanged(); | 1501 table_view_observer_->OnSelectionChanged(); |
| 1484 } | 1502 } |
| 1485 } | 1503 } |
| 1486 | 1504 |
| 1487 void TableView::OnKeyDown(unsigned short virtual_keycode) { | 1505 void TableView::OnKeyDown(unsigned short virtual_keycode) { |
| 1488 if (!ignore_listview_change_ && table_view_observer_) { | 1506 if (!ignore_listview_change_ && table_view_observer_) { |
| 1489 table_view_observer_->OnKeyDown(virtual_keycode); | 1507 table_view_observer_->OnKeyDown(virtual_keycode); |
| 1490 } | 1508 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1571 } | 1589 } |
| 1572 | 1590 |
| 1573 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { | 1591 void TableSelectionIterator::UpdateModelIndexFromViewIndex() { |
| 1574 if (view_index_ == -1) | 1592 if (view_index_ == -1) |
| 1575 model_index_ = -1; | 1593 model_index_ = -1; |
| 1576 else | 1594 else |
| 1577 model_index_ = table_view_->view_to_model(view_index_); | 1595 model_index_ = table_view_->view_to_model(view_index_); |
| 1578 } | 1596 } |
| 1579 | 1597 |
| 1580 } // namespace views | 1598 } // namespace views |
| OLD | NEW |