| 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" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "ui/accessibility/ax_view_state.h" | 12 #include "ui/accessibility/ax_node_data.h" |
| 13 #include "ui/base/ime/input_method.h" | 13 #include "ui/base/ime/input_method.h" |
| 14 #include "ui/base/material_design/material_design_controller.h" | 14 #include "ui/base/material_design/material_design_controller.h" |
| 15 #include "ui/base/resource/resource_bundle.h" | 15 #include "ui/base/resource/resource_bundle.h" |
| 16 #include "ui/events/event.h" | 16 #include "ui/events/event.h" |
| 17 #include "ui/events/keycodes/keyboard_codes.h" | 17 #include "ui/events/keycodes/keyboard_codes.h" |
| 18 #include "ui/gfx/canvas.h" | 18 #include "ui/gfx/canvas.h" |
| 19 #include "ui/gfx/geometry/rect.h" | 19 #include "ui/gfx/geometry/rect.h" |
| 20 #include "ui/gfx/geometry/rect_conversions.h" | 20 #include "ui/gfx/geometry/rect_conversions.h" |
| 21 #include "ui/gfx/image/image.h" | 21 #include "ui/gfx/image/image.h" |
| 22 #include "ui/gfx/skia_util.h" | 22 #include "ui/gfx/skia_util.h" |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 // Only invoke View's implementation (which notifies the | 401 // Only invoke View's implementation (which notifies the |
| 402 // ContextMenuController) if over a node. | 402 // ContextMenuController) if over a node. |
| 403 gfx::Point local_point(p); | 403 gfx::Point local_point(p); |
| 404 ConvertPointFromScreen(this, &local_point); | 404 ConvertPointFromScreen(this, &local_point); |
| 405 if (!GetNodeAtPoint(local_point)) | 405 if (!GetNodeAtPoint(local_point)) |
| 406 return; | 406 return; |
| 407 } | 407 } |
| 408 View::ShowContextMenu(p, source_type); | 408 View::ShowContextMenu(p, source_type); |
| 409 } | 409 } |
| 410 | 410 |
| 411 void TreeView::GetAccessibleState(ui::AXViewState* state) { | 411 void TreeView::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
| 412 state->role = ui::AX_ROLE_TREE; | 412 node_data->role = ui::AX_ROLE_TREE; |
| 413 state->AddStateFlag(ui::AX_STATE_READ_ONLY); | 413 node_data->AddStateFlag(ui::AX_STATE_READ_ONLY); |
| 414 if (!selected_node_) | 414 if (!selected_node_) |
| 415 return; | 415 return; |
| 416 | 416 |
| 417 // Get selected item info. | 417 // Get selected item info. |
| 418 state->role = ui::AX_ROLE_TREE_ITEM; | 418 node_data->role = ui::AX_ROLE_TREE_ITEM; |
| 419 state->name = selected_node_->model_node()->GetTitle(); | 419 node_data->SetName(selected_node_->model_node()->GetTitle()); |
| 420 } | 420 } |
| 421 | 421 |
| 422 const char* TreeView::GetClassName() const { | 422 const char* TreeView::GetClassName() const { |
| 423 return kViewClassName; | 423 return kViewClassName; |
| 424 } | 424 } |
| 425 | 425 |
| 426 void TreeView::TreeNodesAdded(TreeModel* model, | 426 void TreeView::TreeNodesAdded(TreeModel* model, |
| 427 TreeModelNode* parent, | 427 TreeModelNode* parent, |
| 428 int start, | 428 int start, |
| 429 int count) { | 429 int count) { |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1111 if (!is_expanded_) | 1111 if (!is_expanded_) |
| 1112 return max_width; | 1112 return max_width; |
| 1113 for (int i = 0; i < child_count(); ++i) { | 1113 for (int i = 0; i < child_count(); ++i) { |
| 1114 max_width = std::max(max_width, | 1114 max_width = std::max(max_width, |
| 1115 GetChild(i)->GetMaxWidth(indent, depth + 1)); | 1115 GetChild(i)->GetMaxWidth(indent, depth + 1)); |
| 1116 } | 1116 } |
| 1117 return max_width; | 1117 return max_width; |
| 1118 } | 1118 } |
| 1119 | 1119 |
| 1120 } // namespace views | 1120 } // namespace views |
| OLD | NEW |