| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 22 matching lines...) Expand all Loading... |
| 33 * @constructor | 33 * @constructor |
| 34 */ | 34 */ |
| 35 WebInspector.TabbedPane = function() | 35 WebInspector.TabbedPane = function() |
| 36 { | 36 { |
| 37 WebInspector.VBox.call(this, true); | 37 WebInspector.VBox.call(this, true); |
| 38 this.registerRequiredCSS("ui/tabbedPane.css"); | 38 this.registerRequiredCSS("ui/tabbedPane.css"); |
| 39 this.element.classList.add("tabbed-pane"); | 39 this.element.classList.add("tabbed-pane"); |
| 40 this.contentElement.classList.add("tabbed-pane-shadow"); | 40 this.contentElement.classList.add("tabbed-pane-shadow"); |
| 41 this.contentElement.tabIndex = -1; | 41 this.contentElement.tabIndex = -1; |
| 42 this._headerElement = this.contentElement.createChild("div", "tabbed-pane-he
ader"); | 42 this._headerElement = this.contentElement.createChild("div", "tabbed-pane-he
ader"); |
| 43 this._headerElement.createChild("content").select = ".tabbed-pane-header-bef
ore"; | |
| 44 this._headerContentsElement = this._headerElement.createChild("div", "tabbed
-pane-header-contents"); | 43 this._headerContentsElement = this._headerElement.createChild("div", "tabbed
-pane-header-contents"); |
| 45 this._headerContentsElement.setAttribute("aria-label", WebInspector.UIString
("Panels")); | 44 this._headerContentsElement.setAttribute("aria-label", WebInspector.UIString
("Panels")); |
| 46 this._tabSlider = createElementWithClass("div", "tabbed-pane-tab-slider"); | 45 this._tabSlider = createElementWithClass("div", "tabbed-pane-tab-slider"); |
| 47 this._headerElement.createChild("content").select = ".tabbed-pane-header-aft
er"; | |
| 48 this._tabsElement = this._headerContentsElement.createChild("div", "tabbed-p
ane-header-tabs"); | 46 this._tabsElement = this._headerContentsElement.createChild("div", "tabbed-p
ane-header-tabs"); |
| 49 this._tabsElement.setAttribute("role", "tablist"); | 47 this._tabsElement.setAttribute("role", "tablist"); |
| 50 this._contentElement = this.contentElement.createChild("div", "tabbed-pane-c
ontent"); | 48 this._contentElement = this.contentElement.createChild("div", "tabbed-pane-c
ontent"); |
| 51 this._contentElement.setAttribute("role", "tabpanel"); | 49 this._contentElement.setAttribute("role", "tabpanel"); |
| 52 this._contentElement.createChild("content"); | 50 this._contentElement.createChild("content"); |
| 53 /** @type {!Array.<!WebInspector.TabbedPaneTab>} */ | 51 /** @type {!Array.<!WebInspector.TabbedPaneTab>} */ |
| 54 this._tabs = []; | 52 this._tabs = []; |
| 55 /** @type {!Array.<!WebInspector.TabbedPaneTab>} */ | 53 /** @type {!Array.<!WebInspector.TabbedPaneTab>} */ |
| 56 this._tabsHistory = []; | 54 this._tabsHistory = []; |
| 57 /** @type {!Object.<string, !WebInspector.TabbedPaneTab>} */ | 55 /** @type {!Object.<string, !WebInspector.TabbedPaneTab>} */ |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 this._tabsElement.insertBefore(tab._tabElement || null, this._tabsElemen
t.childNodes[index]); | 817 this._tabsElement.insertBefore(tab._tabElement || null, this._tabsElemen
t.childNodes[index]); |
| 820 var oldIndex = this._tabs.indexOf(tab); | 818 var oldIndex = this._tabs.indexOf(tab); |
| 821 this._tabs.splice(oldIndex, 1); | 819 this._tabs.splice(oldIndex, 1); |
| 822 if (oldIndex < index) | 820 if (oldIndex < index) |
| 823 --index; | 821 --index; |
| 824 this._tabs.splice(index, 0, tab); | 822 this._tabs.splice(index, 0, tab); |
| 825 this.dispatchEventToListeners(WebInspector.TabbedPane.Events.TabOrderCha
nged, this._tabs); | 823 this.dispatchEventToListeners(WebInspector.TabbedPane.Events.TabOrderCha
nged, this._tabs); |
| 826 }, | 824 }, |
| 827 | 825 |
| 828 /** | 826 /** |
| 829 * @param {!Element} element | 827 * @return {!WebInspector.Toolbar} |
| 830 */ | 828 */ |
| 831 insertBeforeTabStrip: function(element) | 829 leftToolbar: function() |
| 832 { | 830 { |
| 833 element.classList.add("tabbed-pane-header-before"); | 831 if (!this._leftToolbar) { |
| 834 this.element.appendChild(element); | 832 this._leftToolbar = new WebInspector.Toolbar("tabbed-pane-left-toolb
ar"); |
| 833 this._headerElement.insertBefore(this._leftToolbar.element, this._he
aderElement.firstChild); |
| 834 } |
| 835 return this._leftToolbar; |
| 835 }, | 836 }, |
| 836 | 837 |
| 837 /** | 838 /** |
| 838 * @param {!Element} element | 839 * @return {!WebInspector.Toolbar} |
| 839 */ | 840 */ |
| 840 appendAfterTabStrip: function(element) | 841 rightToolbar: function() |
| 841 { | 842 { |
| 842 element.classList.add("tabbed-pane-header-after"); | 843 if (!this._rightToolbar) { |
| 843 this.element.appendChild(element); | 844 this._rightToolbar = new WebInspector.Toolbar("tabbed-pane-right-too
lbar"); |
| 845 this._headerElement.appendChild(this._rightToolbar.element); |
| 846 } |
| 847 return this._rightToolbar; |
| 844 }, | 848 }, |
| 845 | 849 |
| 846 renderWithNoHeaderBackground: function() | 850 renderWithNoHeaderBackground: function() |
| 847 { | 851 { |
| 848 this._headerElement.classList.add("tabbed-pane-no-header-background"); | 852 this._headerElement.classList.add("tabbed-pane-no-header-background"); |
| 849 }, | 853 }, |
| 850 | 854 |
| 851 /** | 855 /** |
| 852 * @param {boolean} allow | 856 * @param {boolean} allow |
| 853 * @param {boolean=} automatic | 857 * @param {boolean=} automatic |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1247 * @param {!Array.<string>} ids | 1251 * @param {!Array.<string>} ids |
| 1248 */ | 1252 */ |
| 1249 closeTabs: function(tabbedPane, ids) { }, | 1253 closeTabs: function(tabbedPane, ids) { }, |
| 1250 | 1254 |
| 1251 /** | 1255 /** |
| 1252 * @param {string} tabId | 1256 * @param {string} tabId |
| 1253 * @param {!WebInspector.ContextMenu} contextMenu | 1257 * @param {!WebInspector.ContextMenu} contextMenu |
| 1254 */ | 1258 */ |
| 1255 onContextMenu: function(tabId, contextMenu) { } | 1259 onContextMenu: function(tabId, contextMenu) { } |
| 1256 } | 1260 } |
| OLD | NEW |