| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 this.element.classList.add('toolbar'); | 45 this.element.classList.add('toolbar'); |
| 46 this._shadowRoot = UI.createShadowRootWithCoreStyles(this.element, 'ui/toolb
ar.css'); | 46 this._shadowRoot = UI.createShadowRootWithCoreStyles(this.element, 'ui/toolb
ar.css'); |
| 47 this._contentElement = this._shadowRoot.createChild('div', 'toolbar-shadow')
; | 47 this._contentElement = this._shadowRoot.createChild('div', 'toolbar-shadow')
; |
| 48 this._insertionPoint = this._contentElement.createChild('content'); | 48 this._insertionPoint = this._contentElement.createChild('content'); |
| 49 } | 49 } |
| 50 | 50 |
| 51 /** | 51 /** |
| 52 * @param {!UI.Action} action | 52 * @param {!UI.Action} action |
| 53 * @param {!Array<!UI.ToolbarButton>=} toggledOptions | 53 * @param {!Array<!UI.ToolbarButton>=} toggledOptions |
| 54 * @param {!Array<!UI.ToolbarButton>=} untoggledOptions | 54 * @param {!Array<!UI.ToolbarButton>=} untoggledOptions |
| 55 * @return {!UI.ToolbarItem} | 55 * @return {!UI.ToolbarToggle} |
| 56 */ | 56 */ |
| 57 static createActionButton(action, toggledOptions, untoggledOptions) { | 57 static createActionButton(action, toggledOptions, untoggledOptions) { |
| 58 var button = new UI.ToolbarToggle(action.title(), action.icon(), action.togg
ledIcon()); | 58 var button = new UI.ToolbarToggle(action.title(), action.icon(), action.togg
ledIcon()); |
| 59 button.setToggleWithRedColor(action.toggleWithRedColor()); | 59 button.setToggleWithRedColor(action.toggleWithRedColor()); |
| 60 button.addEventListener(UI.ToolbarButton.Events.Click, action.execute, actio
n); | 60 button.addEventListener(UI.ToolbarButton.Events.Click, action.execute, actio
n); |
| 61 action.addEventListener(UI.Action.Events.Enabled, enabledChanged); | 61 action.addEventListener(UI.Action.Events.Enabled, enabledChanged); |
| 62 action.addEventListener(UI.Action.Events.Toggled, toggled); | 62 action.addEventListener(UI.Action.Events.Toggled, toggled); |
| 63 /** @type {?UI.LongClickController} */ | 63 /** @type {?UI.LongClickController} */ |
| 64 var longClickController = null; | 64 var longClickController = null; |
| 65 /** @type {?Array<!UI.ToolbarButton>} */ | 65 /** @type {?Array<!UI.ToolbarButton>} */ |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 buttons[i]._clicked(e); | 175 buttons[i]._clicked(e); |
| 176 break; | 176 break; |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 } | 181 } |
| 182 | 182 |
| 183 /** | 183 /** |
| 184 * @param {string} actionId | 184 * @param {string} actionId |
| 185 * @return {!UI.ToolbarItem} | 185 * @return {!UI.ToolbarToggle} |
| 186 */ | 186 */ |
| 187 static createActionButtonForId(actionId) { | 187 static createActionButtonForId(actionId) { |
| 188 const action = UI.actionRegistry.action(actionId); | 188 const action = UI.actionRegistry.action(actionId); |
| 189 return UI.Toolbar.createActionButton(/** @type {!UI.Action} */ (action)); | 189 return UI.Toolbar.createActionButton(/** @type {!UI.Action} */ (action)); |
| 190 } | 190 } |
| 191 | 191 |
| 192 /** | 192 /** |
| 193 * @param {boolean=} reverse | 193 * @param {boolean=} reverse |
| 194 */ | 194 */ |
| 195 makeWrappable(reverse) { | 195 makeWrappable(reverse) { |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 return this.inputElement.checked; | 905 return this.inputElement.checked; |
| 906 } | 906 } |
| 907 | 907 |
| 908 /** | 908 /** |
| 909 * @param {boolean} value | 909 * @param {boolean} value |
| 910 */ | 910 */ |
| 911 setChecked(value) { | 911 setChecked(value) { |
| 912 this.inputElement.checked = value; | 912 this.inputElement.checked = value; |
| 913 } | 913 } |
| 914 }; | 914 }; |
| OLD | NEW |