| 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/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 } | 773 } |
| 774 | 774 |
| 775 if (model_->GetChildCount(node->model_node())) | 775 if (model_->GetChildCount(node->model_node())) |
| 776 PaintExpandControl(canvas, bounds, node->is_expanded()); | 776 PaintExpandControl(canvas, bounds, node->is_expanded()); |
| 777 | 777 |
| 778 // Paint the icon. | 778 // Paint the icon. |
| 779 gfx::ImageSkia icon; | 779 gfx::ImageSkia icon; |
| 780 int icon_index = model_->GetIconIndex(node->model_node()); | 780 int icon_index = model_->GetIconIndex(node->model_node()); |
| 781 if (icon_index != -1) | 781 if (icon_index != -1) |
| 782 icon = icons_[icon_index]; | 782 icon = icons_[icon_index]; |
| 783 else if (node == selected_node_) | 783 else if (node == selected_node_ && PlatformStyle::kTreeViewUsesOpenIcon) |
| 784 icon = open_icon_; | 784 icon = open_icon_; |
| 785 else | 785 else |
| 786 icon = closed_icon_; | 786 icon = closed_icon_; |
| 787 int icon_x = kArrowRegionSize + kImagePadding + | 787 int icon_x = kArrowRegionSize + kImagePadding + |
| 788 (open_icon_.width() - icon.width()) / 2; | 788 (open_icon_.width() - icon.width()) / 2; |
| 789 if (base::i18n::IsRTL()) | 789 if (base::i18n::IsRTL()) |
| 790 icon_x = bounds.right() - icon_x - open_icon_.width(); | 790 icon_x = bounds.right() - icon_x - open_icon_.width(); |
| 791 else | 791 else |
| 792 icon_x += bounds.x(); | 792 icon_x += bounds.x(); |
| 793 canvas->DrawImageInt( | 793 canvas->DrawImageInt( |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 if (!is_expanded_) | 1097 if (!is_expanded_) |
| 1098 return max_width; | 1098 return max_width; |
| 1099 for (int i = 0; i < child_count(); ++i) { | 1099 for (int i = 0; i < child_count(); ++i) { |
| 1100 max_width = std::max(max_width, | 1100 max_width = std::max(max_width, |
| 1101 GetChild(i)->GetMaxWidth(indent, depth + 1)); | 1101 GetChild(i)->GetMaxWidth(indent, depth + 1)); |
| 1102 } | 1102 } |
| 1103 return max_width; | 1103 return max_width; |
| 1104 } | 1104 } |
| 1105 | 1105 |
| 1106 } // namespace views | 1106 } // namespace views |
| OLD | NEW |