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 /** | 5 /** |
6 * @fileoverview This implements a combobutton control. | 6 * @fileoverview This implements a combobutton control. |
7 */ | 7 */ |
8 | 8 |
9 cr.define('cr.ui', function() { | 9 cr.define('cr.ui', function() { |
10 /** | 10 /** |
(...skipping 17 matching lines...) Expand all Loading... |
28 this.menu.clear(); | 28 this.menu.clear(); |
29 this.multiple = false; | 29 this.multiple = false; |
30 }, | 30 }, |
31 | 31 |
32 addDropDownItem: function(item) { | 32 addDropDownItem: function(item) { |
33 this.multiple = true; | 33 this.multiple = true; |
34 this.menu.addMenuItem(item).data = item; | 34 this.menu.addMenuItem(item).data = item; |
35 }, | 35 }, |
36 | 36 |
37 /** | 37 /** |
| 38 * Adds separator to drop-down list. |
| 39 */ |
| 40 addSeparator: function() { |
| 41 this.menu.addSeparator(); |
| 42 }, |
| 43 |
| 44 /** |
38 * Default item to fire on combobox click | 45 * Default item to fire on combobox click |
39 */ | 46 */ |
40 get defaultItem() { | 47 get defaultItem() { |
41 return this.defaultItem_; | 48 return this.defaultItem_; |
42 }, | 49 }, |
43 set defaultItem(defaultItem) { | 50 set defaultItem(defaultItem) { |
44 this.defaultItem_ = defaultItem; | 51 this.defaultItem_ = defaultItem; |
45 if (defaultItem.label) { | 52 if (defaultItem.label) { |
46 this.labelNode_.textContent = defaultItem.label; | 53 this.labelNode_.textContent = defaultItem.label; |
47 } else { | 54 } else { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 } | 134 } |
128 }; | 135 }; |
129 | 136 |
130 cr.defineProperty(ComboButton, 'disabled', cr.PropertyKind.BOOL_ATTR); | 137 cr.defineProperty(ComboButton, 'disabled', cr.PropertyKind.BOOL_ATTR); |
131 cr.defineProperty(ComboButton, 'multiple', cr.PropertyKind.BOOL_ATTR); | 138 cr.defineProperty(ComboButton, 'multiple', cr.PropertyKind.BOOL_ATTR); |
132 | 139 |
133 return { | 140 return { |
134 ComboButton: ComboButton | 141 ComboButton: ComboButton |
135 }; | 142 }; |
136 }); | 143 }); |
OLD | NEW |