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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 | 243 |
244 if (selected_node_) | 244 if (selected_node_) |
245 ScrollRectToVisible(GetBoundsForNode(selected_node_)); | 245 ScrollRectToVisible(GetBoundsForNode(selected_node_)); |
246 | 246 |
247 // Notify controller if the old selection was empty to handle the case of | 247 // Notify controller if the old selection was empty to handle the case of |
248 // remove explicitly resetting selected_node_ before invoking this. | 248 // remove explicitly resetting selected_node_ before invoking this. |
249 if (controller_ && (changed || was_empty_selection)) | 249 if (controller_ && (changed || was_empty_selection)) |
250 controller_->OnTreeViewSelectionChanged(this); | 250 controller_->OnTreeViewSelectionChanged(this); |
251 | 251 |
252 if (changed) { | 252 if (changed) { |
253 // TODO(dmazzoni): Decide if EVENT_SELECTION_CHANGED is a better choice for | 253 NotifyAccessibilityEvent(ui::AX_EVENT_TEXT_CHANGED, true); |
254 // sub-item selection event. | 254 NotifyAccessibilityEvent(ui::AX_EVENT_SELECTION, true); |
255 NotifyAccessibilityEvent(ui::AX_EVENT_FOCUS, true); | |
256 } | 255 } |
257 } | 256 } |
258 | 257 |
259 TreeModelNode* TreeView::GetSelectedNode() { | 258 TreeModelNode* TreeView::GetSelectedNode() { |
260 return selected_node_ ? selected_node_->model_node() : NULL; | 259 return selected_node_ ? selected_node_->model_node() : NULL; |
261 } | 260 } |
262 | 261 |
263 void TreeView::Collapse(ui::TreeModelNode* model_node) { | 262 void TreeView::Collapse(ui::TreeModelNode* model_node) { |
264 // Don't collapse the root if the root isn't shown, otherwise nothing is | 263 // Don't collapse the root if the root isn't shown, otherwise nothing is |
265 // displayed. | 264 // displayed. |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 if (!is_expanded_) | 1043 if (!is_expanded_) |
1045 return max_width; | 1044 return max_width; |
1046 for (int i = 0; i < child_count(); ++i) { | 1045 for (int i = 0; i < child_count(); ++i) { |
1047 max_width = std::max(max_width, | 1046 max_width = std::max(max_width, |
1048 GetChild(i)->GetMaxWidth(indent, depth + 1)); | 1047 GetChild(i)->GetMaxWidth(indent, depth + 1)); |
1049 } | 1048 } |
1050 return max_width; | 1049 return max_width; |
1051 } | 1050 } |
1052 | 1051 |
1053 } // namespace views | 1052 } // namespace views |
OLD | NEW |