OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/views/controls/tree/tree_view_views.h" | 5 #include "ui/views/controls/tree/tree_view_views.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 } | 295 } |
296 | 296 |
297 gfx::Size TreeView::GetPreferredSize() { | 297 gfx::Size TreeView::GetPreferredSize() { |
298 return preferred_size_; | 298 return preferred_size_; |
299 } | 299 } |
300 | 300 |
301 bool TreeView::OnMousePressed(const ui::MouseEvent& event) { | 301 bool TreeView::OnMousePressed(const ui::MouseEvent& event) { |
302 return OnClickOrTap(event); | 302 return OnClickOrTap(event); |
303 } | 303 } |
304 | 304 |
305 ui::EventResult TreeView::OnGestureEvent(ui::GestureEvent* event) { | 305 void TreeView::OnGestureEvent(ui::GestureEvent* event) { |
306 if (event->type() == ui::ET_GESTURE_TAP || | 306 if (event->type() == ui::ET_GESTURE_TAP || |
307 event->type() == ui::ET_GESTURE_DOUBLE_TAP) { | 307 event->type() == ui::ET_GESTURE_DOUBLE_TAP) { |
308 if (OnClickOrTap(*event)) | 308 if (OnClickOrTap(*event)) |
309 return ui::ER_CONSUMED; | 309 event->SetHandled(); |
310 } | 310 } |
311 return ui::ER_UNHANDLED; | |
312 } | 311 } |
313 | 312 |
314 void TreeView::ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture) { | 313 void TreeView::ShowContextMenu(const gfx::Point& p, bool is_mouse_gesture) { |
315 if (!model_) | 314 if (!model_) |
316 return; | 315 return; |
317 if (is_mouse_gesture) { | 316 if (is_mouse_gesture) { |
318 // Only invoke View's implementation (which notifies the | 317 // Only invoke View's implementation (which notifies the |
319 // ContextMenuController) if over a node. | 318 // ContextMenuController) if over a node. |
320 gfx::Point local_point(p); | 319 gfx::Point local_point(p); |
321 ConvertPointToTarget(NULL, this, &local_point); | 320 ConvertPointToTarget(NULL, this, &local_point); |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 if (!is_expanded_) | 913 if (!is_expanded_) |
915 return max_width; | 914 return max_width; |
916 for (int i = 0; i < child_count(); ++i) { | 915 for (int i = 0; i < child_count(); ++i) { |
917 max_width = std::max(max_width, | 916 max_width = std::max(max_width, |
918 GetChild(i)->GetMaxWidth(indent, depth + 1)); | 917 GetChild(i)->GetMaxWidth(indent, depth + 1)); |
919 } | 918 } |
920 return max_width; | 919 return max_width; |
921 } | 920 } |
922 | 921 |
923 } // namespace views | 922 } // namespace views |
OLD | NEW |