WebInspector.SidebarView = function(sidebarPosition, sidebarWidthSettingName, defaultSidebarWidth, defaultSidebarHeight)
{
WebInspector.SplitView.call(this, true, sidebarWidthSettingName, defaultSidebarWidth, defaultSidebarHeight);
this._minimumSidebarWidth = Preferences.minSidebarWidth;
this._minimumMainWidthPercent = 50;
this._minimumSidebarHeight = Preferences.minSidebarHeight;
this._minimumMainHeightPercent = 50;
this._sidebarPosition = sidebarPosition || WebInspector.SidebarView.SidebarPosition.Start;
this.setSecondIsSidebar(this._sidebarPosition === WebInspector.SidebarView.SidebarPosition.End);
}
WebInspector.SidebarView.EventTypes = {
Resized: "Resized"
}
WebInspector.SidebarView.SidebarPosition = {
Start: "Start",
End: "End"
}
WebInspector.SidebarView.prototype = {
setMinimumSidebarWidth: function(width)
{
this._minimumSidebarWidth = width;
},
setMinimumSidebarHeight: function(height)
{
this._minimumSidebarHeight = height;
},
setMinimumMainWidthPercent: function(widthPercent)
{
this._minimumMainWidthPercent = widthPercent;
},
setMinimumMainHeightPercent: function(heightPercent)
{
this._minimumMainHeightPercent = heightPercent;
},
setSidebarWidth: function(width)
{
this.setSidebarSize(width);
},
sidebarWidth: function()
{
return this.sidebarSize();
},
onResize: function()
{
WebInspector.SplitView.prototype.onResize.call(this);
this.dispatchEventToListeners(WebInspector.SidebarView.EventTypes.Resized, this.sidebarWidth());
},
applyConstraints: function(size)
{
var minSidebarSize = this.isVertical() ? this._minimumSidebarWidth : this._minimumSidebarHeight;
var minMainSizePercent = this.isVertical() ? this._minimumMainWidthPercent : this._minimumMainHeightPercent;
return Number.constrain(size, minSidebarSize, this.totalSize() * (100 - minMainSizePercent) / 100);
},
hideMainElement: function()
{
if (this.isSidebarSecond())
this.showOnlySecond();
else
this.showOnlyFirst();
},
showMainElement: function()
{
this.showBoth();
},
hideSidebarElement: function()
{
if (this.isSidebarSecond())
this.showOnlyFirst();
else
this.showOnlySecond();
},
showSidebarElement: function()
{
this.showBoth();
},
elementsToRestoreScrollPositionsFor: function()
{
return [ this.mainElement, this.sidebarElement ];
},
__proto__: WebInspector.SplitView.prototype
}