From 3022f2dd6906484ab4d500d11122b52fb5b879b8 Mon Sep 17 00:00:00 2001 From: piro Date: Tue, 21 Apr 2009 06:42:52 +0000 Subject: [PATCH] =?UTF-8?q?=E3=82=BF=E3=83=96=E3=83=90=E3=83=BC=E3=81=AE?= =?UTF-8?q?=E5=B9=85=E3=80=81=E5=86=85=E5=AE=B9=E9=87=8F=E5=9F=9F=E3=81=AE?= =?UTF-8?q?=E5=B9=85=E3=82=92=E5=A4=89=E3=81=88=E3=82=8B=E3=83=A1=E3=82=BD?= =?UTF-8?q?=E3=83=83=E3=83=89=E3=82=92API=E3=81=A8=E3=81=97=E3=81=A6?= =?UTF-8?q?=E7=94=A8=E6=84=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4168 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/treestyletab.js | 88 ++++++++++++++++++---------- 1 file changed, 58 insertions(+), 30 deletions(-) diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index 9af6d868..af1c77c1 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -365,6 +365,64 @@ var TreeStyleTabService = { invert : this.getTreePref('urlbar.invertDefaultBehavior') }); }, + + 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 */ getTempTreeStyleTab : function(aTabBrowser) @@ -580,36 +638,6 @@ var TreeStyleTabService = { 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) */ getTabById : function(aId, aTabBrowserChildren)