タブバーの幅、内容量域の幅を変えるメソッドをAPIとして用意

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4168 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-04-21 06:42:52 +00:00
parent a4136ddcc5
commit 3022f2dd69

View File

@ -366,6 +366,64 @@ var TreeStyleTabService = {
}); });
}, },
setTabbarWidth : function(aWidth, aForceExpanded)
{
var treeStyleTab = gBrowser.treeStyleTab;
if (aForceExpanded ||
treeStyleTab.autoHideShown ||
treeStyleTab.autoHideMode != this.kAUTOHIDE_MODE_SHRINK)
this.setTreePref('tabbar.width', aWidth);
else
this.setTreePref('tabbar.shrunkenWidth', aWidth);
},
setContentWidth : function(aWidth, aKeepWindowSize)
{
var treeStyleTab = gBrowser.treeStyleTab;
var tabbarWidth = treeStyleTab.splitterWidth + (treeStyleTab.isVertical ? gBrowser.mStrip.boxObject.width : 0 );
var contentWidth = gBrowser.boxObject.width - tabbarWidth;
if (aKeepWindowSize) {
this.setTabbarWidth(Math.max(10, gBrowser.boxObject.width - aWidth));
}
else if (tabbarWidth + aWidth <= screen.availWidth) {
window.resizeBy(aWidth - contentWidth, 0);
}
else {
window.resizeBy(screen.availWidth - window.outerWidth, 0);
this.setTabbarWidth(gBrowser.boxObject.width - aWidth);
}
},
toggleAutoHide : function()
{
this.setTreePref('tabbar.autoHide.mode',
this.getTreePref('tabbar.autoHide.mode') == this.kAUTOHIDE_MODE_DISABLED ?
this.getTreePref('tabbar.autoHide.mode.toggle') :
this.kAUTOHIDE_MODE_DISABLED
);
},
toggleFixed : function()
{
this.setTreePref('tabbar.fixed',
!this.getTreePref('tabbar.fixed'));
},
changeTabbarPosition : function(aNewPosition)
{
if (!aNewPosition || !/^(top|bottom|left|right)$/i.test(aNewPosition))
aNewPosition = 'top';
aNewPosition = aNewPosition.toLowerCase();
this.setTreePref('tabbar.position', aNewPosition);
if (!this.getTreePref('tabbar.syncRelatedPrefsForDynamicPosition')) return;
var vertical = (aNewPosition == 'left' || aNewPosition == 'right');
this.setTreePref('enableSubtreeIndent', vertical);
this.setTreePref('allowSubtreeCollapseExpand', vertical);
},
/* backward compatibility */ /* backward compatibility */
getTempTreeStyleTab : function(aTabBrowser) getTempTreeStyleTab : function(aTabBrowser)
{ {
@ -580,36 +638,6 @@ var TreeStyleTabService = {
return Number(style.getPropertyValue(aProp).replace(/px$/, '')); return Number(style.getPropertyValue(aProp).replace(/px$/, ''));
}, },
toggleAutoHide : function()
{
this.setTreePref('tabbar.autoHide.mode',
this.getTreePref('tabbar.autoHide.mode') == this.kAUTOHIDE_MODE_DISABLED ?
this.getTreePref('tabbar.autoHide.mode.toggle') :
this.kAUTOHIDE_MODE_DISABLED
);
},
toggleFixed : function()
{
this.setTreePref('tabbar.fixed',
!this.getTreePref('tabbar.fixed'));
},
changeTabbarPosition : function(aNewPosition)
{
if (!aNewPosition || !/^(top|bottom|left|right)$/i.test(aNewPosition))
aNewPosition = 'top';
aNewPosition = aNewPosition.toLowerCase();
this.setTreePref('tabbar.position', aNewPosition);
if (!this.getTreePref('tabbar.syncRelatedPrefsForDynamicPosition')) return;
var vertical = (aNewPosition == 'left' || aNewPosition == 'right');
this.setTreePref('enableSubtreeIndent', vertical);
this.setTreePref('allowSubtreeCollapseExpand', vertical);
},
/* get tab(s) */ /* get tab(s) */
getTabById : function(aId, aTabBrowserChildren) getTabById : function(aId, aTabBrowserChildren)