| 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 #ifndef UI_VIEWS_CONTROLS_TREE_TREE_VIEW_VIEWS_H_ | 5 #ifndef UI_VIEWS_CONTROLS_TREE_TREE_VIEW_VIEWS_H_ |
| 6 #define UI_VIEWS_CONTROLS_TREE_TREE_VIEW_VIEWS_H_ | 6 #define UI_VIEWS_CONTROLS_TREE_TREE_VIEW_VIEWS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // editing a node, NULL is returned. | 74 // editing a node, NULL is returned. |
| 75 ui::TreeModelNode* GetEditingNode(); | 75 ui::TreeModelNode* GetEditingNode(); |
| 76 | 76 |
| 77 // Selects the specified node. This expands all the parents of node. | 77 // Selects the specified node. This expands all the parents of node. |
| 78 void SetSelectedNode(ui::TreeModelNode* model_node); | 78 void SetSelectedNode(ui::TreeModelNode* model_node); |
| 79 | 79 |
| 80 // Returns the selected node, or NULL if nothing is selected. | 80 // Returns the selected node, or NULL if nothing is selected. |
| 81 ui::TreeModelNode* GetSelectedNode(); | 81 ui::TreeModelNode* GetSelectedNode(); |
| 82 | 82 |
| 83 // Marks |model_node| as collapsed. This only effects the UI if node and all | 83 // Marks |model_node| as collapsed. This only effects the UI if node and all |
| 84 // it's parents are expanded (IsExpanded(model_node) returns true). | 84 // its parents are expanded (IsExpanded(model_node) returns true). |
| 85 void Collapse(ui::TreeModelNode* model_node); | 85 void Collapse(ui::TreeModelNode* model_node); |
| 86 | 86 |
| 87 // Make sure node and all its parents are expanded. | 87 // Make sure node and all its parents are expanded. |
| 88 void Expand(ui::TreeModelNode* node); | 88 void Expand(ui::TreeModelNode* node); |
| 89 | 89 |
| 90 // Invoked from ExpandAll(). Expands the supplied node and recursively | 90 // Invoked from ExpandAll(). Expands the supplied node and recursively |
| 91 // invokes itself with all children. | 91 // invokes itself with all children. |
| 92 void ExpandAll(ui::TreeModelNode* node); | 92 void ExpandAll(ui::TreeModelNode* node); |
| 93 | 93 |
| 94 // Returns true if the specified node is expanded. | 94 // Returns true if the specified node is expanded. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 // Width needed to display the string. | 172 // Width needed to display the string. |
| 173 void set_text_width(int width) { text_width_ = width; } | 173 void set_text_width(int width) { text_width_ = width; } |
| 174 int text_width() const { return text_width_; } | 174 int text_width() const { return text_width_; } |
| 175 | 175 |
| 176 // Returns the total number of descendants (including this node). | 176 // Returns the total number of descendants (including this node). |
| 177 int NumExpandedNodes(); | 177 int NumExpandedNodes(); |
| 178 | 178 |
| 179 // Returns the max width of all descendants (including this node). |indent| | 179 // Returns the max width of all descendants (including this node). |indent| |
| 180 // is how many pixels each child is indented and |depth| is the depth of | 180 // is how many pixels each child is indented and |depth| is the depth of |
| 181 // this node from it's parent. | 181 // this node from its parent. |
| 182 int GetMaxWidth(int indent, int depth); | 182 int GetMaxWidth(int indent, int depth); |
| 183 | 183 |
| 184 private: | 184 private: |
| 185 // The node from the model. | 185 // The node from the model. |
| 186 ui::TreeModelNode* model_node_; | 186 ui::TreeModelNode* model_node_; |
| 187 | 187 |
| 188 // Whether the children have been loaded. | 188 // Whether the children have been loaded. |
| 189 bool loaded_children_; | 189 bool loaded_children_; |
| 190 | 190 |
| 191 bool is_expanded_; | 191 bool is_expanded_; |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 // Offset the text is drawn at. This accounts for the size of the expand | 360 // Offset the text is drawn at. This accounts for the size of the expand |
| 361 // control, icon and offsets. | 361 // control, icon and offsets. |
| 362 int text_offset_; | 362 int text_offset_; |
| 363 | 363 |
| 364 DISALLOW_COPY_AND_ASSIGN(TreeView); | 364 DISALLOW_COPY_AND_ASSIGN(TreeView); |
| 365 }; | 365 }; |
| 366 | 366 |
| 367 } // namespace views | 367 } // namespace views |
| 368 | 368 |
| 369 #endif // UI_VIEWS_CONTROLS_TREE_TREE_VIEW_VIEWS_H_ | 369 #endif // UI_VIEWS_CONTROLS_TREE_TREE_VIEW_VIEWS_H_ |
| OLD | NEW |