summaryrefslogtreecommitdiffstats
path: root/views/controls
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-22 18:15:16 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-22 18:15:16 +0000
commit03ce2f5bf335b39ad24306a3a962823e46305cc4 (patch)
tree31dec38ccbc8f8a082020a6c2196aa288b492cce /views/controls
parent0f92d1d1aca69b365685da5e0aa8e2bc315a0694 (diff)
downloadchromium_src-03ce2f5bf335b39ad24306a3a962823e46305cc4.zip
chromium_src-03ce2f5bf335b39ad24306a3a962823e46305cc4.tar.gz
chromium_src-03ce2f5bf335b39ad24306a3a962823e46305cc4.tar.bz2
Middle clicking on a bookmark from the bookmark manager now
opens that bookmark in a new foreground tab. http://crbug.com/7788 Checked in for Meelap Shah Original review = http://codereview.chromium.org/115665 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16760 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls')
-rw-r--r--views/controls/table/table_view.cc18
-rw-r--r--views/controls/table/table_view.h6
2 files changed, 24 insertions, 0 deletions
diff --git a/views/controls/table/table_view.cc b/views/controls/table/table_view.cc
index da4aeb04..5650f9f 100644
--- a/views/controls/table/table_view.cc
+++ b/views/controls/table/table_view.cc
@@ -649,6 +649,19 @@ LRESULT CALLBACK TableView::TableWndProc(HWND window,
return 0;
}
+ case WM_MBUTTONDOWN: {
+ if (w_param == MK_MBUTTON) {
+ int view_index = GetViewIndexFromMouseEvent(window, l_param);
+ if (view_index != -1) {
+ int model_index = table_view->view_to_model(view_index);
+ // Clear all and select the row that was middle clicked.
+ table_view->Select(model_index);
+ table_view->OnMiddleClick();
+ }
+ }
+ return 0;
+ }
+
case WM_LBUTTONUP: {
if (in_mouse_down) {
in_mouse_down = false;
@@ -1478,6 +1491,11 @@ void TableView::OnDoubleClick() {
}
}
+void TableView::OnMiddleClick() {
+ if (!ignore_listview_change_ && table_view_observer_)
+ table_view_observer_->OnMiddleClick();
+}
+
void TableView::OnSelectedStateChanged() {
if (!ignore_listview_change_ && table_view_observer_) {
table_view_observer_->OnSelectionChanged();
diff --git a/views/controls/table/table_view.h b/views/controls/table/table_view.h
index da228fc..c1a9a23 100644
--- a/views/controls/table/table_view.h
+++ b/views/controls/table/table_view.h
@@ -284,6 +284,9 @@ class TableViewObserver {
// Optional method invoked when the user double clicks on the table.
virtual void OnDoubleClick() {}
+ // Optional method invoked when the user middle clicks on the table.
+ virtual void OnMiddleClick() {}
+
// Optional method invoked when the user hits a key with the table in focus.
virtual void OnKeyDown(unsigned short virtual_keycode) {}
@@ -452,6 +455,9 @@ class TableView : public NativeControl,
// Notification from the ListView that the used double clicked the table.
virtual void OnDoubleClick();
+ // Notification from the ListView that the user middle clicked the table.
+ virtual void OnMiddleClick();
+
// Subclasses can implement this method if they need to be notified of a key
// press event. Other wise, it appeals to table_view_observer_
virtual void OnKeyDown(unsigned short virtual_keycode);