| 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.h" | 5 #include "ui/views/controls/tree/tree_view.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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 } | 652 } |
| 653 | 653 |
| 654 void TreeView::ConfigureInternalNode(TreeModelNode* model_node, | 654 void TreeView::ConfigureInternalNode(TreeModelNode* model_node, |
| 655 InternalNode* node) { | 655 InternalNode* node) { |
| 656 node->Reset(model_node); | 656 node->Reset(model_node); |
| 657 UpdateNodeTextWidth(node); | 657 UpdateNodeTextWidth(node); |
| 658 } | 658 } |
| 659 | 659 |
| 660 void TreeView::UpdateNodeTextWidth(InternalNode* node) { | 660 void TreeView::UpdateNodeTextWidth(InternalNode* node) { |
| 661 int width = 0, height = 0; | 661 int width = 0, height = 0; |
| 662 gfx::Canvas::SizeStringInt(node->model_node()->GetTitle(), | 662 gfx::Canvas::SizeStringInt(node->model_node()->GetTitle(), font_, |
| 663 font_, &width, &height, gfx::Canvas::NO_ELLIPSIS); | 663 &width, &height, 0, gfx::Canvas::NO_ELLIPSIS); |
| 664 node->set_text_width(width); | 664 node->set_text_width(width); |
| 665 } | 665 } |
| 666 | 666 |
| 667 void TreeView::DrawnNodesChanged() { | 667 void TreeView::DrawnNodesChanged() { |
| 668 UpdatePreferredSize(); | 668 UpdatePreferredSize(); |
| 669 PreferredSizeChanged(); | 669 PreferredSizeChanged(); |
| 670 SchedulePaint(); | 670 SchedulePaint(); |
| 671 } | 671 } |
| 672 | 672 |
| 673 void TreeView::UpdatePreferredSize() { | 673 void TreeView::UpdatePreferredSize() { |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 if (!is_expanded_) | 998 if (!is_expanded_) |
| 999 return max_width; | 999 return max_width; |
| 1000 for (int i = 0; i < child_count(); ++i) { | 1000 for (int i = 0; i < child_count(); ++i) { |
| 1001 max_width = std::max(max_width, | 1001 max_width = std::max(max_width, |
| 1002 GetChild(i)->GetMaxWidth(indent, depth + 1)); | 1002 GetChild(i)->GetMaxWidth(indent, depth + 1)); |
| 1003 } | 1003 } |
| 1004 return max_width; | 1004 return max_width; |
| 1005 } | 1005 } |
| 1006 | 1006 |
| 1007 } // namespace views | 1007 } // namespace views |
| OLD | NEW |