this._panelName = name;
this._shortcuts = /** !Object.<number, function(Event=):boolean> */ ({});
-
- WebInspector.settings[this._sidebarWidthSettingName()] = WebInspector.settings.createSetting(this._sidebarWidthSettingName(), undefined);
}
// Should by in sync with style declarations.
*/
defaultFocusedElement: function()
{
- return this.sidebarTreeElement || this.element;
+ return this.element;
},
/**
{
},
- /**
- * @param {!Element=} parentElement
- * @param {string=} position
- * @param {number=} defaultWidth
- * @param {number=} defaultHeight
- */
- createSidebarView: function(parentElement, position, defaultWidth, defaultHeight)
- {
- if (this.splitView)
- return;
-
- if (!parentElement)
- parentElement = this.element;
-
- this.splitView = new WebInspector.SidebarView(position, this._sidebarWidthSettingName(), defaultWidth, defaultHeight);
- this.splitView.show(parentElement);
- this.splitView.addEventListener(WebInspector.SidebarView.EventTypes.Resized, this.sidebarResized.bind(this));
- },
-
- /**
- * @param {!Element=} parentElement
- * @param {string=} position
- * @param {number=} defaultWidth
- */
- createSidebarViewWithTree: function(parentElement, position, defaultWidth)
- {
- if (this.splitView)
- return;
-
- this.createSidebarView(parentElement, position);
-
- this.sidebarTreeElement = document.createElement("ol");
- this.sidebarTreeElement.className = "sidebar-tree";
- this.splitView.sidebarElement().appendChild(this.sidebarTreeElement);
- this.splitView.sidebarElement().classList.add("sidebar");
-
- this.sidebarTree = new TreeOutline(this.sidebarTreeElement);
- this.sidebarTree.panel = this;
- },
-
- _sidebarWidthSettingName: function()
- {
- return this._panelName + "SidebarWidth";
- },
-
// Should be implemented by ancestors.
-
get statusBarItems()
{
},
/**
- * @param {!WebInspector.Event} event
- */
- sidebarResized: function(event)
- {
- },
-
- statusBarResized: function()
- {
- },
-
- /**
- * @param {!Element} anchor
- * @return {boolean}
- */
- showAnchorLocation: function(anchor)
- {
- return false;
- },
-
- /**
* @return {!Array.<!Element>}
*/
elementsToRestoreScrollPositionsFor: function()
}
/**
+ * @extends {WebInspector.Panel}
+ * @param {number=} defaultWidth
+ * @constructor
+ */
+WebInspector.PanelWithSidebarTree = function(name, defaultWidth)
+{
+ WebInspector.Panel.call(this, name);
+
+ this._panelSplitView = new WebInspector.SplitView(true, false, this._panelName + "SidebarWidth", defaultWidth || 200);
+ this._panelSplitView.setSidebarElementConstraints(Preferences.minSidebarWidth);
+ this._panelSplitView.show(this.element);
+
+ var sidebarElement = this._panelSplitView.sidebarElement();
+ sidebarElement.classList.add("sidebar");
+ var sidebarTreeElement = sidebarElement.createChild("ol", "sidebar-tree");
+ this.sidebarTree = new TreeOutline(sidebarTreeElement);
+}
+
+WebInspector.PanelWithSidebarTree.prototype = {
+ /**
+ * @return {!Element}
+ */
+ sidebarElement: function()
+ {
+ return this._panelSplitView.sidebarElement();
+ },
+
+ /**
+ * @return {!Element} element
+ */
+ mainElement: function()
+ {
+ return this._panelSplitView.mainElement();
+ },
+
+ /**
+ * @param {number=} minWidth
+ * @param {number=} minHeight
+ */
+ setMainElementConstraints: function(minWidth, minHeight)
+ {
+ this._panelSplitView.setMainElementConstraints(minWidth, minHeight);
+ },
+
+ /**
+ * @return {!Element}
+ */
+ defaultFocusedElement: function()
+ {
+ return this.sidebarTree.element || this.element;
+ },
+
+ __proto__: WebInspector.Panel.prototype
+}
+
+/**
* @interface
*/
WebInspector.PanelDescriptor = function()