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 height = std::max(parent()->height(), height); | 295 height = std::max(parent()->height(), height); |
296 } | 296 } |
297 SetBounds(x(), y(), width, height); | 297 SetBounds(x(), y(), width, height); |
298 LayoutEditor(); | 298 LayoutEditor(); |
299 } | 299 } |
300 | 300 |
301 gfx::Size TreeView::GetPreferredSize() { | 301 gfx::Size TreeView::GetPreferredSize() { |
302 return preferred_size_; | 302 return preferred_size_; |
303 } | 303 } |
304 | 304 |
305 bool TreeView::OnMousePressed(const MouseEvent& event) { | 305 bool TreeView::OnMousePressed(const ui::MouseEvent& event) { |
306 int row = (event.y() - kVerticalInset) / row_height_; | 306 int row = (event.y() - kVerticalInset) / row_height_; |
307 int depth; | 307 int depth; |
308 InternalNode* node = GetNodeByRow(row, &depth); | 308 InternalNode* node = GetNodeByRow(row, &depth); |
309 if (node) { | 309 if (node) { |
310 RequestFocus(); | 310 RequestFocus(); |
311 gfx::Rect bounds(GetBoundsForNodeImpl(node, row, depth)); | 311 gfx::Rect bounds(GetBoundsForNodeImpl(node, row, depth)); |
312 if (bounds.Contains(event.location())) { | 312 if (bounds.Contains(event.location())) { |
313 int relative_x = event.x() - bounds.x(); | 313 int relative_x = event.x() - bounds.x(); |
314 if (base::i18n::IsRTL()) | 314 if (base::i18n::IsRTL()) |
315 relative_x = bounds.width() - relative_x; | 315 relative_x = bounds.width() - relative_x; |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 if (!is_expanded_) | 902 if (!is_expanded_) |
903 return max_width; | 903 return max_width; |
904 for (int i = 0; i < child_count(); ++i) { | 904 for (int i = 0; i < child_count(); ++i) { |
905 max_width = std::max(max_width, | 905 max_width = std::max(max_width, |
906 GetChild(i)->GetMaxWidth(indent, depth + 1)); | 906 GetChild(i)->GetMaxWidth(indent, depth + 1)); |
907 } | 907 } |
908 return max_width; | 908 return max_width; |
909 } | 909 } |
910 | 910 |
911 } // namespace views | 911 } // namespace views |
OLD | NEW |