| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 this._contentElement = this.contentElement.createChild("div", "tabbed-pane-c
ontent"); | 48 this._contentElement = this.contentElement.createChild("div", "tabbed-pane-c
ontent"); |
| 49 this._contentElement.setAttribute("role", "tabpanel"); | 49 this._contentElement.setAttribute("role", "tabpanel"); |
| 50 this._contentElement.createChild("content"); | 50 this._contentElement.createChild("content"); |
| 51 /** @type {!Array.<!WebInspector.TabbedPaneTab>} */ | 51 /** @type {!Array.<!WebInspector.TabbedPaneTab>} */ |
| 52 this._tabs = []; | 52 this._tabs = []; |
| 53 /** @type {!Array.<!WebInspector.TabbedPaneTab>} */ | 53 /** @type {!Array.<!WebInspector.TabbedPaneTab>} */ |
| 54 this._tabsHistory = []; | 54 this._tabsHistory = []; |
| 55 /** @type {!Object.<string, !WebInspector.TabbedPaneTab>} */ | 55 /** @type {!Object.<string, !WebInspector.TabbedPaneTab>} */ |
| 56 this._tabsById = {}; | 56 this._tabsById = {}; |
| 57 this._currentTabLocked = false; | 57 this._currentTabLocked = false; |
| 58 this._autoSelectFirstItemOnShow = true; |
| 58 | 59 |
| 59 this._dropDownButton = this._createDropDownButton(); | 60 this._dropDownButton = this._createDropDownButton(); |
| 60 WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.Zo
omChanged, this._zoomChanged, this); | 61 WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.Zo
omChanged, this._zoomChanged, this); |
| 61 } | 62 } |
| 62 | 63 |
| 63 /** @enum {symbol} */ | 64 /** @enum {symbol} */ |
| 64 WebInspector.TabbedPane.Events = { | 65 WebInspector.TabbedPane.Events = { |
| 65 TabSelected: Symbol("TabSelected"), | 66 TabSelected: Symbol("TabSelected"), |
| 66 TabClosed: Symbol("TabClosed"), | 67 TabClosed: Symbol("TabClosed"), |
| 67 TabOrderChanged: Symbol("TabOrderChanged") | 68 TabOrderChanged: Symbol("TabOrderChanged") |
| 68 } | 69 } |
| 69 | 70 |
| 70 WebInspector.TabbedPane.prototype = { | 71 WebInspector.TabbedPane.prototype = { |
| 71 /** | 72 /** |
| 72 * @param {boolean} locked | 73 * @param {boolean} locked |
| 73 */ | 74 */ |
| 74 setCurrentTabLocked: function(locked) | 75 setCurrentTabLocked: function(locked) |
| 75 { | 76 { |
| 76 this._currentTabLocked = locked; | 77 this._currentTabLocked = locked; |
| 77 this._headerElement.classList.toggle("locked", this._currentTabLocked); | 78 this._headerElement.classList.toggle("locked", this._currentTabLocked); |
| 78 }, | 79 }, |
| 79 | 80 |
| 80 /** | 81 /** |
| 82 * @param {boolean} autoSelect |
| 83 */ |
| 84 setAutoSelectFirstItemOnShow: function(autoSelect) |
| 85 { |
| 86 this._autoSelectFirstItemOnShow = autoSelect; |
| 87 }, |
| 88 |
| 89 /** |
| 81 * @return {?WebInspector.Widget} | 90 * @return {?WebInspector.Widget} |
| 82 */ | 91 */ |
| 83 get visibleView() | 92 get visibleView() |
| 84 { | 93 { |
| 85 return this._currentTab ? this._currentTab.view : null; | 94 return this._currentTab ? this._currentTab.view : null; |
| 86 }, | 95 }, |
| 87 | 96 |
| 88 /** | 97 /** |
| 89 * @return {!Array.<string>} | 98 * @return {!Array.<string>} |
| 90 */ | 99 */ |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 }, | 471 }, |
| 463 | 472 |
| 464 headerResized: function() | 473 headerResized: function() |
| 465 { | 474 { |
| 466 this._updateTabElements(); | 475 this._updateTabElements(); |
| 467 }, | 476 }, |
| 468 | 477 |
| 469 wasShown: function() | 478 wasShown: function() |
| 470 { | 479 { |
| 471 var effectiveTab = this._currentTab || this._tabsHistory[0]; | 480 var effectiveTab = this._currentTab || this._tabsHistory[0]; |
| 472 if (effectiveTab) | 481 if (effectiveTab && this._autoSelectFirstItemOnShow) |
| 473 this.selectTab(effectiveTab.id); | 482 this.selectTab(effectiveTab.id); |
| 474 }, | 483 }, |
| 475 | 484 |
| 476 /** | 485 /** |
| 477 * @param {boolean} enable | 486 * @param {boolean} enable |
| 478 */ | 487 */ |
| 479 setTabSlider: function(enable) | 488 setTabSlider: function(enable) |
| 480 { | 489 { |
| 481 this._sliderEnabled = enable; | 490 this._sliderEnabled = enable; |
| 482 this._tabSlider.classList.toggle("enabled", enable); | 491 this._tabSlider.classList.toggle("enabled", enable); |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1266 * @param {!Array.<string>} ids | 1275 * @param {!Array.<string>} ids |
| 1267 */ | 1276 */ |
| 1268 closeTabs: function(tabbedPane, ids) { }, | 1277 closeTabs: function(tabbedPane, ids) { }, |
| 1269 | 1278 |
| 1270 /** | 1279 /** |
| 1271 * @param {string} tabId | 1280 * @param {string} tabId |
| 1272 * @param {!WebInspector.ContextMenu} contextMenu | 1281 * @param {!WebInspector.ContextMenu} contextMenu |
| 1273 */ | 1282 */ |
| 1274 onContextMenu: function(tabId, contextMenu) { } | 1283 onContextMenu: function(tabId, contextMenu) { } |
| 1275 } | 1284 } |
| OLD | NEW |