| 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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(), |
| 663 font_, &width, &height, gfx::Canvas::NO_ELLIPSIS); | 663 font_, &width, &height, -1, // -1 = Default line height. |
| 664 gfx::Canvas::NO_ELLIPSIS); |
| 664 node->set_text_width(width); | 665 node->set_text_width(width); |
| 665 } | 666 } |
| 666 | 667 |
| 667 void TreeView::DrawnNodesChanged() { | 668 void TreeView::DrawnNodesChanged() { |
| 668 UpdatePreferredSize(); | 669 UpdatePreferredSize(); |
| 669 PreferredSizeChanged(); | 670 PreferredSizeChanged(); |
| 670 SchedulePaint(); | 671 SchedulePaint(); |
| 671 } | 672 } |
| 672 | 673 |
| 673 void TreeView::UpdatePreferredSize() { | 674 void TreeView::UpdatePreferredSize() { |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 if (!is_expanded_) | 999 if (!is_expanded_) |
| 999 return max_width; | 1000 return max_width; |
| 1000 for (int i = 0; i < child_count(); ++i) { | 1001 for (int i = 0; i < child_count(); ++i) { |
| 1001 max_width = std::max(max_width, | 1002 max_width = std::max(max_width, |
| 1002 GetChild(i)->GetMaxWidth(indent, depth + 1)); | 1003 GetChild(i)->GetMaxWidth(indent, depth + 1)); |
| 1003 } | 1004 } |
| 1004 return max_width; | 1005 return max_width; |
| 1005 } | 1006 } |
| 1006 | 1007 |
| 1007 } // namespace views | 1008 } // namespace views |
| OLD | NEW |