| 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/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 } | 667 } |
| 668 } | 668 } |
| 669 | 669 |
| 670 void TreeView::ConfigureInternalNode(TreeModelNode* model_node, | 670 void TreeView::ConfigureInternalNode(TreeModelNode* model_node, |
| 671 InternalNode* node) { | 671 InternalNode* node) { |
| 672 node->Reset(model_node); | 672 node->Reset(model_node); |
| 673 UpdateNodeTextWidth(node); | 673 UpdateNodeTextWidth(node); |
| 674 } | 674 } |
| 675 | 675 |
| 676 void TreeView::UpdateNodeTextWidth(InternalNode* node) { | 676 void TreeView::UpdateNodeTextWidth(InternalNode* node) { |
| 677 int width = 0, height = 0; | 677 float width = 0, height = 0; |
| 678 gfx::Canvas::SizeStringInt(node->model_node()->GetTitle(), font_, | 678 gfx::Canvas::SizeStringToFit(node->model_node()->GetTitle(), font_, |
| 679 &width, &height, 0, gfx::Canvas::NO_ELLIPSIS); | 679 &width, &height, 0, gfx::Canvas::NO_ELLIPSIS); |
| 680 node->set_text_width(width); | 680 node->set_text_width(width); |
| 681 } | 681 } |
| 682 | 682 |
| 683 void TreeView::DrawnNodesChanged() { | 683 void TreeView::DrawnNodesChanged() { |
| 684 UpdatePreferredSize(); | 684 UpdatePreferredSize(); |
| 685 PreferredSizeChanged(); | 685 PreferredSizeChanged(); |
| 686 SchedulePaint(); | 686 SchedulePaint(); |
| 687 } | 687 } |
| 688 | 688 |
| 689 void TreeView::UpdatePreferredSize() { | 689 void TreeView::UpdatePreferredSize() { |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 if (!is_expanded_) | 1014 if (!is_expanded_) |
| 1015 return max_width; | 1015 return max_width; |
| 1016 for (int i = 0; i < child_count(); ++i) { | 1016 for (int i = 0; i < child_count(); ++i) { |
| 1017 max_width = std::max(max_width, | 1017 max_width = std::max(max_width, |
| 1018 GetChild(i)->GetMaxWidth(indent, depth + 1)); | 1018 GetChild(i)->GetMaxWidth(indent, depth + 1)); |
| 1019 } | 1019 } |
| 1020 return max_width; | 1020 return max_width; |
| 1021 } | 1021 } |
| 1022 | 1022 |
| 1023 } // namespace views | 1023 } // namespace views |
| OLD | NEW |