| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 cr.define('cr.ui', function() { | 5 cr.define('cr.ui', function() { |
| 6 // require cr.ui.define | 6 // require cr.ui.define |
| 7 // require cr.ui.limitInputWidth | 7 // require cr.ui.limitInputWidth |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * The number of pixels to indent per level. | 10 * The number of pixels to indent per level. |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 getRectForContextMenu: function() { | 211 getRectForContextMenu: function() { |
| 212 // TODO(arv): Add trait support so we can share more code between trees | 212 // TODO(arv): Add trait support so we can share more code between trees |
| 213 // and lists. | 213 // and lists. |
| 214 if (this.selectedItem) | 214 if (this.selectedItem) |
| 215 return this.selectedItem.rowElement.getBoundingClientRect(); | 215 return this.selectedItem.rowElement.getBoundingClientRect(); |
| 216 return this.getBoundingClientRect(); | 216 return this.getBoundingClientRect(); |
| 217 } | 217 } |
| 218 }; | 218 }; |
| 219 | 219 |
| 220 /** | 220 /** |
| 221 * Determines the visibility of icons next to the treeItem labels. If set to |
| 222 * 'hidden', no space is reserved for icons and no icons are displayed next |
| 223 * to treeItem labels. If set to 'parent', folder icons will be displayed |
| 224 * next to expandable parent nodes. If set to 'all' folder icons will be |
| 225 * displayed next to all nodes. Icons can be set using the treeItem's icon |
| 226 * property. |
| 227 */ |
| 228 cr.defineProperty(Tree, 'iconVisibility', cr.PropertyKind.ATTR); |
| 229 |
| 230 /** |
| 221 * This is used as a blueprint for new tree item elements. | 231 * This is used as a blueprint for new tree item elements. |
| 222 * @type {!HTMLElement} | 232 * @type {!HTMLElement} |
| 223 */ | 233 */ |
| 224 var treeItemProto = (function() { | 234 var treeItemProto = (function() { |
| 225 var treeItem = cr.doc.createElement('div'); | 235 var treeItem = cr.doc.createElement('div'); |
| 226 treeItem.className = 'tree-item'; | 236 treeItem.className = 'tree-item'; |
| 227 treeItem.innerHTML = '<div class=tree-row>' + | 237 treeItem.innerHTML = '<div class=tree-row>' + |
| 228 '<span class=expand-icon></span>' + | 238 '<span class=expand-icon></span>' + |
| 229 '<span class=tree-label></span>' + | 239 '<span class=tree-label></span>' + |
| 230 '</div>' + | 240 '</div>' + |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 } | 666 } |
| 657 return item; | 667 return item; |
| 658 } | 668 } |
| 659 | 669 |
| 660 // Export | 670 // Export |
| 661 return { | 671 return { |
| 662 Tree: Tree, | 672 Tree: Tree, |
| 663 TreeItem: TreeItem | 673 TreeItem: TreeItem |
| 664 }; | 674 }; |
| 665 }); | 675 }); |
| OLD | NEW |