| 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // Add the editor immediately as GetPreferredSize returns the wrong thing if | 136 // Add the editor immediately as GetPreferredSize returns the wrong thing if |
| 137 // not parented. | 137 // not parented. |
| 138 AddChildView(editor_); | 138 AddChildView(editor_); |
| 139 editor_->SetFont(font_); | 139 editor_->SetFont(font_); |
| 140 empty_editor_size_ = editor_->GetPreferredSize(); | 140 empty_editor_size_ = editor_->GetPreferredSize(); |
| 141 editor_->SetText(selected_node_->model_node()->GetTitle()); | 141 editor_->SetText(selected_node_->model_node()->GetTitle()); |
| 142 editor_->SetController(this); | 142 editor_->SetController(this); |
| 143 LayoutEditor(); | 143 LayoutEditor(); |
| 144 SchedulePaintForNode(selected_node_); | 144 SchedulePaintForNode(selected_node_); |
| 145 editor_->RequestFocus(); | 145 editor_->RequestFocus(); |
| 146 editor_->SelectAll(); | 146 editor_->SelectAll(false); |
| 147 | 147 |
| 148 // Listen for focus changes so that we can cancel editing. | 148 // Listen for focus changes so that we can cancel editing. |
| 149 focus_manager_ = GetFocusManager(); | 149 focus_manager_ = GetFocusManager(); |
| 150 if (focus_manager_) | 150 if (focus_manager_) |
| 151 focus_manager_->AddFocusChangeListener(this); | 151 focus_manager_->AddFocusChangeListener(this); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void TreeView::CancelEdit() { | 154 void TreeView::CancelEdit() { |
| 155 if (!editor_) | 155 if (!editor_) |
| 156 return; | 156 return; |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 if (!is_expanded_) | 901 if (!is_expanded_) |
| 902 return max_width; | 902 return max_width; |
| 903 for (int i = 0; i < child_count(); ++i) { | 903 for (int i = 0; i < child_count(); ++i) { |
| 904 max_width = std::max(max_width, | 904 max_width = std::max(max_width, |
| 905 GetChild(i)->GetMaxWidth(indent, depth + 1)); | 905 GetChild(i)->GetMaxWidth(indent, depth + 1)); |
| 906 } | 906 } |
| 907 return max_width; | 907 return max_width; |
| 908 } | 908 } |
| 909 | 909 |
| 910 } // namespace views | 910 } // namespace views |
| OLD | NEW |